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

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct InitMsg {
    pub owner: HumanAddr,
    pub mint_contract: HumanAddr,
    pub base_denom: String,
    pub mirror_oracle: HumanAddr,
    pub anchor_oracle: HumanAddr,
    pub band_oracle: HumanAddr,
}
KeyTypeDescription

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.

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum HandleMsg {
    UpdateConfig {
        owner: Option<HumanAddr>,
        mint_contract: Option<HumanAddr>,
        base_denom: Option<String>,
        mirror_oracle: Option<HumanAddr>,
        anchor_oracle: Option<HumanAddr>,
        band_oracle: Option<HumanAddr>,
    },
}
KeyTypeDescription

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.

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum HandleMsg {
    RegisterCollateralAsset {
        asset: AssetInfo,
        price_source: SourceType,
        multiplier: Decimal,
    },
}
KeyTypeDescription

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

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum SourceType {
    TerraOracle {
        terra_oracle_query: Binary,
    },
    BandOracle {
        band_oracle_query: Binary,
    },
    FixedPrice {
        price: Decimal,
    },
    Terraswap {
        terraswap_query: Binary,
        intermediate_denom: Option<String>,
    },
    AnchorMarket {
        anchor_market_query: Binary,
    },
    Native {
        native_denom: String,
    },
} 
KeyTypeDescription

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.

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum HandleMsg {
    RevokeCollateralAsset {
        asset: AssetInfo,
    },
}
KeyTypeDescription

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.

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum HandleMsg {
    UpdateCollateralPriceSource {
        asset: AssetInfo,
        price_source: SourceType,
    },
}
KeyTypeDescription

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.

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]    
pub enum HandleMsg {
    UpdateCollateralPremium {
        asset: AssetInfo,
        multiplier: Decimal,
    },
}
KeyTypeDescription

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.

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
    pub enum QueryMsg {
        Config {},
}

Response

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct ConfigResponse {
    pub owner: HumanAddr,
    pub mint_contract: HumanAddr,
    pub base_denom: String,
    pub mirror_oracle: HumanAddr,
    pub anchor_oracle: HumanAddr, 
    pub band_oracle: HumanAddr,
}
KeyTypeDescription

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.

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
    CollateralPrice {
        asset: String,
    },
}
KeyTypeDescription

asset

String

Name of the collateral asset to query prices

Response

Returns the UST price of the selected collateral asset.

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct CollateralPriceResponse {
    pub asset: String,
    pub rate: Decimal,
    pub last_updated: u64
    pub multiplier: Decimal,
    pub is_revoked: bool,
}
KeyTypeDescription

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

CollateralAssetInfo

Returns the parameter of selected collateral.

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
    CollateralAssetInfo {
        asset: String,
    },
}
KeyTypeDescription

asset

String

Name of the collateral asset to query prices

Response

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct CollateralInfoResponse {
    pub asset: String,
    pub multiplier: Decimal,
    pub source_type: String,
    pub is_revoked: bool,
}
KeyTypeDescription

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

CollateralAssetInfos

Returns parameters for multiple collateral assets.

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
    CollateralAssetInfos {},
}

Response

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct CollateralInfosResponse {
    pub collaterals: Vec<CollateralInfoResponse>,
}
KeyTypeDescription

collaterals

Vec<CollateralInfoResponse>

Array of CollateralInfoResponse

Last updated