Skip to content
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
6 changes: 6 additions & 0 deletions .changeset/eighty-pianos-wait.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@nomicfoundation/ignition-core": patch
"@nomicfoundation/hardhat-ignition": patch
---

Add configurable maxFeePerGas and default to it if set
3 changes: 3 additions & 0 deletions packages/hardhat-ignition-core/src/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export async function deploy<
strategy,
strategyConfig,
maxFeePerGasLimit,
maxFeePerGas,
maxPriorityFeePerGas,
gasPrice,
disableFeeBumping,
Expand All @@ -72,6 +73,7 @@ export async function deploy<
strategy?: StrategyT;
strategyConfig?: StrategyConfig[StrategyT];
maxFeePerGasLimit?: bigint;
maxFeePerGas?: bigint;
maxPriorityFeePerGas?: bigint;
gasPrice?: bigint;
disableFeeBumping?: boolean;
Expand Down Expand Up @@ -120,6 +122,7 @@ export async function deploy<

const jsonRpcClient = new EIP1193JsonRpcClient(provider, {
maxFeePerGasLimit,
maxFeePerGas,
maxPriorityFeePerGas,
gasPrice,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ export class EIP1193JsonRpcClient implements JsonRpcClient {
private readonly _provider: EIP1193Provider,
private readonly _config?: {
maxFeePerGasLimit?: bigint;
maxFeePerGas?: bigint;
maxPriorityFeePerGas?: bigint;
gasPrice?: bigint;
}
Expand Down Expand Up @@ -687,6 +688,7 @@ export class EIP1193JsonRpcClient implements JsonRpcClient {

// Logic copied from ethers v6
const maxFeePerGas =
this._config?.maxFeePerGas ??
latestBlock.baseFeePerGas * 2n + maxPriorityFeePerGas;

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,20 @@ describe("JSON-RPC client", function () {
assert.equal(fees.maxPriorityFeePerGas, 1n);
});

it("Should use the configured maxFeePerGas", async function () {
const maxFeeClient = new EIP1193JsonRpcClient(
this.hre.network.provider,
{
maxFeePerGas: 1n,
}
);
const fees = await maxFeeClient.getNetworkFees();

assert("maxFeePerGas" in fees);

assert.equal(fees.maxFeePerGas, 1n);
});

it("Should use return legacy fees when deploying to polygon network (chainId 137)", async function () {
const polygonClient = new EIP1193JsonRpcClient(
{
Expand Down
3 changes: 3 additions & 0 deletions packages/hardhat-ignition/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ extendConfig((config, userConfig) => {

config.networks[networkName].ignition = {
maxFeePerGasLimit: userNetworkConfig.ignition?.maxFeePerGasLimit,
maxFeePerGas: userNetworkConfig.ignition?.maxFeePerGas,
maxPriorityFeePerGas: userNetworkConfig.ignition?.maxPriorityFeePerGas,
gasPrice: userNetworkConfig.ignition?.gasPrice,
disableFeeBumping: userNetworkConfig.ignition?.disableFeeBumping,
Expand Down Expand Up @@ -325,6 +326,8 @@ ignitionScope
strategyConfig,
maxFeePerGasLimit:
hre.config.networks[hre.network.name]?.ignition.maxFeePerGasLimit,
maxFeePerGas:
hre.config.networks[hre.network.name]?.ignition.maxFeePerGas,
maxPriorityFeePerGas:
hre.config.networks[hre.network.name]?.ignition
.maxPriorityFeePerGas,
Expand Down
4 changes: 4 additions & 0 deletions packages/hardhat-ignition/src/type-extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ declare module "hardhat/types/config" {
export interface HardhatNetworkUserConfig {
ignition?: {
maxFeePerGasLimit?: bigint;
maxFeePerGas?: bigint;
maxPriorityFeePerGas?: bigint;
gasPrice?: bigint;
disableFeeBumping?: boolean;
Expand All @@ -26,6 +27,7 @@ declare module "hardhat/types/config" {
export interface HardhatNetworkConfig {
ignition: {
maxFeePerGasLimit?: bigint;
maxFeePerGas?: bigint;
maxPriorityFeePerGas?: bigint;
gasPrice?: bigint;
disableFeeBumping?: boolean;
Expand All @@ -36,6 +38,7 @@ declare module "hardhat/types/config" {
export interface HttpNetworkUserConfig {
ignition?: {
maxFeePerGasLimit?: bigint;
maxFeePerGas?: bigint;
maxPriorityFeePerGas?: bigint;
gasPrice?: bigint;
disableFeeBumping?: boolean;
Expand All @@ -46,6 +49,7 @@ declare module "hardhat/types/config" {
export interface HttpNetworkConfig {
ignition: {
maxFeePerGasLimit?: bigint;
maxFeePerGas?: bigint;
maxPriorityFeePerGas?: bigint;
gasPrice?: bigint;
disableFeeBumping?: boolean;
Expand Down
Loading