Skip to content

Commit

Permalink
More parseUnits
Browse files Browse the repository at this point in the history
  • Loading branch information
pxrl committed Sep 4, 2024
1 parent 8c4dae6 commit 291b8be
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/gasPriceOracle/adapters/arbitrum.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { providers, utils as ethersUtils } from "ethers";
import { bnOne } from "../../utils";
import { providers } from "ethers";
import { bnOne, parseUnits } from "../../utils";
import { GasPriceEstimate } from "../types";
import * as ethereum from "./ethereum";

const DEFAULT_PRIORITY_FEE = ethersUtils.parseUnits("1.5", 9);
const DEFAULT_PRIORITY_FEE = parseUnits("1.5", 9);

// Arbitrum Nitro implements EIP-1559 pricing, but the priority fee is always refunded to the caller. Further,
// ethers typically hardcodes the priority fee to 1.5 Gwei. So, confirm that the priority fee supplied was 1.5
Expand Down
10 changes: 5 additions & 5 deletions src/gasPriceOracle/adapters/polygon.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { providers, utils as ethersUtils } from "ethers";
import { providers } from "ethers";
import { BaseHTTPAdapter, BaseHTTPAdapterArgs } from "../../priceClient/adapters/baseAdapter";
import { bnZero, isDefined } from "../../utils";
import { bnZero, isDefined, parseUnits } from "../../utils";
import { CHAIN_IDs } from "../../constants";
import { GasPriceEstimate } from "../types";
import { gasPriceError } from "../util";
Expand Down Expand Up @@ -50,12 +50,12 @@ class PolygonGasStation extends BaseHTTPAdapter {

[gasPrice.maxFee, gasPrice.maxPriorityFee].forEach((gasPrice) => {
if (Number(gasPrice) < 0) {
gasPriceError("getFeeData()", this.chainId, ethersUtils.parseUnits(gasPrice.toString(), 9));
gasPriceError("getFeeData()", this.chainId, parseUnits(gasPrice.toString(), 9));
}
});

const maxPriorityFeePerGas = ethersUtils.parseUnits(gasPrice.maxPriorityFee.toString(), 9);
const maxFeePerGas = ethersUtils.parseUnits(gasPrice.maxFee.toString(), 9);
const maxPriorityFeePerGas = parseUnits(gasPrice.maxPriorityFee.toString(), 9);
const maxFeePerGas = parseUnits(gasPrice.maxFee.toString(), 9);

return { maxPriorityFeePerGas, maxFeePerGas };
}
Expand Down

0 comments on commit 291b8be

Please sign in to comment.