Skip to content

Commit

Permalink
Format fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
CostinCarabas committed Mar 11, 2024
1 parent df6eb62 commit 7d2044d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
10 changes: 5 additions & 5 deletions bridge-proxy/src/bridge-proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ pub trait BridgeProxyContract:
.unwrap_or_else(|| sc_panic!("Invalid ETH transaction!"));
let tx = tx_node.get_value_as_ref();

require!(tx.eth_tx.call_data.is_some(), "There is no data for a SC call!");
require!(
tx.eth_tx.call_data.is_some(),
"There is no data for a SC call!"
);

let call_data = unsafe { tx.eth_tx.call_data.clone().unwrap_unchecked() };
self.send()
.contract_call::<IgnoreValue>(
tx.eth_tx.to.clone(),
call_data.endpoint.clone(),
)
.contract_call::<IgnoreValue>(tx.eth_tx.to.clone(), call_data.endpoint.clone())
.with_raw_arguments(call_data.args.clone().into())
.with_esdt_transfer((tx.token_id.clone(), tx.nonce, tx.amount.clone()))
.with_gas_limit(call_data.gas_limit)
Expand Down
11 changes: 6 additions & 5 deletions common/token-module/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,10 @@ pub trait TokenModule: fee_estimator_module::FeeEstimatorModule {
let burn_balances_mapper = self.burn_balances(token_id);
let mint_balances_mapper = self.mint_balances(token_id);
if self.native_token(token_id).get() {
require!(burn_balances_mapper.get() >= &mint_balances_mapper.get() + amount, "Not enough burned tokens!");
require!(
burn_balances_mapper.get() >= &mint_balances_mapper.get() + amount,
"Not enough burned tokens!"
);
}

let mint_executed = self.internal_mint(token_id, amount);
Expand All @@ -139,17 +142,15 @@ pub trait TokenModule: fee_estimator_module::FeeEstimatorModule {
// private

fn internal_mint(&self, token_id: &TokenIdentifier, amount: &BigUint) -> bool {
if !self.is_local_role_set(token_id, &EsdtLocalRole::Mint)
{
if !self.is_local_role_set(token_id, &EsdtLocalRole::Mint) {
return false;
}
self.send().esdt_local_mint(token_id, 0, amount);
return true;
}

fn internal_burn(&self, token_id: &TokenIdentifier, amount: &BigUint) -> bool {
if !self.is_local_role_set(token_id, &EsdtLocalRole::Burn)
{
if !self.is_local_role_set(token_id, &EsdtLocalRole::Burn) {
return false;
}
self.send().esdt_local_burn(token_id, 0, amount);
Expand Down
22 changes: 11 additions & 11 deletions esdt-safe/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ pub trait EsdtSafe:
}

match tx_status {
TransactionStatus::Executed => {
}
TransactionStatus::Executed => {}
TransactionStatus::Rejected => {
let addr = ManagedAddress::try_from(tx.from).unwrap();
self.mark_refund(&addr, &tx.token_identifier, &tx.amount);
Expand Down Expand Up @@ -229,7 +228,11 @@ pub trait EsdtSafe:
let burn_balances_mapper = self.burn_balances(&payment_token);
let mint_balances_mapper = self.mint_balances(&payment_token);
if self.native_token(&payment_token).get() {
require!(mint_balances_mapper.get() >= &burn_balances_mapper.get() + &actual_bridged_amount, "Not enough minted tokens!");
require!(
mint_balances_mapper.get()
>= &burn_balances_mapper.get() + &actual_bridged_amount,
"Not enough minted tokens!"
);
}
let burn_executed = self.internal_burn(&payment_token, &actual_bridged_amount);
require!(burn_executed, "Cannot do the burn action!");
Expand Down Expand Up @@ -288,10 +291,10 @@ pub trait EsdtSafe:

#[event("createTransactionEvent")]
fn create_transaction_event(
&self,
#[indexed] batch_id: u64,
#[indexed] tx_id: u64,
#[indexed] token_id: TokenIdentifier,
&self,
#[indexed] batch_id: u64,
#[indexed] tx_id: u64,
#[indexed] token_id: TokenIdentifier,
#[indexed] amount: BigUint,
);

Expand All @@ -304,10 +307,7 @@ pub trait EsdtSafe:
);

#[event("claimRefundTransactionEvent")]
fn claim_refund_transaction_event(
&self,
#[indexed] token_id: &TokenIdentifier,
);
fn claim_refund_transaction_event(&self, #[indexed] token_id: &TokenIdentifier);

#[event("setStatusEvent")]
fn set_status_event(
Expand Down
3 changes: 1 addition & 2 deletions multi-transfer-esdt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ pub trait MultiTransferEsdt:
} else if self.is_account_same_shard_frozen(sc_shard, &eth_tx.to, &eth_tx.token_id) {
self.transfer_failed_frozen_destination_account(batch_id, eth_tx.tx_nonce);
must_refund = true;
} else if self.blockchain().is_smart_contract(&eth_tx.to)
{
} else if self.blockchain().is_smart_contract(&eth_tx.to) {
match &eth_tx.call_data {
Some(call_data) => {
if call_data.gas_limit < MIN_GAS_LIMIT_FOR_SC_CALL {
Expand Down

0 comments on commit 7d2044d

Please sign in to comment.