Developer Resources
  • Overview
    • Introduction
    • TBCs on Solana
  • Get started
    • Quick Start Guide
    • TBC on Solana
      • Step 1: Create token
      • Step 2: Initialize Token Bonding Curve (TBC)
        • TBC Guides
        • TBC Examples
        • FAQs
      • Step 3: Swap Tokens
    • Grants
  • Tools
    • Swap for sRLY
  • Resources
    • FAQ
    • Solana Docs
    • Discord
    • Github
    • Anchor
    • Example React App
  • Archived
    • RLY Rewards
      • Bootstrap phase
      • Mature phase
Powered by GitBook
On this page
  • TBC Resources
  • Initialize the TBC
  • Step 2.1: Initialize the TBC
  • Step 2.2: Supply application tokens to the TBC swap (Automatic)
  • That's it!
  1. Get started
  2. TBC on Solana

Step 2: Initialize Token Bonding Curve (TBC)

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

PreviousStep 1: Create tokenNextTBC Guides

Last updated 3 years ago

TBC Resources

Initialize the TBC

Step 2.1: Initialize the TBC

Configure your TBC parameters. View the and pages for help.

Usage: rly-cli tbc-init [options] <token_a> <token_b> <token_b_liquidity>

Arguments:
  token_a                              token A
  token_b                              token B
  token_b_liquidity                    token B liquidity (base units)

Options:
  -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);

Examples:

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.

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. A token account for token A (sRLY on prod, any SPL token on devnet)

  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

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 . Token B is your application token from Step 1.

TBC Guides
TBC Examples
TBC Guide
Examples
https://github.com/rally-dfs/dfs-ts/tree/main/ts/tests
similar properties as sRLY