neutron_sdk/bindings/msg.rs
1use crate::{
2 bindings::types::{KVKey, ProtobufAny},
3 interchain_queries::types::{QueryPayload, QueryType, TransactionFilterItem, MAX_TX_FILTERS},
4 sudo::msg::RequestPacketTimeoutHeight,
5 NeutronError, NeutronResult,
6};
7
8use crate::bindings::dex::msg::DexMsg;
9use cosmwasm_std::{Binary, Coin, CosmosMsg, CustomMsg, DenomUnit, StdError, Uint128};
10use schemars::JsonSchema;
11use serde::{Deserialize, Serialize};
12use serde_json_wasm::to_string;
13
14#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
15/// IbcFee defines struct for fees that refund the relayer for `SudoMsg` messages submission.
16/// Unused fee kind will be returned back to message sender.
17/// Please refer to these links for more information:
18/// IBC transaction structure - <https://docs.neutron.org/neutron/interchain-txs/messages/#msgsubmittx>
19/// General mechanics of fee payments - <https://docs.neutron.org/neutron/feerefunder/overview/#general-mechanics>
20pub struct IbcFee {
21 /// **recv_fee** currently is used for compatibility with ICS-29 interface only and must be set to zero (i.e. 0untrn),
22 /// because Neutron's fee module can't refund relayer for submission of Recv IBC packets due to compatibility with target chains.
23 pub recv_fee: Vec<Coin>,
24 /// **ack_fee** is an amount of coins to refund relayer for submitting ack message for a particular IBC packet.
25 pub ack_fee: Vec<Coin>,
26 /// **timeout_fee** amount of coins to refund relayer for submitting timeout message for a particular IBC packet.
27 pub timeout_fee: Vec<Coin>,
28}
29
30#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
31#[serde(rename_all = "snake_case")]
32/// A number of Custom messages that can call into the Neutron bindings.
33pub enum NeutronMsg {
34 /// RegisterInterchainAccount registers an interchain account on remote chain.
35 RegisterInterchainAccount {
36 /// **connection_id** is an IBC connection identifier between Neutron and remote chain.
37 connection_id: String,
38
39 /// **interchain_account_id** is an identifier of your new interchain account. Can be any string.
40 /// This identifier allows contracts to have multiple interchain accounts on remote chains.
41 interchain_account_id: String,
42
43 /// **register_fee** is a fees required to be payed to register interchain account
44 register_fee: Option<Vec<Coin>>,
45 },
46
47 /// SubmitTx starts the process of executing any Cosmos-SDK *msgs* on remote chain.
48 SubmitTx {
49 /// **connection_id** is an IBC connection identifier between Neutron and remote chain.
50 connection_id: String,
51
52 /// **interchain_account_id** is an identifier of your interchain account from which you want to execute msgs.
53 interchain_account_id: String,
54
55 /// **msgs** is a list of protobuf encoded Cosmos-SDK messages you want to execute on remote chain.
56 msgs: Vec<ProtobufAny>,
57
58 /// **memo** is a memo you want to attach to your interchain transaction.It behaves like a memo in usual Cosmos transaction.
59 memo: String,
60
61 /// **timeout** is a timeout in seconds after which the packet times out.
62 timeout: u64,
63
64 /// ***fee** is an ibc fee for the transaction.
65 fee: IbcFee,
66 },
67
68 /// RegisterInterchainQuery registers an interchain query.
69 RegisterInterchainQuery {
70 /// **query_type** is a query type identifier ('tx' or 'kv' for now).
71 query_type: String,
72
73 /// **keys** is the KV-storage keys for which we want to get values from remote chain.
74 keys: Vec<KVKey>,
75
76 /// **transactions_filter** is the filter for transaction search ICQ.
77 transactions_filter: String,
78
79 /// **connection_id** is an IBC connection identifier between Neutron and remote chain.
80 connection_id: String,
81
82 /// **update_period** is used to say how often the query must be updated.
83 update_period: u64,
84 },
85
86 /// RegisterInterchainQuery updates an interchain query.
87 UpdateInterchainQuery {
88 /// **query_id** is the ID of the query we want to update.
89 query_id: u64,
90
91 /// **new_keys** is the new query keys to retrive.
92 new_keys: Option<Vec<KVKey>>,
93
94 /// **new_update_period** is a new update period of the query.
95 new_update_period: Option<u64>,
96
97 /// **new_transactions_filter** is a new transactions filter of the query.
98 new_transactions_filter: Option<String>,
99 },
100
101 /// RemoveInterchainQuery removes as interchain query.
102 RemoveInterchainQuery {
103 /// **query_id** is ID of the query we want to remove.
104 query_id: u64,
105 },
106 /// IbcTransfer sends a fungible token packet over IBC.
107 IbcTransfer {
108 // the port on which the packet will be sent
109 source_port: String,
110 // the channel by which the packet will be sent
111 source_channel: String,
112 // the tokens to be transferred
113 token: Coin,
114 // the sender address
115 sender: String,
116 // the recipient address on the destination chain
117 receiver: String,
118 // Timeout height relative to the current block height.
119 // The timeout is disabled when set to 0.
120 timeout_height: RequestPacketTimeoutHeight,
121 // Timeout timestamp in absolute nanoseconds since unix epoch.
122 // The timeout is disabled when set to 0.
123 timeout_timestamp: u64,
124 // Memo to be sent along with transaction.
125 memo: String,
126 // Fees to refund relayer for different kinds of `SudoMsg` transmission
127 // Unused fee types will be returned to msg sender.
128 fee: IbcFee,
129 },
130 /// SubmitAdminProposal sends a proposal to neutron's Admin module.
131 /// This type of messages can be only executed by Neutron DAO.
132 SubmitAdminProposal { admin_proposal: AdminProposal },
133
134 /// TokenFactory message.
135 /// Contracts can create denoms, namespaced under the contract's address.
136 /// A contract may create any number of independent sub-denoms.
137 CreateDenom { subdenom: String },
138
139 /// TokenFactory message.
140 /// Contracts can change the admin of a denom that they are the admin of.
141 ChangeAdmin {
142 denom: String,
143 new_admin_address: String,
144 },
145
146 /// TokenFactory message.
147 /// Contracts can mint native tokens for an existing factory denom
148 /// that they are the admin of.
149 MintTokens {
150 denom: String,
151 amount: Uint128,
152 mint_to_address: String,
153 },
154
155 /// TokenFactory message.
156 /// Contracts can burn native tokens for an existing factory denom
157 /// that they are the admin of.
158 /// Currently, the burn from address must be the admin contract.
159 BurnTokens {
160 denom: String,
161 amount: Uint128,
162 /// Must be set to `""` for now
163 burn_from_address: String,
164 },
165
166 /// TokenFactory message.
167 /// Contracts can set before send hooks for denoms, namespaced under the contract's address.
168 SetBeforeSendHook {
169 denom: String,
170 contract_addr: String,
171 },
172
173 /// TokenFactoryMessage
174 /// Contracts can force specified `amount` of an existing factory denom
175 /// that they are admin of to a `transfer_to_address` from a `transfer_from_address`.
176 ForceTransfer {
177 denom: String,
178 amount: Uint128,
179 transfer_from_address: String,
180 transfer_to_address: String,
181 },
182
183 /// TokenFactoryMessage
184 /// Contracts can set a metadata for of an existing factory denom
185 /// that they are admin of.
186 SetDenomMetadata {
187 /// **description** description of a token
188 description: String,
189 /// **denom_units** represents the list of DenomUnit's for a given coin
190 denom_units: Vec<DenomUnit>,
191 /// **base** represents the base denom (should be the DenomUnit with exponent = 0).
192 base: String,
193 /// **display** indicates the suggested denom that should be
194 /// displayed in clients.
195 display: String,
196 /// **name** defines the name of the token (eg: Cosmos Atom)
197 name: String,
198 /// **symbol** is the token symbol usually shown on exchanges (eg: ATOM). This can
199 /// be the same as the display.
200 symbol: String,
201 /// **uri** to a document (on or off-chain) that contains additional information. Optional.
202 uri: String,
203 /// **uri_hash** is a sha256 hash of a document pointed by URI. It's used to verify that
204 /// the document didn't change. Optional.
205 uri_hash: String,
206 },
207
208 /// AddSchedule adds new schedule with a given `name`.
209 /// Until schedule is removed it will execute all `msgs` every `period` blocks.
210 /// First execution is at least on `current_block + period` block.
211 /// [Permissioned - DAO Only]
212 AddSchedule {
213 /// Name of a new schedule.
214 /// Needed to be able to `RemoveSchedule` and to log information about it
215 name: String,
216 /// period in blocks with which `msgs` will be executed
217 period: u64,
218 /// list of cosmwasm messages to be executed
219 msgs: Vec<MsgExecuteContract>,
220 },
221
222 /// RemoveSchedule removes the schedule with a given `name`.
223 /// [Permissioned - DAO or Security DAO only]
224 RemoveSchedule { name: String },
225
226 /// Contractmanager message
227 /// Resubmits failed acknowledgement.
228 /// Acknowledgement failure is created when contract returns error or acknowledgement is out of gas.
229 /// [Permissioned - only from contract that is initial caller of IBC transaction]
230 ResubmitFailure { failure_id: u64 },
231
232 /// Dex messages
233 Dex(DexMsg),
234}
235
236impl NeutronMsg {
237 /// Basic helper to define a register interchain account message:
238 /// * **connection_id** is an IBC connection identifier between Neutron and remote chain;
239 /// * **interchain_account_id** is an identifier of your new interchain account. Can be any string.
240 pub fn register_interchain_account(
241 connection_id: String,
242 interchain_account_id: String,
243 register_fee: Option<Vec<Coin>>,
244 ) -> Self {
245 NeutronMsg::RegisterInterchainAccount {
246 connection_id,
247 interchain_account_id,
248 register_fee,
249 }
250 }
251
252 /// Basic helper to define a submit tx message:
253 /// * **connection_id** is an IBC connection identifier between Neutron and remote chain;
254 /// * **interchain_account_id** is an identifier of your interchain account from which you want to execute msgs;
255 /// * **msgs** is a list of protobuf encoded Cosmos-SDK messages you want to execute on remote chain;
256 /// * **memo** is a memo you want to attach to your interchain transaction. It behaves like a memo in usual Cosmos transaction;
257 /// * **timeout** is a timeout in seconds after which the packet times out.
258 /// * **fee** is a fee that is used for different kinds of callbacks. Unused fee types will be returned to msg sender.
259 pub fn submit_tx(
260 connection_id: String,
261 interchain_account_id: String,
262 msgs: Vec<ProtobufAny>,
263 memo: String,
264 timeout: u64,
265 fee: IbcFee,
266 ) -> Self {
267 NeutronMsg::SubmitTx {
268 connection_id,
269 interchain_account_id,
270 msgs,
271 memo,
272 timeout,
273 fee,
274 }
275 }
276
277 /// Basic helper to define a register interchain query message:
278 /// * **query** is a query type identifier ('tx' or 'kv' for now) with a payload:
279 /// - when the query enum is 'kv' then payload is the KV-storage keys for which we want to get
280 /// values from remote chain;
281 /// - when the query enum is 'tx' then payload is the filters for transaction search ICQ,
282 /// maximum allowed number of filters is 32.
283 /// * **connection_id** is an IBC connection identifier between Neutron and remote chain;
284 /// * **update_period** is used to say how often (in neutron blocks) the query must be updated.
285 pub fn register_interchain_query(
286 query: QueryPayload,
287 connection_id: String,
288 update_period: u64,
289 ) -> NeutronResult<Self> {
290 Ok(match query {
291 QueryPayload::KV(keys) => NeutronMsg::RegisterInterchainQuery {
292 query_type: QueryType::KV.into(),
293 keys,
294 transactions_filter: String::new(),
295 connection_id,
296 update_period,
297 },
298 QueryPayload::TX(transactions_filters) => {
299 if transactions_filters.len() > MAX_TX_FILTERS {
300 return Err(NeutronError::TooManyTransactionFilters {
301 max: MAX_TX_FILTERS,
302 });
303 } else {
304 NeutronMsg::RegisterInterchainQuery {
305 query_type: QueryType::TX.into(),
306 keys: vec![],
307 transactions_filter: to_string(&transactions_filters)
308 .map_err(|e| StdError::generic_err(e.to_string()))?,
309 connection_id,
310 update_period,
311 }
312 }
313 }
314 })
315 }
316
317 /// Basic helper to define a update interchain query message:
318 /// * **query_id** is ID of the query we want to update;
319 /// * **new_keys** is encoded keys to query;
320 /// * **new_update_period** is used to say how often (in neutron blocks) the query must be updated.
321 pub fn update_interchain_query(
322 query_id: u64,
323 new_keys: Option<Vec<KVKey>>,
324 new_update_period: Option<u64>,
325 new_transactions_filter: Option<Vec<TransactionFilterItem>>,
326 ) -> NeutronResult<Self> {
327 Ok(NeutronMsg::UpdateInterchainQuery {
328 query_id,
329 new_keys,
330 new_update_period,
331 new_transactions_filter: match new_transactions_filter {
332 Some(filters) => {
333 if filters.len() > MAX_TX_FILTERS {
334 return Err(NeutronError::TooManyTransactionFilters {
335 max: MAX_TX_FILTERS,
336 });
337 } else {
338 Some(
339 to_string(&filters)
340 .map_err(|e| StdError::generic_err(e.to_string()))?,
341 )
342 }
343 }
344 None => None,
345 },
346 })
347 }
348
349 /// Basic helper to define a remove interchain query message:
350 /// * **query_id** is ID of the query we want to remove.
351 pub fn remove_interchain_query(query_id: u64) -> Self {
352 NeutronMsg::RemoveInterchainQuery { query_id }
353 }
354
355 /// Basic helper to define a parameter change proposal passed to AdminModule:
356 /// * **proposal** is struct which contains proposal that should change network parameter.
357 pub fn submit_param_change_proposal(proposal: ParamChangeProposal) -> Self {
358 NeutronMsg::SubmitAdminProposal {
359 admin_proposal: AdminProposal::ParamChangeProposal(proposal),
360 }
361 }
362
363 #[deprecated(
364 since = "0.11.0",
365 note = "Used only for querying old proposals. Will fail if executed in a new proposal. Use submit_proposal_execute_message instead"
366 )]
367 /// Basic helper to define an ibc upgrade proposal passed to AdminModule:
368 /// * **proposal** is struct which contains proposal that upgrades network.
369 pub fn submit_upgrade_proposal(proposal: UpgradeProposal) -> Self {
370 NeutronMsg::SubmitAdminProposal {
371 admin_proposal: AdminProposal::UpgradeProposal(proposal),
372 }
373 }
374
375 #[deprecated(
376 since = "0.11.0",
377 note = "Used only for querying old proposals. Will fail if executed in a new proposal. Use submit_proposal_execute_message instead"
378 )]
379 /// Basic helper to define an ibc update client change proposal passed to AdminModule:
380 /// * **proposal** is struct which contains proposal updates cliient.
381 pub fn submit_client_update_proposal(proposal: ClientUpdateProposal) -> Self {
382 NeutronMsg::SubmitAdminProposal {
383 admin_proposal: AdminProposal::ClientUpdateProposal(proposal),
384 }
385 }
386
387 /// Basic helper to define sdk47 compatible proposal passed to AdminModule:
388 /// * **proposal** is struct which contains JSON encoded sdk message.
389 pub fn submit_proposal_execute_message(proposal: ProposalExecuteMessage) -> Self {
390 NeutronMsg::SubmitAdminProposal {
391 admin_proposal: AdminProposal::ProposalExecuteMessage(proposal),
392 }
393 }
394
395 /// Basic helper to build create denom message passed to TokenFactory module:
396 /// * **subdenom** is a subdenom name for denom to be created.
397 pub fn submit_create_denom(subdenom: impl Into<String>) -> Self {
398 NeutronMsg::CreateDenom {
399 subdenom: subdenom.into(),
400 }
401 }
402
403 /// Basic helper to define change of admin for a token passed to TokenFactory module:
404 /// * **denom** is a name of the denom to change an admin for;
405 /// * **new_admin_address** is a new admin address for a denom.
406 pub fn submit_change_admin(
407 denom: impl Into<String>,
408 new_admin_address: impl Into<String>,
409 ) -> Self {
410 NeutronMsg::ChangeAdmin {
411 denom: denom.into(),
412 new_admin_address: new_admin_address.into(),
413 }
414 }
415
416 /// Basic helper to define mint tokens passed to TokenFactory module:
417 /// * **denom** is a name of the denom;
418 /// * **amount** is an amount of tokens to mint;
419 /// * **mint_to_address** is an address that will receive minted tokens.
420 pub fn submit_mint_tokens(
421 denom: impl Into<String>,
422 amount: Uint128,
423 mint_to_address: impl Into<String>,
424 ) -> Self {
425 NeutronMsg::MintTokens {
426 denom: denom.into(),
427 amount,
428 mint_to_address: mint_to_address.into(),
429 }
430 }
431
432 /// Basic helper to define burn tokens passed to TokenFactory module:
433 /// * **denom** is a name of the denom;
434 /// * **amount** is an amount of tokens to burn.
435 pub fn submit_burn_tokens(denom: impl Into<String>, amount: Uint128) -> Self {
436 NeutronMsg::BurnTokens {
437 denom: denom.into(),
438 amount,
439 burn_from_address: String::new(),
440 }
441 }
442
443 /// Basic helper to create set before send hook message passed to TokenFactory module:
444 /// * **denom** is a name for denom for hook to be created.
445 pub fn submit_set_before_send_hook(
446 denom: impl Into<String>,
447 contract_addr: impl Into<String>,
448 ) -> Self {
449 NeutronMsg::SetBeforeSendHook {
450 denom: denom.into(),
451 contract_addr: contract_addr.into(),
452 }
453 }
454
455 /// Basic helper to create force transfer message passed to TokenFactory module:
456 /// * **denom** is a name for a denom to transfer;
457 /// * **amount** is an amount of **denom** tokens to transfer;
458 /// * **from_address** is from which address to transfer tokens;
459 /// * **to_address** is where to transfer tokens.
460 pub fn submit_force_transfer(
461 denom: impl Into<String>,
462 amount: Uint128,
463 from_address: impl Into<String>,
464 to_address: impl Into<String>,
465 ) -> Self {
466 NeutronMsg::ForceTransfer {
467 denom: denom.into(),
468 amount,
469 transfer_from_address: from_address.into(),
470 transfer_to_address: to_address.into(),
471 }
472 }
473 /// Basic helper to create a set denom metadata message passed to TokenFactory module:
474 /// * **description** description of a token;
475 /// * **denom_units** represents the list of DenomUnit's for a given coin;
476 /// * **base** represents the base denom (should be the DenomUnit with exponent = 0);
477 /// * **display** indicates the suggested denom that should be
478 /// displayed in clients;
479 /// * **name** defines the name of the token (eg: Cosmos Atom);
480 /// * **symbol** is the token symbol usually shown on exchanges (eg: ATOM). This can
481 /// be the same as the display;
482 /// * **uri** to a document (on or off-chain) that contains additional information. Optional;
483 /// * **uri_hash** is a sha256 hash of a document pointed by URI. It's used to verify that
484 /// the document didn't change. Optional.
485 #[allow(clippy::too_many_arguments)]
486 pub fn submit_set_denom_metadata(
487 description: String,
488 denom_units: Vec<DenomUnit>,
489 base: String,
490 display: String,
491 name: String,
492 symbol: String,
493 uri: String,
494 uri_hash: String,
495 ) -> Self {
496 NeutronMsg::SetDenomMetadata {
497 description,
498 denom_units,
499 base,
500 display,
501 name,
502 symbol,
503 uri,
504 uri_hash,
505 }
506 }
507
508 /// Basic helper to define add schedule passed to Cron module:
509 /// * **name** is a name of the schedule;
510 /// * **period** is a period of schedule execution in blocks;
511 /// * **msgs** is the messages that will be executed.
512 pub fn submit_add_schedule(name: String, period: u64, msgs: Vec<MsgExecuteContract>) -> Self {
513 NeutronMsg::AddSchedule { name, period, msgs }
514 }
515
516 /// Basic helper to define remove schedule passed to Cron module:
517 /// * **name** is a name of the schedule to be removed.
518 pub fn submit_remove_schedule(name: String) -> Self {
519 NeutronMsg::RemoveSchedule { name }
520 }
521
522 /// Basic helper to define resubmit failure passed to Contractmanager module:
523 /// * **failure_id** is an id of the failure to be resubmitted.
524 pub fn submit_resubmit_failure(failure_id: u64) -> Self {
525 NeutronMsg::ResubmitFailure { failure_id }
526 }
527}
528
529impl From<NeutronMsg> for CosmosMsg<NeutronMsg> {
530 fn from(msg: NeutronMsg) -> CosmosMsg<NeutronMsg> {
531 CosmosMsg::Custom(msg)
532 }
533}
534
535impl CustomMsg for NeutronMsg {}
536
537#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
538#[serde(rename_all = "snake_case")]
539/// Describes response structure for **RegisterInterchainQuery** msg.
540pub struct MsgRegisterInterchainQueryResponse {
541 /// **id** is an identifier of newly registered interchain query.
542 pub id: u64,
543}
544
545#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
546#[serde(rename_all = "snake_case")]
547/// MsgRegisterInterchainAccountResponse defines the Msg/RegisterInterchainAccount response type.
548pub struct MsgRegisterInterchainAccountResponse {
549 /// **channel_id** is a ...
550 pub channel_id: String,
551 /// **port_id** is a ...
552 pub port_id: String,
553}
554
555#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
556#[serde(rename_all = "snake_case")]
557/// MsgSubmitTxResponse defines the response for Msg/SubmitTx.
558pub struct MsgSubmitTxResponse {
559 /// **sequence_id** is a channel's sequence_id for outgoing ibc packet. Unique per a channel.
560 pub sequence_id: u64,
561 /// **channel** is a src channel on neutron side trasaction was submitted from.
562 pub channel: String,
563}
564
565#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
566#[serde(rename_all = "snake_case")]
567/// MsgIbcTransferResponse defines the response for Msg/IbcTransfer.
568pub struct MsgIbcTransferResponse {
569 /// **sequence_id** is a channel's sequence_id for outgoing ibc packet. Unique per a channel.
570 pub sequence_id: u64,
571 /// **channel** is a src channel on neutron side trasaction was submitted from.
572 pub channel: String,
573}
574
575#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
576#[serde(rename_all = "snake_case")]
577/// AdminProposal defines the struct for various proposals which Neutron's Admin Module may accept.
578pub enum AdminProposal {
579 /// Proposal to change params. Note that this works for old params.
580 /// New params has their own `MsgUpdateParams` msgs that can be supplied to `ProposalExecuteMessage`
581 ParamChangeProposal(ParamChangeProposal),
582
583 #[deprecated(
584 since = "0.11.0",
585 note = "Used only for querying old proposals. Will fail if executed in a new proposal. Use ProposalExecuteMessage instead"
586 )]
587 /// Deprecated. Proposal to upgrade IBC client
588 UpgradeProposal(UpgradeProposal),
589
590 #[deprecated(
591 since = "0.11.0",
592 note = "Used only for querying old proposals. Will fail if executed in a new proposal. Use ProposalExecuteMessage instead"
593 )]
594 /// Deprecated. Proposal to update IBC client
595 ClientUpdateProposal(ClientUpdateProposal),
596
597 /// Proposal to execute CosmosMsg.
598 ProposalExecuteMessage(ProposalExecuteMessage),
599
600 #[deprecated(
601 since = "0.7.0",
602 note = "Used only for querying old proposals. Will fail if executed in a new proposal. Use ProposalExecuteMessage instead"
603 )]
604 /// Deprecated. Proposal to upgrade network
605 SoftwareUpgradeProposal(SoftwareUpgradeProposal),
606
607 #[deprecated(
608 since = "0.7.0",
609 note = "Used only for querying old proposals. Will fail if executed in a new proposal. Use ProposalExecuteMessage instead"
610 )]
611 /// Deprecated. Proposal to cancel existing software upgrade
612 CancelSoftwareUpgradeProposal(CancelSoftwareUpgradeProposal),
613
614 /// Deprecated. Will fail to execute if you use it.
615 #[deprecated(
616 since = "0.7.0",
617 note = "Used only for querying old proposals. Will fail if executed in a new proposal. Use ProposalExecuteMessage instead"
618 )]
619 /// Deprecated. Proposal to pin wasm contract codes
620 PinCodesProposal(PinCodesProposal),
621
622 #[deprecated(
623 since = "0.7.0",
624 note = "Used only for querying old proposals. Will fail if executed in a new proposal. Use ProposalExecuteMessage instead"
625 )]
626 /// Deprecated. Deprecated. Proposal to unpin wasm contract codes.
627 UnpinCodesProposal(UnpinCodesProposal),
628
629 #[deprecated(
630 since = "0.7.0",
631 note = "Used only for querying old proposals. Will fail if executed in a new proposal. Use ProposalExecuteMessage instead"
632 )]
633 /// Deprecated. Proposal to call sudo on contract.
634 SudoContractProposal(SudoContractProposal),
635
636 #[deprecated(
637 since = "0.7.0",
638 note = "Used only for querying old proposals. Will fail if executed in a new proposal. Use ProposalExecuteMessage instead"
639 )]
640 /// Deprecated. Proposal to update contract admin.
641 UpdateAdminProposal(UpdateAdminProposal),
642
643 #[deprecated(
644 since = "0.7.0",
645 note = "Used only for querying old proposals. Will fail if executed in a new proposal. Use ProposalExecuteMessage instead"
646 )]
647 /// Deprecated. Proposal to clear contract admin.
648 ClearAdminProposal(ClearAdminProposal),
649}
650
651#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
652#[serde(rename_all = "snake_case")]
653/// ParamChangeProposal defines the struct for single parameter change proposal.
654pub struct ParamChangeProposal {
655 /// **title** is a text title of proposal. Non unique.
656 pub title: String,
657 /// **description** is a text description of proposal. Non unique.
658 pub description: String,
659 /// **param_changes** is a vector of params to be changed. Non unique.
660 pub param_changes: Vec<ParamChange>,
661}
662
663#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
664#[serde(rename_all = "snake_case")]
665/// ParamChange defines the struct for parameter change request.
666pub struct ParamChange {
667 /// **subspace** is a key of module to which the parameter to change belongs. Unique for each module.
668 pub subspace: String,
669 /// **key** is a name of parameter. Unique for subspace.
670 pub key: String,
671 /// **value** is a new value for given parameter. Non unique.
672 pub value: String,
673}
674
675#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
676#[serde(rename_all = "snake_case")]
677/// Plan defines the struct for planned upgrade.
678pub struct Plan {
679 /// **name** is a name for the upgrade
680 pub name: String,
681 /// **height** is a height at which the upgrade must be performed
682 pub height: i64,
683 /// **info** is any application specific upgrade info to be included on-chain
684 pub info: String,
685}
686
687#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
688#[serde(rename_all = "snake_case")]
689#[deprecated(
690 since = "0.11.0",
691 note = "Used only for querying old proposals. Will fail if executed in a new proposal. Use ProposalExecuteMessage instead"
692)]
693/// UpgradeProposal defines the struct for IBC upgrade proposal.
694pub struct UpgradeProposal {
695 /// **title** is a text title of proposal.
696 pub title: String,
697 /// **description** is a text description of proposal.
698 pub description: String,
699 /// **plan** is a plan of upgrade.
700 pub plan: Plan,
701 /// **upgraded_client_state** is an upgraded client state.
702 pub upgraded_client_state: ProtobufAny,
703}
704
705#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
706#[serde(rename_all = "snake_case")]
707#[deprecated(
708 since = "0.11.0",
709 note = "Used only for querying old proposals. Will fail if executed in a new proposal. Use ProposalExecuteMessage instead"
710)]
711/// ClientUpdateProposal defines the struct for client update proposal.
712pub struct ClientUpdateProposal {
713 /// **title** is a text title of proposal.
714 pub title: String,
715 /// **description** is a text description of proposal. Non unique.
716 pub description: String,
717 /// **subject_client_id** is a subject client id.
718 pub subject_client_id: String,
719 /// **substitute_client_id** is a substitute client id.
720 pub substitute_client_id: String,
721}
722
723#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
724#[serde(rename_all = "snake_case")]
725/// ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.
726pub struct ProposalExecuteMessage {
727 /// **message** is a json representing an sdk message passed to admin module to execute.
728 pub message: String,
729}
730
731#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
732#[serde(rename_all = "snake_case")]
733/// MsgExecuteContract defines a call to the contract execution
734pub struct MsgExecuteContract {
735 /// **contract** is a contract address that will be called
736 pub contract: String,
737 /// **msg** is a contract call message
738 pub msg: String,
739}
740
741#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
742#[serde(rename_all = "snake_case")]
743#[deprecated(
744 since = "0.7.0",
745 note = "Used only for querying old proposals. Will fail if executed in a new proposal. Use ProposalExecuteMessage instead"
746)]
747/// Deprecated. SoftwareUpgradeProposal defines the struct for software upgrade proposal.
748pub struct SoftwareUpgradeProposal {
749 /// **title** is a text title of proposal. Non unique.
750 pub title: String,
751 /// **description** is a text description of proposal. Non unique.
752 pub description: String,
753 /// **plan** is a plan of upgrade.
754 pub plan: Plan,
755}
756
757#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
758#[serde(rename_all = "snake_case")]
759#[deprecated(
760 since = "0.7.0",
761 note = "Used only for querying old proposals. Will fail if executed in a new proposal. Use ProposalExecuteMessage instead"
762)]
763/// Deprecated. CancelSoftwareUpgradeProposal defines the struct for cancel software upgrade proposal.
764pub struct CancelSoftwareUpgradeProposal {
765 /// **title** is a text title of proposal. Non unique.
766 pub title: String,
767 /// **description** is a text description of proposal. Non unique.
768 pub description: String,
769}
770
771#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
772#[serde(rename_all = "snake_case")]
773#[deprecated(
774 since = "0.7.0",
775 note = "Used only for querying old proposals. Will fail if executed in a new proposal. Use ProposalExecuteMessage instead"
776)]
777/// Deprecated. SudoContractProposal defines the struct for sudo execution proposal.
778pub struct SudoContractProposal {
779 /// **title** is a text title of proposal.
780 pub title: String,
781 /// **description** is a text description of proposal.
782 pub description: String,
783 /// **contract** is an address of contract to be executed.
784 pub contract: String,
785 /// ***msg*** is a sudo message.
786 pub msg: Binary,
787}
788
789#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
790#[serde(rename_all = "snake_case")]
791#[deprecated(
792 since = "0.7.0",
793 note = "Used only for querying old proposals. Will fail if executed in a new proposal. Use ProposalExecuteMessage instead"
794)]
795/// Deprecated. PinCodesProposal defines the struct for pin contract codes proposal.
796pub struct PinCodesProposal {
797 /// **title** is a text title of proposal.
798 pub title: String,
799 /// **description** is a text description of proposal.
800 pub description: String,
801 /// **code_ids** is an array of codes to be pined.
802 pub code_ids: Vec<u64>,
803}
804
805#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
806#[serde(rename_all = "snake_case")]
807#[deprecated(
808 since = "0.7.0",
809 note = "Used only for querying old proposals. Will fail if executed in a new proposal. Use ProposalExecuteMessage instead"
810)]
811/// Deprecated. UnpinCodesProposal defines the struct for unpin contract codes proposal.
812pub struct UnpinCodesProposal {
813 /// **title** is a text title of proposal.
814 pub title: String,
815 /// **description** is a text description of proposal.
816 pub description: String,
817 /// **code_ids** is an array of codes to be unpined.
818 pub code_ids: Vec<u64>,
819}
820
821#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
822#[serde(rename_all = "snake_case")]
823#[deprecated(
824 since = "0.7.0",
825 note = "Used only for querying old proposals. Will fail if executed in a new proposal. Use ProposalExecuteMessage instead"
826)]
827/// Deprecated. UpdateAdminProposal defines the struct for update admin proposal.
828pub struct UpdateAdminProposal {
829 /// **title** is a text title of proposal.
830 pub title: String,
831 /// **description** is a text description of proposal.
832 pub description: String,
833 /// ***new_admin*** is an address of new admin
834 pub new_admin: String,
835 /// **contract** is an address of contract to update admin.
836 pub contract: String,
837}
838
839#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
840#[serde(rename_all = "snake_case")]
841#[deprecated(
842 since = "0.7.0",
843 note = "Used only for querying old proposals. Will fail if executed in a new proposal. Use ProposalExecuteMessage instead"
844)]
845/// Deprecated. SudoContractProposal defines the struct for clear admin proposal.
846pub struct ClearAdminProposal {
847 /// **title** is a text title of proposal.
848 pub title: String,
849 /// **description** is a text description of proposal.
850 pub description: String,
851 /// **contract** is an address of contract admin will be removed.
852 pub contract: String,
853}