Skip to content

Commit

Permalink
move subgraph api key to config
Browse files Browse the repository at this point in the history
  • Loading branch information
aburkut committed Oct 10, 2023
1 parent 76817f1 commit b2079b1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type BaseConfig = {
hashFlowAuthToken?: string;
hashFlowDisabledMMs: string[];
swaapV2AuthToken?: string;
smardexSubgraphAuthToken?: string;
forceRpcFallbackDexs: string[];
};

Expand Down Expand Up @@ -58,6 +59,7 @@ const baseConfigs: { [network: number]: BaseConfig } = {
'0xF9234CB08edb93c0d4a4d4c70cC3FfD070e78e07',
rpcPollingMaxAllowedStateDelayInBlocks: 0,
rpcPollingBlocksBackToTriggerUpdate: 0,
smardexSubgraphAuthToken: process.env.API_KEY_SMARDEX_SUBGRAPH || '',
swaapV2AuthToken: process.env.API_KEY_SWAAP_V2_AUTH_TOKEN || '',
hashFlowAuthToken: process.env.API_KEY_HASHFLOW_AUTH_TOKEN || '',
hashFlowDisabledMMs:
Expand Down Expand Up @@ -158,6 +160,7 @@ const baseConfigs: { [network: number]: BaseConfig } = {
tokenTransferProxyAddress: '0x216b4b4ba9f3e719726886d34a177484278bfcae',
multicallV2Address: '0xC50F4c1E81c873B2204D7eFf7069Ffec6Fbe136D',
privateHttpProvider: process.env.HTTP_PROVIDER_56,
smardexSubgraphAuthToken: process.env.API_KEY_SMARDEX_SUBGRAPH || '',
hashFlowAuthToken: process.env.API_KEY_HASHFLOW_AUTH_TOKEN || '',
hashFlowDisabledMMs:
process.env[`HASHFLOW_DISABLED_MMS_56`]?.split(',') || [],
Expand Down Expand Up @@ -186,6 +189,7 @@ const baseConfigs: { [network: number]: BaseConfig } = {
tokenTransferProxyAddress: '0x216b4b4ba9f3e719726886d34a177484278bfcae',
multicallV2Address: '0x275617327c958bD06b5D6b871E7f491D76113dd8',
privateHttpProvider: process.env.HTTP_PROVIDER_137,
smardexSubgraphAuthToken: process.env.API_KEY_SMARDEX_SUBGRAPH || '',
hashFlowAuthToken: process.env.API_KEY_HASHFLOW_AUTH_TOKEN || '',
hashFlowDisabledMMs:
process.env[`HASHFLOW_DISABLED_MMS_137`]?.split(',') || [],
Expand Down Expand Up @@ -272,6 +276,7 @@ const baseConfigs: { [network: number]: BaseConfig } = {
tokenTransferProxyAddress: '0x216b4b4ba9f3e719726886d34a177484278bfcae',
multicallV2Address: '0x7eCfBaa8742fDf5756DAC92fbc8b90a19b8815bF',
privateHttpProvider: process.env.HTTP_PROVIDER_42161,
smardexSubgraphAuthToken: process.env.API_KEY_SMARDEX_SUBGRAPH || '',
hashFlowAuthToken: process.env.API_KEY_HASHFLOW_AUTH_TOKEN || '',
hashFlowDisabledMMs:
process.env[`HASHFLOW_DISABLED_MMS_42161`]?.split(',') || [],
Expand Down Expand Up @@ -358,6 +363,7 @@ const baseConfigs: { [network: number]: BaseConfig } = {
augustusRFQAddress: '0xa003dFBA51C9e1e56C67ae445b852bdEd7aC5EEd',
tokenTransferProxyAddress: '0x93aAAe79a53759cD164340E4C8766E4Db5331cD7',
multicallV2Address: '0xeDF6D2a16e8081F777eB623EeB4411466556aF3d',
smardexSubgraphAuthToken: process.env.API_KEY_SMARDEX_SUBGRAPH || '',
privateHttpProvider: process.env.HTTP_PROVIDER_8453,
hashFlowAuthToken: process.env.API_KEY_HASHFLOW_AUTH_TOKEN || '',
hashFlowDisabledMMs: [],
Expand Down Expand Up @@ -415,6 +421,7 @@ export function generateConfig(network: number): Config {
hashFlowAuthToken: baseConfig.hashFlowAuthToken,
swaapV2AuthToken: baseConfig.swaapV2AuthToken,
hashFlowDisabledMMs: baseConfig.hashFlowDisabledMMs,
smardexSubgraphAuthToken: baseConfig.smardexSubgraphAuthToken,
forceRpcFallbackDexs: baseConfig.forceRpcFallbackDexs,
};
}
Expand Down
3 changes: 1 addition & 2 deletions src/dex/smardex/smardex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ export class Smardex
implements IDex<SmardexData, SmardexParam>
{
pairs: { [key: string]: SmardexPair } = {};
// feeFactor = 10000;
factory: Contract;

routerInterface: Interface;
Expand Down Expand Up @@ -805,7 +804,7 @@ export class Smardex
variables: { token: tokenAddress.toLowerCase(), limit },
},
SUBGRAPH_TIMEOUT,
{ 'x-api-key': process.env.API_KEY_SMARDEX_SUBGRAPH! },
{ 'x-api-key': this.dexHelper.config.data.smardexSubgraphAuthToken! },
);

if (!(data && data.pools0 && data.pools1))
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ export type Config = {
hashFlowDisabledMMs: string[];
uniswapV3EventLoggingSampleRate?: number;
swaapV2AuthToken?: string;
smardexSubgraphAuthToken?: string,
forceRpcFallbackDexs: string[];
};

Expand Down

0 comments on commit b2079b1

Please sign in to comment.