Search…
Collateral Oracle
Collateral Oracle contract manages a directory of whitelisted collateral assets, providing the necessary interfaces to register and revoke assets. Mint contract will fetch prices from collateral oracle to determine the C-ratio of each CDP. The Collateral Oracle fetches prices from different sources on the Terra ecosystem, acting as a proxy for Mint Contract.

InitMsg

Rust
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
pub struct InitMsg {
3
pub owner: HumanAddr,
4
pub mint_contract: HumanAddr,
5
pub base_denom: String,
6
pub mirror_oracle: HumanAddr,
7
pub anchor_oracle: HumanAddr,
8
pub band_oracle: HumanAddr,
9
}
Copied!
Key
Type
Description
owner
HumanAddr
Address of owner
mint_contract
HumanAddr
Address of Mirror Mint contract
base_denom
String
Asset in which prices will be denominated in (default TerraUSD)
mirror_oracle
HumanAddr
Address of MIR token oracle feeder
anchor_oracle
HumanAddr
Address of ANC token oracle feeder
band_oracle
HumanAddr
Address of Band Protocol oracle feeder

HandleMsg

UpdateConfig

This function can be only issued by the active owner of the Collateral Oracle contract. Changes the configuration of collateral oracle contract.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum HandleMsg {
4
UpdateConfig {
5
owner: Option<HumanAddr>,
6
mint_contract: Option<HumanAddr>,
7
base_denom: Option<String>,
8
mirror_oracle: Option<HumanAddr>,
9
anchor_oracle: Option<HumanAddr>,
10
band_oracle: Option<HumanAddr>,
11
},
12
}
Copied!
1
{
2
"update_config": {
3
"owner": "terra1...",
4
"mint_contract": "terra1...",
5
"base_denom": "uusd",
6
"mirror_oracle": "terra1...",
7
"anchor_oracle": "terra1...",
8
"band_oracle": "terra1..."
9
}
10
}
Copied!
Key
Type
Description
owner*
HumanAddr
Address of owner
mint_contract*
HumanAddr
Address of Mirror Mint contract
base_denom*
String
Asset in which prices will be denominated in (default TerraUSD)
mirror_oracle*
HumanAddr
Address of MIR token oracle feeder
anchor_oracle*
HumanAddr
Address of ANC token oracle feeder
band_oracle*
HumanAddr
Address of Band Protocol oracle feeder
*= optional

RegisterCollateralAsset

Registers a new type of collateral to be used on Mirror Mint contract for the creation of new CDP. Can only be issued by the owner of Collateral Oracle.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum HandleMsg {
4
RegisterCollateralAsset {
5
asset: AssetInfo,
6
price_source: SourceType,
7
multiplier: Decimal,
8
},
9
}
Copied!
1
{
2
"register_collateral_asset": {
3
"asset": {
4
"token": {
5
"contract_addr": "terra1..."
6
}
7
},
8
"price_source": {
9
"terra_oracle": {
10
"terra_oracle_query": "eyAiZXhlY3V0ZV9tc2ciOiAiYmxhaCBibGFoIiB9"
11
},
12
"band_oracle": {
13
"band_oracle_query": "eyAiZXhlY3V0ZV9tc2ciOiAiYmxhaCBibGFoIiB9"
14
},
15
"fixed_price": {
16
"price": "123.123456"
17
},
18
"terraswap": {
19
"terraswap_query": "eyAiZXhlY3V0ZV9tc2ciOiAiYmxhaCBibGFoIiB9",
20
"intermediate_denom": "uluna"
21
},
22
"anchor_market": {
23
"anchor_market_query": "eyAiZXhlY3V0ZV9tc2ciOiAiYmxhaCBibGFoIiB9"
24
},
25
"native": {
26
"native_denom": "uusd"
27
}
28
}
29
"multiplier": "0.05"
30
}
31
}
Copied!
Key
Type
Description
asset
AssetInfo
Asset to be registered
price_source
SourceType
Base64-encoded string of JSON of Receive Hook
multiplier
Decimal
Multiplied to min_collateral_ratio when this asset is chosen as collateral

SourceType

