From e662f595ec43410d79cf4c81be8414e6fa474cd5 Mon Sep 17 00:00:00 2001 From: Dong-Ha Kim Date: Thu, 5 Sep 2024 16:10:32 +0700 Subject: [PATCH] replace gasLimits override option with gasUnits --- src/relayFeeCalculator/chain-queries/baseQuery.ts | 3 --- src/relayFeeCalculator/relayFeeCalculator.ts | 6 ++++-- src/utils/common.ts | 3 --- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/relayFeeCalculator/chain-queries/baseQuery.ts b/src/relayFeeCalculator/chain-queries/baseQuery.ts index 1d95afec..21c16cde 100644 --- a/src/relayFeeCalculator/chain-queries/baseQuery.ts +++ b/src/relayFeeCalculator/chain-queries/baseQuery.ts @@ -59,7 +59,6 @@ export class QueryBase implements QueryInterface { * @param deposit V3 deposit instance. * @param relayerAddress Relayer address to simulate with. * @param gasPrice Optional gas price to use for the simulation. - * @param gasLimit Optional gas limit to use for the simulation. * @param gasUnits Optional gas units to use for the simulation. * @returns The gas estimate for this function call (multiplied with the optional buffer). */ @@ -67,7 +66,6 @@ export class QueryBase implements QueryInterface { deposit: Deposit, relayer = DEFAULT_SIMULATED_RELAYER_ADDRESS, gasPrice = this.fixedGasPrice, - gasLimit?: BigNumberish, gasUnits?: BigNumberish ): Promise { const tx = await populateV3Relay(this.spokePool, deposit, relayer); @@ -77,7 +75,6 @@ export class QueryBase implements QueryInterface { this.provider, this.gasMarkup, gasPrice, - gasLimit, gasUnits ); } diff --git a/src/relayFeeCalculator/relayFeeCalculator.ts b/src/relayFeeCalculator/relayFeeCalculator.ts index beb72791..135b35e8 100644 --- a/src/relayFeeCalculator/relayFeeCalculator.ts +++ b/src/relayFeeCalculator/relayFeeCalculator.ts @@ -342,6 +342,8 @@ export class RelayFeeCalculator { * the relayer. * @param relayerAddress The relayer that will be used for the gas cost simulation * @param _tokenPrice The token price for normalizing fees + * @param gasPrice Optional gas price to use for the simulation + * @param gasUnits Optional gas units to use for the simulation * @returns A resulting `RelayerFeeDetails` object */ async relayerFeeDetails( @@ -351,7 +353,7 @@ export class RelayFeeCalculator { relayerAddress = DEFAULT_SIMULATED_RELAYER_ADDRESS, _tokenPrice?: number, gasPrice?: BigNumberish, - gasLimit?: BigNumberish + gasUnits?: BigNumberish ): Promise { // If the amount to relay is not provided, then we // should use the full deposit amount. @@ -370,7 +372,7 @@ export class RelayFeeCalculator { _tokenPrice, undefined, gasPrice, - gasLimit + gasUnits ); const gasFeeTotal = gasFeePercent.mul(amountToRelay).div(fixedPointAdjustment); const capitalFeePercent = this.capitalFeePercent( diff --git a/src/utils/common.ts b/src/utils/common.ts index 04d2488c..9ed49751 100644 --- a/src/utils/common.ts +++ b/src/utils/common.ts @@ -242,7 +242,6 @@ export type TransactionCostEstimate = { * @param provider A valid ethers provider - will be used to reason the gas price. * @param gasMarkup Markup on the estimated gas cost. For example, 0.2 will increase this resulting value 1.2x. * @param gasPrice A manually provided gas price - if set, this function will not resolve the current gas price. - * @param gasLimit A manually provided gas limit - if set, this function will not estimate the gas limit. * @param gasUnits A manually provided gas units - if set, this function will not estimate the gas units. * @returns Estimated cost in units of gas and the underlying gas token (gasPrice * estimatedGasUnits). */ @@ -252,7 +251,6 @@ export async function estimateTotalGasRequiredByUnsignedTransaction( provider: providers.Provider | L2Provider, gasMarkup: number, gasPrice?: BigNumberish, - gasLimit?: BigNumberish, gasUnits?: BigNumberish ): Promise { assert( @@ -269,7 +267,6 @@ export async function estimateTotalGasRequiredByUnsignedTransaction( : await voidSigner.estimateGas({ ...unsignedTx, gasPrice, - gasLimit, }); let tokenGasCost: BigNumber;