Mars Protocol
Search…
🌐
Oracle
The Oracle contract provides prices in uusd for assets used in the protocol.

Links

Config

Key
Type
Description
owner
CanonicalAddr
Contract owner

InstantiateMsg

Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct InstantiateMsg {
pub owner: String,
}
{
"owner": "terra...",
}
Key
Type
Description
owner
String
Contract owner

ExecuteMsg

UpdateConfig

Updates the configuration of the contract. Can only be issued by the owner.
Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
UpdateConfig {
owner: Option<String>
}
}
{
"update_config": {
"owner": "terra..."
}
}
Key
Type
Description
owner*
String
Address of new owner
* = optional

SetAsset

Specifies parameters to query asset price.
Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
SetAsset {
asset: Asset,
price_source: PriceSourceUnchecked,
}
}
{
"set_asset": {
"asset": "terra...",
"price_source": {}
}
}
Key
Type
Description
asset
String
Contract address for asset being queried
price_source
String
Price source unchecked

RecordTwapSnapshots

Fetches cumulative prices from Astroport pairs and records in contract storage.
Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
RecordTwapSnapshots {
assets: Vec<Asset>
}
}
{
"record_twap_snapshots": {
"assets": [
["terra..."],
["terra..."]
]
}
}
Key
Type
Description
assets
Vec<(String)>
Vector of assets

QueryMsg

Config

Gets the Oracle contract configuration.
Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
Config {}
}
{
"config": {}
}

AssetPriceSource

Get asset's price source.
Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
AssetPriceSource {
asset: Asset
}
}
{
"asset_price_source": {
"asset": "terra..."
}
}
Key
Type
Description
asset
String
Asset to get price source information

AssetPrice

Gets asset price given an asset.
Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
AssetPrice {
asset: Asset
}
}
{
"asset_price": {
"asset": "terra..."
}
}
Key
Type
Description
asset
String
Asset to get price information

AssetPriceByReference

Gets asset price given its internal reference. Meant to be used by protocol contracts only.
Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
AssetPriceByReference {
asset_reference: Vec<u8>
}
}
{
"asset_price_by_reference": {
"asset_reference": [
[123],
[123]
]
}
}
Key
Type
Description
asset_reference
Vec<u8>
Asset reference
Copy link
On this page
Links
Config
InstantiateMsg
ExecuteMsg
UpdateConfig
SetAsset
RecordTwapSnapshots
QueryMsg
Config
AssetPriceSource
AssetPrice
AssetPriceByReference