pub trait PfmContext {
type Error: Display;
// Required methods
fn send_transfer_execute(
&mut self,
msg: MsgTransfer,
) -> Result<Sequence, Self::Error>;
fn receive_refund_execute(
&mut self,
packet_forwarded_by_pfm_to_next_hop: &Packet,
transfer_forwarded_by_pfm_to_next_hop: PacketData,
) -> Result<(), Self::Error>;
fn send_refund_execute(
&mut self,
packet_from_previous_hop_sent_to_pfm: &InFlightPacket,
) -> Result<(), Self::Error>;
fn write_ack_and_events(
&mut self,
packet: &Packet,
acknowledgement: &Acknowledgement,
) -> Result<(), Self::Error>;
fn override_receiver(
&self,
channel: &ChannelId,
original_sender: &Signer,
) -> Result<Signer, Self::Error>;
fn timeout_timestamp(
&self,
timeout_duration: Duration,
) -> Result<TimeoutTimestamp, Self::Error>;
fn store_inflight_packet(
&mut self,
key: InFlightPacketKey,
inflight_packet: InFlightPacket,
) -> Result<(), Self::Error>;
fn retrieve_inflight_packet(
&self,
key: &InFlightPacketKey,
) -> Result<Option<InFlightPacket>, Self::Error>;
fn delete_inflight_packet(
&mut self,
key: &InFlightPacketKey,
) -> Result<(), Self::Error>;
// Provided method
fn get_denom_for_this_chain(
&self,
this_chain_port: &PortId,
this_chain_chan: &ChannelId,
source_port: &PortId,
source_chan: &ChannelId,
source_denom: &PrefixedDenom,
) -> Result<PrefixedDenom, Self::Error> { ... }
}Expand description
Context data required by the PacketForwardMiddleware.
Required Associated Types§
Required Methods§
Sourcefn send_transfer_execute(
&mut self,
msg: MsgTransfer,
) -> Result<Sequence, Self::Error>
fn send_transfer_execute( &mut self, msg: MsgTransfer, ) -> Result<Sequence, Self::Error>
Execute an ICS-20 transfer. This method returns the Sequence
of the sent packet.
Sourcefn receive_refund_execute(
&mut self,
packet_forwarded_by_pfm_to_next_hop: &Packet,
transfer_forwarded_by_pfm_to_next_hop: PacketData,
) -> Result<(), Self::Error>
fn receive_refund_execute( &mut self, packet_forwarded_by_pfm_to_next_hop: &Packet, transfer_forwarded_by_pfm_to_next_hop: PacketData, ) -> Result<(), Self::Error>
Handle receiving a refund from the next hop. This involves minting or unescrowing tokens on this chain.
Sourcefn send_refund_execute(
&mut self,
packet_from_previous_hop_sent_to_pfm: &InFlightPacket,
) -> Result<(), Self::Error>
fn send_refund_execute( &mut self, packet_from_previous_hop_sent_to_pfm: &InFlightPacket, ) -> Result<(), Self::Error>
Handle sending a refund back to the previous hop. This involves burning or escrowing tokens on this chain.
Sourcefn write_ack_and_events(
&mut self,
packet: &Packet,
acknowledgement: &Acknowledgement,
) -> Result<(), Self::Error>
fn write_ack_and_events( &mut self, packet: &Packet, acknowledgement: &Acknowledgement, ) -> Result<(), Self::Error>
Write the acknowledgement of packet, and emit events.
Sourcefn override_receiver(
&self,
channel: &ChannelId,
original_sender: &Signer,
) -> Result<Signer, Self::Error>
fn override_receiver( &self, channel: &ChannelId, original_sender: &Signer, ) -> Result<Signer, Self::Error>
Get an escrow account that will receive funds to be forwarded through
channel channel.
The account should not be controllable by original_sender, but the
Packet Forward Middleware should be able to freely deposit and withdraw
funds from it.
Sourcefn timeout_timestamp(
&self,
timeout_duration: Duration,
) -> Result<TimeoutTimestamp, Self::Error>
fn timeout_timestamp( &self, timeout_duration: Duration, ) -> Result<TimeoutTimestamp, Self::Error>
Given a timeout duration, return a TimeoutTimestamp, to be
applied to some hop.
Sourcefn store_inflight_packet(
&mut self,
key: InFlightPacketKey,
inflight_packet: InFlightPacket,
) -> Result<(), Self::Error>
fn store_inflight_packet( &mut self, key: InFlightPacketKey, inflight_packet: InFlightPacket, ) -> Result<(), Self::Error>
Stores an in-flight packet (i.e. a packet that is currently being transmitted over multiple hops by the PFM).
Sourcefn retrieve_inflight_packet(
&self,
key: &InFlightPacketKey,
) -> Result<Option<InFlightPacket>, Self::Error>
fn retrieve_inflight_packet( &self, key: &InFlightPacketKey, ) -> Result<Option<InFlightPacket>, Self::Error>
Retrieve an in-flight packet from storage.
Sourcefn delete_inflight_packet(
&mut self,
key: &InFlightPacketKey,
) -> Result<(), Self::Error>
fn delete_inflight_packet( &mut self, key: &InFlightPacketKey, ) -> Result<(), Self::Error>
Delete an in-flight packet from storage.
Provided Methods§
Sourcefn get_denom_for_this_chain(
&self,
this_chain_port: &PortId,
this_chain_chan: &ChannelId,
source_port: &PortId,
source_chan: &ChannelId,
source_denom: &PrefixedDenom,
) -> Result<PrefixedDenom, Self::Error>
fn get_denom_for_this_chain( &self, this_chain_port: &PortId, this_chain_chan: &ChannelId, source_port: &PortId, source_chan: &ChannelId, source_denom: &PrefixedDenom, ) -> Result<PrefixedDenom, Self::Error>
Get the denomination of source_denom for this chain,
either involving wrapping or unwrapping of tokens.