Skip to content

Commit

Permalink
(refactor) Uniswap_avalanche on avalanche chain
Browse files Browse the repository at this point in the history
  • Loading branch information
isreallee82 committed May 21, 2024
1 parent cf42853 commit 755af3a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
10 changes: 10 additions & 0 deletions src/connectors/uniswap/uniswap.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ export namespace UniswapConfig {
).includes(network),
),
},
{
chain: 'avalanche',
networks: Object.keys(
ConfigManagerV2.getInstance().get('uniswap.contractAddresses'),
).filter((network) =>
Object.keys(
ConfigManagerV2.getInstance().get('avalanche.networks'),
).includes(network),
),
},
{
chain: 'polygon',
networks: Object.keys(
Expand Down
5 changes: 4 additions & 1 deletion src/connectors/uniswap/uniswap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,14 @@ import {
import { logger } from '../../services/logger';
import { percentRegexp } from '../../services/config-manager-v2';
import { Ethereum } from '../../chains/ethereum/ethereum';
import { Avalanche } from '../../chains/avalanche/avalanche';
import { Polygon } from '../../chains/polygon/polygon';
import { ExpectedTrade, Uniswapish } from '../../services/common-interfaces';
import { getAddress } from 'ethers/lib/utils';

export class Uniswap implements Uniswapish {
private static _instances: { [name: string]: Uniswap };
private chain: Ethereum | Polygon;
private chain: Ethereum | Polygon | Avalanche;
private _alphaRouter: AlphaRouter;
private _router: string;
private _v3Factory: string;
Expand All @@ -61,6 +62,8 @@ export class Uniswap implements Uniswapish {
const config = UniswapConfig.config;
if (chain === 'ethereum') {
this.chain = Ethereum.getInstance(network);
} else if (chain === 'avalanche') {
this.chain = Avalanche.getInstance(network);
} else {
this.chain = Polygon.getInstance(network);
}
Expand Down
7 changes: 0 additions & 7 deletions src/templates/ethereum.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@ networks:
tokenListType: FILE
tokenListSource: /home/gateway/conf/lists/arbitrum_rinkeby_tokens.json
nativeCurrencySymbol: ETH
avalanche:
chainID: 43114
nodeURL: https://rpc.ankr.com/avalanche
tokenListType: FILE
tokenListSource: /home/gateway/conf/lists/avalanche_tokens.json
nativeCurrencySymbol: AVAX
gasPriceRefreshInterval: 60
mainnet:
chainID: 1
nodeURL: https://rpc.ankr.com/eth
Expand Down

0 comments on commit 755af3a

Please sign in to comment.