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
86
87
88
89
90
91
use cosmwasm_schema::{cw_serde, QueryResponses};
use cosmwasm_std::{Binary, Uint128};
/// This structure describes the parameters used for creating a contract.
#[cw_serde]
pub struct InstantiateMsg {
/// The ASTRO token contract address
pub deposit_token_denom: String,
/// Tracking contract admin
pub tracking_admin: String,
/// The Code ID of contract used to track the TokenFactory token balances
pub tracking_code_id: u64,
/// Token factory module address. Contract creator must ensure that the address is exact token factory module address.
pub token_factory_addr: String,
}
/// This structure describes the execute messages available in the contract.
#[cw_serde]
pub enum ExecuteMsg {
/// Deposits ASTRO in exchange for xASTRO
/// The receiver is optional. If not set, the sender will receive the xASTRO.
Enter { receiver: Option<String> },
/// Deposits ASTRO in exchange for xASTRO
/// and passes **all resulting xASTRO** to defined contract along with an executable message.
EnterWithHook {
contract_address: String,
msg: Binary,
},
/// Burns xASTRO in exchange for ASTRO.
/// The receiver is optional. If not set, the sender will receive the ASTRO.
Leave { receiver: Option<String> },
}
/// This structure describes the query messages available in the contract.
#[cw_serde]
#[derive(QueryResponses)]
pub enum QueryMsg {
/// Config returns the contract configuration specified in a custom [`Config`] structure
#[returns(Config)]
Config {},
/// Returns xASTRO total supply. Duplicates TotalSupplyAt { timestamp: None } logic but kept for backward compatibility.
#[returns(Uint128)]
TotalShares {},
/// Returns total ASTRO staked in the contract
#[returns(Uint128)]
TotalDeposit {},
#[returns(TrackerData)]
TrackerConfig {},
/// BalanceAt returns xASTRO balance of the given address at at the given timestamp.
/// Returns current balance if timestamp unset.
#[returns(Uint128)]
BalanceAt {
address: String,
timestamp: Option<u64>,
},
/// TotalSupplyAt returns xASTRO total token supply at the given timestamp.
/// Returns current total supply if timestamp unset.
#[returns(Uint128)]
TotalSupplyAt { timestamp: Option<u64> },
}
/// This structure stores the main parameters for the staking contract.
#[cw_serde]
pub struct Config {
/// The ASTRO token denom
pub astro_denom: String,
/// The xASTRO token denom
pub xastro_denom: String,
}
/// This structure stores the tracking contract data.
#[cw_serde]
pub struct TrackerData {
/// Tracking contract code id
pub code_id: u64,
/// Tracking contract admin
pub admin: String,
/// Token factory module address
pub token_factory_addr: String,
/// Tracker contract address
pub tracker_addr: String,
}
/// The structure returned as part of set_data when staking or unstaking
#[cw_serde]
pub struct StakingResponse {
/// The ASTRO denom
pub astro_amount: Uint128,
/// The xASTRO denom
pub xastro_amount: Uint128,
}