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