OrderBook
Last updated
Was this helpful?
Last updated
Was this helpful?
Add liquidity logic
Only used by ClearingHouse
contract
params
struct IOrderBook.AddLiquidityParams
Add liquidity params, detail on IOrderBook.AddLiquidityParams
response
struct IOrderBook.AddLiquidityResponse
Add liquidity response, detail on IOrderBook.AddLiquidityResponse
Remove liquidity logic, only used by ClearingHouse
contract
params
struct IOrderBook.RemoveLiquidityParams
Remove liquidity params, detail on IOrderBook.RemoveLiquidityParams
response
struct IOrderBook.RemoveLiquidityResponse
Remove liquidity response, detail on IOrderBook.RemoveLiquidityResponse
This is the non-view version of getLiquidityCoefficientInFundingPayment()
, only can be called by Exchange
contract
trader
address
The trader address
baseToken
address
The base token address
fundingGrowthGlobal
struct Funding.Growth
The funding growth info, detail on Funding.Growth
liquidityCoefficientInFundingPayment
int256
the funding payment of all orders/liquidity of a maker
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.
amount0Owed
uint256
The amount of token0 due to the pool for the minted liquidity
amount1Owed
uint256
The amount of token1 due to the pool for the minted liquidity
data
bytes
Any data passed through by the caller via the IUniswapV3PoolActions#mint call
Replay the swap and get the swap result (price impact and swap fee), only can be called by Exchange
contract;
ReplaySwapResponse.insuranceFundFee = fee * insuranceFundFeeRatio
params
struct IOrderBook.ReplaySwapParams
ReplaySwap params, detail on IOrderBook.ReplaySwapParams
response
struct IOrderBook.ReplaySwapResponse
The swap result encoded in ReplaySwapResponse
Get Exchange
contract address
exchange
address
The Exchange
contract address
Get open order ids of a trader in the given market
trader
address
The trader address
baseToken
address
The base token address
orderIds
bytes32[]
The open order ids
Get open order info by given order id
orderId
bytes32
The order id
info
struct OpenOrder.Info
The open order info encoded in OpenOrder.Info
Get open order info by given base token, upper tick and lower tick
trader
address
The trader address
baseToken
address
The base token address
upperTick
int24
The upper tick
lowerTick
int24
The lower tick
info
struct OpenOrder.Info
he open order info encoded in OpenOrder.Info
Check if the specified trader has order in given markets
trader
address
The trader address
tokens
address[]
The base token addresses
hasOrder
bool
True if the trader has order in given markets
Get the total quote token amount and pending fees of all orders in given markets
trader
address
The trader address
baseTokens
address[]
The base token addresses
totalQuoteAmountInPools
int256
The total quote token amount
totalPendingFee
uint256
The total pending fees in the orders
Get the total token amount (quote or base) and pending fees of all orders in the given market
trader
address
The trader address
baseToken
address
The base token addresses
fetchBase
bool
True if fetch base token amount, false if fetch quote token amount
tokenAmount
uint256
The total quote/base token amount
totalPendingFee
uint256
The total pending fees in the orders
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
liquidityCoefficientInFundingPayment
int256
the funding payment of all orders/liquidity of a maker
Get the pending fees of a order
trader
address
The trader address
baseToken
address
The base token address
lowerTick
int24
The lower tick
upperTick
int24
The upper tick
fee
uint256
The pending fees
Get the total debt token amount (base or quote) of all orders in the given market
trader
address
The trader address
baseToken
address
The base token address
fetchBase
bool
True if fetch base token amount, false if fetch quote token amount
debtAmount
uint256
The total debt token amount
Parameters:
Return Values:
Parameters:
Return Values:
Parameters:
Return Values:
Parameters:
Parameters:
Return Values:
Return Values:
Parameters:
Return Values:
Parameters:
Return Values:
Parameters:
Return Values:
Parameters:
Return Values:
Parameters:
Return Values:
Parameters:
Return Values:
Return Values:
Parameters:
Return Values:
Parameters:
Return Values: