This is a postponed post I wanted to make long ago when I investigated the problem of what LP is and how it is minted by DEX.
LP here is liquidity provision token like SLP on sushi, CLP on MarsColony DEX and many others.
It may be not very interesting, but it should be here.
- LP token is a token which is minted by AMM (DEX, pair contract) when user provides liquidity
- user can give LP back to the contract and get his/her liquidity (may be in changed proportion, but I will not dive into it here)
- LP amount user gets is defined by liquidity amount he/she provides and some initial conditions in this pair then the first liquidity is provided. Due to these conditions LP token can be very cheap or very expensive, but actually there is no difference as it is some kind of a proof that user has provided some liquidity
- Total LP supply should be equal to the total liquidity cost
- If we use dollars, to estimate LP price, we can just get all liquidity reserves, estimate them in USD and divide by total LP token supply.
- So we made a method to calculate LP price which is used in our app: viewer/LPStats.sol at master · marscolony-io/viewer · GitHub