wormhole/terra/contracts/cw721-wrapped/src/msg.rs

129 lines
3.9 KiB
Rust

pub use cw721_base::MintMsg;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use cosmwasm_std::{Addr, Binary, Empty};
pub use cw721_base::msg::ExecuteMsg;
type HumanAddr = String;
/// The cw721_base crate allows an extension point which we don't care about
pub type NoExt = Option<Empty>;
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct InstantiateMsg {
/// Name of the NFT contract
pub name: String,
/// Symbol of the NFT contract
pub symbol: String,
/// Native chain of the NFT
pub asset_chain: u16,
/// Native address of the NFT
pub asset_address: Binary,
/// The minter is the only one who can create new NFTs.
/// This is designed for a base NFT that is controlled by an external program
/// or contract. You will likely replace this with custom logic in custom NFTs
pub minter: String,
/// Mint a new NFT upon creation
pub mint: Option<MintMsg<NoExt>>,
/// Generic callback - used to register the newly instantiated asset
pub init_hook: Option<InitHook>,
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct InitHook {
pub msg: Binary,
pub contract_addr: HumanAddr,
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
/// Generic information about the wrapped asset
WrappedAssetInfo {},
/// Return the owner of the given token, error if token does not exist
/// Return type: OwnerOfResponse
OwnerOf {
token_id: String,
/// unset or false will filter out expired approvals, you must set to true to see them
include_expired: Option<bool>,
},
/// Return operator that can access all of the owner's tokens.
/// Return type: `ApprovalResponse`
Approval {
token_id: String,
spender: String,
include_expired: Option<bool>,
},
/// Return approvals that a token has
/// Return type: `ApprovalsResponse`
Approvals {
token_id: String,
include_expired: Option<bool>,
},
/// List all operators that can access all of the owner's tokens
/// Return type: `OperatorsResponse`
AllOperators {
owner: String,
/// unset or false will filter out expired items, you must set to true to see them
include_expired: Option<bool>,
start_after: Option<String>,
limit: Option<u32>,
},
/// Total number of tokens issued
NumTokens {},
/// With MetaData Extension.
/// Returns top-level metadata about the contract: `ContractInfoResponse`
ContractInfo {},
/// Returns metadata about one particular token, based on *ERC721 Metadata JSON Schema*
/// but directly from the contract: `NftInfoResponse`
NftInfo {
token_id: String,
},
/// Returns the result of both `NftInfo` and `OwnerOf` as one query as an optimization
/// for clients: `AllNftInfo`
AllNftInfo {
token_id: String,
/// unset or false will filter out expired approvals, you must set to true to see them
include_expired: Option<bool>,
},
/// Returns all tokens owned by the given address, [] if unset.
/// Return type: TokensResponse.
Tokens {
owner: String,
start_after: Option<String>,
limit: Option<u32>,
},
/// Requires pagination. Lists all token_ids controlled by the contract.
/// Return type: TokensResponse.
AllTokens {
start_after: Option<String>,
limit: Option<u32>,
},
// Return the minter
Minter {},
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct WrappedAssetInfoResponse {
pub asset_chain: u16, // Asset chain id
pub asset_address: Binary, // Asset smart contract address in the original chain
pub bridge: Addr, // Bridge address, authorized to mint and burn wrapped tokens
}