Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated deposit event logs #25

Merged
merged 3 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading