diff --git a/packages/token-converter-bot/src/config/index.ts b/packages/token-converter-bot/src/config/index.ts new file mode 100644 index 00000000..c04add3c --- /dev/null +++ b/packages/token-converter-bot/src/config/index.ts @@ -0,0 +1,10 @@ +const subgraphUrlByNetwork = { + bsctestnet: "https://api.thegraph.com/subgraphs/name/pancakeswap/exchange-v3-chapel", + bscmainnet: "https://api.thegraph.com/subgraphs/name/pancakeswap/exchange-v3-bsc" +} + +const config = { + subgraphUrl: subgraphUrlByNetwork[process.env.NETWORK] +} + +export default config diff --git a/packages/token-converter-bot/src/converter-bot/TokenConverter.ts b/packages/token-converter-bot/src/converter-bot/TokenConverter.ts index 6c9714d5..025b92c6 100644 --- a/packages/token-converter-bot/src/converter-bot/TokenConverter.ts +++ b/packages/token-converter-bot/src/converter-bot/TokenConverter.ts @@ -9,6 +9,7 @@ import type { SUPPORTED_CHAINS } from "../config/chains"; import { chains } from "../config/chains"; import publicClient from "../config/clients/publicClient"; import walletClient from "../config/clients/walletClient"; +import config from '../config'; const REVERT_IF_NOT_MINED_AFTER = 60n; // seconds const MAX_HOPS = 5; @@ -37,7 +38,7 @@ export class TokenConverter { abi: tokenConverterOperatorAbi, }; this.v3SubgraphClient = createClient({ - url: "https://api.thegraph.com/subgraphs/name/pancakeswap/exchange-v3-bsc", + url: config.subgraphUrl, requestPolicy: "network-only", }); this.quoteProvider = SmartRouter.createQuoteProvider({ onChainProvider: () => this.publicClient });