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(zk_toolbox): Do not panic if mint is not successful #2973

Merged
merged 1 commit into from
Sep 26, 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
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,
Deniallugo marked this conversation as resolved.
Show resolved Hide resolved
base_token.address,
addresses,
l1_rpc_url,
Expand Down
Loading