From 42ff93ff1d996b5b049db8a90f46dc23987109b0 Mon Sep 17 00:00:00 2001 From: hu55a1n1 Date: Wed, 16 Nov 2022 22:26:51 +0530 Subject: [PATCH] Add blanket impl for Ics20ChannelKeeper --- .../ibc/src/applications/transfer/context.rs | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/crates/ibc/src/applications/transfer/context.rs b/crates/ibc/src/applications/transfer/context.rs index f20bae054..d4c50b09d 100644 --- a/crates/ibc/src/applications/transfer/context.rs +++ b/crates/ibc/src/applications/transfer/context.rs @@ -10,7 +10,7 @@ use crate::applications::transfer::relay::on_timeout_packet::process_timeout_pac use crate::applications::transfer::{PrefixedCoin, PrefixedDenom, VERSION}; use crate::core::ics04_channel::channel::{Counterparty, Order}; use crate::core::ics04_channel::commitment::PacketCommitment; -use crate::core::ics04_channel::context::SendPacketReader; +use crate::core::ics04_channel::context::{ChannelKeeper, SendPacketReader}; use crate::core::ics04_channel::error::Error as Ics04Error; use crate::core::ics04_channel::handler::send_packet::SendPacketResult; use crate::core::ics04_channel::handler::ModuleExtras; @@ -87,6 +87,27 @@ pub trait Ics20ChannelKeeper { ) -> Result<(), Ics04Error>; } +impl Ics20ChannelKeeper for T { + fn store_packet_commitment( + &mut self, + port_id: PortId, + channel_id: ChannelId, + sequence: Sequence, + commitment: PacketCommitment, + ) -> Result<(), Ics04Error> { + ChannelKeeper::store_packet_commitment(self, port_id, channel_id, sequence, commitment) + } + + fn store_next_sequence_send( + &mut self, + port_id: PortId, + channel_id: ChannelId, + seq: Sequence, + ) -> Result<(), Ics04Error> { + ChannelKeeper::store_next_sequence_send(self, port_id, channel_id, seq) + } +} + // https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-028-public-key-addresses.md pub fn cosmos_adr028_escrow_address(port_id: &PortId, channel_id: &ChannelId) -> Vec { let contents = format!("{}/{}", port_id, channel_id);