mirror_protocol/
oracle.rs1use schemars::JsonSchema;
2use serde::{Deserialize, Serialize};
3
4use crate::common::OrderBy;
5use cosmwasm_std::Decimal;
6
7#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
8pub struct InstantiateMsg {
9 pub owner: String,
10 pub base_asset: String,
11}
12
13#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
14#[serde(rename_all = "snake_case")]
15pub enum ExecuteMsg {
16 UpdateConfig {
17 owner: Option<String>,
18 },
19 RegisterAsset {
21 asset_token: String,
22 feeder: String,
23 },
24 FeedPrice {
25 prices: Vec<(String, Decimal)>,
26 },
27}
28
29#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
30#[serde(rename_all = "snake_case")]
31pub enum QueryMsg {
32 Config {},
33 Feeder {
34 asset_token: String,
35 },
36 Price {
37 base_asset: String,
38 quote_asset: String,
39 },
40 Prices {
41 start_after: Option<String>,
42 limit: Option<u32>,
43 order_by: Option<OrderBy>,
44 },
45}
46
47#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
49pub struct ConfigResponse {
50 pub owner: String,
51 pub base_asset: String,
52}
53
54#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
56pub struct FeederResponse {
57 pub asset_token: String,
58 pub feeder: String,
59}
60
61#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
63pub struct PriceResponse {
64 pub rate: Decimal,
65 pub last_updated_base: u64,
66 pub last_updated_quote: u64,
67}
68
69#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
71pub struct PricesResponseElem {
72 pub asset_token: String,
73 pub price: Decimal,
74 pub last_updated_time: u64,
75}
76
77#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
79pub struct PricesResponse {
80 pub prices: Vec<PricesResponseElem>,
81}
82
83#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
85pub struct MigrateMsg {}