Skip to content

Commit

Permalink
fix(zk_toolbox): Do not panic if mint is not successful
Browse files Browse the repository at this point in the history
Signed-off-by: Danil <[email protected]>
  • Loading branch information
Deniallugo committed Sep 26, 2024
1 parent df68762 commit 684c817
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
15 changes: 7 additions & 8 deletions zk_toolbox/crates/common/src/ethereum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use ethers::{
};
use types::TokenInfo;

use crate::wallets::Wallet;
use crate::{logger, wallets::Wallet};

pub fn create_ethers_client(
private_key: H256,
Expand Down Expand Up @@ -103,13 +103,12 @@ pub async fn mint_token(

let mut pending_txs = vec![];
for call in &pending_calls {
pending_txs.push(
call.send()
.await?
// It's safe to set such low number of confirmations and low interval for localhost
.confirmations(3)
.interval(Duration::from_millis(30)),
);
let call = call.send().await;
match call {
// It's safe to set such low number of confirmations and low interval for localhost
Ok(call) => pending_txs.push(call.confirmations(3).interval(Duration::from_millis(30))),
Err(e) => logger::error(format!("Minting is not successful {e}")),
}
}

futures::future::join_all(pending_txs).await;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ pub async fn mint_base_token(
let amount = AMOUNT_FOR_DISTRIBUTION_TO_WALLETS * base_token.nominator as u128
/ base_token.denominator as u128;
common::ethereum::mint_token(
wallets.operator,
wallets.governor,
base_token.address,
addresses,
l1_rpc_url,
Expand Down

0 comments on commit 684c817

Please sign in to comment.