Skip to content

Commit

Permalink
Add blanket impl for Ics20ChannelKeeper
Browse files Browse the repository at this point in the history
  • Loading branch information
hu55a1n1 committed Nov 16, 2022
1 parent 6974ff6 commit 42ff93f
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion crates/ibc/src/applications/transfer/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -87,6 +87,27 @@ pub trait Ics20ChannelKeeper {
) -> Result<(), Ics04Error>;
}

impl<T: ChannelKeeper> 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<u8> {
let contents = format!("{}/{}", port_id, channel_id);
Expand Down

0 comments on commit 42ff93f

Please sign in to comment.