How Karrot Exchange works
Last updated
Last updated
Inspired by the intuitive architecture of Uniswap V2, Karrot Exchange is an automated liquidity protocol designed to support Meme Tokens, utilizing a constant product formula within a system of non-upgradable smart contracts on the Starknet blockchain. It eliminates the need for trusted intermediaries, emphasizing decentralization, censorship resistance, and security. Karrot Exchange is open-source software licensed under the GPL.
Each Karrot Exchange smart contract, or pair, manages a liquidity pool consisting of reserves of two ERC-20 tokens.
Anyone can become a liquidity provider (LP) for a pool by depositing an equivalent value of each underlying token in exchange for pool tokens. These tokens represent the LPβs share of the total reserves and can be redeemed for the underlying assets at any time.
Pairs function as automated market makers, ready to accept one token for another as long as the βconstant productβ formula is maintained. This formula, expressed as x * y = k
, ensures that the product (k
) of a pairβs reserve balances (x
and y
) remains unchanged from the perspective of a trade, often referred to as the invariant. This property ensures that larger trades (relative to reserves) execute at exponentially worse rates than smaller ones.
Karrot Exchange applies a 0.30% fee to trades, which is added to the reserves. As a result, each trade increases k, functioning as a payout to LPs, which is realized when they burn their pool tokens to withdraw their share of the total reserves. In the future, this fee may be reduced to 0.25%, with the remaining 0.05% withheld as a protocol-wide charge.
Since the relative price of the two assets in a pair can only be changed through trading, divergences between the Karrot Exchange price and external prices create arbitrage opportunities. This mechanism ensures that Karrot Exchange prices always trend toward the market-clearing price.
To see how token swaps work in practice and to explore the lifecycle of a swap, check out Swaps. To understand how liquidity pools function, see Pools.