Skip to content

Commit

Permalink
Add gas price estimate in forge script summary (foundry-rs#4149)
Browse files Browse the repository at this point in the history
* add gas price in forge script

* rustmft

Co-authored-by: Matthias Seitz <[email protected]>
  • Loading branch information
i-m-aditya and mattsse authored Jan 22, 2023
1 parent 08d4315 commit 2d331a2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cli/src/cmd/forge/script/broadcast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,14 @@ impl ScriptArgs {

println!("\n==========================");
println!("\nChain {}", provider_info.chain);

println!(
"\nEstimated gas price: {} gwei",
format_units(per_gas, 9)
.unwrap_or_else(|_| "[Could not calculate]".to_string())
.trim_end_matches('0')
.trim_end_matches('.')
);
println!("\nEstimated total gas used for script: {total_gas}");
println!(
"\nEstimated amount required: {} ETH",
Expand Down

0 comments on commit 2d331a2

Please sign in to comment.