Skip to main content

CloberRouter

CloberRouter

LimitOrderParams

struct LimitOrderParams {
address market;
uint64 deadline;
uint32 claimBounty;
address user;
uint16 priceIndex;
uint64 rawAmount;
bool postOnly;
bool useNative;
uint256 baseAmount;
}

GeneralLimitOrderParams

struct GeneralLimitOrderParams {
struct CloberRouter.LimitOrderParams params;
bool isBid;
}

limitOrder

function limitOrder(struct CloberRouter.GeneralLimitOrderParams[] limitOrderParamsList, struct CloberRouter.ClaimOrderParams[] claimParamsList) external payable returns (uint256[] orderIds)

Places limit orders.

Parameters

NameTypeDescription
limitOrderParamsListstruct CloberRouter.GeneralLimitOrderParams[]The limit order parameters list.
claimParamsListstruct CloberRouter.ClaimOrderParams[]Array of ClaimOrderParams: The list of orders to be claimed.

Return Values

NameTypeDescription
orderIdsuint256[]The order indices. If an order is not made type(uint256).max is returned instead.

limitBid

function limitBid(struct CloberRouter.LimitOrderParams params) external payable returns (uint256)

Places a limit order on the bid side.

Parameters

NameTypeDescription
paramsstruct CloberRouter.LimitOrderParamsThe limit order parameters.

Return Values

NameTypeDescription
[0]uint256The order index. If an order is not made type(uint256).max is returned instead.

limitAsk

function limitAsk(struct CloberRouter.LimitOrderParams params) external payable returns (uint256)

Places a limit order on the ask side.

Parameters

NameTypeDescription
paramsstruct CloberRouter.LimitOrderParamsThe limit order parameters.

Return Values

NameTypeDescription
[0]uint256The order index. If an order is not made type(uint256).max is returned instead.

MarketOrderParams

struct MarketOrderParams {
address market;
uint64 deadline;
address user;
uint16 limitPriceIndex;
uint64 rawAmount;
bool expendInput;
bool useNative;
uint256 baseAmount;
}

marketBid

function marketBid(struct CloberRouter.MarketOrderParams params) external payable

Place a market order on the bid side.

Parameters

NameTypeDescription
paramsstruct CloberRouter.MarketOrderParamsThe market order parameters.

marketAsk

function marketAsk(struct CloberRouter.MarketOrderParams params) external payable

Place a market order on the ask side.

Parameters

NameTypeDescription
paramsstruct CloberRouter.MarketOrderParamsThe market order parameters.

ClaimOrderParams

struct ClaimOrderParams {
address market;
struct OrderKey[] orderKeys;
}

claim

function claim(uint64 deadline, struct CloberRouter.ClaimOrderParams[] paramsList) external

Claims orders across markets.

Parameters

NameTypeDescription
deadlineuint64The deadline for the transaction. Reverts if the block timestamp is greater than this value.
paramsListstruct CloberRouter.ClaimOrderParams[]The list of ClaimOrderParams

limitBidAfterClaim

function limitBidAfterClaim(struct CloberRouter.ClaimOrderParams[] claimParamsList, struct CloberRouter.LimitOrderParams limitOrderParams) external payable returns (uint256)

Submits a limit bid order to the order book after claiming a list of orders.

Parameters

NameTypeDescription
claimParamsListstruct CloberRouter.ClaimOrderParams[]Array of ClaimOrderParams: The list of orders to be claimed.
limitOrderParamsstruct CloberRouter.LimitOrderParamsLimitOrderParams: The parameters for the limit order.

Return Values

NameTypeDescription
[0]uint256The order index. If an order is not made type(uint256).max is returned instead.

limitAskAfterClaim

function limitAskAfterClaim(struct CloberRouter.ClaimOrderParams[] claimParamsList, struct CloberRouter.LimitOrderParams limitOrderParams) external payable returns (uint256)

Submits a limit ask order to the order book after claiming a list of orders.

Parameters

NameTypeDescription
claimParamsListstruct CloberRouter.ClaimOrderParams[]Array of ClaimOrderParams: The list of orders to be claimed.
limitOrderParamsstruct CloberRouter.LimitOrderParamsLimitOrderParams: The parameters for the limit order.

Return Values

NameTypeDescription
[0]uint256The order index. If an order is not made type(uint256).max is returned instead.

marketBidAfterClaim

function marketBidAfterClaim(struct CloberRouter.ClaimOrderParams[] claimParamsList, struct CloberRouter.MarketOrderParams marketOrderParams) external payable

Submits a market bid order to the order book after claiming a list of orders.

Parameters

NameTypeDescription
claimParamsListstruct CloberRouter.ClaimOrderParams[]Array of ClaimOrderParams: The list of orders to be claimed.
marketOrderParamsstruct CloberRouter.MarketOrderParamsMarketOrderParams: The parameters for the market order.

marketAskAfterClaim

function marketAskAfterClaim(struct CloberRouter.ClaimOrderParams[] claimParamsList, struct CloberRouter.MarketOrderParams marketOrderParams) external payable

Submits a market ask order to the order book after claiming a list of orders.

Parameters

NameTypeDescription
claimParamsListstruct CloberRouter.ClaimOrderParams[]Array of ClaimOrderParams: The list of orders to be claimed.
marketOrderParamsstruct CloberRouter.MarketOrderParamsMarketOrderParams: The parameters for the market order.

registerMarkets

function registerMarkets(address[] markets) external

Registers markets to be accepted by the router.

Parameters

NameTypeDescription
marketsaddress[]Markets to be registered.

unregisterMarkets

function unregisterMarkets(address[] markets) external

Unregisters markets denying their use by the router.

Parameters

NameTypeDescription
marketsaddress[]Markets to be unregistered.

isRegisteredMarket

function isRegisteredMarket(address market) external view returns (bool)

Checks if the market is registered.

Parameters

NameTypeDescription
marketaddressThe market to be checked for registration status.