Bonding Curve Stage Trading
This guide covers coins trading during Bonding Curve stage which are execute through Official 4meme Factory contract. There are 4 methods available for trading.
Buy Coins with Exact Collateral Value
The buyExactIn
method accepts a specified collateral amount (BNB) and buy the maximum possible number of coins for that input.
Method Interface
// solidity interface
/// @notice Buy maximum coin with specified collateral amount
///
/// @param _token The token contract address
/// @param _amountOutMin The minimum amount of token expected to receive for collateral amount sending in
/// @param _tradeReferrer The Trade Referrer address to receive reward
function buyExactIn(
address _token,
uint256 _amountOutMin,
address _tradeReferrer
)
external
payable;
Events
A Buy
event will be emitted upon successful coin purchase.
/// @notice emitted upon successful token purchase during Bonding Curve stage
///
/// @param buyer The token buyer address
/// @param token The purchased token address
/// @param tokenAmount The amount of token purhased
/// @param collateralAmount The amount of collateral, usually chain's native token, used to purchase token
/// @param refund The amount of collateral refunded to buyer if there's leftover
/// @param tradeFee The amount of fee collected by platform for token purchase
/// @param curveProgressBps The updated Bonding Curve progress basis points for token
/// @param virtualCollateralReserves The updated virtual collateral reserves amount in Bonding Curve stage
/// @param virtualTokenReserves The updated virtual token reserves amount in Bonding Curve stage
/// @param collateralReserves The updated real collateral reserves amount in Bonding Curve stage
/// @param tokenReserves The updated real token reserves amount in Bonding Curve stage
event Buy(
address indexed buyer,
address indexed token,
uint256 tokenAmount,
uint256 collateralAmount,
uint256 refund,
uint256 tradeFee,
uint256 curveProgressBps,
uint256 virtualCollateralReserves,
uint256 virtualTokenReserves,
uint256 collateralReserves,
uint256 tokenReserves
);
Buy Exact Coin Amount
The buyExactOut
method allows the buyer to specify the exact number of coins to purchase with the collateral amount (BNB) sent in.
Method Interface
// solidity interface
/// @notice Buy exact amount of coin
///
/// @param _token The token contract address
/// @param _tokenAmount The amount of token expect to receive
/// @param _maxCollateralAmount The maximum amount of collateral expected to spent
/// @param _tradeReferrer The Trade Referrer address to receive reward
function buyExactOut(
address _token,
uint256 _tokenAmount,
uint256 _maxCollateralAmount,
address _tradeReferrer
)
external
payable;
Events
A Buy
event will be emitted upon successful coin purchase.
/// @notice emitted upon successful token purchase during Bonding Curve stage
///
/// @param buyer The token buyer address
/// @param token The purchased token address
/// @param tokenAmount The amount of token purhased
/// @param collateralAmount The amount of collateral, usually chain's native token, used to purchase token
/// @param refund The amount of collateral refunded to buyer if there's leftover
/// @param tradeFee The amount of fee collected by platform for token purchase
/// @param curveProgressBps The updated Bonding Curve progress basis points for token
/// @param virtualCollateralReserves The updated virtual collateral reserves amount in Bonding Curve stage
/// @param virtualTokenReserves The updated virtual token reserves amount in Bonding Curve stage
/// @param collateralReserves The updated real collateral reserves amount in Bonding Curve stage
/// @param tokenReserves The updated real token reserves amount in Bonding Curve stage
event Buy(
address indexed buyer,
address indexed token,
uint256 tokenAmount,
uint256 collateralAmount,
uint256 refund,
uint256 tradeFee,
uint256 curveProgressBps,
uint256 virtualCollateralReserves,
uint256 virtualTokenReserves,
uint256 collateralReserves,
uint256 tokenReserves
);
Sell Exact Coin Amount
The sellExactIn
method accept the exact number of coins to sell and receives at least the minimum expected collateral (BNB) in return.
// solidity interface
/// @notice Sell exact amount of coin
///
/// @param _token The token contract address
/// @param _tokenAmount The amount of token to sell
/// @param _amountCollateralMin The minimum amount of collateral expected in return
/// @param _traderReferrer The Trade Referrer address to receive reward
function sellExactIn(
address _token,
uint256 _tokenAmount,
uint256 _amountCollateralMin,
address _tradeReferrer
)
external;
Events
A Sell
event will be emitted upon successful coin sale.
/// @notice emitted upon successful token sale during Bonding Curve stage
///
/// @param seller The token seller address
/// @param token The sold token address
/// @param tokenAmount The amount of token sold
/// @param collateralAmount The amount of collateral received upon token sale
/// @param tradeFee The amount of fee collected by platform for token sale
/// @param curveProgressBps The updated Bonding Curve progress basis points for token
/// @param virtualCollateralReserves The updated virtual collateral reserves amount in Bonding Curve stage
/// @param virtualTokenReserves The updated virtual token reserves amount in Bonding Curve stage
/// @param collateralReserves The updated real collateral reserves amount in Bonding Curve stage
/// @param tokenReserves The updated real token reserves amount in Bonding Curve stage
event Sell(
address indexed seller,
address indexed token,
uint256 tokenAmount,
uint256 collateralAmount,
uint256 tradeFee,
uint256 curveProgressBps,
uint256 virtualCollateralReserves,
uint256 virtualTokenReserves,
uint256 collateralReserves,
uint256 tokenReserves
);
Sell Coins for Exact Collateral Value
The sellExactOut
method allows accept the exact collateral amount to receive upon coin sale, with the required coin amount (up to a maximum) specified.
// solidity interface
/// @notice Sell token for exact amount of collateral
///
/// @param _token The token contract address
/// @param _tokenAmountMax The maximum amount of token to sell
/// @param _amountCollateral The exact amount of collateral expected in return
/// @param _traderReferrer The Trade Referrer address to receive reward
function sellExactOut(
address _token,
uint256 _tokenAmountMax,
uint256 _amountCollateral,
address _tradeReferrer
)
external;
Events
A Sell
event will be emitted upon successful coin sale.
/// @notice emitted upon successful token sale during Bonding Curve stage
///
/// @param seller The token seller address
/// @param token The sold token address
/// @param tokenAmount The amount of token sold
/// @param collateralAmount The amount of collateral received upon token sale
/// @param tradeFee The amount of fee collected by platform for token sale
/// @param curveProgressBps The updated Bonding Curve progress basis points for token
/// @param virtualCollateralReserves The updated virtual collateral reserves amount in Bonding Curve stage
/// @param virtualTokenReserves The updated virtual token reserves amount in Bonding Curve stage
/// @param collateralReserves The updated real collateral reserves amount in Bonding Curve stage
/// @param tokenReserves The updated real token reserves amount in Bonding Curve stage
event Sell(
address indexed seller,
address indexed token,
uint256 tokenAmount,
uint256 collateralAmount,
uint256 tradeFee,
uint256 curveProgressBps,
uint256 virtualCollateralReserves,
uint256 virtualTokenReserves,
uint256 collateralReserves,
uint256 tokenReserves
);
Last updated