Skip to content

Commit

Permalink
replace gasLimits override option with gasUnits
Browse files Browse the repository at this point in the history
  • Loading branch information
dohaki committed Sep 5, 2024
1 parent ff98b79 commit e662f59
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
3 changes: 0 additions & 3 deletions src/relayFeeCalculator/chain-queries/baseQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,13 @@ 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).
*/
async getGasCosts(
deposit: Deposit,
relayer = DEFAULT_SIMULATED_RELAYER_ADDRESS,
gasPrice = this.fixedGasPrice,
gasLimit?: BigNumberish,
gasUnits?: BigNumberish
): Promise<TransactionCostEstimate> {
const tx = await populateV3Relay(this.spokePool, deposit, relayer);
Expand All @@ -77,7 +75,6 @@ export class QueryBase implements QueryInterface {
this.provider,
this.gasMarkup,
gasPrice,
gasLimit,
gasUnits
);
}
Expand Down
6 changes: 4 additions & 2 deletions src/relayFeeCalculator/relayFeeCalculator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -351,7 +353,7 @@ export class RelayFeeCalculator {
relayerAddress = DEFAULT_SIMULATED_RELAYER_ADDRESS,
_tokenPrice?: number,
gasPrice?: BigNumberish,
gasLimit?: BigNumberish
gasUnits?: BigNumberish
): Promise<RelayerFeeDetails> {
// If the amount to relay is not provided, then we
// should use the full deposit amount.
Expand All @@ -370,7 +372,7 @@ export class RelayFeeCalculator {
_tokenPrice,
undefined,
gasPrice,
gasLimit
gasUnits
);
const gasFeeTotal = gasFeePercent.mul(amountToRelay).div(fixedPointAdjustment);
const capitalFeePercent = this.capitalFeePercent(
Expand Down
3 changes: 0 additions & 3 deletions src/utils/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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).
*/
Expand All @@ -252,7 +251,6 @@ export async function estimateTotalGasRequiredByUnsignedTransaction(
provider: providers.Provider | L2Provider<providers.Provider>,
gasMarkup: number,
gasPrice?: BigNumberish,
gasLimit?: BigNumberish,
gasUnits?: BigNumberish
): Promise<TransactionCostEstimate> {
assert(
Expand All @@ -269,7 +267,6 @@ export async function estimateTotalGasRequiredByUnsignedTransaction(
: await voidSigner.estimateGas({
...unsignedTx,
gasPrice,
gasLimit,
});
let tokenGasCost: BigNumber;

Expand Down

0 comments on commit e662f59

Please sign in to comment.