CLOB Factory
CLOB Factory Contract
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
.