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
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
pub struct InstantiateMsg {
3
pub owner: String,
4
}
Copied!
1
{
2
"owner": "terra...",
3
}
Copied!
Key
Type
Description
owner
String
Contract owner

ExecuteMsg

UpdateConfig

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

SetAsset

Specifies parameters to query asset price.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum ExecuteMsg {
4
SetAsset {
5
asset: Asset,
6
price_source: PriceSourceUnchecked,
7
}
8
}
Copied!
1
{
2
"set_asset": {
3
"asset": "terra...",
4
"price_source": {}
5
}
6
}
Copied!
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
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum ExecuteMsg {
4
RecordTwapSnapshots {
5
assets: Vec<Asset>
6
}
7
}
Copied!
1
{
2
"record_twap_snapshots": {
3
"assets": [
4
["terra..."],
5
["terra..."]
6
]
7
}
8
}
Copied!
Key
Type
Description
assets
Vec<(String)>
Vector of assets

QueryMsg

Config

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

AssetPriceSource

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

AssetPrice

Gets asset price given an asset.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum QueryMsg {
4
AssetPrice {
5
asset: Asset
6
}
7
}
Copied!
1
{
2
"asset_price": {
3
"asset": "terra..."
4
}
5
}
Copied!
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
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum QueryMsg {
4
AssetPriceByReference {
5
asset_reference: Vec<u8>
6
}
7
}
Copied!
1
{
2
"asset_price_by_reference": {
3
"asset_reference": [
4
[123],
5
[123]
6
]
7
}
8
}
Copied!
Key
Type
Description
asset_reference
Vec<u8>
Asset reference