github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/dev/wasm/erc20/src/msg.rs (about) 1 use schemars::JsonSchema; 2 use serde::{Deserialize, Serialize}; 3 4 use cosmwasm_std::Uint128; 5 use cosmwasm_std::{CosmosMsg,CustomMsg}; 6 use schemars::gen::SchemaGenerator; 7 use schemars::schema::Schema; 8 9 #[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema)] 10 pub struct InitialBalance { 11 pub address: String, 12 pub amount: Uint128, 13 } 14 15 #[derive(Serialize, Deserialize, JsonSchema)] 16 pub struct InstantiateMsg { 17 pub name: String, 18 pub symbol: String, 19 pub decimals: u8, 20 pub initial_balances: Vec<InitialBalance>, 21 } 22 23 #[derive(Serialize, Deserialize, JsonSchema)] 24 #[serde(rename_all = "snake_case")] 25 pub enum ExecuteMsg { 26 Approve { 27 spender: String, 28 amount: Uint128, 29 }, 30 Transfer { 31 recipient: String, 32 amount: Uint128, 33 }, 34 TransferFrom { 35 owner: String, 36 recipient: String, 37 amount: Uint128, 38 }, 39 Burn { 40 amount: Uint128, 41 }, 42 MintCW20 { 43 recipient: String, 44 amount: Uint128, 45 }, 46 SendToEvm { 47 evmContract: String, 48 recipient: String, 49 amount: Uint128, 50 } 51 } 52 53 #[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)] 54 #[serde(rename_all = "snake_case")] 55 pub struct SendToEvmMsg { 56 pub sender: String, 57 pub contract: String, 58 pub recipient: String, 59 pub amount: Uint128, 60 61 } 62 impl Into<CosmosMsg<SendToEvmMsg>> for SendToEvmMsg { 63 fn into(self) -> CosmosMsg<SendToEvmMsg> { 64 CosmosMsg::Custom(self) 65 } 66 } 67 impl CustomMsg for SendToEvmMsg {} 68 69 #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] 70 #[serde(rename_all = "snake_case")] 71 pub enum QueryMsg { 72 Balance { address: String }, 73 Allowance { owner: String, spender: String }, 74 } 75 76 #[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema)] 77 pub struct BalanceResponse { 78 pub balance: Uint128, 79 } 80 81 #[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema)] 82 pub struct AllowanceResponse { 83 pub allowance: Uint128, 84 }