diff --git a/ibc-apps/ics20-transfer/src/context.rs b/ibc-apps/ics20-transfer/src/context.rs index ca7611dcd..6fce5225b 100644 --- a/ibc-apps/ics20-transfer/src/context.rs +++ b/ibc-apps/ics20-transfer/src/context.rs @@ -11,8 +11,11 @@ pub trait TokenTransferValidationContext { /// Native chain account id. type AccountId; - /// Attempt to convert a [`Signer`] to a native chain account id. - fn account_id_from_signer(&self, signer: &Signer) -> Option; + /// Attempt to convert a [`Signer`] to a native chain sender account. + fn sender_account_from_signer(&self, signer: &Signer) -> Option; + + /// Attempt to convert a [`Signer`] to a native chain receiver account. + fn receiver_account_from_signer(&self, signer: &Signer) -> Option; /// get_port returns the portID for the transfer module. fn get_port(&self) -> Result; diff --git a/ibc-apps/ics20-transfer/src/handler/mod.rs b/ibc-apps/ics20-transfer/src/handler/mod.rs index 918958792..48d5215ca 100644 --- a/ibc-apps/ics20-transfer/src/handler/mod.rs +++ b/ibc-apps/ics20-transfer/src/handler/mod.rs @@ -18,7 +18,7 @@ pub fn refund_packet_token_execute( data: &PacketData, ) -> Result<(), TokenTransferError> { let sender = ctx_a - .account_id_from_signer(&data.sender) + .sender_account_from_signer(&data.sender) .ok_or(TokenTransferError::FailedToParseAccount)?; if is_sender_chain_source( @@ -47,7 +47,7 @@ pub fn refund_packet_token_validate( data: &PacketData, ) -> Result<(), TokenTransferError> { let sender = ctx_a - .account_id_from_signer(&data.sender) + .sender_account_from_signer(&data.sender) .ok_or(TokenTransferError::FailedToParseAccount)?; if is_sender_chain_source( diff --git a/ibc-apps/ics20-transfer/src/handler/on_recv_packet.rs b/ibc-apps/ics20-transfer/src/handler/on_recv_packet.rs index 9fa942a90..d7e022292 100644 --- a/ibc-apps/ics20-transfer/src/handler/on_recv_packet.rs +++ b/ibc-apps/ics20-transfer/src/handler/on_recv_packet.rs @@ -24,7 +24,7 @@ pub fn process_recv_packet_execute( .map_err(|err| (ModuleExtras::empty(), err.into()))?; let receiver_account = ctx_b - .account_id_from_signer(&data.receiver) + .receiver_account_from_signer(&data.receiver) .ok_or_else(|| { ( ModuleExtras::empty(), diff --git a/ibc-apps/ics20-transfer/src/handler/send_transfer.rs b/ibc-apps/ics20-transfer/src/handler/send_transfer.rs index 6752430f6..0c4b1c7e9 100644 --- a/ibc-apps/ics20-transfer/src/handler/send_transfer.rs +++ b/ibc-apps/ics20-transfer/src/handler/send_transfer.rs @@ -57,7 +57,7 @@ where let token = &msg.packet_data.token; let sender = token_ctx_a - .account_id_from_signer(&msg.packet_data.sender) + .sender_account_from_signer(&msg.packet_data.sender) .ok_or(TokenTransferError::FailedToParseAccount)?; if is_sender_chain_source( @@ -127,7 +127,7 @@ where let token = &msg.packet_data.token; let sender = token_ctx_a - .account_id_from_signer(&msg.packet_data.sender) + .sender_account_from_signer(&msg.packet_data.sender) .ok_or(TokenTransferError::FailedToParseAccount)?; if is_sender_chain_source( diff --git a/ibc-testkit/src/testapp/ibc/applications/transfer/context.rs b/ibc-testkit/src/testapp/ibc/applications/transfer/context.rs index b2e2d1c6e..86a06dc23 100644 --- a/ibc-testkit/src/testapp/ibc/applications/transfer/context.rs +++ b/ibc-testkit/src/testapp/ibc/applications/transfer/context.rs @@ -9,7 +9,11 @@ use super::types::DummyTransferModule; impl TokenTransferValidationContext for DummyTransferModule { type AccountId = Signer; - fn account_id_from_signer(&self, signer: &Signer) -> Option { + fn sender_account_from_signer(&self, signer: &Signer) -> Option { + Some(signer.clone()) + } + + fn receiver_account_from_signer(&self, signer: &Signer) -> Option { Some(signer.clone()) }