diff --git a/src/cli.ts b/src/cli.ts index 545fa022..1e717dca 100755 --- a/src/cli.ts +++ b/src/cli.ts @@ -614,7 +614,7 @@ export const main = async (argv: any, version?: string) => { }); // periodically fetch and set gas price in state (once every 20 seconds) - setInterval(() => getGasPrice(config, state), 20_000); + // setInterval(() => getGasPrice(config, state), 20_000); const lastReadOrdersMap = options.subgraph.map((v) => ({ sg: v, diff --git a/src/processOrders.ts b/src/processOrders.ts index e803eeab..b954964c 100644 --- a/src/processOrders.ts +++ b/src/processOrders.ts @@ -1,6 +1,6 @@ import { ChainId } from "sushi"; import { findOpp } from "./modes"; -import { getQuoteGas } from "./gas"; +import { getGasPrice, getQuoteGas } from "./gas"; import { PublicClient } from "viem"; import { Token } from "sushi/currency"; import { createViemClient } from "./config"; @@ -450,7 +450,6 @@ export async function processPair(args: { sellToken: orderPairObject.sellToken, }, }; - const gasPrice = ethers.BigNumber.from(state.gasPrice); spanAttributes["details.orders"] = orderPairObject.takeOrders.map((v) => v.id); spanAttributes["details.pair"] = pair; @@ -499,6 +498,9 @@ export async function processPair(args: { ratio: ethers.utils.formatUnits(orderPairObject.takeOrders[0].quote!.ratio), }); + await getGasPrice(config, state); + const gasPrice = ethers.BigNumber.from(state.gasPrice); + // get pool details if ( !dataFetcher.fetchedPairPools.includes(pair) ||