Oracle

Contract that holds price fetching information for assets

This contract queries Osmosis TWAP and Pyth network for prices. It has two paths for getting prices, either Pyth-only or Osmosis TWAP + Pyth's OSMO/USD. The latter option uses OSMO denominated TWAP prices that are then used later to produce USD(-par) prices && is necessary for bridged/wrapped tokens so the protocol can accurately price risk between variants (ex: Axelar USDC vs Wormhole USDC vs Noble native USDC). The Pyth OSMO/USD price is prioritized, if unavailable it medianizes the USD-par TWAP prices from Osmosis to denominate prices in. This means CDT, the Positions contract's debt token, flips betweem USD and USD-par (USDC initially) pegs depending on USD's price availability.

Notes:

  • When the final quote price of the pools_for_osmo_twap isn't uosmo, the oracle will attempt to use its own pricing info to convert said price into USD. Ex: milkTIA's quote in TIA will query the oracle for TIA's price to end with a USD price

InstantiateMsg

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct InstantiateMsg {
    pub owner: Option<String>,
    pub positions_contract: Option<String>,
    pub osmosis_proxy_contract: Option<String>,
    pub oracle_contract: Option<String>,
}

Key
Type
Description

*owner

String

Contract owner, defaults to info.sender

*positions_contract

String

Positions contract address

*osmosis_proxy_contract

String

Osmosis Proxy contract

*oracle_contract

String

Oracle contract

* = optional

ExecuteMsg

UpdateConfig

Updates contract configuration

Key
Type
Description

*owner

String

Contract owner

*positions_contract

String

Position's contract address

*osmosis_proxy_contract

String

Osmosis Proxy contract

*osmo_usd_pyth_feed_id

PriceIdentifier

OSMO/USD Pyth price feed id

*pyth_osmosis_address

String

Pyth Network's oracle contract address

*pools_for_usd_par_twap

TWAPPoolInfo

Osmosis pools for OSMO/USD-par TWAP

* = optional

AddAsset

Add Asset oracle information to the contract

Key
Type
Description

asset_info

AssetInfo

Asset info

oracle_info

AssetOracleInfo

Oracle info for added asset

EditAsset

Replace existing asset oracle info

Key
Type
Description

asset_info

AssetInfo

Asset info

*oracle_info

AssetOracleInfo

Asset oracle info

remove

bool

Toggle to remove asset

* = optional

QueryMsg

Config

Returns contract configuration

Price

Returns list of asset prices and average price

Key
Type
Description

asset_info

AssetInfo

Asset info

twap_timeframe

u64

TWAP timeframe (in days) for TWAP prices

oracle_time_limit

u64

Pyth Oracle time limit in seconds

*basket_id

Uint128

Basket_id to select oracle quote asset for CDT

* = optional

Prices

Returns list of PriceResponse for list of assets

Key
Type
Description

asset_info

Vec<AssetInfo>

Asset infos

twap_timeframe

u64

TWAP timeframe (in days) for TWAP prices

oracle_time_limit

u64

Pyth Oracle time limit in seconds

Assets

Returns list of oracle info for a list of assets

Key
Type
Description

asset_infos

Vec<AssetInfo>

List of Asset Info

Last updated