Skip to content

Commit

Permalink
Merge pull request #25 from multiversx/deposit-logs
Browse files Browse the repository at this point in the history
Updated deposit event logs
  • Loading branch information
andreiblt1304 authored Jan 31, 2024
2 parents d0a2b64 + 2a1dd95 commit 0cb280b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
12 changes: 10 additions & 2 deletions esdt-safe/src/to_sovereign/create_tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ pub trait CreateTxModule:
let own_sc_address = self.blockchain().get_sc_address();
let mut all_token_data = ManagedVec::new();
let mut total_tokens_for_fees = 0usize;
let mut event_payments = MultiValueEncoded::new();
let burn_mapper = self.burn_tokens();
for payment in &payments {
self.require_below_max_amount(&payment.token_identifier, &payment.amount);
Expand All @@ -170,6 +171,14 @@ pub trait CreateTxModule:
} else {
all_token_data.push(StolenFromFrameworkEsdtTokenData::default());
}

event_payments.push(
MultiValue3 ((
payment.token_identifier.clone(),
payment.token_nonce,
payment.amount.clone()
))
);

if burn_mapper.contains(&payment.token_identifier) {
self.send().esdt_local_burn(
Expand All @@ -196,8 +205,7 @@ pub trait CreateTxModule:

self.deposit_event(
&to,
&final_payments.fee,
&payments,
&event_payments,
DepositEvent::from(tx_nonce, &opt_transfer_data),
);

Expand Down
5 changes: 2 additions & 3 deletions esdt-safe/src/to_sovereign/events.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use transaction::{
transaction_status::TransactionStatus, BatchId, GasLimit, PaymentsVec, TransferData, TxId,
transaction_status::TransactionStatus, BatchId, GasLimit, TransferData, TxId
};

multiversx_sc::imports!();
Expand Down Expand Up @@ -38,8 +38,7 @@ pub trait EventsModule {
fn deposit_event(
&self,
#[indexed] dest_address: &ManagedAddress,
#[indexed] fee: &EsdtTokenPayment,
#[indexed] tokens: &PaymentsVec<Self::Api>,
#[indexed] tokens: &MultiValueEncoded<MultiValue3<TokenIdentifier, u64, BigUint>>,
event_data: DepositEvent<Self::Api>,
);

Expand Down

0 comments on commit 0cb280b

Please sign in to comment.