tg_bindings/
gov.rs

1use schemars::JsonSchema;
2use serde::{Deserialize, Serialize};
3
4use cosmwasm_std::{Binary, Coin};
5
6#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, JsonSchema, Debug)]
7#[serde(rename_all = "snake_case")]
8pub enum GovProposal {
9    /// Signaling proposal, the text and description field will be recorded
10    Text {},
11    /// Register an "live upgrade" on the x/upgrade module
12    /// See https://github.com/cosmos/cosmos-sdk/blob/v0.42.3/proto/cosmos/upgrade/v1beta1/upgrade.proto#L12-L53
13    RegisterUpgrade {
14        /// Sets the name for the upgrade. This name will be used by the upgraded
15        /// version of the software to apply any special "on-upgrade" commands during
16        /// the first BeginBlock method after the upgrade is applied.
17        name: String,
18        /// The height at which the upgrade must be performed.
19        /// (Time-based upgrades are not supported due to instability)
20        height: u64,
21        /// Any application specific upgrade info to be included on-chain
22        /// such as a git commit that validators could automatically upgrade to
23        info: String,
24    },
25    /// There can only be one pending upgrade at a given time. This cancels the pending upgrade, if any.
26    /// See https://github.com/cosmos/cosmos-sdk/blob/v0.42.3/proto/cosmos/upgrade/v1beta1/upgrade.proto#L57-L62
27    CancelUpgrade {},
28    /// Defines a proposal to change one or more parameters.
29    /// See https://github.com/cosmos/cosmos-sdk/blob/v0.42.3/proto/cosmos/params/v1beta1/params.proto#L9-L27
30    ChangeParams(Vec<ParamChange>),
31    /// Updates the matching client to set a new trusted header.
32    /// This can be used by governance to restore a client that has timed out or forked or otherwise broken.
33    /// See https://github.com/cosmos/cosmos-sdk/blob/v0.42.3/proto/ibc/core/client/v1/client.proto#L36-L49
34    IbcClientUpdate { client_id: String, header: ProtoAny },
35
36    /// See https://github.com/confio/tgrade/blob/privileged_contracts_5/proto/confio/twasm/v1beta1/proposal.proto
37    PromoteToPrivilegedContract { contract: String },
38    /// See https://github.com/confio/tgrade/blob/privileged_contracts_5/proto/confio/twasm/v1beta1/proposal.proto
39    DemotePrivilegedContract { contract: String },
40
41    /// See https://github.com/CosmWasm/wasmd/blob/master/proto/cosmwasm/wasm/v1beta1/proposal.proto#L32-L54
42    InstantiateContract {
43        /// the address that is passed to the contract's environment as sender
44        run_as: String,
45        /// Admin is an optional address that can execute migrations
46        admin: String,
47        /// the reference to the stored WASM code
48        code_id: u64,
49        /// metadata to be stored with a contract instance.
50        label: String,
51        /// json encoded message to be passed to the contract on instantiation
52        init_msg: Binary,
53        /// coins that are transferred to the contract on instantiation
54        funds: Vec<Coin>,
55    },
56    /// See https://github.com/CosmWasm/wasmd/blob/master/proto/cosmwasm/wasm/v1beta1/proposal.proto#L56-L70
57    MigrateContract {
58        /// the address that is passed to the contract's environment as sender
59        run_as: String,
60        /// the contract address to be migrated
61        contract: String,
62        /// a reference to the new WASM code that it should be migrated to
63        code_id: u64,
64        /// json encoded message to be passed to the new WASM code to perform the migration
65        migrate_msg: Binary,
66    },
67    /// See https://github.com/CosmWasm/wasmd/blob/master/proto/cosmwasm/wasm/v1beta1/proposal.proto#L72-L82
68    SetContractAdmin {
69        /// the contract address to be updated
70        contract: String,
71        /// the account address to become admin of this contract
72        new_admin: String,
73    },
74    /// See https://github.com/CosmWasm/wasmd/blob/master/proto/cosmwasm/wasm/v1beta1/proposal.proto#L84-L93
75    ClearContractAdmin {
76        /// the contract address to be cleared
77        contract: String,
78    },
79    /// See https://github.com/CosmWasm/wasmd/blob/master/proto/cosmwasm/wasm/v1beta1/proposal.proto#L95-L107
80    PinCodes {
81        /// all code ideas that should be pinned in cache for high performance
82        code_ids: Vec<u64>,
83    },
84    /// See https://github.com/CosmWasm/wasmd/blob/master/proto/cosmwasm/wasm/v1beta1/proposal.proto#L109-L121
85    UnpinCodes {
86        /// all code ideas that should be removed from cache to free space
87        code_ids: Vec<u64>,
88    },
89}
90
91/// ParamChange defines an individual parameter change, for use in ParameterChangeProposal.
92#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, PartialOrd, Ord, JsonSchema, Debug)]
93pub struct ParamChange {
94    pub subspace: String,
95    pub key: String,
96    pub value: String,
97}
98
99#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, JsonSchema, Debug)]
100pub struct ProtoAny {
101    type_url: String,
102    value: Binary,
103}