sei_cosmwasm/
proto_structs.rs

1use schemars::JsonSchema;
2use serde::{Deserialize, Serialize};
3
4use cosmwasm_std::{Decimal, Uint64};
5
6// ExchangeRateItem is data format returned from OracleRequest::ExchangeRates query
7#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
8pub struct OracleExchangeRate {
9    pub exchange_rate: Decimal,
10    pub last_update: Uint64,
11    pub last_update_timestamp: u64,
12}
13
14// ExchangeRateItem is data format returned from OracleRequest::ExchangeRates query
15#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
16pub struct DenomOracleExchangeRatePair {
17    pub denom: String,
18    pub oracle_exchange_rate: OracleExchangeRate,
19}
20
21#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
22pub struct OracleTwap {
23    pub denom: String,
24    pub twap: Decimal,
25    pub lookback_seconds: u64,
26}
27
28#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
29pub struct DexPair {
30    pub price_denom: String,
31    pub asset_denom: String,
32    pub price_tick_size: Decimal,
33    pub quantity_tick_size: Decimal,
34}
35
36#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
37pub struct DexTwap {
38    pub pair: DexPair,
39    pub twap: Decimal,
40    pub lookback_seconds: u64,
41}
42
43// Epoch is the struct that matches the data format of Epoch in Epoch Response
44#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
45pub struct Epoch {
46    pub genesis_time: String, // represented as ISO8601 UTC
47    pub duration: u64,        // Represented as nanos
48    pub current_epoch: u64,
49    pub current_epoch_start_time: String, // represented as ISO8601 UTC
50    pub current_epoch_height: i64,
51}