# Curve Encoding

Pricing of services on the zap platform is determined via a pricing mechanism set by the provider known as a Bonding Curve. This section details how a user can setup their bonding curve.

NOTE: If you're using Zap tools like the web-admin or cli, you wont need to know how to parse our curve encodings but a brief breakdown follows where encode/decode a few examples. Tldr; we provide some examples at the bottom of this page

## Curve Encoding

Zap curves are piece-wise functions where each piece-wise segment is a sum-of-powers polynomial.

$c0x^0+c1x^1+c2x^2+...$

So if you have a function like 2+x^2, you'd want to put it in the form

$2+ 2x^2 => 2x^0+0x^1+2x^2$

If you just wanted a stable price, you'd just stick a constant, ala 3

$3 => 3x^0$

Since Zap bonding curves are piece-wise functions, our curves are encoded via integer encoded as follows

$[n_1, c_0,c_1,...,c_n,l_1,n_2, c_0,c_1,...,c_n,l_2,...]$

where

• n1 is the number of terms in the first polynomial

• c0, c1, ... are the coefficients of their respective n terms

• l1 is the x limit of the first polynomial function

• n2 is the number of terms in the second polynomial

• etc, etc

For the following examples we have equation + encoding

### Example 1:

This curve has 1 polynomial function, 3x^2. This takes 3 terms in the sum of powers repesentation

$0x^0+ 0x^1+3x^2$

Hence we have 3 terms in the 1st polynomial, [3,0,0,3,10000000000]

and c0=0, c1=0, and c2=3, [3,0,0,3,10000000000]

Since the x-limit of the first term is 10000000000, we use this for our l1 term , [3,0,0,3,10000000000]

### Example 2:

$3x^0, 5x^0, 7x^0, 9x^0, 11x^0$