Liquidity
Liquidity operations
Add liquidity
where amount_U - is amount of added underlying liquidity. Then called Pool Update().
Remove liquidity
where amount_LP - amount of removed LP tokens.Then call Pool Update().
Adding / removing liquidity programatically
addLiquidity
Adds liquidity to pool and send diesel (LP) tokens back to LP:
- Transfers underlying asset to pool
- Mints diesel (LP) token with current diesel rate
- Updates expected liquidity
- Updates borrow rate
function addLiquidity(
uint256 amount,
address onBehalfOf,
uint256 referralCode
) external
Parameter | Description |
---|---|
amount | Amount of tokens to be transfer |
onBehalfOf | The address that will receive the diesel tokens, same as msg.sender if the user wants to receive them on his own wallet, or a different address if the beneficiary of diesel tokens is a different wallet |
referralCode | Code used to register the integrator originating the operation, for potential rewards. 0 if the action is executed directly by the user, without any middle-man |
removeLiquidity
function removeLiquidity(uint256 amount, address to)
external
Parameter | Description |
---|---|
amount | Amount of tokens to be transfer |
to | Address to transfer liquidity |
It burns user diesel (LP) tokens and returns underlying tokens:
- Transfers to LP underlying account = amount * diesel rate
- Burns diesel tokens
- Decreases underlying amount from total_liquidity
- Updates borrow rate