Clearinghouse

All basic exchange functions are kept in the clearinghouse contract. This includes open and close position, and liquidation functions.

Find parameters like marketID in Metadata

openPosition

Open 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

Close 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

Liquidate a position. Contract will test the position for eligibility before liquidation.

Parameters

Returns

Event

setAuthorization

Delegate open and close permissions; delegation is currently limited to order gateway contracts only.

isLiquidatable

Parameters

Returns

Last updated

Was this helpful?