diff --git a/src/relayFeeCalculator/chain-queries/alephZero.ts b/src/relayFeeCalculator/chain-queries/alephZero.ts index ee303142..2e9f125c 100644 --- a/src/relayFeeCalculator/chain-queries/alephZero.ts +++ b/src/relayFeeCalculator/chain-queries/alephZero.ts @@ -1,36 +1,10 @@ -import assert from "assert"; -import { getDeployedAddress } from "../../utils/DeploymentUtils"; -import { DEFAULT_LOGGER, Logger } from "../relayFeeCalculator"; -import { providers } from "ethers"; -import { CHAIN_IDs, DEFAULT_SIMULATED_RELAYER_ADDRESS, TOKEN_SYMBOLS_MAP } from "../../constants"; +import { CHAIN_IDs } from "../../constants"; import { Coingecko } from "../../coingecko/Coingecko"; -import { isDefined } from "../../utils"; import { QueryBase } from "./baseQuery"; // @dev This class only exists because querying the native token price for this network is not the standard // CoinGecko query because the native token symbol is not ETH. export class AlephZeroQueries extends QueryBase { - constructor( - provider: providers.Provider, - symbolMapping = TOKEN_SYMBOLS_MAP, - spokePoolAddress = getDeployedAddress("SpokePool", CHAIN_IDs.ALEPH_ZERO), - simulatedRelayerAddress = DEFAULT_SIMULATED_RELAYER_ADDRESS, - coingeckoProApiKey?: string, - logger: Logger = DEFAULT_LOGGER - ) { - assert(isDefined(spokePoolAddress)); - super( - provider, - symbolMapping, - spokePoolAddress, - simulatedRelayerAddress, - logger, - coingeckoProApiKey, - undefined, - "usd" - ); - } - override async getTokenPrice(tokenSymbol: string): Promise { if (!this.symbolMapping[tokenSymbol]) throw new Error(`${tokenSymbol} does not exist in mapping`); const coingeckoInstance = Coingecko.get(this.logger, this.coingeckoProApiKey); diff --git a/src/relayFeeCalculator/chain-queries/factory.ts b/src/relayFeeCalculator/chain-queries/factory.ts index 54f3bc8f..9bfee85f 100644 --- a/src/relayFeeCalculator/chain-queries/factory.ts +++ b/src/relayFeeCalculator/chain-queries/factory.ts @@ -37,8 +37,10 @@ export class QueryBase__factory { symbolMapping, spokePoolAddress, simulatedRelayerAddress, + logger, coingeckoProApiKey, - logger + fixedGasPrice[chainId], + "usd" ); } @@ -48,8 +50,10 @@ export class QueryBase__factory { symbolMapping, spokePoolAddress, simulatedRelayerAddress, + logger, coingeckoProApiKey, - logger + fixedGasPrice[chainId], + "usd" ); } diff --git a/src/relayFeeCalculator/chain-queries/polygon.ts b/src/relayFeeCalculator/chain-queries/polygon.ts index 1eea710d..d403749c 100644 --- a/src/relayFeeCalculator/chain-queries/polygon.ts +++ b/src/relayFeeCalculator/chain-queries/polygon.ts @@ -1,36 +1,10 @@ -import assert from "assert"; -import { getDeployedAddress } from "../../utils/DeploymentUtils"; -import { DEFAULT_LOGGER, Logger } from "../relayFeeCalculator"; -import { providers } from "ethers"; -import { CHAIN_IDs, DEFAULT_SIMULATED_RELAYER_ADDRESS, TOKEN_SYMBOLS_MAP } from "../../constants"; +import { CHAIN_IDs } from "../../constants"; import { Coingecko } from "../../coingecko/Coingecko"; -import { isDefined } from "../../utils"; import { QueryBase } from "./baseQuery"; // @dev This class only exists because querying the native token price for this network is not the standard // CoinGecko query because the native token symbol is not ETH. export class PolygonQueries extends QueryBase { - constructor( - provider: providers.Provider, - symbolMapping = TOKEN_SYMBOLS_MAP, - spokePoolAddress = getDeployedAddress("SpokePool", CHAIN_IDs.POLYGON), - simulatedRelayerAddress = DEFAULT_SIMULATED_RELAYER_ADDRESS, - coingeckoProApiKey?: string, - logger: Logger = DEFAULT_LOGGER - ) { - assert(isDefined(spokePoolAddress)); - super( - provider, - symbolMapping, - spokePoolAddress, - simulatedRelayerAddress, - logger, - coingeckoProApiKey, - undefined, - "usd" - ); - } - override async getTokenPrice(tokenSymbol: string): Promise { if (!this.symbolMapping[tokenSymbol]) throw new Error(`${tokenSymbol} does not exist in mapping`); const coingeckoInstance = Coingecko.get(this.logger, this.coingeckoProApiKey);