Create Market
Overview
Create Market functionality allows anyone to create a new market within the Chromatic Protocol. The creation is based on registered oracle providers and settlement tokens, which are managed by the DAO (Decentralized Autonomous Organization).
ChromaticMarketFactory Interface
The IChromaticMarketFactory
interface serves as the primary interface for interacting with the ChromaticMarketFactory contract. It provides access to the following functions:
interface IChromaticMarketFactory {
/**
* @notice Creates a new market associated with an oracle provider and settlement token.
* @param oracleProvider The address of the oracle provider.
* @param settlementToken The address of the settlement token.
*/
function createMarket(address oracleProvider, address settlementToken) external;
/**
* @notice Gets the registered oracle providers.
* @return An array of registered oracle provider addresses.
*/
function registeredOracleProviders() external view returns (address[] memory);
/**
* @notice Gets the list of registered settlement tokens.
* @return An array of addresses representing the registered settlement tokens.
*/
function registeredSettlementTokens() external view returns (address[] memory);
}
Create Market
The createMarket function is used to create a new market within the Chromatic Protocol. Any user can call the createMarket method of the ChromaticMarketFactory contract, providing the addresses of the desired oracle provider and settlement token as parameters.
Upon successful execution of the createMarket function, a new market is created and associated with the specified oracle provider and settlement token. This enables users to trade perpetual futures contracts using the newly created market.
Usage
To create a market, developers should follow these steps:
- Obtain the address of the desired oracle provider and settlement token.
- Call the createMarket function of the ChromaticMarketFactory contract, providing the addresses of the oracle provider and settlement token as parameters.
- Wait for the transaction to be confirmed on the blockchain.
Registered Oracle Providers and Settlement Tokens
The ChromaticMarketFactory contract provides additional functions to retrieve information about the registered oracle providers and settlement tokens. Developers can call the registeredOracleProviders function to get an array of registered oracle provider addresses. Similarly, the registeredSettlementTokens function returns an array of addresses representing the registered settlement tokens.
By utilizing the createMarket function and the information about registered oracle providers and settlement tokens, developers can create new markets within the Chromatic Protocol, expanding the trading options available to users. The DAO manages the registration and administration of oracle providers and settlement tokens to ensure the integrity and functionality of the protocol.