Call registerClubto create a new token. This deploys a token contract with your specified name, symbol, image URI, vesting schedule and a hook. The deployer can also opt to purchase up to 10% of the mintable supply.
If your hook requires custom initialization data the contract owner can set that.
Call buyChipsto buy new tokens. Each time tokens are bought they are minted to the recipient.
Call sellChipsto sell your tokens back to the contract burning them.
There are 800 million tokens for sale in total. The first 200 million will be at a flat price and then a linear price increase kicks in for the remaining tokens.
Once all 800 million have been bought and minted the trading functions are automatically closed.
At this point the contract owner can call releaseLiquidityto trigger a swap from the USDC raised into $BONSAI, which is then paired with 200 million newly minted tokens and a Uniswap V4 pool is created where the $BONSAI and 200 million tokens are paired together with the hook that the token was created with. NOTE: on the app, anyone can click a button to trigger the release liquidity flow.
At this point vesting automatically starts for all tokens along the terms specified. There are no transactions required, the tokens are already in your wallet and will automatically become available for transfer along the schedule.
There's three kinds of fees in the Launchpad protocol
Protocol fee: 1% is collected to the contract owner
Client fee: 1% for the client. Any frontend client that integrates the Launchpad can inject a custom address here to collect their own fee.
Referral fee: 1% is given to the referrer if there is one
Additionally when the token graduates to Uniswap the LP is locked in the contract where it can't be edited or transferred. The trading fees can be collected and are split 60/40 with the protocol and the creator.
When you create a token the creator is minted a "Bonsai Creator NFT" with its id number set to the id of the club and this NFT confers creator status and ownership over all creator fees on the Launchpad and Uniswap.
Contract Reference
State changing functions
Constructor
Sets initial params
/**
* @notice contract constructor
* @param _owner The contract owner
* @param _quoteToken Quote token to trade against (USDC)
* @param _poolManager Uniswap pool manager address
* @param _defaultHook Default hook to use for all created uni v4 pools
* @param _bonsaiNFT Bonsai NFT contract to read balances
* @param _bonsaiToken Bonsai token address
* @param _lastClubId Starting point for clubd ids
*/
constructor(
address _owner,
address _quoteToken,
address _poolManager,
address _posm,
address _defaultHook,
address _bonsaiNFT,
address _bonsaiToken,
uint256 _lastClubId
)
registerClub
Creates a new token and sets the bonding curve params. Also allows the creator to buy an initial amount
/**
* @notice Registers a new club with the info and mints the initial supply for `creator`. Requires the caller to
* pay for the initial supply, to init the bonding curve. Must provided signed data proving ownership
* @param hook Address of a univ4 hook for the token
* @param tokenInfo encoded bytes of the token (name, ticker, uri)
* @param initialSupply The initial supply for the club chips
* @param creator The token creator address
* @param cliffPercent The cliff percentage in basis points (e.g. 2000 = 20%)
* @param vestingDuration The vesting duration in seconds
*/
function registerClub(
address hook,
bytes calldata tokenInfo,
uint256 initialSupply,
address creator,
uint256 cliffPercent,
uint256 vestingDuration
)
buyChips
Allows anyone to buy tokens (chips). The token must not have graduated yet
/**
* @notice Allows anyone to buy an `amount` of chips from a registered club with `clubId`. Must have approved the
* price returned from `#getBuyPriceAfterFees` on quote token. Bonsai NFT holders pay 0 fees.
* @param clubId The club id
* @param amount The amount of club chips to buy
* @param maxPrice The maximum amount of quote token to pay
* @param clientAddress The client address to receive fee split
* @param recipient The recipient of the chips
* @param referral The address to receive a referral split (33% of creator fee)
*/
function buyChips(
uint256 clubId,
uint256 amount,
uint256 maxPrice,
address clientAddress,
address recipient,
address referral
)
sellChips
Allows anyone to sell tokens (chips). The token must not have graduated yet
/**
* @notice Allows anyone to sell an `amount` of chips from a registered club with `clubId`. Bonsai NFT holders pay 0
* fees.
* @param clubId The club id
* @param amount The amount of club chips to sell
* @param minAmountOut Minimum amount of quote token to receive for sale
* @param clientAddress The client address to receive fee split
*/
function sellChips(uint256 clubId, uint256 amount, uint256 minAmountOut, address clientAddress)
releaseLiquidity
Allows the owner of the contract to graduate the token. This will cause the collected USDC to be swapped to $BONSAI and then create a new pool on Uniswap with the token paired against $BONSAI
/**
* @notice Converts liquidity in bonding curve into a uniswap v4 pool.
* NOTE: only callable by the contract owner, done so from a backend service.
* @param clubId Id of the club to convert
* @param minAmountOut for a v4 swap
* @param swapInfoV4 struct data for swapping into v4 pool
*/
function releaseLiquidity(uint256 clubId, uint128 minAmountOut, SwapInfoV4 calldata swapInfoV4)
withdrawFeesEarned
Allows anyone to withdraw protocol or referral fees earned
/**
* @notice Allows anyone (treasury/owner, client, referrals) to withdraw fees earned
* @param recipient The address to withdraw fees to. If zero address is provided, msg.sender is used
*/
function withdrawFeesEarned(address recipient)
withdrawClubFeesEarned
Allows anyone to withdraw creator fees earned from a token to the creator.
/**
* @notice Allows anyone to withdraw fees earned on creator nfts (club trading fees)
* @param clubIds Array of club IDs to withdraw fees for
*/
function withdrawClubFeesEarned(uint256[] calldata clubIds)
collectUniswapFees
Allows anyone to collect the Uniswap trading fees for a token. 40% will go to the creator and 60% to the protocol.
/**
* @notice Collects LP fees from a Uniswap V4 position and distributes to creator and owner
* @param clubId clubId to collect for
*/
function collectUniswapFees(uint256 clubId)
View Functions
getFees
Returns the current fee configuration
/**
* @notice View function to get current fee configuration
* @return protocolFeeBps protocol fee
* @return creatorFeeBps creator fee
* @return clientFeeBps client fee
*/
function getFees()
getBuyPrice
Calculates the buy price by integrating the bonding curve from current supply to (supply + amount)
/**
* @notice Calculates the buy price by integrating the bonding curve from current supply to (supply + amount)
* @param supply The current token supply
* @param amount The amount of club chips to buy
* @return price The total price in quote tokens for buying the specified amount
*/
function getBuyPrice(uint256 supply, uint256 amount)
getBuyPriceByClub
Fetches current buy price for a given token (club).
/// @notice bundles token supply with price fetch
function getBuyPriceByClub(uint256 clubId, uint256 amount)
getSellPrice
Calculates the sell price by integrating the bonding curve from (supply - amount) to current supply
/**
* @notice Calculates the sell price by integrating the bonding curve from (supply - amount) to current supply
* @param supply The current token supply
* @param amount The amount of club chips to sell
* @return price The total price in quote tokens for selling the specified amount
*/
function getSellPrice(uint256 supply, uint256 amount)
getSellPriceByClub
Fetches current sell price for a given token (club).
/// @notice bundles token supply with price fetch
function getSellPriceByClub(uint256 clubId, uint256 amount)
Changes in Lens Chain deployment
The Lens Chain deployment of the Launchpad contract brings a few changes that allow for custom configuration per token launch and Uniswap V3 compatability.
Constructor -> Initializer
The constructor is removed in favor of an initializer to allow for UUPS upgradeability
/**
* @notice contract constructor
* @param _owner The contract owner
* @param _quoteToken Default quote token to trade against (USDC)
* @param _defaultHook Default hook to use for all created uni v4 pools
* @param _bonsaiNFT Bonsai NFT contract to read balances
* @param _bonsaiToken Bonsai token address
* @param _lastClubId Starting point for clubd ids
*/
function initialize(
address _owner,
address _quoteToken,
address _defaultHook,
address _bonsaiNFT,
address _bonsaiToken,
uint256 _lastClubId
)
registerClub
New args are added allowing for greater customizability of token launches including custom pricing functions and whitelist modules.
/**
* @notice Registers a new club with the info and mints the initial supply for `creator`. Requires the caller to
* pay for the initial supply, to init the bonding curve. Must provided signed data proving ownership
* @param hook Address of a univ4 hook for the token
* @param tokenInfo encoded bytes of the token (name, ticker, uri)
* @param initialSupply The initial supply for the club chips
* @param creator The token creator address
* @param cliffPercent The cliff percentage in basis points (e.g. 2000 = 20%)
* @param vestingDuration The vesting duration in seconds
* @param initialPrice The initial price of the club chips
* @param flatThreshold The flat threshold for the club chips
* @param targetPriceMultiplier The target price multiplier for the club chips
* @param whitelistModule The whitelist module for the club chips
* @param whitelistData The whitelist data for the club chips
* @param quoteToken The quote token for the club chips
*/
function registerClub(
address hook,
bytes calldata tokenInfo,
uint256 initialSupply,
address creator,
uint256 cliffPercent,
uint256 vestingDuration,
uint256 initialPrice,
uint256 flatThreshold,
uint256 targetPriceMultiplier,
address whitelistModule,
bytes calldata whitelistData,
address quoteToken
)
releaseLiquidity
Release liquidity is updated to allow for Uniswap V3 support.
/**
* @notice Converts liquidity in bonding curve into a uniswap v3 pool.
* NOTE: only callable by the contract owner, done so from a backend service.
* @param clubId Id of the club to convert
* @param minAmountOut for a v3 swap
* @param swapInfoV3 struct data for swapping into v3 pool
* @param swapInfoV4 struct data for swapping into v4 pool
* @param isV3 whether the pool is v3 or v4
*/
function releaseLiquidity(
uint256 clubId,
uint128 minAmountOut,
SwapInfoV3 calldata swapInfoV3,
SwapInfoV4 calldata swapInfoV4,
bool isV3
)
withdrawFeesEarned
Withdraw fees now takes a quote token argument since tokens can now trade in other tokens besides USDC.
/**
* @notice Allows anyone (treasury/owner, client, referrals) to withdraw fees earned
* @param recipient The address to withdraw fees to. If zero address is provided, msg.sender is used
*/
function withdrawFeesEarned(address recipient, address quoteToken)
getBuyPrice
Takes additional arguments that can vary by token.
/**
* @notice Calculates the buy price by integrating the bonding curve from current supply to (supply + amount)
* @dev If the quote token has less than 18 decimals, the initialPrice should be adjusted by dividing by 10 ** (18 - decimals)
* @param supply The current token supply
* @param amount The amount of club chips to buy
* @param initialPrice Initial price of the club
* @param flatThreshold Where the flat pricing ended
* @param targetPriceMultiplier The multiplier from initialPrice to targetPrice
* @return price The total price in quote tokens for buying the specified amount
*/
function getBuyPrice(
uint256 supply,
uint256 amount,
uint256 initialPrice,
uint256 flatThreshold,
uint256 targetPriceMultiplier
)
getSellPrice
Takes additional arguments that can vary by token.
/**
* @notice Calculates the sell price by integrating the bonding curve from (supply - amount) to current supply.
* @dev If the quote token has less than 18 decimals, the initialPrice should be adjusted by dividing by 10 ** (18 - decimals)
* @param supply The current token supply
* @param amount The amount of club chips to sell
* @param initialPrice Initial price of the club
* @param flatThreshold Where the flat pricing ended
* @param targetPriceMultiplier The multiplier from initialPrice to targetPrice
* @return price The total price in quote tokens for selling the specified amount
*/
function getSellPrice(
uint256 supply,
uint256 amount,
uint256 initialPrice,
uint256 flatThreshold,
uint256 targetPriceMultiplier
)