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

Fix “update_lowest_tx_id” fails #243

Merged
merged 2 commits into from
Oct 29, 2024
Merged
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
24 changes: 15 additions & 9 deletions bridge-proxy/src/bridge-proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ const MIN_GAS_LIMIT_FOR_SC_CALL: u64 = 10_000_000;
const MAX_GAS_LIMIT_FOR_SC_CALL: u64 = 249999999;
const DEFAULT_GAS_LIMIT_FOR_REFUND_CALLBACK: u64 = 20_000_000; // 20 million
const DELAY_BEFORE_OWNER_CAN_CANCEL_TRANSACTION: u64 = 300;
const MIN_GAS_TO_SAVE_PROGRESS: u64 = 100_000;
const MIN_GAS_TO_SAVE_PROGRESS: u64 = 1_000_000;

#[multiversx_sc::contract]
pub trait BridgeProxyContract:
config::ConfigModule
config::ConfigModule
+ multiversx_sc_modules::pause::PauseModule
+ multiversx_sc_modules::ongoing_operation::OngoingOperationModule
{
Expand Down Expand Up @@ -81,7 +81,10 @@ pub trait BridgeProxyContract:
}

let gas_left = self.blockchain().get_gas_left();
require!(gas_left > call_data.gas_limit + DEFAULT_GAS_LIMIT_FOR_REFUND_CALLBACK, "Not enough gas to execute");
require!(
gas_left > call_data.gas_limit + DEFAULT_GAS_LIMIT_FOR_REFUND_CALLBACK,
"Not enough gas to execute"
);

let tx_call = self
.tx()
Expand Down Expand Up @@ -136,11 +139,14 @@ pub trait BridgeProxyContract:
self.tx()
.to(esdt_safe_contract_address)
.typed(esdt_safe_proxy::EsdtSafeProxy)
.create_transaction(tx.from, OptionalValue::Some(esdt_safe_proxy::RefundInfo {
address: tx.to,
initial_batch_id: batch_id,
initial_nonce: tx.tx_nonce,
}))
.create_transaction(
tx.from,
OptionalValue::Some(esdt_safe_proxy::RefundInfo {
address: tx.to,
initial_batch_id: batch_id,
initial_nonce: tx.tx_nonce,
}),
)
.single_esdt(
&unwrapped_token.token_identifier,
unwrapped_token.token_nonce,
Expand All @@ -159,7 +165,7 @@ pub trait BridgeProxyContract:

let transfers = self
.tx()
.to(&bridged_tokens_wrapper_address)
.to(&bridged_tokens_wrapper_address)
.typed(bridged_tokens_wrapper_proxy::BridgedTokensWrapperProxy)
.unwrap_token(requested_token)
.single_esdt(
Expand Down
Loading