⭐Clearinghouse
All basic exchange functions are kept in the clearinghouse contract. This includes open and close position, and liquidation functions.
openPosition
openPositionOpen a position or update the size of an existing position (you can only have one position in a given asset).
Parameters
struct OpenPositionParams {
uint256 marketId;
address maker; // Maker type, e.g. spotHedgeMaker
bool isBaseToQuote;
bool isExactInput;
uint256 amount;
uint256 oppositeAmountBound; // Control slippage
uint256 deadline; // Timestamp
bytes makerData; // @param makerData Encoded calls are custom data defined by maker
}Returns
returns (int256 base, int256 quote);closePosition
closePositionClose a position. Note you can also close using openPosition and opening an equal size position of the opposite direction (e.g. long closes short).
Parameters
Returns
liquidate
liquidateLiquidate a position. Contract will test the position for eligibility before liquidation.
Parameters
Returns
Event
setAuthorization
setAuthorizationDelegate open and close permissions; delegation is currently limited to order gateway contracts only.
isLiquidatable
isLiquidatableParameters
Returns
Last updated
Was this helpful?