clp_feed_interface/
msg.rs1use cosmwasm_schema::{cw_serde, QueryResponses};
2use cosmwasm_std::{Addr, Timestamp};
3
4pub type AssetName = String;
5
6
7#[cw_serde]
8pub struct AssetInfo {
9 pub name: AssetName,
10 pub denom: String,
11 pub decimals: u8,
12}
13
14#[cw_serde]
15pub struct ValidatorInfo {
16 pub public_key: String,
17 pub active: bool,
18}
19
20#[cw_serde]
21pub struct PriceSubmission {
22 pub validator_id: String,
23 pub asset: String,
24 pub price: String,
25 pub timestamp: u64,
26 pub sources: Vec<String>,
27 pub signature: String,
28}
29
30#[cw_serde]
31pub struct AggregatedPrice {
32 pub asset: String,
33 pub price: String,
34 pub timestamp: Timestamp,
35 pub deviation: Option<String>,
36 pub submissions: Vec<PriceSubmission>,
37 pub feed_block_height: u64,
38 pub chain_block_height: Option<u64>,
39}
40
41#[cw_serde]
42pub struct InstantiateMsg {
43 pub admin: String,
45 pub validators: Vec<(String, String)>, pub operators: Vec<String>,
49 pub min_signatures: Option<u32>,
51 pub max_price_age: Option<u64>,
53 pub assets: Vec<AssetInfo>,
55}
56
57#[cw_serde]
58pub enum ExecuteMsg {
59 SubmitPrice {
61 aggregated_price: AggregatedPrice,
63 validator_submissions: Vec<PriceSubmission>,
66 },
67
68 AddValidator {
71 validator_id: String,
72 public_key: String,
73 },
74
75 RemoveValidator { validator_id: String },
77
78 UpdateValidatorStatus { validator_id: String, active: bool },
80
81 AddOperator { operator: String },
83
84 RemoveOperator { operator: String },
86
87 UpdateConfig {
89 min_signatures: Option<u32>,
90 max_price_age: Option<u64>,
91 },
92
93 UpdateDenoms {
95 add: Vec<AssetInfo>,
96 remove: Vec<String>,
97 },
98}
99
100#[cw_serde]
101#[derive(QueryResponses)]
102pub enum QueryMsg {
103 #[returns(AggregatedPriceResponse)]
105 GetPrice { asset: String },
106
107 #[returns(AggregatedPriceResponse)]
109 GetPriceByDenom { denom: String },
110
111 #[returns(AllPricesResponse)]
113 GetAllPrices {},
114
115 #[returns(ValidatorInfoResponse)]
117 GetValidator { validator_id: String },
118
119 #[returns(AllValidatorsResponse)]
121 GetAllValidators {},
122
123 #[returns(PriceSubmissionResponse)]
125 GetRecentSubmission { asset: String, validator_id: String },
126
127 #[returns(ConfigResponse)]
129 GetConfig {},
130
131 #[returns(AdminResponse)]
133 GetAdmin {},
134
135 #[returns(OperatorsResponse)]
137 GetOperators {},
138
139 #[returns(DenomExistsResponse)]
141 GetDenomExists { denom: String },
142}
143
144#[cw_serde]
149pub struct AggregatedPriceResponse {
150 pub price: Option<AggregatedPrice>,
151}
152
153#[cw_serde]
154pub struct AllPricesResponse {
155 pub prices: Vec<AggregatedPrice>,
156}
157
158#[cw_serde]
159pub struct ValidatorInfoResponse {
160 pub validator_id: String,
161 pub info: Option<ValidatorInfo>,
162}
163
164#[cw_serde]
165pub struct AllValidatorsResponse {
166 pub validators: Vec<(String, ValidatorInfo)>,
167}
168
169#[cw_serde]
170pub struct PriceSubmissionResponse {
171 pub submission: Option<PriceSubmission>,
172}
173
174#[cw_serde]
175pub struct ConfigResponse {
176 pub min_signatures: u32,
177 pub max_price_age: u64,
178}
179
180#[cw_serde]
181pub struct AdminResponse {
182 pub admin: Addr,
183}
184
185#[cw_serde]
186pub struct OperatorsResponse {
187 pub operators: Vec<Addr>,
188}
189
190#[cw_serde]
191pub struct DenomExistsResponse {
192 pub exists: bool,
193 pub asset: Option<AssetInfo>,
194}
195
196#[cw_serde]
197pub struct MigrateMsg {}