cw_core/
query.rs

1use cosmwasm_std::{Addr, Uint128};
2use cw2::ContractVersion;
3use cw_utils::Expiration;
4use schemars::JsonSchema;
5use serde::{Deserialize, Serialize};
6
7use crate::state::Config;
8
9/// Relevant state for the governance module. Returned by the
10/// `DumpState` query.
11#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
12pub struct DumpStateResponse {
13    /// Optional DAO Admin
14    pub admin: Addr,
15    /// The governance contract's config.
16    pub config: Config,
17    // True if the contract is currently paused.
18    pub pause_info: PauseInfoResponse,
19    /// The governance contract's version.
20    pub version: ContractVersion,
21    /// The governance modules associated with the governance
22    /// contract.
23    pub proposal_modules: Vec<Addr>,
24    /// The voting module associated with the governance contract.
25    pub voting_module: Addr,
26}
27
28/// Information about if the contract is currently paused.
29#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
30pub enum PauseInfoResponse {
31    Paused { expiration: Expiration },
32    Unpaused {},
33}
34
35/// Returned by the `GetItem` query.
36#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
37pub struct GetItemResponse {
38    /// `None` if no item with the provided key was found, `Some`
39    /// otherwise.
40    pub item: Option<String>,
41}
42
43/// Returned by the `Cw20Balances` query.
44#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
45pub struct Cw20BalanceResponse {
46    /// The address of the token.
47    pub addr: Addr,
48    /// The contract's balance.
49    pub balance: Uint128,
50}
51
52/// Returned by the `AdminNomination` query.
53#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
54pub struct AdminNominationResponse {
55    /// The currently nominated admin or None if no nomination is
56    /// pending.
57    pub nomination: Option<Addr>,
58}