Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Spooky subgraph to the graph studio API #703

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type BaseConfig = {
swaapV2AuthToken?: string;
dexalotAuthToken?: string;
forceRpcFallbackDexs: string[];
spookySwapSubgraphAuthToken?: string;
};

const baseConfigs: { [network: number]: BaseConfig } = {
Expand Down Expand Up @@ -249,6 +250,9 @@ const baseConfigs: { [network: number]: BaseConfig } = {
multicallV2Address: '0xdC6E2b14260F972ad4e5a31c68294Fba7E720701',
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(',') || [],
augustusV6Address: '0x000dB803A70511E09dA650D4C0506d0000100000',
Expand Down Expand Up @@ -459,6 +463,7 @@ export function generateConfig(network: number): Config {
dexalotAuthToken: baseConfig.dexalotAuthToken,
hashFlowDisabledMMs: baseConfig.hashFlowDisabledMMs,
forceRpcFallbackDexs: baseConfig.forceRpcFallbackDexs,
spookySwapSubgraphAuthToken: baseConfig.spookySwapSubgraphAuthToken,
};
}

Expand Down
3 changes: 1 addition & 2 deletions src/dex/uniswap-v2/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -472,8 +472,7 @@ export const UniswapV2Config: DexConfigMap<DexParams> = {
},
SpookySwap: {
[Network.FANTOM]: {
subgraphURL:
'https://api.thegraph.com/subgraphs/name/eerieeight/spookyswap',
subgraphURL: 'https://gateway-arbitrum.network.thegraph.com/api/',
factoryAddress: '0x152ee697f2e276fa89e96742e9bb9ab1f2e61be3',
initCode:
'0xcdf2deca40a0bd56de8e3ce5c7df6727e5b1bf2ac96f283fa9c4b3e6b42ea9d2',
Expand Down
13 changes: 12 additions & 1 deletion src/dex/uniswap-v2/uniswap-v2.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AbiCoder, Interface } from '@ethersproject/abi';
import { pack } from '@ethersproject/solidity';
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 {
Expand Down Expand Up @@ -269,6 +269,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,
Expand Down
2 changes: 1 addition & 1 deletion src/dex/uniswap-v3/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ export const UniswapV3Config: DexConfigMap<DexParams> = {
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: {
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ export type Config = {
swaapV2AuthToken?: string;
dexalotAuthToken?: string;
forceRpcFallbackDexs: string[];
spookySwapSubgraphAuthToken?: string;
};

export type BigIntAsString = string;
Expand Down