-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmsg.rs
56 lines (49 loc) · 1.24 KB
/
msg.rs
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
use cosmwasm_schema::{cw_serde, QueryResponses};
use cosmwasm_std::{Addr, BlockInfo, Decimal256, Timestamp};
#[cw_serde]
pub struct InstantiateMsg {
/// the owner of the contract who can execute value changes
/// if not set, then it will be the instantiator
pub owner: Option<String>,
}
#[cw_serde]
pub enum ExecuteMsg {
/// Change the owner
SetOwner {
/// The owner address
owner: String,
},
/// Set the price
SetPrice {
/// The new price value
value: Decimal256,
/// Optional timestamp for the price, independent of block time
timestamp: Option<Timestamp>,
},
}
#[cw_serde]
#[derive(QueryResponses)]
pub enum QueryMsg {
/// Get the current price
#[returns(Price)]
Price {},
/// Get the owner
#[returns(OwnerResp)]
Owner {},
}
#[cw_serde]
pub struct MigrateMsg {}
#[cw_serde]
pub struct OwnerResp {
/// The owner address
pub owner: Addr,
}
#[cw_serde]
pub struct Price {
/// The price value set via `ExecuteMsg::SetPrice`
pub value: Decimal256,
/// The block info when this price was set
pub block_info: BlockInfo,
/// Optional timestamp for the price, independent of block_info.time
pub timestamp: Option<Timestamp>,
}