Skip to content

Commit

Permalink
updating chain names
Browse files Browse the repository at this point in the history
  • Loading branch information
snreynolds committed Dec 13, 2021
1 parent 3122fb8 commit 4356c63
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
17 changes: 8 additions & 9 deletions src/routers/alpha-router/alpha-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ import {
} from '../../providers/v3/quote-provider';
import { IV3SubgraphProvider } from '../../providers/v3/subgraph-provider';
import { CurrencyAmount } from '../../util/amounts';
import { ChainId, ID_TO_CHAIN_ID } from '../../util/chains';
import { ChainId, ChainName, ID_TO_CHAIN_ID } from '../../util/chains';
import { log } from '../../util/log';
import { metric, MetricLoggerUnit } from '../../util/metric';
import { routeToString } from '../../util/routes';
Expand Down Expand Up @@ -284,18 +284,17 @@ export const DEFAULT_CONFIG: AlphaRouterConfig = {

const ETH_GAS_STATION_API_URL = 'https://ethgasstation.info/api/ethgasAPI.json';
// TODO: Change to prod once ready. Fill in other chains.

// ipfs urls in the following format: `https://cloudflare-ipfs.com/ipns/api.uniswap.org/v1/pools/${protocol}/${chainName}.json`;
const V3_IPFS_POOL_CACHE_URL_BY_CHAIN: { [chainId in ChainId]?: string } = {
[ChainId.MAINNET]:
'https://cloudflare-ipfs.com/ipns/api.uniswap.org/v1/pools/v3/mainnet.json',
[ChainId.RINKEBY]:
'https://cloudflare-ipfs.com/ipns/api.uniswap.org/v1/pools/v3/rinkeby.json',
// add as more chains are supported in the ipfs cache
[ChainId.MAINNET]: `https://cloudflare-ipfs.com/ipns/api.uniswap.org/v1/pools/v3/${ChainName.MAINNET}.json`,
[ChainId.RINKEBY]: `https://cloudflare-ipfs.com/ipns/api.uniswap.org/v1/pools/v3/${ChainName.RINKEBY}.json`,
};

const V2_IPFS_POOL_CACHE_URL_BY_CHAIN: { [chainId in ChainId]?: string } = {
[ChainId.MAINNET]:
'https://cloudflare-ipfs.com/ipns/api.uniswap.org/v1/pools/v2/mainnet.json',
[ChainId.RINKEBY]:
'https://cloudflare-ipfs.com/ipns/api.uniswap.org/v1/pools/v2/rinkeby.json',
[ChainId.MAINNET]: `https://cloudflare-ipfs.com/ipns/api.uniswap.org/v1/pools/v2/${ChainName.MAINNET}.json`,
[ChainId.RINKEBY]: `https://cloudflare-ipfs.com/ipns/api.uniswap.org/v1/pools/v2/${ChainName.RINKEBY}.json`,
};

export class AlphaRouter
Expand Down
7 changes: 4 additions & 3 deletions src/util/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,15 @@ export const ID_TO_CHAIN_ID = (id: number): ChainId => {
};

export enum ChainName {
// ChainNames match infura network strings
MAINNET = 'mainnet',
ROPSTEN = 'ropsten',
RINKEBY = 'rinkeby',
GÖRLI = 'goerli',
KOVAN = 'kovan',
OPTIMISM = 'optimism',
OPTIMISTIC_KOVAN = 'optimistic-kovan',
ARBITRUM_ONE = 'arbitrum',
OPTIMISM = 'optimism-mainnet',
OPTIMISTIC_KOVAN = 'optimism-kovan',
ARBITRUM_ONE = 'arbitrum-mainnet',
ARBITRUM_RINKEBY = 'arbitrum-rinkeby',
}

Expand Down

0 comments on commit 4356c63

Please sign in to comment.