ICLOBFactory
CLOB Factory Interface
Structs & Enums
ConfigParams
quoteLotSizeInAtoms
: The smallest tradeable unit of the quote token, measured in atoms.baseLotSizeInAtoms
: The smallest tradeable unit of the base token, measured in atoms.tickSizeInQuoteLotsPerBaseUnit
: The minimum price increment for trading, expressed as a number of quote lots per base unit.minLimitOrderAmountInBaseLots
: Minimum allowable size for a limit order, measured in base lots.feeTier
: Defined in the FeeTier enum.
FeeTier
Events
MarketCreated
creator
: The address of the account that created the market.quoteToken
: The address of the quote token.baseToken
: The address of the base token.marketAddress
: The address of the deployed CLOB market contract.quoteDecimals
: The number of decimals for the quote token.baseDecimals
: The number of decimals for the base token.quoteLotSizeInAtoms
: The smallest tradeable unit of the quote token, measured in atoms.baseLotSizeInAtoms
: The smallest tradeable unit of the base token, measured in atoms.tickSizeInQuoteLotsPerBaseUnit
: The minimum price increment for trading, expressed as a number of quote lots per base unit.minLimitOrderAmountInBaseLots
: Minimum allowable size for a limit order, measured in base lots.feeAmountInBps
: The fee amount in basis points (1/100th of a percent).
Functions
createMarket
Creates a CLOB market for the given token pair. ConfigParams specifies the market fee tier, lot sizes, and tick sizes.
The call will revert if the market already exists, or if the ConfigParams are invalid.
Parameters
Type | Name | Description |
---|---|---|
address | quoteToken | The quote token of the market. |
address | baseToken | The base token of the market. |
ConfigParams memory | params | Custom ConfigParams structure, which specifies the market fee tier, lot sizes, and tick sizes. |
Return Values
Type | Description |
---|---|
address | The deployment address of the CLOB market contract. |
Events
Reverts
MarketAlreadyExists
: If the market already exists for the given token pair and configuration.InvalidConfigParams
: If the provided configuration parameters are invalid.TokensMustBeDifferent
: If the quote and base tokens are the same.
getMarketAddress
Returns the address of the CLOB market for the given token pair and configuration parameters. Markets are identified by the keccak256 hash of the unique combination of quoteToken address, baseToken address, and ConfigParams.
Parameters
Type | Name | Description |
---|---|---|
address | quoteToken | The quote token of the market. |
address | baseToken | The base token of the market. |
ConfigParams memory | params | Custom ConfigParams structure, which specifies the market fee tier, lot sizes, and tick sizes. |
Return Values
Type | Description |
---|---|
address | The address of the CLOB market. |
Reverts
MarketDoesNotExist
: If the market does not exist for the given token pair and configuration.
getMarketCount
Given a certain token pair (sensitive to the order of quoteToken and baseToken), returns the number of markets created for that token pair, each being distinct via different ConfigParams.
Parameters
Type | Name | Description |
---|---|---|
address | quoteToken | The quote token of the market. |
address | baseToken | The base token of the market. |
Return Values
Type | Description |
---|---|
uint256 | The number of markets created for the given token pair. |
getConfigParams
Returns a subset of ConfigParams for the specified token pair, granted that a token pair may have multiple different markets distinguished by their ConfigParams
.
Returns a list of ConfigParams
starting from a specified startIndex
up to a specified number of parameters. The function reverts if the indices are invalid.
Parameters
Type | Name | Description |
---|---|---|
address | quoteToken | The quote token of the market. |
address | baseToken | The base token of the market. |
uint256 | startIndex | The index which specifies where to start in the array of all ConfigParams for the given token pairs. |
uint256 | numParams | The number of ConfigParams to retrieve for the return value, starting iteration from the startIndex |
Return Values
Type | Name | Description |
---|---|---|
ConfigParams[] memory | params | An array of ConfigParams structs. |
uint256 | returnedParams | The number of ConfigParams returned. |
Reverts
InvalidIndices
: If the specified indices are out of bounds for the availableConfigParams
.