Skip to main content
Version: 1.0

Queries

This contract accepts the following query msgs:

// This structure describes the query messages available in the contract.
pub enum QueryMsg {
/// Calculates a new TWAP with updated precision
#[returns(Vec<(AssetInfo, Uint256)>)]
Consult {
/// The asset for which to compute a new TWAP value
token: AssetInfo,
/// The amount of tokens for which to compute the token price
amount: Uint128,
},
/// Returns token TWAP value for given asset & height.
#[returns(Vec<(AssetInfo, Decimal256)>)]
TWAPAtHeight {
/// The asset for which to compute a new TWAP value
token: AssetInfo,
/// The amount of tokens for which to compute the token price
height: Uint64,
},
}

Consult

See original documentation

TWAPAtHeight

Returns token TWAP value for given height.

#[returns(Vec<(AssetInfo, Decimal256)>)]
TWAPAtHeight {
/// The asset for which to compute a new TWAP value
token: AssetInfo,
/// The amount of tokens for which to compute the token price
height: Uint64,
}

token: token for which we're getting its historical TWAP value. height: height, on which we receive TWAP.

returns

Vec(AssetInfo, Decimal256)

  • AssetInfo
  • Decimal256: TWAP value for returned asset