LFG.CLUB
  • Hello there
  • Bonding Curve
    • How it works
    • Displayed Token
    • Create Token
    • Metadata
    • Buy and Sell
    • Bonding Curve Math
    • Migration
    • Slightly Deflationary
    • Locks
  • Deposit Contract
    • Deposit, Claim, and Withdraw
  • LFG Token
    • Tokenomics
  • Deployments and liquidity lock
  • Locks
  • Deployment Addresses
    • Testnet
    • All Chains
  • Links
    • Links
Powered by GitBook
On this page
  1. Bonding Curve

Buy and Sell

For Buys and Sells the corresponding function are

function buy(uint256 id, uint256 amountOutMin) public payable returns (uint256 amountOut)

Where id is the tokenId (or you could also say it's the poolId or curveId), and the amountOutMin the minimum amount of tokens we want to receive (i.e. slippage).

Platform fees (in ETH/BNB) are taken before the actual amountOut is calculated.

function sell(uint256 id, uint256 amountIn, uint256 amountOutMin) public returns (uint256 amountOut)

TokenId is the token we want to sell, amountIn is the amount of tokens we want to sell, and amountOutMin is the minimum amount of ETH we want to receive.

Platform fees (in ETH/BNB) are taken after the amountOut has been calculated.

Refund

Should a buy be the last buy and trigger migration, an automatic refund is triggered for too much ETH provided.

For example, if there are only 2,000,000 tokens left to be sold and you make a buy with 1 ETH, only the value of the actual tokens amount sold in ETH will be subtracted from the provided ETH (plus platform fees), the rest will be refunded in the same transaction. So lets sat the 2,000,000 tokens are worth 0.15 ETH, then the platform fee (1% maximum) will be 0.0015 ETH, therefor 0.1515 ETH are subtracted and 0.8485 ETH are refunded.

To accurately calculate slippage this refunding process needs to be taken into account.

PreviousMetadataNextBonding Curve Math

Last updated 1 month ago