Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
use default branch
  • Loading branch information
mattsse committed Nov 23, 2023
commit 46ccf524a9d5eba6add859b741f8f16617dffb57
14 changes: 4 additions & 10 deletions crates/forge/bin/cmd/script/broadcast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,14 @@ impl ScriptArgs {
// Make a one-time gas price estimation
let (gas_price, eip1559_fees) = {
match deployment_sequence.transactions.front().unwrap().typed_tx() {
TypedTransaction::Legacy(_) |
TypedTransaction::Eip2930(_) |
TypedTransaction::DepositTransaction(_) => {
(provider.get_gas_price().await.ok(), None)
}
TypedTransaction::Eip1559(_) => {
let fees = estimate_eip1559_fees(&provider, Some(chain))
.await
.wrap_err("Failed to estimate EIP1559 fees. This chain might not support EIP1559, try adding --legacy to your command.")?;

(None, Some(fees))
}
_ => (provider.get_gas_price().await.ok(), None),
}
};

Expand All @@ -104,11 +100,6 @@ impl ScriptArgs {
} else {
// fill gas price
match tx {
TypedTransaction::Eip2930(_) |
TypedTransaction::Legacy(_) |
TypedTransaction::DepositTransaction(_) => {
tx.set_gas_price(gas_price.expect("Could not get gas_price."));
}
TypedTransaction::Eip1559(ref mut inner) => {
let eip1559_fees =
eip1559_fees.expect("Could not get eip1559 fee estimation.");
Expand All @@ -120,6 +111,9 @@ impl ScriptArgs {
}
inner.max_fee_per_gas = Some(eip1559_fees.0);
}
_ => {
tx.set_gas_price(gas_price.expect("Could not get gas_price."));
}
}
}

Expand Down