From c374bfc9f6db1db5c106e73b096cfe848824c633 Mon Sep 17 00:00:00 2001 From: BiancaIalangi Date: Fri, 22 Mar 2024 16:54:50 +0200 Subject: [PATCH] unified syntax - add transfer_non_zero and replace multi_esdt_transfer_execute --- .../composability/forwarder/src/esdt.rs | 12 +++++------- framework/base/src/types/interaction/tx_call_te.rs | 8 ++++++++ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/contracts/feature-tests/composability/forwarder/src/esdt.rs b/contracts/feature-tests/composability/forwarder/src/esdt.rs index ae9e366720..c178749ba9 100644 --- a/contracts/feature-tests/composability/forwarder/src/esdt.rs +++ b/contracts/feature-tests/composability/forwarder/src/esdt.rs @@ -73,13 +73,11 @@ pub trait ForwarderEsdtModule: storage::ForwarderStorageModule { all_token_payments.push(payment); } - let _ = self.send_raw().multi_esdt_transfer_execute( - &to, - &all_token_payments, - self.blockchain().get_gas_left(), - &ManagedBuffer::new(), - &ManagedArgBuffer::new(), - ); + self.tx() + .with_gas_limit(self.blockchain().get_gas_left()) + .to(&to) + .multi_esdt(all_token_payments) + .transfer_execute(); } #[payable("EGLD")] diff --git a/framework/base/src/types/interaction/tx_call_te.rs b/framework/base/src/types/interaction/tx_call_te.rs index b7a97a93d1..96eb1a72fb 100644 --- a/framework/base/src/types/interaction/tx_call_te.rs +++ b/framework/base/src/types/interaction/tx_call_te.rs @@ -49,4 +49,12 @@ where pub fn transfer(self) { self.transfer_execute_with_gas(0) } + + pub fn transfer_non_zero(self) { + if self.payment.is_no_payment() { + return; + } + + self.transfer_execute_with_gas(0) + } }