kujira_std/query.rs
1use cosmwasm_schema::cw_serde;
2use cosmwasm_std::{Addr, Binary, Coin, CustomQuery, Decimal};
3
4use crate::denom::Denom;
5
6/// KujiraQuery is an override of QueryRequest::Custom to access Terra-specific modules
7#[cw_serde]
8pub enum KujiraQuery {
9 Bank(BankQuery),
10 Denom(DenomQuery),
11 Oracle(OracleQuery),
12 Ica(IcaQuery),
13 Ibc(IbcVerifyQuery),
14}
15
16impl CustomQuery for KujiraQuery {}
17
18#[cw_serde]
19pub enum BankQuery {
20 Supply { denom: Denom },
21}
22
23/// This contains all queries that can be made to the denom module
24#[cw_serde]
25pub enum DenomQuery {
26 /// Given a subdenom minted by a contract via `DenomMsg::MintTokens`,
27 /// returns the full denom as used by `BankMsg::Send`.
28 FullDenom {
29 creator_addr: Addr,
30 subdenom: String,
31 },
32 /// Returns the admin of a denom, if the denom is a Token Factory denom.
33 DenomAdmin { subdenom: String },
34}
35
36/// This contains all queries that can be made to the oracle module
37#[cw_serde]
38pub enum OracleQuery {
39 // ExchangeRate will return the rate of this denom.
40 ExchangeRate { denom: String },
41 // ExchangeRates will return the exchange rate between offer denom and all supported asks
42 // ExchangeRates { offer: String },
43}
44
45/// This contains all queries that can be made to the cw-ica module
46#[cw_serde]
47pub enum IcaQuery {
48 // AccountAddress will return the address of the interchain account.
49 AccountAddress {
50 owner: Addr,
51 connection_id: String,
52 account_id: String,
53 },
54}
55
56/// This contains all queries that can be made to the IBC-verify module
57#[cw_serde]
58pub enum IbcVerifyQuery {
59 // VerifyMembership will verifies the membership of a merkle proof against the given connection, revision height, path, and value
60 VerifyMembership {
61 connection: String,
62 revision_number: u64,
63 revision_height: u64,
64 proof: Binary,
65 value: Binary,
66 path_prefix: String,
67 path_key: Binary,
68 },
69 // VerifyMembership will verifies the absence of a merkle proof against the given connection, revision height, and path
70 VerifyNonMembership {
71 connection: String,
72 revision_number: u64,
73 revision_height: u64,
74 proof: Binary,
75 path_prefix: String,
76 path_key: Binary,
77 },
78}
79
80/// ExchangeRateResponse is data format returned from OracleRequest::ExchangeRate query
81#[cw_serde]
82pub struct ExchangeRateResponse {
83 pub rate: Decimal,
84}
85
86#[cw_serde]
87pub struct SupplyResponse {
88 pub amount: Coin,
89}
90
91#[cw_serde]
92pub struct FullDenomResponse {
93 pub denom: Denom,
94}
95
96#[cw_serde]
97pub struct DenomAdminResponse {
98 pub admin: Addr,
99}
100
101/// AccountAddressResponse is data format returned from CwIcaRequest::AccountAddress query
102#[cw_serde]
103pub struct AccountAddressResponse {
104 pub address: String,
105}
106
107/// IbcVerifyResponse is data format returned from IbcRequest::VerifyMembership query
108#[cw_serde]
109pub struct IbcVerifyResponse {}