Skip to main content

CloberMarketFactory

CloberMarketFactory​

CreateVolatileMarket​

event CreateVolatileMarket(address market, address orderToken, address quoteToken, address baseToken, uint256 quoteUnit, uint256 nonce, int24 makerFee, uint24 takerFee, uint128 a, uint128 r)

Emitted when a new volatile market is created.

Parameters​

NameTypeDescription
marketaddressThe address of the new market.
orderTokenaddressThe address of the new market's order token.
quoteTokenaddressThe address of the new market's quote token.
baseTokenaddressThe address of the new market's base token.
quoteUnituint256The amount that one raw amount represents in quote tokens.
nonceuint256The nonce for this market.
makerFeeint24The maker fee. Paid to the maker when negative, paid by the maker when positive. Every 10000 represents a 1% fee on trade volume.
takerFeeuint24The taker fee. Paid by the taker. Every 10000 represents a 1% fee on trade volume.
auint128The scale factor of the price points.
ruint128The common ratio between price points.

CreateStableMarket​

event CreateStableMarket(address market, address orderToken, address quoteToken, address baseToken, uint256 quoteUnit, uint256 nonce, int24 makerFee, uint24 takerFee, uint128 a, uint128 d)

Emitted when a new stable market is created.

Parameters​

NameTypeDescription
marketaddressThe address of the new market.
orderTokenaddressThe address of the new market's order token.
quoteTokenaddressThe address of the new market's quote token.
baseTokenaddressThe address of the new market's base token.
quoteUnituint256The amount that one raw amount represents in quote tokens.
nonceuint256The nonce for this market.
makerFeeint24The maker fee. Paid to the maker when negative, paid by the maker when positive. Every 10000 represents a 1% fee on trade volume.
takerFeeuint24The taker fee. Paid by the taker. Every 10000 represents a 1% fee on trade volume.
auint128The starting price point.
duint128The common difference between price points.

ChangeOwner​

event ChangeOwner(address previousOwner, address newOwner)

Emitted when the address of the owner has changed.

Parameters​

NameTypeDescription
previousOwneraddressThe address of the previous owner.
newOwneraddressThe address of the new owner.

ChangeDaoTreasury​

event ChangeDaoTreasury(address previousTreasury, address newTreasury)

Emitted when the DAO Treasury address has changed.

Parameters​

NameTypeDescription
previousTreasuryaddressThe address of the previous DAO Treasury.
newTreasuryaddressThe address of the new DAO Treasury.

ChangeHost​

event ChangeHost(address market, address previousHost, address newHost)

Emitted when the host address has changed.

Parameters​

NameTypeDescription
marketaddressThe address of the market that had a change of hosts.
previousHostaddressThe address of the previous host.
newHostaddressThe address of a new host.

deployedGeometricPriceBook​

function deployedGeometricPriceBook(uint128 a, uint128 r) external view returns (address)

Returns the address of the deployed GeometricPriceBook.

Return Values​

NameTypeDescription
[0]addressThe address of the GeometricPriceBook.

deployedArithmeticPriceBook​

function deployedArithmeticPriceBook(uint128 a, uint128 d) external view returns (address)

Returns the address of the deployed GeometricPriceBook.

Return Values​

NameTypeDescription
[0]addressThe address of the GeometricPriceBook.

marketDeployer​

function marketDeployer() external view returns (address)

Returns the address of the MarketDeployer.

Return Values​

NameTypeDescription
[0]addressThe address of the MarketDeployer.

priceBookDeployer​

function priceBookDeployer() external view returns (address)

Returns the address of the priceBookDeployer.

Return Values​

NameTypeDescription
[0]addressThe address of the priceBookDeployer.

orderTokenDeployer​

function orderTokenDeployer() external view returns (address)

Returns the address of the orderTokenDeployer.

Return Values​

NameTypeDescription
[0]addressThe address of the orderTokenDeployer.

canceler​

function canceler() external view returns (address)

Returns the address of the OrderCanceler.

Return Values​

NameTypeDescription
[0]addressThe address of the OrderCanceler.

registeredQuoteTokens​

function registeredQuoteTokens(address token) external view returns (bool)

Returns whether the specified token address has been registered as a quote token.

Parameters​

NameTypeDescription
tokenaddressThe address of the token to check.

Return Values​

NameTypeDescription
[0]boolbool Whether the token is registered as a quote token.

owner​

function owner() external view returns (address)

Returns the address of the factory owner

Return Values​

NameTypeDescription
[0]addressThe address of the factory owner

futureOwner​

function futureOwner() external view returns (address)

Returns the address of the factory owner candidate

Return Values​

NameTypeDescription
[0]addressThe address of the factory owner candidate

daoTreasury​

function daoTreasury() external view returns (address)

Returns the address of the DAO Treasury

Return Values​

NameTypeDescription
[0]addressThe address of the DAO Treasury

nonce​

function nonce() external view returns (uint256)

Returns the current nonce

Return Values​

NameTypeDescription
[0]uint256The current nonce

