QilinV2Router
QILINV2Router
Peripheral contract, for unified contract operation entry
createPoolFromUni
Create a trading pool on Qilin (based on uniswap)
parameters:
name | type | description |
tradeToken | address | Trading assets, not used for actual transaction payment, together with the pool assets constitute a trading pair |
poolToken | address | Pool assets, that is, the assets that traders actually use to pay for tradings |
fee | uint24 | This fee is the fee in the uniswap v3 pool, which uniquely determines a uniswap price feed source together with the trading pair. When this parameter is 0, a pool is built based on uniswap v2 |
reverse | bool | Whether it is reversed or not, it is used to identify whether the price of this trading pool is reversed |
createPoolFromSushi
Create a trading pool on Qilin (based on sushiswap)
parameters:
name | type | description |
tradeToken | address | Trading assets, not used for actual transaction payment, together with the pool assets constitute a trading pair |
poolToken | address | Pool assets, that is, the assets that traders actually use to pay for tradings |
reverse | bool | Whether it is reversed or not, it is used to identify whether the price of this trading pool is reversed |
getLsBalance
Get balance of user's LS token (pools based on uniswap)
parameters:
name | type | description |
tradeToken | address | Trading assets, not used for actual transaction payment, together with the pool assets constitute a trading pair |
poolToken | address | Pool assets, that is, the assets that traders actually use to pay for tradings |
fee | uint24 | This fee is the fee in the uniswap v3 pool, which uniquely determines a uniswap price feed source together with the trading pair. When this parameter is 0, a pool is built based on uniswap v2 |
reverse | bool | Whether it is reversed or not, it is used to identify whether the price of this trading pool is reversed |
user | address | Address of user |
getLsBalance2
Get balance of user's LS token (pools based on sushiswap)
parameters:
name | type | description |
tradeToken | address | Trading assets, not used for actual transaction payment, together with the pool assets constitute a trading pair |
poolToken | address | Pool assets, that is, the assets that traders actually use to pay for tradings |
reverse | bool | Whether it is reversed or not, it is used to identify whether the price of this trading pool is reversed |
user | address | Address of user |
getLsPrice
Get price of user's LS token (pools based on uniswap)
parameters:
name | type | description |
tradeToken | address | Trading assets, not used for actual transaction payment, together with the pool assets constitute a trading pair |
poolToken | address | Pool assets, that is, the assets that traders actually use to pay for tradings |
fee | uint24 | This fee is the fee in the uniswap v3 pool, which uniquely determines a uniswap price feed source together with the trading pair. When this parameter is 0, a pool is built based on uniswap v2 |
reverse | bool | Whether it is reversed or not, it is used to identify whether the price of this trading pool is reversed |
getLsPrice2
Get price of user's LS token (pools based on sushiswap)
parameters:
name | type | description |
tradeToken | address | Trading assets, not used for actual transaction payment, together with the pool assets constitute a trading pair |
poolToken | address | Pool assets, that is, the assets that traders actually use to pay for tradings |
reverse | bool | Whether it is reversed or not, it is used to identify whether the price of this trading pool is reversed |
addLiquidity
Add liquidity (pools based on uniswap)
parameters:
name | type | description |
tradeToken | address | Trading assets, not used for actual transaction payment, together with the pool assets constitute a trading pair |
poolToken | address | Pool assets, that is, the assets that traders actually use to pay for tradings |
fee | uint24 | This fee is the fee in the uniswap v3 pool, which uniquely determines a uniswap price feed source together with the trading pair. When this parameter is 0, a pool is built based on uniswap v2 |
reverse | bool | Whether it is reversed or not, it is used to identify whether the price of this trading pool is reversed |
amount | uint256 | Amount of added liquidity (measured in pool tokens) |
addLiquidity2
Add liquidity (pools based on sushiswap)
parameters:
name | type | description |
tradeToken | address | Trading assets, not used for actual transaction payment, together with the pool assets constitute a trading pair |
poolToken | address | Pool assets, that is, the assets that traders actually use to pay for tradings |
reverse | bool | Whether it is reversed or not, it is used to identify whether the price of this trading pool is reversed |
amount | uint256 | Amount of added liquidity (measured in pool tokens) |
removeLiquidity
Remove liquidity (pools based on uniswap)
parameters:
name | type | description |
tradeToken | address | Trading assets, not used for actual transaction payment, together with the pool assets constitute a trading pair |
poolToken | address | Pool assets, that is, the assets that traders actually use to pay for tradings |
fee | uint24 | This fee is the fee in the uniswap v3 pool, which uniquely determines a uniswap price feed source together with the trading pair. When this parameter is 0, a pool is built based on uniswap v2 |
reverse | bool | Whether it is reversed or not, it is used to identify whether the price of this trading pool is reversed |
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 |
removeLiquidity2
Remove liquidity (pools based on sushiswap)
parameters:
name | type | description |
tradeToken | address | Trading assets, not used for actual transaction payment, together with the pool assets constitute a trading pair |
poolToken | address | Pool assets, that is, the assets that traders actually use to pay for tradings |
reverse | bool | Whether it is reversed or not, it is used to identify whether the price of this trading pool is reversed |
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 position (pools based on uniswap)
parameters:
name | type | description |
tradeToken | address | Trading assets, not used for actual transaction payment, together with the pool assets constitute a trading pair |
poolToken | address | Pool assets, that is, the assets that traders actually use to pay for tradings |
fee | uint24 | This fee is the fee in the uniswap v3 pool, which uniquely determines a uniswap price feed source together with the trading pair. When this parameter is 0, a pool is built based on uniswap v2 |
reverse | bool | Whether it is reversed or not, it is used to identify whether the price of this trading pool is reversed |
direction | uint8 | Trading direction,1: buy long,2: buy short |
leverage | uint16 | Leverage |
position | uint256 | Initial margin size of position |
openPosition2
Open position (pools based on sushiswap)
parameters:
name | type | description |
tradeToken | address | Trading assets, not used for actual transaction payment, together with the pool assets constitute a trading pair |
poolToken | address | Pool assets, that is, the assets that traders actually use to pay for tradings |
reverse | bool | Whether it is reversed or not, it is used to identify whether the price of this trading pool is reversed |
direction | uint8 | Trading direction,1: buy long,2: buy short |
leverage | uint16 | Leverage |
position | uint256 | Initial margin size of position |
addMargin
Add margin
parameters:
name | type | description |
tokenId | uint32 | Used to map this position to a router |
margin | uint256 | Amount of margin added |
closePosition
Close position
parameters:
name | type | description |
tokenId | uint32 | Used to map this position to a router |
receipt | address | Address of token receiver |
liquidate
liquidate
parameters:
name | type | description |
tokenId | uint32 | Used to map this position to a router |
receipt | address | Address of token receiver |
liquiditebyPool
Liquidate by a specified pool
parameters:
name | type | description |
poolAddress | address | Address of pool |
positionId | uint32 | Position ID |
receipt | address | Address of token receiver |
withdrawERC20
Withdraw the erc20 token from the router contract
parameters:
name | type | description |
poolToken | address | Token address to be withdrawed |
withdrawETH
Withdraw the eth token from the router contract
repayLoan
Repay loan (pools based on uniswap)
parameters:
name | type | description |
tradeToken | address | Trading assets, not used for actual transaction payment, together with the pool assets constitute a trading pair |
poolToken | address | Pool assets, that is, the assets that traders actually use to pay for tradings |
fee | uint24 | This fee is the fee in the uniswap v3 pool, which uniquely determines a uniswap price feed source together with the trading pair. When this parameter is 0, a pool is built based on uniswap v2 |
reverse | bool | Whether it is reversed or not, it is used to identify whether the price of this trading pool is reversed |
amount | uint256 | Amount of repaid token |
receipt | address | Address of token receiver |
repayLoan2
Repay loan (pools based on sushiswap)
parameters:
name | type | description |
tradeToken | address | Trading assets, not used for actual transaction payment, together with the pool assets constitute a trading pair |
poolToken | address | Pool assets, that is, the assets that traders actually use to pay for tradings |
reverse | bool | Whether it is reversed or not, it is used to identify whether the price of this trading pool is reversed |
amount | uint256 | Amount of repaid token |
receipt | address | Address of token receiver |
Last updated