Burning LP tokens
Last modified:
Liquidity providers may also remove liquidity from a CenturionDEX v2 pool. To do so, they return LP tokens to the protocol and, in exchange, receive the corresponding proportional share of the pool reserves.
We now describe this process more precisely. Consider a CenturionDEX v2 pool with reserves and of tokens and , respectively, and let denote the current total supply of LP tokens. Suppose that a liquidity provider redeems an amount of LP tokens. Since LP tokens represent proportional ownership of the pool, redeeming tokens corresponds to withdrawing the fraction
of the pool.
Therefore, in exchange for burning LP tokens, the liquidity provider receives
units of token and
units of token .
The redeemed LP tokens are then burned, so the total supply of LP tokens is updated to
At the same time, the pool reserves are reduced proportionally. Hence, the post-burn reserves become
and
Thus, burning LP tokens simply returns to the liquidity provider the same fraction of each reserve as the fraction of LP supply being redeemed.
In the on-chain implementation, the returned token amounts are computed with integer division (for example, liquidity * balance / totalSupply), so each token amount is rounded down to the nearest wei.
The formula for the amounts returned upon liquidity removal is exactly the one implemented by the burn logic in CenturionDEX v2. In canonical notation, the mechanism is fully described by the relations above.