Skip to content

Commit

Permalink
fix: remove arb from v2 support (#482)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsy1218 authored Jan 31, 2024
1 parent f2e0597 commit dbd5929
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/routers/alpha-router/alpha-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,11 @@ export type AlphaRouterParams = {
* A provider for computing the portion-related data for routes and quotes.
*/
portionProvider?: IPortionProvider;

/**
* All the supported v2 chains configuration
*/
v2Supported?: ChainId[];
};

export class MapWithLowerCaseKey<V> extends Map<string, V> {
Expand Down Expand Up @@ -458,6 +463,7 @@ export class AlphaRouter
protected routeCachingProvider?: IRouteCachingProvider;
protected tokenPropertiesProvider: ITokenPropertiesProvider;
protected portionProvider: IPortionProvider;
protected v2Supported?: ChainId[];

constructor({
chainId,
Expand All @@ -483,6 +489,7 @@ export class AlphaRouter
routeCachingProvider,
tokenPropertiesProvider,
portionProvider,
v2Supported,
}: AlphaRouterParams) {
this.chainId = chainId;
this.provider = provider;
Expand Down Expand Up @@ -820,6 +827,8 @@ export class AlphaRouter
this.blockedTokenListProvider,
this.tokenValidatorProvider
);

this.v2Supported = v2Supported ?? V2_SUPPORTED;
}

public async routeToRatio(
Expand Down Expand Up @@ -1716,7 +1725,7 @@ export class AlphaRouter
const noProtocolsSpecified = protocols.length === 0;
const v3ProtocolSpecified = protocols.includes(Protocol.V3);
const v2ProtocolSpecified = protocols.includes(Protocol.V2);
const v2SupportedInChain = V2_SUPPORTED.includes(this.chainId);
const v2SupportedInChain = this.v2Supported?.includes(this.chainId);
const shouldQueryMixedProtocol =
protocols.includes(Protocol.MIXED) ||
(noProtocolsSpecified && v2SupportedInChain);
Expand Down
1 change: 0 additions & 1 deletion src/util/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export const V2_SUPPORTED = [
ChainId.GOERLI,
ChainId.SEPOLIA,
ChainId.OPTIMISM,
ChainId.ARBITRUM_ONE,
ChainId.POLYGON,
ChainId.BNB,
ChainId.AVALANCHE,
Expand Down

0 comments on commit dbd5929

Please sign in to comment.