QilinV2Pool
QILINV2POOL
Managing liquidity pools, LP tokens, positions
addLiquidity
Add liquidity to a trading pool to obtain corresponding LP tokens
parameters:
name | type | description |
user | address | Address of whom actually adds liquidity, since Qilin's trading pool is called by Router, the actually signer address cannot be obtained through msg.sender |
amount | uint256 | Amount of added liquidity (measured in pool tokens) |
removeLiquidity
Remove the liquidity in a trading pool, destroy the corresponding LP token, and obtain the pool tokens
parameters:
name | type | description |
user | address | Address of whom actually removes liquidity |
lsAmount | uint256 | Amount of removed liquidity (measured in ls tokens) |
bondsAmount | uint256 | The amount of bond tokens used to offset debt when removing liquidity |
receipt | address | Receiver address after removing liquidity |
openPosition
Open a position based on a certain trading pool
parameters:
name | type | description |
user | address | Actual trading address |
direction | uint8 | Trading direction,1: buy long,2: buy short |
leverage | uint16 | Leverage |
position | uint256 | Initial margin size of position |
returns:
name | type | description |
positionId | uint32 | Position ID |
addMargin
Add margin to a specified position
parameters:
name | type | description |
user | address | The address where the margin is actually added |
positionId | uint32 | Position ID |
margin | uint256 | Amount of margin added |
closePosition
Close position, only when the remaining margin of the position is not lower than the margin*margin rate, the position can be closed
parameters:
name | type | description |
receipt | address | Address to receive tokens |
positionId | uint32 | Position ID |
liquidate
Liquidation, when the remaining margin of the position is lower than the margin * margin rate, you can use this interface to liquidate
parameters:
name | type | description |
user | address | The address where the position is actually liquidated |
positionId | uint32 | Position ID |
receipt | address | Address to receive tokens |
Last updated