Oracle

Encapsulated the call to PythOracle.

Config

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct Config {
    pub owner: CanonicalAddr,
    pub pyth_contract: CanonicalAddr,
    pub new_owner: Option<CanonicalAddr>,
}
Key
Type
Description

owner

CanonicalAddr

The address of the contract's owner

pyth_contract

CanonicalAddr

The address of pyth oracle contract

new_owner*

CanonicalAddr

The address of the contract's new owner

* = optional

InitMsg

#[cw_serde]
pub struct InstantiateMsg {
    pub pyth_contract: String,
    pub owner: Addr,
}
Key
Type
Description

owner

string

The address of the contract's owner

pyth_contract

string

The address of pyth oracle contract

ExecuteMsg

ConfigFeedInfo

Set the relevant information for updating oracle.

Key
Type
Description

asset

string

The address of the asset

price_feed_id

string

The pyth price feed id

price_feed_symbol

string

The pyth price feed symbol

price_feed_decimal

u32

The pyth price feed decimal

check_feed_age

bool

Whether to check the age of the price feed

price_feed_age

u64

The maximum age of the price feed in seconds

ChangeOwner

Change the contract owner, only can issued by current owner.

Key
Type
Description

new_owner

string

The address of the new contract owner.

SetConfigFeedValid

Set whether the oracle is available, the default is available, the type is bool.

Key
Type
Description

asset

string

The address of the asset

valid

bool

Whether the oracle is available

ChangePythContract

Change the pyth contract address, only can issued by current owner.

Key
Type
Description

pyth_contract

String

The pyth contract address

QueryMsg

All query messages are described below. A custom struct is defined for each query response.

QueryPrice

Returns the price of the asset.

Key
Type
Description

asset

string

The address of the asset

PriceResponse

Key
Type
Description

asset

string

The address of the asset

emv_price

decimal

The emv price of the asset in the base currency

emv_price_raw

i64

The emv price of the asset in the base currency, multiplied by 10^8

price

decimal

The price of the asset in the quote currency

price_raw

i64

The price of the asset in the quote currency, multiplied by 10^8

last_updated_base

u64

The timestamp of the last update of the price of the asset in the base currency

last_updated_quote

u64

The timestamp of the last update of the price of the asset in the quote currency

QueryPrices

Returns the prices of the assets.

Key
Type
Description

assets

Vec<String>

The list of asset addresses

QueryConfig

Returns information about global config.

ConfigResponse

QueryPythFeederConfig

Returns the pyth feeder config.

Key
Type
Description

asset

string

The address of the asset

PythFeederConfigResponse

Key
Type
Description

price_feed_id

string

The price feed id

price_feed_symbol

string

The price feed symbol

price_feed_decimal

u32

The price feed decimal

price_feed_age

u64

The price feed age

check_feed_age

bool

Whether to check the price feed age

is_valid

bool

Whether the config is valid

QueryExchangeRateByAssetLabel

Returns the exchange rate of the asset label.

Key
Type
Description

base_label

String

The base label

quote_label

String

The quote label

Last updated