LpProvide examples
This section contains example schemes for liquidity provision
Last updated
This section contains example schemes for liquidity provision
Last updated
Liquidity provision is done via 2 transactions: deposit of the first token and deposit of the second token.
The amount of the first token sent is stored on a user's lp account awaiting a transaction of the second token.
When the second token is sent, lp account automatically initiates liquidity addition into the pool. As a result, full amounts of deposited tokens are used as new liquidity and the user receives lp tokens.
Notes:
the Lp Account
contract is deleted on cb_add_liquidity
in order to not pay storage fees (each deposit sends state init so it will be redeployed as soon as any new deposit occurs)
when depositing initial liquidity 0.000001001
lp tokens will be reserved on pool, the rest of liquidity will be sent to the user
It is possible to deposit liquidity by sending just 1 type of token, the pool will automatically perform a swap and use the resulting amount to mint lp tokens
It is possible to specify who will receive lp tokens and to include a payload which will be sent as transfer_notification
(e.g. Farm
contract)
In the event that the issued amount of lp tokens doesn't match the specified minimum value, all deposited liquidity is returned to lp account and can be withdrawn by user.
Liquidly is withdrawn from a pool by burning lp tokens, a user then receives both pool tokens based on the current exchange rate.
A user can deposit liquidity after it was refunded to lp account without doing a withdraw.