IOrderBook
AddLiquidityParams
RemoveLiquidityParams
AddLiquidityResponse
RemoveLiquidityResponse
ReplaySwapParams
ReplaySwapResponse
MintCallbackData
Functions
addLiquidity
Add liquidity logic
Only used by ClearingHouse
contract
Parameters:
Name | Type | Description |
---|---|---|
| struct IOrderBook.AddLiquidityParams | Add liquidity params, detail on |
Return Values:
Name | Type | Description |
---|---|---|
| struct IOrderBook.AddLiquidityResponse | Add liquidity response, detail on |
removeLiquidity
Remove liquidity logic, only used by ClearingHouse
contract
Parameters:
Name | Type | Description |
---|---|---|
| struct IOrderBook.RemoveLiquidityParams | Remove liquidity params, detail on |
Return Values:
Name | Type | Description |
---|---|---|
| struct IOrderBook.RemoveLiquidityResponse | Remove liquidity response, detail on |
updateFundingGrowthAndLiquidityCoefficientInFundingPayment
This is the non-view version of getLiquidityCoefficientInFundingPayment()
, only can be called by Exchange
contract
Parameters:
Name | Type | Description |
---|---|---|
| address | The trader address |
| address | The base token address |
| struct Funding.Growth | The funding growth info, detail on |
Return Values:
Name | Type | Description |
---|---|---|
| int256 | the funding payment of all orders/liquidity of a maker |
replaySwap
Replay the swap and get the swap result (price impact and swap fee), only can be called by Exchange
contract;
ReplaySwapResponse.insuranceFundFee = fee * insuranceFundFeeRatio
Parameters:
Name | Type | Description |
---|---|---|
| struct IOrderBook.ReplaySwapParams | ReplaySwap params, detail on |
Return Values:
Name | Type | Description |
---|---|---|
| struct IOrderBook.ReplaySwapResponse | The swap result encoded in |
updateOrderDebt
getOpenOrderIds
Get open order ids of a trader in the given market
Parameters:
Name | Type | Description |
---|---|---|
| address | The trader address |
| address | The base token address |
Return Values:
Name | Type | Description |
---|---|---|
| bytes32[] | The open order ids |
getOpenOrderById
Get open order info by given order id
Parameters:
Name | Type | Description |
---|---|---|
| bytes32 | The order id |
Return Values:
Name | Type | Description |
---|---|---|
| struct OpenOrder.Info | The open order info encoded in |
getOpenOrder
Get open order info by given base token, upper tick and lower tick
Parameters:
Name | Type | Description |
---|---|---|
| address | The trader address |
| address | The base token address |
| int24 | The upper tick |
| int24 | The lower tick |
Return Values:
Name | Type | Description |
---|---|---|
| struct OpenOrder.Info | he open order info encoded in |
hasOrder
Check if the specified trader has order in given markets
Parameters:
Name | Type | Description |
---|---|---|
| address | The trader address |
| address[] | The base token addresses |
Return Values:
Name | Type | Description |
---|---|---|
| bool | True if the trader has order in given markets |
getTotalQuoteBalanceAndPendingFee
Get the total quote token amount and pending fees of all orders in given markets
Parameters:
Name | Type | Description |
---|---|---|
| address | The trader address |
| address[] | The base token addresses |
Return Values:
Name | Type | Description |
---|---|---|
| int256 | The total quote token amount |
| uint256 | The total pending fees in the orders |
getTotalTokenAmountInPoolAndPendingFee
Get the total token amount (quote or base) and pending fees of all orders in the given market
Parameters:
Name | Type | Description |
---|---|---|
| address | The trader address |
| address | The base token addresses |
| bool | True if fetch base token amount, false if fetch quote token amount |
Return Values:
Name | Type | Description |
---|---|---|
| uint256 | The total quote/base token amount |
| uint256 | The total pending fees in the orders |
getTotalOrderDebt
Get the total debt token amount (base or quote) of all orders in the given market
Parameters:
Name | Type | Description |
---|---|---|
| address | The trader address |
| address | The base token address |
| bool | True if fetch base token amount, false if fetch quote token amount |
Return Values:
Name | Type | Description |
---|---|---|
| uint256 | The total debt token amount |
getLiquidityCoefficientInFundingPayment
Get the pending funding payment of all orders in the given market
This is the view version of updateFundingGrowthAndLiquidityCoefficientInFundingPayment()
, so only part of the funding payment will be returned. Use it with caution because it does not return all the pending funding payment of orders. Normally you won't need to use this function
Return Values:
Name | Type | Description |
---|---|---|
| int256 | the funding payment of all orders/liquidity of a maker |
getPendingFee
Get the pending fees of a order
Parameters:
Name | Type | Description |
---|---|---|
| address | The trader address |
| address | The base token address |
| int24 | The lower tick |
| int24 | The upper tick |
Return Values:
Name | Type | Description |
---|---|---|
| uint256 | The pending fees |
getExchange
Get Exchange
contract address
Return Values:
Name | Type | Description |
---|---|---|
| address | The |
Events
ExchangeChanged
Emitted when the Exchange
contract address changed
Parameters:
Name | Type | Description |
---|---|---|
| address | The address of exchange contract |
Last updated