cw_core/state.rs
1use cw_utils::Expiration;
2use schemars::JsonSchema;
3use serde::{Deserialize, Serialize};
4
5use cosmwasm_std::{Addr, Empty};
6use cw_storage_plus::{Item, Map};
7
8#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
9pub struct Config {
10 /// The name of the contract.
11 pub name: String,
12 /// A description of the contract.
13 pub description: String,
14 /// An optional image URL for displaying alongside the contract.
15 pub image_url: Option<String>,
16
17 /// If true the contract will automatically add received cw20
18 /// tokens to its treasury.
19 pub automatically_add_cw20s: bool,
20 /// If true the contract will automatically add received cw721
21 /// tokens to its treasury.
22 pub automatically_add_cw721s: bool,
23}
24
25/// The admin of the contract. Typically a DAO. The contract admin may
26/// unilaterally execute messages on this contract.
27///
28/// In cases where no admin is wanted the admin should be set to the
29/// contract itself. This will happen by default if no admin is
30/// specified in `NominateAdmin` and instantiate messages.
31pub const ADMIN: Item<Addr> = Item::new("admin");
32
33/// A new admin that has been nominated by the current admin. The
34/// nominated admin must accept the proposal before becoming the admin
35/// themselves.
36///
37/// NOTE: If no admin is currently nominated this will not have a
38/// value set. To load this value, use
39/// `NOMINATED_ADMIN.may_load(deps.storage)`.
40pub const NOMINATED_ADMIN: Item<Addr> = Item::new("nominated_admin");
41
42pub const CONFIG: Item<Config> = Item::new("config");
43
44pub const PAUSED: Item<Expiration> = Item::new("paused");
45
46/// The voting module associated with this contract.
47pub const VOTING_MODULE: Item<Addr> = Item::new("voting_module");
48pub const PROPOSAL_MODULES: Map<Addr, Empty> = Map::new("proposal_modules");
49
50// General purpose KV store for DAO associated state.
51pub const ITEMS: Map<String, String> = Map::new("items");
52
53/// Set of cw20 tokens that have been registered with this contract's
54/// treasury.
55pub const CW20_LIST: Map<Addr, Empty> = Map::new("cw20s");
56/// Set of cw721 tokens that have been registered with this contract's
57/// treasury.
58pub const CW721_LIST: Map<Addr, Empty> = Map::new("cw721s");