1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum SourceType {
4
TerraOracle {
5
terra_oracle_query: Binary,
6
},
7
BandOracle {
8
band_oracle_query: Binary,
9
},
10
FixedPrice {
11
price: Decimal,
12
},
13
Terraswap {
14
terraswap_query: Binary,
15
intermediate_denom: Option<String>,
16
},
17
AnchorMarket {
18
anchor_market_query: Binary,
19
},
20
Native {
21
native_denom: String,
22
},
23
}
Copied!
Key
Type
Description
terra_oracle_query
Binary
Queries information of Terra's oracle
band_oracle_query
Binary
Queries information of Band Protocol oracle
price
Decimal
Fixed price to be used for the collateral type (aUST = 1 UST)
terraswap_query
Binary
Queries information of Terraswap Pair
intermediate_denom*
String
Used to calculate UST denominated price of an asset when the asset does not have UST pair pool
anchor_market_query
Binary
Query to fetch information for Anchor Protocol's asset information (ANC)
native_denom
String
String denomination of the Terra native asset (uusd)

RevokeCollateralAsset

Removes registered collateral so that it is no longer used as collateral for Mirror Mint. Can only be issued by the owner of Collateral Oracle.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum HandleMsg {
4
RevokeCollateralAsset {
5
asset: AssetInfo,
6
},
7
}
Copied!
1
{
2
"revote_collateral_asset": {
3
"asset": {
4
"token": {
5
"contract_addr": "terra1..."
6
}
7
}
8
}
9
}
Copied!
Key
Type
Description
asset
AssetInfo
Asset to be revoked

UpdateCollateralPriceSource

Updates the price data source for a specific collateral asset. Can only be issued by the owner of Collateral Oracle.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum HandleMsg {
4
UpdateCollateralPriceSource {
5
asset: AssetInfo,
6
price_source: SourceType,
7
},
8
}
Copied!
1
{
2
"update_collateral_query": {
3
"asset": {
4
"token": {
5
"contract_addr": "terra1..."
6
}
7
},
8
"price_source": {
9
"terra_oracle": {
10
"terra_oracle_query": "eyAiZXhlY3V0ZV9tc2ciOiAiYmxhaCBibGFoIiB9"
11
},
12
"band_oracle": {
13
"band_oracle_query": "eyAiZXhlY3V0ZV9tc2ciOiAiYmxhaCBibGFoIiB9"
14
},
15
"fixed_price": {
16
"price": "123.123456"
17
},
18
"terraswap": {
19
"terraswap_query": "eyAiZXhlY3V0ZV9tc2ciOiAiYmxhaCBibGFoIiB9",
20
"intermediate_denom": "uluna"
21
},
22
"anchor_market": {
23
"anchor_market_query": "eyAiZXhlY3V0ZV9tc2ciOiAiYmxhaCBibGFoIiB9"
24
},
25
"native": {
26
"native_denom": "uusd"
27
}
28
}
29
}
30
}
Copied!
Key
Type
Description
asset
AssetInfo
Asset to update query information
price_source
SourceType
Message detailing where to query asset information from

UpdateCollateralMultiplier

Updates the multiplier parameter of a specific collateral asset registered in Mirror contract. Can only be issued by the owner of Collateral Oracle.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum HandleMsg {
4
UpdateCollateralPremium {
5
asset: AssetInfo,
6
multiplier: Decimal,
7
},
8
}
Copied!
1
{
2
"update_collateral_premium": {
3
"asset": {
4
"token": {
5
"contract_addr": "terra1..."
6
}
7
},
8
"multiplier": "2.00"
9
}
10
}
Copied!
Key
Type
Description
asset
AssetInfo
Asset to change collateral premium
multiplier
Decimal
Collateral ratio multiplied to min_collateral_ratio of the CDP being created by choosing this asset

QueryMsg

Config

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

Response

1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
pub struct ConfigResponse {
3
pub owner: HumanAddr,
4
pub mint_contract: HumanAddr,
5
pub base_denom: String,
6
pub mirror_oracle: HumanAddr,
7
pub anchor_oracle: HumanAddr,
8
pub band_oracle: HumanAddr,
9
}
Copied!
Key
Type
Description
owner
HumanAddr
Address of owner
mint_contract
HumanAddr
Address of Mirror Mint contract
base_denom
String
Asset in which prices will be denominated in (default TerraUSD)
mirror_oracle
HumanAddr
Address of MIR token oracle feeder
anchor_oracle
HumanAddr
Address of ANC token oracle feeder
band_oracle
HumanAddr
Address of Band Protocol oracle feeder
1
{
2
"config": {}
3
}
Copied!

Response

