simple_nft/
state.rs

1//! Defines the state and tokeninfo structs
2
3use crate::msg::Approval;
4use cw721::Expiration;
5use schemars::JsonSchema;
6use serde::{Deserialize, Serialize};
7
8use cosmwasm_std::{Addr, Coin};
9use cw_storage_plus::{Item, Map};
10
11#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
12pub struct State {
13    pub name: String,
14    pub symbol: String,
15    pub minter: Addr,
16    pub num_tokens: u64,
17}
18
19#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
20pub struct TokenInfo {
21    /// Owner of the new token
22    pub owner: Addr,
23    /// Approvals to third-party to perform actions on this token
24    pub approvals: Vec<Approval>,
25    /// Base price of this token
26    pub base_price: Vec<Coin>,
27    /// URI of NFT according to ERC 721 Metadata Schema
28    pub token_uri: Option<String>,
29    /// Unique token_id
30    pub token_id: u64,
31}
32
33pub const CONFIG: Item<State> = Item::new("config");
34pub const TOKENS: Map<u64, TokenInfo> = Map::new("tokens");
35pub const OPERATORS: Map<(&Addr, &Addr), Expiration> = Map::new("approvals");