QilinV2Pool

QILINV2POOL

Managing liquidity pools, LP tokens, positions

addLiquidity

Add liquidity to a trading pool to obtain corresponding LP tokens
1
function addLiquidity(
2
address user,
3
uint256 amount
4
) external;
Copied!
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
1
function removeLiquidity(
2
address user,
3
uint256 lsAmount,
4
uint256 bondsAmount,
5
address receipt
6
) external;
Copied!
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
1
function openPosition(
2
address user,
3
uint8 direction,
4
uint16 leverage,
5
uint256 position
6
) external returns (uint32);
Copied!
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
1
function addMargin(
2
address user,
3
uint32 positionId,
4
uint256 margin
5
) external;
Copied!
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
1
function closePosition(
2
address receipt,
3
uint32 positionId
4
) external;
Copied!
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
1
function liquidate(
2
address user,
3
uint32 positionId,
4
address receipt
5
) external;
Copied!
parameters:
name
type
description
user
address
The address where the position is actually liquidated
positionId
uint32
Position ID
receipt
address
Address to receive tokens
Copy link
Contents
QILINV2POOL