astroport_governance/emissions_controller/outpost.rs
1use astroport::incentives::InputSchedule;
2use cosmwasm_schema::{cw_serde, QueryResponses};
3use cosmwasm_std::Addr;
4
5use crate::assembly::ProposalVoteOption;
6use crate::emissions_controller::msg::VxAstroIbcMsg;
7use crate::voting_escrow::UpdateMarketingInfo;
8
9/// This structure describes the basic settings for creating a contract.
10#[cw_serde]
11pub struct OutpostInstantiateMsg {
12 /// Contract owner
13 pub owner: String,
14 /// ASTRO denom on the chain
15 pub astro_denom: String,
16 /// xASTRO denom
17 pub xastro_denom: String,
18 /// vxASTRO contract code id
19 pub vxastro_code_id: u64,
20 /// vxASTRO token marketing info
21 pub vxastro_marketing_info: UpdateMarketingInfo,
22 /// Astroport Factory contract
23 pub factory: String,
24 /// Emissions controller on the Hub
25 pub hub_emissions_controller: String,
26 /// Official ICS20 IBC channel from this outpost to the Hub
27 pub ics20_channel: String,
28}
29
30#[cw_serde]
31pub enum OutpostMsg {
32 /// SetEmissions is a permissionless endpoint that allows setting ASTRO emissions for the next epoch
33 /// from the Hub by leveraging IBC hooks.
34 SetEmissions {
35 schedules: Vec<(String, InputSchedule)>,
36 },
37 /// Same as SetEmissions but it allows using funds from contract balance (if available).
38 /// This endpoint can be called only by contract owner. It is meant to be used in case of
39 /// IBC hook wasn't triggered upon ics20 packet arrival, for example, if a chain doesn't support IBC hooks.
40 PermissionedSetEmissions {
41 schedules: Vec<(String, InputSchedule)>,
42 },
43 /// Allows using vxASTRO voting power to vote on general DAO proposals.
44 /// The contract requires a proposal with specific id to be registered via
45 /// a special permissionless IBC message.
46 CastVote {
47 /// Proposal id
48 proposal_id: u64,
49 /// Vote option
50 vote: ProposalVoteOption,
51 },
52 UpdateConfig {
53 /// Voting IBC wasm<>wasm channel
54 voting_ibc_channel: Option<String>,
55 /// Emissions controller on the Hub
56 hub_emissions_controller: Option<String>,
57 /// Official ICS20 IBC channel from this outpost to the Hub
58 ics20_channel: Option<String>,
59 },
60}
61
62/// This structure describes the query messages available in the contract.
63#[cw_serde]
64#[derive(QueryResponses)]
65pub enum QueryMsg {
66 /// Config returns the contract configuration
67 #[returns(Config)]
68 Config {},
69 /// QueryUserIbcStatus returns the status of the user's IBC request.
70 /// Whether they have a pending request or an error.
71 #[returns(UserIbcStatus)]
72 QueryUserIbcStatus { user: String },
73 /// QueryRegisteredProposals returns the list of registered proposals.
74 #[returns(Vec<RegisteredProposal>)]
75 QueryRegisteredProposals {
76 limit: Option<u8>,
77 start_after: Option<u64>,
78 },
79 /// QueryProposalVoters returns the list of voters for the proposal.
80 #[returns(Vec<String>)]
81 QueryProposalVoters {
82 proposal_id: u64,
83 limit: Option<u8>,
84 start_after: Option<String>,
85 },
86}
87
88/// Contains failed IBC along with the error message
89#[cw_serde]
90pub struct UserIbcError {
91 pub msg: VxAstroIbcMsg,
92 pub err: String,
93}
94
95/// Contains the pending IBC message or an error
96#[cw_serde]
97pub struct UserIbcStatus {
98 pub pending_msg: Option<VxAstroIbcMsg>,
99 pub error: Option<UserIbcError>,
100}
101
102/// General contract configuration
103#[cw_serde]
104pub struct Config {
105 /// Address that's allowed to change contract parameters
106 pub owner: Addr,
107 /// vxASTRO contract address
108 pub vxastro: Addr,
109 /// ASTRO denom on the chain
110 pub astro_denom: String,
111 /// Astroport Factory contract
112 pub factory: Addr,
113 /// The Astroport Incentives contract
114 pub incentives_addr: Addr,
115 /// vxASTRO IBC channel
116 pub voting_ibc_channel: String,
117 /// Emissions controller on the Hub
118 pub hub_emissions_controller: String,
119 /// ICS20 IBC channel from this outpost to the Hub
120 pub ics20_channel: String,
121}
122
123/// Contains the proposal id and the start time.
124/// Used exclusively in query response.
125#[cw_serde]
126pub struct RegisteredProposal {
127 pub id: u64,
128 pub start_time: u64,
129}