TBC Guides

How to guides for initializing TBC

Understanding display vs base values

Display units are common units that is used outside of chain units such as:

5 sRLY Tokens

Base values are representative of the display in the form of chain units. sRLY has 9 decimals on chain but the blockchain and TBC program only operates on base units.

Because all numbers on the blockchain must be whole numbers, the decimals in the display value are represented by base units instead by multiplying by 10^decimals

Therefore the equivalent base unit of 5 sRLY would be

5,000,000,000 sRLY Tokens

Another example:

Where sRLY has 9 decimals on chain:

0.01 sRLY in display value is equivalent to

10,000,000 sRLY in base value

Number of decimals on chain can be configured when creating a token but the default and standard on Solana is 9.

Determining the slope of your TBC

Method 1: Using App token price

This method can be interpreted as: the curve growing the application token price from price point 1 to price point 2 over the course of b2-b1 app token supply.

Plug in the following parameters to the calculator above to receive your slope. https://www.desmos.com/calculator/h5n2oijxn

  • App token price at point 1 (p1)

  • App token price at point 2 (p2)

  • Amount of app token swapped out point 1 (b1)

  • Amount of app token swapped out point 2 (b2)

Plug in your slope and initial token price to this graph to double check that the slope is accurate: https://www.desmos.com/calculator/u8xdqvv2vg

Method 2: Using TVL

This method can be interpreted as: the curve growing the application token price from price point 1 to price point 2 over the course of TVL in sRLY.

Plug in the following parameters to the calculator above to receive your slope. https://www.desmos.com/calculator/haskcbnlch

  • App token price at point 1 (p1)

  • App token price at point 2 (p2)

  • TVL in sRLY between TVL=0 and point 2 (t2)

Plug in your slope and initial token price to this graph to double check that the slope is accurate: https://www.desmos.com/calculator/u8xdqvv2vg

Converting slope and token price to numerators and denominators

Converting slope to slope_numerator and slope_denominator

During rly-cli tbc-init you will have to enter the slope numerator and denominator.

Example:

The slope m=5x10^-15

would be equivalent to:

slope_numerator = 5

slope_denominator = 1_000_000_000_000_000

Values cannot have decimals so the numerator/denominator must be adjusted if required.

Converting initial token A price to initial_token_a_price_numerator and initial_token_a_price_denominator

During rly-cli tbc-init you will have to enter the initial token A (sRLY) price as a price numerator and denominator.

A initial token A starting price of 0.01 sRLY would be equivalent to

initial_token_a_price_numerator = 1 initial_token_a_price_denominator = 100

Because price always represents how much base token A (sRLY) it costs to buy 1 base token B (app token), there's no need to scale by 9 decimals.

Last updated