From e4a3de3349947c0d293943ade883af8d2d0e244e Mon Sep 17 00:00:00 2001 From: Sergey Ratiashvili Date: Fri, 20 Jan 2023 11:44:20 +0100 Subject: [PATCH] feat: fee payer added --- contracts/ibc_transfer/src/contract.rs | 1 + .../neutron_interchain_txs/src/contract.rs | 2 ++ packages/neutron-sdk/schema/neutron_msg.json | 20 ++++++++++++++++--- packages/neutron-sdk/src/bindings/msg.rs | 3 ++- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/contracts/ibc_transfer/src/contract.rs b/contracts/ibc_transfer/src/contract.rs index 98193dee..60cf6d12 100644 --- a/contracts/ibc_transfer/src/contract.rs +++ b/contracts/ibc_transfer/src/contract.rs @@ -161,6 +161,7 @@ fn execute_send( recv_fee: vec![], ack_fee: vec![Coin::new(1000u128, "stake")], timeout_fee: vec![Coin::new(1000u128, "stake")], + payer: None, }; let coin1 = coin(amount, denom.clone()); let msg1 = NeutronMsg::IbcTransfer { diff --git a/contracts/neutron_interchain_txs/src/contract.rs b/contracts/neutron_interchain_txs/src/contract.rs index 673308d6..a7800b88 100644 --- a/contracts/neutron_interchain_txs/src/contract.rs +++ b/contracts/neutron_interchain_txs/src/contract.rs @@ -205,6 +205,7 @@ fn execute_delegate( recv_fee: vec![], ack_fee: vec![CosmosCoin::new(1000u128, "stake")], timeout_fee: vec![CosmosCoin::new(1000u128, "stake")], + payer: None, }; let (delegator, connection_id) = get_ica(deps.as_ref(), &env, &interchain_account_id)?; let delegate_msg = MsgDelegate { @@ -265,6 +266,7 @@ fn execute_undelegate( recv_fee: vec![], ack_fee: vec![CosmosCoin::new(1000u128, "stake")], timeout_fee: vec![CosmosCoin::new(1000u128, "stake")], + payer: None, }; let (delegator, connection_id) = get_ica(deps.as_ref(), &env, &interchain_account_id)?; let delegate_msg = MsgUndelegate { diff --git a/packages/neutron-sdk/schema/neutron_msg.json b/packages/neutron-sdk/schema/neutron_msg.json index 63ebbab7..c0e097fb 100644 --- a/packages/neutron-sdk/schema/neutron_msg.json +++ b/packages/neutron-sdk/schema/neutron_msg.json @@ -281,11 +281,15 @@ } ], "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, "AdminProposal": { "description": "AdminProposal defines the struct for various proposals which Neutron's Admin Module may accept.", "oneOf": [ { - "description": "*param_change_proposal** is a parameter change proposal field.", + "description": "*ParamChangeProposal** is a parameter change proposal field.", "type": "object", "required": [ "param_change_proposal" @@ -298,7 +302,7 @@ "additionalProperties": false }, { - "description": "*software_upgrade_proposal** is a software upgrade proposal field.", + "description": "*SoftwareUpgradeProposal** is a software upgrade proposal field.", "type": "object", "required": [ "software_upgrade_proposal" @@ -311,7 +315,7 @@ "additionalProperties": false }, { - "description": "*cancel_software_upgrade_proposal** is a cancel software upgrade proposal field.", + "description": "*CancelSoftwareUpgradeProposal** is a cancel software upgrade proposal field.", "type": "object", "required": [ "cancel_software_upgrade_proposal" @@ -376,6 +380,16 @@ "$ref": "#/definitions/Coin" } }, + "payer": { + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + }, "recv_fee": { "type": "array", "items": { diff --git a/packages/neutron-sdk/src/bindings/msg.rs b/packages/neutron-sdk/src/bindings/msg.rs index b82a76a9..59bbec08 100644 --- a/packages/neutron-sdk/src/bindings/msg.rs +++ b/packages/neutron-sdk/src/bindings/msg.rs @@ -5,7 +5,7 @@ use crate::{ NeutronError, NeutronResult, }; -use cosmwasm_std::{Coin, CosmosMsg, CustomMsg, StdError}; +use cosmwasm_std::{Addr, Coin, CosmosMsg, CustomMsg, StdError}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use serde_json_wasm::to_string; @@ -15,6 +15,7 @@ pub struct IbcFee { pub recv_fee: Vec, pub ack_fee: Vec, pub timeout_fee: Vec, + pub payer: Option, } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]