Automated market maker & liquidity pool.
Last updated
Last updated
CarbonDEX is a decentralized exchange ("DEX") for the CCR series of tokens and any other 3rd party's token backed by active carbon credits. CarbonDEX is non-custodial, which means that—unlike centralized exchanges—CarbonDEX does not need to possess users' tokens in order for the user to be able to trade them. Instead, the CarbonDEX allows users to trade peer-to-peer, with liquidity pools that are supplied by other users.
To be a liquidity provider, holders of any token need to supply equal parts liquidity for that token (sometimes called the quote token), and a second token (usually Matic, or the system token). In return, these holders receive the liquidity provider tokens that represent their share of the pooled liquidity for that token pair. The existence of this pooled liquidity gives other traders access to the underlying tokens in exchange for a small fee, which is distributed proportionately to all of the liquidity providers.
In this sense, CarbonDEX is also an “automated market maker” (or AMM, for short). While a user’s underlying tokens remain in the pool, fluctuations in the price of the two underlying tokens automatically recalibrate the quantity of those tokens to conform to the equation x*y=k, where x and y are the quantities of the two paired tokens, and k is constant. This means that even though you supply equal parts of two tokens to the pool, the quantities you receive when you reclaim your liquidity will change relative to the difference in the change in the price of the two tokens when you remove the liquidity. If the price of x token goes up, and y token goes down, you will have less of x and more of y, and vice versa. If the price of both tokens goes up, or the price of both goes down, you will nonetheless have relative quantities of each token proportionately to the difference in the change of the price of x and y.
Liquidity pools are places to pool tokens (which we sometimes call liquidity) so that users can use them to make trades in a decentralized way. These pools are created by users and decentralized apps (or Dapps, for short) who want to profit from their usage. To pool liquidity, the amounts a user supplies must be equally divided between two tokens: the primary token (sometimes called the quote token) and the base token (CCOIN). Our CarbonDEX's liquidity pools allow anyone to provide liquidity.
When anybody deposits tokens into the liquidity pools, they will receive LP Token. If for example, a user deposited CCRS tokens and CCOIN into a pool, they would receive CCRS-CCOIN LP Tokens. These tokens represent a proportional share of the pooled assets, allowing a user to reclaim their 'deposited tokens' at any point. Every time another user uses the pool to trade between CCRS and CCOIN, a 0.3% fee is taken on the trade, 0.25% of that trade goes back to that particular liquidity pool and will be shared by the liquidity providers based on their proportionate holdings in the liquidity pools. The fee will be added to the amount of token the user is giving. For example, if a user wants to swap 100 CCOIN (give) for 100 CCRS (receive), the user will have to provide 100.30 CCOIN, if the user is swapping 100 CCRS for 100 CCOIN, the user will have to provide 100.30 CCRS.
The value of the LP Tokens, which represent the shares of the total liquidity of each pool, is updated with each trade to add their value relative to the tokens the pool uses to trade. If previously there were 100 LP Tokens representing 100 CCOIN and 100 CCRS, each token would be worth 1 CCOIN & 1 CCRS (note in this example, CCOIN and CCRS are the same relative value for the ease of clarity). If a user were then to trade 10 CCOIN for 10 CCRS in that pool, and another user was to trade 10 CCRS for 10 CCOIN, then there would now be 100.025 CCOIN and 100.025 CCRS. This means each LP Token would be worth 1.0025 CCOIN and 1.0025 CCRS now when it is withdrawn.