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

fix: remove arb from v2 support #482

Merged
merged 4 commits into from
Jan 31, 2024
Merged
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
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
Loading