Skip to content

feat(forge): create add scale-gas-limit #1928

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

Closed
Closed
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
17 changes: 16 additions & 1 deletion cli/src/cmd/forge/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@ This is automatically enabled for common networks without EIP1559."#
)]
gas_limit: Option<U256>,

#[clap(
long = "scale-gas-limit",
help_heading = "TRANSACTION OPTIONS",
help = "Scale the gas limit by the given percentage.",
value_name = "NUM"
)]
scale_gas_limit: Option<U256>,

#[clap(
long = "priority-fee",
help_heading = "TRANSACTION OPTIONS",
Expand All @@ -97,6 +105,7 @@ This is automatically enabled for common networks without EIP1559."#
value_name = "PRICE"
)]
priority_fee: Option<U256>,

#[clap(
long,
help_heading = "TRANSACTION OPTIONS",
Expand Down Expand Up @@ -241,7 +250,13 @@ impl CreateArgs {

// set gas limit if specified
if let Some(gas_limit) = self.gas_limit {
deployer.tx.set_gas(gas_limit);
if let Some(scale_gas_limit) = self.scale_gas_limit {
// let new_gas_limit = gas_limit * (1f64 + (scale_gas_limit / 100f64));
// deployer.tx.set_gas(new_gas_limit);
deployer.tx.set_gas(gas_limit * scale_gas_limit);
} else {
deployer.tx.set_gas(gas_limit);
}
}

// set nonce if specified
Expand Down