Step 2: Initialize Token Bonding Curve (TBC)

Learn how to configure and initialize the TBC that defines the supply and price of your token.

TBC Resources

Initialize the TBC

Step 2.1: Initialize the TBC

Configure your TBC parameters. View the TBC Guide and Examples pages for help.
Usage: rly-cli tbc-init [options] <token_a> <token_b> <token_b_liquidity>
token_a token A
token_b token B
token_b_liquidity token B liquidity (base units)
-e, --env <string> Solana cluster env name (default: "devnet")
-k, --keypair <path> Solana wallet location (default: "--keypair not provided")
--slope_numerator <string> slope numerator
--slope_denominator <string> slope denominator
--init_price_a_numerator <string> initial price token A
--init_price_a_denominator <string> initial price token A
-h, --help display help for command
// token bonding curve
import { Provider } from "@project-serum/anchor"
import { Keypair, Connection, clusterApiUrl } from 'solana/web3js`;
import { tokenSwapProgram } from 'rly-js';
const walletKeyPair = Keypair.generate();
const provider = new Provider(new Connection(clusterApiUrl("devnet")), new NodeWallet(walletKeyPair), {});
const tokenSwap = await tokenSwapProgram(provider);
The keypair used above is required to be the same keypair that owns the initial minted app token in Step 1 because that's where the liquidity is coming from.
Token A is the sRLY token on production environments. On non production environments, token A can be any SPL token. It is recommended that you create an SPL token that has similar properties as sRLY. Token B is your application token from Step 1.

Step 2.2: Supply application tokens to the TBC swap (Automatic)

Once the TBC is configured and initialized, two token accounts will automatically be created in the swap program:
  1. 1.
    A token account for token A (sRLY on prod, any SPL token on devnet)
  2. 2.
    A token account for your application token (token B)
Once created, the initial token B supply amount will be transferred from the authorized wallet to the token B account owned by the swap program.
The new bonding curve should start out with only the newly minted token B in the swap. As users buy against the curve, the collateral in sRLY builds.
Note: Pool tokens and deposits/withdrawals of pool tokens are intentionally disabled so that liquidity can't be added/removed from the swap outside of the swap instruction.

That's it!

In this section you should have:
  • Initialized a TBC based on your parameters
  • Verified the token account for your app token owned by the swap program
  • Verified the token account for sRLY owned by the swap program
  • Verified the transfer and balance of the initial supply of application token to app token account