From e2f0c004d96cec99a54945c0786d8ffee9eedd0c Mon Sep 17 00:00:00 2001 From: dragosrebegea Date: Mon, 21 Oct 2024 11:43:15 +0300 Subject: [PATCH 1/2] fix unwrap_token if native token --- bridge-proxy/src/bridge-proxy.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/bridge-proxy/src/bridge-proxy.rs b/bridge-proxy/src/bridge-proxy.rs index 3c049c91..e96f3310 100644 --- a/bridge-proxy/src/bridge-proxy.rs +++ b/bridge-proxy/src/bridge-proxy.rs @@ -153,9 +153,22 @@ pub trait BridgeProxyContract: let payment = self.payments(tx_id).get(); let bridged_tokens_wrapper_address = self.bridged_tokens_wrapper_address().get(); + let universal_token = self + .tx() + .to(&bridged_tokens_wrapper_address) + .typed(bridged_tokens_wrapper_proxy::BridgedTokensWrapperProxy) + .chain_specific_to_universal_mapping(requested_token) + .returns(ReturnsResult) + .sync_call(); + + if universal_token != payment.token_identifier { + return payment; + } + let transfers = self .tx() - .to(bridged_tokens_wrapper_address) .typed(bridged_tokens_wrapper_proxy::BridgedTokensWrapperProxy) + .to(&bridged_tokens_wrapper_address) + .typed(bridged_tokens_wrapper_proxy::BridgedTokensWrapperProxy) .unwrap_token(requested_token) .single_esdt( &payment.token_identifier, From 0802c222f04e8a6b814d1e8ebe661db713554313 Mon Sep 17 00:00:00 2001 From: dragosrebegea Date: Mon, 21 Oct 2024 13:48:19 +0300 Subject: [PATCH 2/2] improvement --- bridge-proxy/src/bridge-proxy.rs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/bridge-proxy/src/bridge-proxy.rs b/bridge-proxy/src/bridge-proxy.rs index e96f3310..32913859 100644 --- a/bridge-proxy/src/bridge-proxy.rs +++ b/bridge-proxy/src/bridge-proxy.rs @@ -152,16 +152,8 @@ pub trait BridgeProxyContract: fn unwrap_token(&self, requested_token: &TokenIdentifier, tx_id: usize) -> EsdtTokenPayment { let payment = self.payments(tx_id).get(); let bridged_tokens_wrapper_address = self.bridged_tokens_wrapper_address().get(); - - let universal_token = self - .tx() - .to(&bridged_tokens_wrapper_address) - .typed(bridged_tokens_wrapper_proxy::BridgedTokensWrapperProxy) - .chain_specific_to_universal_mapping(requested_token) - .returns(ReturnsResult) - .sync_call(); - if universal_token != payment.token_identifier { + if requested_token == &payment.token_identifier { return payment; }