From f74623eb1af414918b006f305e370f27a109a92c Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Tue, 27 Jun 2023 10:49:34 +0200 Subject: [PATCH] Add IBC fees to IbcMsg::Transfer and ::SendPacket --- packages/std/src/ibc.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/packages/std/src/ibc.rs b/packages/std/src/ibc.rs index 1ce06432a6..990861c6e0 100644 --- a/packages/std/src/ibc.rs +++ b/packages/std/src/ibc.rs @@ -36,6 +36,13 @@ pub enum IbcMsg { amount: Coin, /// when packet times out, measured on remote chain timeout: IbcTimeout, + /// When set, a [MsgPayPacketFee] with the provided fee is created and + /// emitted before the packet is sent. + /// `signer` gets filled automatically with the contract address. + /// No relayer restrictions will be in place. + /// + /// [MsgPayPacketFee]: https://github.com/cosmos/ibc-go/blob/v7.2.0/proto/ibc/applications/fee/v1/tx.proto#L76-L93 + packet_fee: Option, }, /// Sends an IBC packet with given data over the existing channel. /// Data should be encoded in a format defined by the channel version, @@ -45,12 +52,29 @@ pub enum IbcMsg { data: Binary, /// when packet times out, measured on remote chain timeout: IbcTimeout, + /// When set, a [MsgPayPacketFee] with the provided fee is created and + /// emitted before the packet is sent. + /// `signer` gets filled automatically with the contract address. + /// No relayer restrictions will be in place. + /// + /// [MsgPayPacketFee]: https://github.com/cosmos/ibc-go/blob/v7.2.0/proto/ibc/applications/fee/v1/tx.proto#L76-L93 + packet_fee: Option, }, /// This will close an existing channel that is owned by this contract. /// Port is auto-assigned to the contract's IBC port CloseChannel { channel_id: String }, } +#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, Eq, JsonSchema)] +pub struct IbcFee { + /// The packet receive fee + pub recv: Vec, + /// The packet acknowledgement fee + pub ack: Vec, + /// The packet timeout fee + pub timeout: Vec, +} + #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] pub struct IbcEndpoint { pub port_id: String,