The Oracle Contract exposes an interface for accessing the latest reported price for mAssets. Price quotes are kept up-to-date by oracle feeders that are tasked with periodically fetching exchange rates from reputable sources and reporting them to the Oracle contract.
Prices are only considered valid for 60 seconds. If no new prices are published after the data has expired, Mirror will disable CDP operations (mint, burn, deposit, withdraw) until the price feed resumes.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]pub struct InitMsg {pub owner: HumanAddr,pub base_asset: String,}
Key | Type | Description |
| HumanAddr | Address of the owner who can register new assets |
| String | Asset in which prices will be denominated (default TerraUSD) |
This function can only be issued by the active owner of the Oracle contract.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]#[serde(rename_all = "snake_case")]pub enum HandleMsg {UpdateConfig {owner: Option<HumanAddr>,}}
{"update_config": {"owner": "terra1..."}}
Key | Type | Description |
| HumanAddr | Address of new owner |
* = optional
Registers a new asset with the oracle, enabling a price feed for the asset. The feeder account responsible for reporting the price is assigned at this step.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]#[serde(rename_all = "snake_case")]pub enum HandleMsg {RegisterAsset {asset_token: HumanAddr,feeder: HumanAddr,}}
{"register_asset": {"asset_token": "terra1...","feeder": "terra1..."}}
Key | Type | Description |
| HumanAddr | Contract address of asset token |
| HumanAddr | Address of Oracle Feeder for the asset |
Publish a price for one or multiple assets. Caller should be the designated oracle feeder for each of the assets for which price information is provided.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]#[serde(rename_all = "snake_case")]pub enum HandleMsg {FeedPrice {prices: Vec<(HumanAddr, Decimal)>,}}
{"feed_price": {"prices": [["terra1...", "123.456789"],["terra1...", "123.456789"]]}}
Key | Type | Description |
| Vec<(HumanAddr, Decimal)> | Price information for assets |
Get the Mirror Oracle contract configuration.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]#[serde(rename_all = "snake_case")]pub enum QueryMsg {Config {}}
{"config": {}}
Key | Type | Description |
Get asset token details, such as designated oracle feeder.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]#[serde(rename_all = "snake_case")]pub enum QueryMsg {Feeder {asset_token: HumanAddr,}}
{"asset": {"asset_token": "terra1..."}}
Key | Type | Description |
| HumanAddr | Contract address of asset token to query |
Get price information for the specified mAsset.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]#[serde(rename_all = "snake_case")]pub enum QueryMsg {Price {base_asset: String,quote_asset: String}}
{"price": {"base_asset": "terra1...","quote_asset": "uusd"}}
Key | Type | Description |
| HumanAddr | Asset for which to get price |
| HumanAddr / | Asset in which price will be denominated |
Get price information for all registered mAssets.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]#[serde(rename_all = "snake_case")]pub enum QueryMsg {Prices {start_after: Option<HumanAddr>,limit: Option<u32>}}
{"prices": {"start_after": "terra1...","limit": 8}}
Key | Type | Description |
| HumanAddr | Contract address to start query from |
| u32 | Max number of results to report |