Skip to content

Commit 1044042

Browse files
authored
add priority-gas-price arg to forge script (foundry-rs#5585)
1 parent 97190e6 commit 1044042

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

cli/src/cmd/forge/script/broadcast.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,12 @@ impl ScriptArgs {
113113
TypedTransaction::Eip1559(ref mut inner) => {
114114
let eip1559_fees =
115115
eip1559_fees.expect("Could not get eip1559 fee estimation.");
116+
if let Some(priority_gas_price) = self.priority_gas_price {
117+
inner.max_priority_fee_per_gas = Some(priority_gas_price);
118+
} else {
119+
inner.max_priority_fee_per_gas = Some(eip1559_fees.1);
120+
}
116121
inner.max_fee_per_gas = Some(eip1559_fees.0);
117-
inner.max_priority_fee_per_gas = Some(eip1559_fees.1);
118122
}
119123
}
120124
}

cli/src/cmd/forge/script/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,15 @@ pub struct ScriptArgs {
116116
)]
117117
pub sig: String,
118118

119+
/// Max priority fee per gas for EIP1559 transactions.
120+
#[clap(
121+
long,
122+
env = "ETH_PRIORITY_GAS_PRICE",
123+
value_parser = parse_ether_value,
124+
value_name = "PRICE"
125+
)]
126+
pub priority_gas_price: Option<U256>,
127+
119128
/// Use legacy transactions instead of EIP1559 ones.
120129
///
121130
/// This is auto-enabled for common networks without EIP1559.

0 commit comments

Comments
 (0)