From 6bdcb8c8bf695aa3d80d9e15172174e7ebf29920 Mon Sep 17 00:00:00 2001 From: Aiden <30964272+0xaaiden@users.noreply.github.com> Date: Sun, 2 Jun 2024 17:08:22 -0500 Subject: [PATCH 1/3] Update config.ts updated thegraph to use decentralized service --- src/dex/uniswap-v2/config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dex/uniswap-v2/config.ts b/src/dex/uniswap-v2/config.ts index 88cafc11c..a801717f6 100644 --- a/src/dex/uniswap-v2/config.ts +++ b/src/dex/uniswap-v2/config.ts @@ -628,7 +628,7 @@ export const UniswapV2Config: DexConfigMap = { SpookySwap: { [Network.FANTOM]: { subgraphURL: - 'https://api.thegraph.com/subgraphs/name/eerieeight/spookyswap', + 'https://gateway-arbitrum.network.thegraph.com/api/1a0543db1f03e407e3cfd4f9a1e1b800/subgraphs/id/HyhMfT7gehNHMBmFiExqeg3pDtop9UikjvBPfAXT3b21', factoryAddress: '0x152ee697f2e276fa89e96742e9bb9ab1f2e61be3', initCode: '0xcdf2deca40a0bd56de8e3ce5c7df6727e5b1bf2ac96f283fa9c4b3e6b42ea9d2', From 743d3da26047ad45f1dc14eee00486f82932a8af Mon Sep 17 00:00:00 2001 From: aiden Date: Tue, 11 Jun 2024 09:07:53 -0500 Subject: [PATCH 2/3] push updates graph studio --- src/config.ts | 3 +++ src/dex/uniswap-v2/config.ts | 3 +-- src/dex/uniswap-v2/uniswap-v2.ts | 13 ++++++++++++- src/types.ts | 1 + 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/config.ts b/src/config.ts index 5018dab16..826709c80 100644 --- a/src/config.ts +++ b/src/config.ts @@ -33,6 +33,7 @@ type BaseConfig = { dexalotAuthToken?: string; smardexSubgraphAuthToken?: string; forceRpcFallbackDexs: string[]; + spookySwapSubgraphAuthToken?: string; }; const baseConfigs: { [network: number]: BaseConfig } = { @@ -256,6 +257,7 @@ const baseConfigs: { [network: number]: BaseConfig } = { privateHttpProvider: process.env.HTTP_PROVIDER_250, hashFlowAuthToken: process.env.API_KEY_HASHFLOW_AUTH_TOKEN || '', smardexSubgraphAuthToken: process.env.API_KEY_SMARDEX_SUBGRAPH || '', + spookySwapSubgraphAuthToken: process.env.API_KEY_SPOOKY_SWAP_SUBGRAPH || '', hashFlowDisabledMMs: process.env[`HASHFLOW_DISABLED_MMS_250`]?.split(',') || [], @@ -437,6 +439,7 @@ export function generateConfig(network: number): Config { dexalotAuthToken: baseConfig.dexalotAuthToken, hashFlowDisabledMMs: baseConfig.hashFlowDisabledMMs, forceRpcFallbackDexs: baseConfig.forceRpcFallbackDexs, + spookySwapSubgraphAuthToken: baseConfig.spookySwapSubgraphAuthToken, }; } diff --git a/src/dex/uniswap-v2/config.ts b/src/dex/uniswap-v2/config.ts index a801717f6..b36b9717b 100644 --- a/src/dex/uniswap-v2/config.ts +++ b/src/dex/uniswap-v2/config.ts @@ -627,8 +627,7 @@ export const UniswapV2Config: DexConfigMap = { }, SpookySwap: { [Network.FANTOM]: { - subgraphURL: - 'https://gateway-arbitrum.network.thegraph.com/api/1a0543db1f03e407e3cfd4f9a1e1b800/subgraphs/id/HyhMfT7gehNHMBmFiExqeg3pDtop9UikjvBPfAXT3b21', + subgraphURL: 'https://gateway-arbitrum.network.thegraph.com/api/', factoryAddress: '0x152ee697f2e276fa89e96742e9bb9ab1f2e61be3', initCode: '0xcdf2deca40a0bd56de8e3ce5c7df6727e5b1bf2ac96f283fa9c4b3e6b42ea9d2', diff --git a/src/dex/uniswap-v2/uniswap-v2.ts b/src/dex/uniswap-v2/uniswap-v2.ts index 45be5a2e8..eb918d44e 100644 --- a/src/dex/uniswap-v2/uniswap-v2.ts +++ b/src/dex/uniswap-v2/uniswap-v2.ts @@ -1,6 +1,6 @@ import { AbiCoder, Interface } from '@ethersproject/abi'; import _ from 'lodash'; -import { AsyncOrSync, DeepReadonly } from 'ts-essentials'; +import { AsyncOrSync, DeepReadonly, assert } from 'ts-essentials'; import erc20ABI from '../../abi/erc20.json'; import { StatefulEventSubscriber } from '../../stateful-event-subscriber'; import { @@ -244,6 +244,17 @@ export class UniswapV2 ) { super(dexHelper, dexKey); this.logger = dexHelper.getLogger(dexKey); + if (dexKey === 'SpookySwap' && network === Network.FANTOM) { + const token = dexHelper.config.data.spookySwapSubgraphAuthToken; + assert( + token !== undefined, + 'Spooky subgraph token is not specified with env variable', + ); + this.subgraphURL = + this.subgraphURL + + token + + '/subgraphs/id/HyhMfT7gehNHMBmFiExqeg3pDtop9UikjvBPfAXT3b21'; + } this.factory = new dexHelper.web3Provider.eth.Contract( uniswapV2factoryABI as any, diff --git a/src/types.ts b/src/types.ts index 73a65db7f..1568b8156 100644 --- a/src/types.ts +++ b/src/types.ts @@ -279,6 +279,7 @@ export type Config = { dexalotAuthToken?: string; smardexSubgraphAuthToken?: string; forceRpcFallbackDexs: string[]; + spookySwapSubgraphAuthToken?: string; }; export type BigIntAsString = string; From fdce2e3999a946945398b9ee0c74cf66b384a6cd Mon Sep 17 00:00:00 2001 From: aiden Date: Tue, 11 Jun 2024 14:53:44 -0500 Subject: [PATCH 3/3] Update UniswapV3Config subgraphURL --- src/dex/uniswap-v3/config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dex/uniswap-v3/config.ts b/src/dex/uniswap-v3/config.ts index 24f6bdc33..0503bdf68 100644 --- a/src/dex/uniswap-v3/config.ts +++ b/src/dex/uniswap-v3/config.ts @@ -315,7 +315,7 @@ export const UniswapV3Config: DexConfigMap = { initHash: '0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54', subgraphURL: - 'https://api.thegraph.com/subgraphs/name/0xalucard/ftm-spooky-v3', + `https://gateway-arbitrum.network.thegraph.com/api/` + process.env.API_KEY_SPOOKY_SWAP_SUBGRAPH + `/subgraphs/id/6WBxx3gYia4oCLsYMFTZs6HLEnEqVMdpeZDCABnM1tj2`, }, }, Retro: {