OrderBook
InternalAddLiquidityToOrderParams
InternalRemoveLiquidityParams
InternalSwapStep
Functions
initialize
setExchange
addLiquidity
Add liquidity logic
Only used by ClearingHouse
contract
Parameters:
Return Values:
removeLiquidity
Remove liquidity logic, only used by ClearingHouse
contract
Parameters:
Return Values:
updateFundingGrowthAndLiquidityCoefficientInFundingPayment
This is the non-view version of getLiquidityCoefficientInFundingPayment()
, only can be called by Exchange
contract
Parameters:
Return Values:
updateOrderDebt
uniswapV3MintCallback
Called to msg.sender
after minting liquidity to a position from IUniswapV3Pool#mint.
In the implementation you must pay the pool tokens owed for the minted liquidity. The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.
Parameters:
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:
Return Values:
getExchange
Get Exchange
contract address
Return Values:
getOpenOrderIds
Get open order ids of a trader in the given market
Parameters:
Return Values:
getOpenOrderById
Get open order info by given order id
Parameters:
Return Values:
getOpenOrder
Get open order info by given base token, upper tick and lower tick
Parameters:
Return Values:
hasOrder
Check if the specified trader has order in given markets
Parameters:
Return Values:
getTotalQuoteBalanceAndPendingFee
Get the total quote token amount and pending fees of all orders in given markets
Parameters:
Return Values:
getTotalTokenAmountInPoolAndPendingFee
Get the total token amount (quote or base) and pending fees of all orders in the given market
Parameters:
Return Values:
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:
getPendingFee
Get the pending fees of a order
Parameters:
Return Values:
getTotalOrderDebt
Get the total debt token amount (base or quote) of all orders in the given market
Parameters:
Return Values:
Last updated