createVolatileMarket​

function createVolatileMarket(address host, address quoteToken, address baseToken, uint96 quoteUnit, int24 makerFee, uint24 takerFee, uint128 a, uint128 r) external returns (address)

Creates a new market with a VolatilePriceBook.

Parameters​

NameTypeDescription
hostaddressThe address of the new market's host.
quoteTokenaddressThe address of the new market's quote token.
baseTokenaddressThe address of the new market's base token.
quoteUnituint96The amount that one raw amount represents in quote tokens.
makerFeeint24The maker fee. Paid to the maker when negative, paid by the maker when positive. Every 10000 represents a 1% fee on trade volume.
takerFeeuint24The taker fee. Paid by the taker. Every 10000 represents a 1% fee on trade volume.
auint128The scale factor of the price points.
ruint128The common ratio between price points.

Return Values​

NameTypeDescription
[0]addressThe address of the created market.

createStableMarket​

function createStableMarket(address host, address quoteToken, address baseToken, uint96 quoteUnit, int24 makerFee, uint24 takerFee, uint128 a, uint128 d) external returns (address)

Creates a new market with a StablePriceBook

Parameters​

NameTypeDescription
hostaddressThe address of the new market's host
quoteTokenaddressThe address of the new market's quote token
baseTokenaddressThe address of the new market's base token
quoteUnituint96The amount that one raw amount represents in quote tokens
makerFeeint24The maker fee. Paid to the maker when negative, paid by the maker when positive. Every 10000 represents a 1% fee on trade volume.
takerFeeuint24The taker fee. Paid by the taker. Every 10000 represents a 1% fee on trade volume.
auint128The starting price point.
duint128The common difference between price points.

Return Values​

NameTypeDescription
[0]addressThe address of the created market.

changeDaoTreasury​

function changeDaoTreasury(address treasury) external

Change the DAO Treasury address.

Only the factory owner can call this function.

Parameters​

NameTypeDescription
treasuryaddressThe new address of the DAO Treasury.

prepareChangeOwner​

function prepareChangeOwner(address newOwner) external

Sets the new owner address for this contract.

Only the factory owner can call this function.

Parameters​

NameTypeDescription
newOwneraddressThe new owner address for this contract.

executeChangeOwner​

function executeChangeOwner() external

Changes the owner of this contract to the address set by prepareChangeOwner.

Only the future owner can call this function.

getMarketHost​

function getMarketHost(address market) external view returns (address)

Returns the host address of the given market.

Parameters​

NameTypeDescription
marketaddressThe address of the target market.

Return Values​

NameTypeDescription
[0]addressThe host address of the market.

prepareHandOverHost​

function prepareHandOverHost(address market, address newHost) external

Prepares to set a new host address for the given market address.

Only the market host can call this function.

Parameters​

NameTypeDescription
marketaddressThe market address for which the host will be changed.
newHostaddressThe new host address for the given market.

executeHandOverHost​

function executeHandOverHost(address market) external

Changes the host address of the given market to the address set by prepareHandOverHost.

Only the future market host can call this function.

Parameters​

NameTypeDescription
marketaddressThe market address for which the host will be changed.

MarketType​

enum MarketType {
NONE,
VOLATILE,
STABLE
}

MarketInfo​

struct MarketInfo {
address host;
enum CloberMarketFactory.MarketType marketType;
uint128 a;
uint128 factor;
address futureHost;
}

getMarketInfo​

function getMarketInfo(address market) external view returns (struct CloberMarketFactory.MarketInfo marketInfo)

Returns key information about the market.

Parameters​

NameTypeDescription
marketaddressThe address of the market.

Return Values​

NameTypeDescription
marketInfostruct CloberMarketFactory.MarketInfoThe MarketInfo structure of the given market.

registerQuoteToken​

function registerQuoteToken(address token) external

Allows the specified token to be used as the quote token.

Only the factory owner can call this function.

Parameters​

NameTypeDescription
tokenaddressThe address of the token to register.

unregisterQuoteToken​

function unregisterQuoteToken(address token) external

Revokes the token's right to be used as a quote token.

Only the factory owner can call this function.

Parameters​

NameTypeDescription
tokenaddressThe address of the token to unregister.

formatOrderTokenName​

function formatOrderTokenName(address quoteToken, address baseToken, uint256 marketNonce) external view returns (string)

Returns the order token name.

Parameters​

NameTypeDescription
quoteTokenaddressThe address of the market's quote token.
baseTokenaddressThe address of the market's base token.
marketNonceuint256The market nonce.

Return Values​

NameTypeDescription
[0]stringThe order token name.

formatOrderTokenSymbol​

function formatOrderTokenSymbol(address quoteToken, address baseToken, uint256 marketNonce) external view returns (string)

Returns the order token symbol.

Parameters​

NameTypeDescription
quoteTokenaddressThe address of a new market's quote token.
baseTokenaddressThe address of a new market's base token.
marketNonceuint256The market nonce.

Return Values​

NameTypeDescription
[0]stringThe order token symbol.