Skip to content

Commit

Permalink
gwei to wei
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholaspai committed Dec 26, 2024
1 parent de2a339 commit e913c75
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/gasPriceOracle/adapters/linea-viem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { PopulatedTransaction } from "ethers";
* compressed transaction size, layer 1 verification costs and capacity, gas price ratio between layer 1 and layer 2,
* the transaction's gas usage, the minimum gas price on layer 2,
* and a minimum margin (for error) for gas price estimation.
* Source: https://docs.linea.build/get-started/how-to/gas-fees#how-gas-works-on-linea
* @dev Because the Linea priority fee is more volatile than the base fee, the base fee multiplier will be applied
* to the priority fee.
* @param provider
Expand Down
6 changes: 5 additions & 1 deletion test/GasPriceOracle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const dummyLogger = winston.createLogger({

const stdLastBaseFeePerGas = parseUnits("12", 9);
const stdMaxPriorityFeePerGas = parseUnits("1", 9); // EIP-1559 chains only
const expectedLineaMaxFeePerGas = parseUnits("7", 9);
const expectedLineaMaxFeePerGas = BigNumber.from("7");
const ethersProviderChainIds = [1, 10, 137, 324, 8453, 42161, 534352, 59144];
const viemProviderChainIds = [59144];

Expand Down Expand Up @@ -142,6 +142,10 @@ describe("Gas Price Oracle", function () {
expect(markedUpMaxPriorityFeePerGas).to.equal(1);
expect(maxPriorityFeePerGas).to.equal(1);
}
if (chainId === 324 || chainId === 534352) {
// Scroll and ZkSync use legacy pricing so priority fee should be 0.
expect(maxPriorityFeePerGas).to.equal(0);
}
if (eip1559RawGasPriceFeedChainIds.includes(chainId)) {
const chainKey = `GAS_PRICE_EIP1559_RAW_${chainId}`;
delete process.env[chainKey];
Expand Down
4 changes: 2 additions & 2 deletions test/utils/transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export const makeCustomTransport = (
return BigInt(stdMaxPriorityFeePerGas.toString());
case "linea_estimateGas":
return {
// Linea base fee is always 7 gwei
baseFeePerGas: BigInt(parseUnits("7", 9).toString()),
// Linea base fee is always 7 wei
baseFeePerGas: BigInt(7),
priorityFeePerGas: BigInt(stdMaxPriorityFeePerGas.toString()),
gasLimit: BigInt("0"),
};
Expand Down

0 comments on commit e913c75

Please sign in to comment.