astro_satellite_package/
lib.rs

1use cosmwasm_schema::{cw_serde, QueryResponses};
2use cosmwasm_std::{Binary, CosmosMsg, CustomMsg, Empty};
3
4#[cw_serde]
5pub struct InstantiateMsg {
6    /// Address which is able to update contracts' parameters
7    pub owner: String,
8    /// ASTRO denom on the remote chain.
9    pub astro_denom: String,
10    /// Channel used to transfer Astro tokens
11    pub transfer_channel: String,
12    /// Controller contract hosted on the main chain.
13    pub main_controller: String,
14    /// Maker address on the main chain
15    pub main_maker: String,
16    /// when packet times out, measured on remote chain
17    pub timeout: u64,
18    /// Time in seconds after which the satellite considers itself lost
19    pub max_signal_outage: u64,
20    /// An address that can migrate the contract and change its config if the satellite is lost
21    pub emergency_owner: String,
22}
23
24#[cw_serde]
25pub struct UpdateConfigMsg {
26    pub astro_denom: Option<String>,
27    pub gov_channel: Option<String>,
28    pub main_controller_addr: Option<String>,
29    pub main_maker: Option<String>,
30    pub transfer_channel: Option<String>,
31    pub accept_new_connections: Option<bool>,
32    pub timeout: Option<u64>,
33    pub max_signal_outage: Option<u64>,
34    pub emergency_owner: Option<String>,
35}
36
37#[cw_serde]
38pub enum ExecuteMsg<M: CustomMsg = Empty> {
39    TransferAstro {},
40    UpdateConfig(UpdateConfigMsg),
41    CheckMessages(Vec<CosmosMsg<M>>),
42    ExecuteFromMultisig(Vec<CosmosMsg<M>>),
43    CheckMessagesPassed {},
44    /// Creates a request to change contract ownership
45    /// ## Executor
46    /// Only the current owner can execute this.
47    ProposeNewOwner {
48        /// The newly proposed owner
49        owner: String,
50        /// The validity period of the proposal to change the contract owner
51        expires_in: u64,
52    },
53    /// Removes a request to change contract ownership
54    /// ## Executor
55    /// Only the current owner can execute this
56    DropOwnershipProposal {},
57    /// Claims contract ownership
58    /// ## Executor
59    /// Only the newly proposed owner can execute this
60    ClaimOwnership {},
61    /// It sets the emergency owner as admin of the contract to migrate it if the satellite is lost
62    SetEmergencyOwnerAsAdmin {},
63}
64
65#[cw_serde]
66pub enum SatelliteMsg {
67    ExecuteProposal { id: u64, messages: Vec<CosmosMsg> },
68    Heartbeat {},
69}
70
71/// Status of a governance proposal.
72/// Imported from the astroport-governance crate to avoid dependency issues.
73#[cw_serde]
74pub enum ProposalStatus {
75    Active,
76    Passed,
77    Rejected,
78    InProgress,
79    Failed,
80    Executed,
81    Expired,
82}
83
84#[cw_serde]
85#[derive(QueryResponses)]
86pub enum QueryMsg {
87    #[returns(ProposalStatus)]
88    ProposalState { id: u64 },
89}
90
91/// This is a generic ICS acknowledgement format.
92/// Proto defined here: https://github.com/cosmos/cosmos-sdk/blob/v0.42.0/proto/ibc/core/channel/v1/channel.proto#L141-L147
93/// This is compatible with the JSON serialization
94#[cw_serde]
95pub enum IbcAckResult {
96    Ok(Binary),
97    Error(String),
98}