Skip to content

Commit

Permalink
take blacklist into account + todo
Browse files Browse the repository at this point in the history
  • Loading branch information
dorin-iancu committed Jan 17, 2024
1 parent 722a874 commit e5b0bd8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions common/token-whitelist/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ pub trait TokenWhitelistModule:
self.remove_items(&mut self.token_whitelist(), token_list.into_iter());
}

fn require_token_not_blacklisted(&self, token_id: &TokenIdentifier) {
require!(
!self.token_blacklist().contains(token_id),
"Token blacklisted"
);
}

/// Tokens in blacklist cannot be transferred
#[endpoint(addTokensToBlacklist)]
fn add_tokens_to_blacklist(
Expand Down
7 changes: 7 additions & 0 deletions esdt-safe/src/to_sovereign/create_tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ pub trait CreateTxModule:
super::events::EventsModule
+ tx_batch_module::TxBatchModule
+ max_bridged_amount_module::MaxBridgedAmountModule
+ token_whitelist::TokenWhitelistModule
+ bls_signature::BlsSignatureModule
+ setup_phase::SetupPhaseModule
+ utils::UtilsModule
+ multiversx_sc_modules::pause::PauseModule
{
/// Create an Elrond -> Sovereign transaction.
Expand Down Expand Up @@ -39,6 +43,9 @@ pub trait CreateTxModule:
let mut all_token_data = ManagedVec::new();
for payment in &payments {
self.require_below_max_amount(&payment.token_identifier, &payment.amount);
self.require_token_not_blacklisted(&payment.token_identifier);

// TODO: When adding fees, take whitelist into account

if payment.token_nonce > 0 {
let current_token_data = self.blockchain().get_esdt_token_data(
Expand Down

0 comments on commit e5b0bd8

Please sign in to comment.