1
{
2
"config_response": {
3
"owner": "terra1...",
4
"mint_contract": "terra1...",
5
"base_denom": "uusd",
6
"mirror_oracle": "terra1...",
7
"anchor_oracle": "terra1...",
8
"band_oracle": "terra1..."
9
}
10
}
Copied!
Key
Type
Description
owner
HumanAddr
Address of owner
mint_contract
HumanAddr
Address of Mirror Mint contract
base_denom
String
Asset in which prices will be denominated in (default TerraUSD)
mirror_oracle
HumanAddr
Address of MIR token oracle feeder
anchor_oracle
HumanAddr
Address of ANC token oracle feeder
band_oracle
HumanAddr
Address of Band Protocol oracle feeder

CollateralPrice

Returns the UST price of the selected collateral asset.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum QueryMsg {
4
CollateralPrice {
5
asset: String,
6
},
7
}
Copied!
Key
Type
Description
asset
String
Name of the collateral asset to query prices

Response

Returns the UST price of the selected collateral asset.
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
pub struct CollateralPriceResponse {
3
pub asset: String,
4
pub rate: Decimal,
5
pub last_updated: u64
6
pub multiplier: Decimal,
7
pub is_revoked: bool,
8
}
Copied!
Key
Type
Description
asset
String
Name of the collateral asset to query prices
rate
Decimal
Current price of the collateral
collateral_premium
Decimal
Collateral ratio added to min_collateral_ratio of the CDP being created by choosing this asset
is_revoked
bool
Check if the collateral is registered or revoked
1
{
2
"collateral_price": {
3
"asset": "uluna"
4
}
5
}
Copied!
Key
Type
Description
asset
String
Name of the collateral asset to query prices

Response

Returns the UST price of the selected collateral asset.
1
{
2
"collateral_price_response": {
3
"asset": "uluna",
4
"rate": "123.456789",
5
"last_updated": 8
6
"multiplier": "2.0",
7
"is_revoked": false
8
}
9
}
Copied!
Key
Type
Description
asset
String
Name of the collateral asset to query prices
rate
Decimal
Current price of the collateral
last_updated
Decimal
Time when the asset price was last updated
multiplier
Decimal
Collateral ratio multiplied to min_collateral_ratio of the CDP being created by choosing this asset
is_revoked
bool
Check if the collateral is registered or revoked

CollateralAssetInfo

Returns the parameter of selected collateral.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum QueryMsg {
4
CollateralAssetInfo {
5
asset: String,
6
},
7
}
Copied!
Key
Type
Description
asset
String
Name of the collateral asset to query prices

Response

1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
pub struct CollateralInfoResponse {
3
pub asset: String,
4
pub multiplier: Decimal,
5
pub source_type: String,
6
pub is_revoked: bool,
7
}
Copied!
Key
Type
Description
asset
String
Name of the collateral asset to query prices
collateral_premium
Decimal
Collateral ratio added to min_collateral_ratio of the CDP being created by choosing this asset
source_type
WasmQuery
Queries the public API of another contract at a known address (with known ABI) return value is whatever the contract returns (caller should know)
is_revoked
bool
Check if the collateral is registered or revoked
1
{
2
"collateral_asset_info": {
3
"asset": "uluna"
4
}
5
}
Copied!
Key
Type
Description
asset
String
Name of the collateral asset to query prices

Response

1
{
2
"collateral_asset_info_response": {
3
"asset": "uluna",
4
"multiplier": "2.0",
5
"source_type": "WasmQuery",
6
"is_revoked": false
7
}
8
}
Copied!
Key
Type
Description
asset
String
Name of the collateral asset to query prices
multiplier
Decimal
Collateral ratio multiplied to min_collateral_ratio of the CDP being created by choosing this asset
source_type
String
Queries the public API of another contract at a known address (with known ABI) return value is whatever the contract returns (caller should know)
is_revoked
bool
Check if the collateral is registered or revoked

CollateralAssetInfos

Returns parameters for multiple collateral assets.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum QueryMsg {
4
CollateralAssetInfos {},
5
}
Copied!

Response

1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
pub struct CollateralInfosResponse {
3
pub collaterals: Vec<CollateralInfoResponse>,
4
}
Copied!
Key
Type
Description
collaterals
Vec<CollateralInfoResponse>
Array of CollateralInfoResponse
1
{
2
"collateral_asset_infos": {}
3
}
Copied!

Response

1
{
2
"collateral_infos_respose": {
3
"collaterals": [
4
[
5
"asset": "uluna",
6
"collateral_premium": "2.0",
7
"query_request": "WasmQuery",
8
"is_revoked": false
9
]
10
...
11
}
12
}
Copied!
Key
Type
Description
collaterals
Vec<CollateralInfoResponse>
Array of CollateralInfoResponse
Last modified 3mo ago