Skip to content

Commit

Permalink
add baseFeeMultiplier assertion test
Browse files Browse the repository at this point in the history
Signed-off-by: nicholaspai <[email protected]>
  • Loading branch information
nicholaspai committed Dec 27, 2024
1 parent 3f31537 commit bcd10bb
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion test/GasPriceOracle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import dotenv from "dotenv";
import { encodeFunctionData } from "viem";
import { getGasPriceEstimate } from "../src/gasPriceOracle";
import { BigNumber, bnZero, parseUnits } from "../src/utils";
import { expect, makeCustomTransport, randomAddress } from "../test/utils";
import { assertPromiseError, expect, makeCustomTransport, randomAddress } from "../test/utils";
import { MockedProvider } from "./utils/provider";
import { MockPolygonGasStation } from "../src/gasPriceOracle/adapters/polygon";
dotenv.config({ path: ".env" });
Expand Down Expand Up @@ -42,6 +42,24 @@ const erc20TransferTransactionObject = encodeFunctionData({
});

describe("Gas Price Oracle", function () {
it("baseFeeMultiplier is validated", async function () {
// Too low:
await assertPromiseError(
getGasPriceEstimate(provider, {
chainId: 1,
baseFeeMultiplier: 0.5,
}),
"base fee multiplier"
);
// Too high:
await assertPromiseError(
getGasPriceEstimate(provider, {
chainId: 1,
baseFeeMultiplier: 5.5,
}),
"base fee multiplier"
);
});
it("Linea Viem gas price retrieval with unsignedTx", async function () {
const chainId = 59144;
const chainKey = `NEW_GAS_PRICE_ORACLE_${chainId}`;
Expand Down

0 comments on commit bcd10bb

Please sign in to comment.