Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
rouzwelt committed Feb 7, 2025
1 parent 51bd633 commit be72205
Show file tree
Hide file tree
Showing 6 changed files with 413 additions and 4 deletions.
4 changes: 4 additions & 0 deletions packages/sushi/src/router/data-fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { http, PublicClient, createPublicClient } from 'viem'
import { ChainId, TestnetChainId } from '../chain/index.js'
import { publicClientConfig } from '../config/index.js'
import { Type } from '../currency/index.js'
import { AerodromeSlipstreamProvider } from './liquidity-providers/AerodromeSlipstream.js'
import { AlienBaseV2Provider } from './liquidity-providers/AlienBaseV2.js'
import { AlienBaseV3Provider } from './liquidity-providers/AlienBaseV3.js'
import { ApeSwapProvider } from './liquidity-providers/ApeSwap.js'
Expand Down Expand Up @@ -82,6 +83,7 @@ import { UniswapV2Provider } from './liquidity-providers/UniswapV2.js'
import { UniswapV3Provider } from './liquidity-providers/UniswapV3.js'
import { VVSFlawlessProvider } from './liquidity-providers/VVSFlawless.js'
import { VVSStandardProvider } from './liquidity-providers/VVSStandard.js'
import { VelodromeSlipstreamProvider } from './liquidity-providers/VelodromeSlipstream.js'
import { WagmiProvider } from './liquidity-providers/Wagmi.js'
import { WigoswapProvider } from './liquidity-providers/Wigoswap.js'
import { ZebraV2Provider } from './liquidity-providers/ZebraV2.js'
Expand Down Expand Up @@ -183,6 +185,7 @@ export class DataFetcher {
// concrete providers
this.providers = [new NativeWrapProvider(this.chainId, this.web3Client)]
;[
AerodromeSlipstreamProvider,
AlienBaseV2Provider,
AlienBaseV3Provider,
ApeSwapProvider,
Expand Down Expand Up @@ -254,6 +257,7 @@ export class DataFetcher {
UbeSwapProvider,
UniswapV2Provider,
UniswapV3Provider,
VelodromeSlipstreamProvider,
VVSStandardProvider,
VVSFlawlessProvider,
WagmiProvider,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { PublicClient } from 'viem'
import { ChainId } from '../../chain/index.js'
import { LiquidityProviders } from './LiquidityProvider.js'
import { VelodromeSlipstreamBaseProvider } from './VelodromeSlipstreamBase.js'

export class AerodromeSlipstreamProvider extends VelodromeSlipstreamBaseProvider {
constructor(chainId: ChainId, web3Client: PublicClient) {
const factory = {
[ChainId.BASE]: '0x5e7BB104d84c7CB9B682AaC2F3d509f5F406809A',
} as const
const customSwapFeeModule = {
[ChainId.BASE]: '0xF4171B0953b52Fa55462E4d76ecA1845Db69af00',
} as const
const poolImplementation = {
[ChainId.BASE]: '0xeC8E5342B19977B4eF8892e02D8DAEcfa1315831',
} as const
const tickLens = {
[ChainId.BASE]: '0x3e1116ea5034f5d73a7b530071709d54a4109f5f',
} as const
super(
chainId,
web3Client,
factory,
tickLens,
poolImplementation,
customSwapFeeModule,
)
}
getType(): LiquidityProviders {
return LiquidityProviders.AerodromeSlipstream
}
getPoolProviderName(): string {
return 'AerodromeSlipstream'
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ export enum LiquidityProviders {
EddyFinance = 'EddyFinance',
MMFinance = 'MMFinance',
VVSFlawless = 'VVSFlawless',
AerodromeSlipstream = 'AerodromeSlipstream',
VelodromeSlipstream = 'VelodromeSlipstream',
}

export abstract class LiquidityProvider {
Expand Down Expand Up @@ -236,4 +238,6 @@ export const UniV3LiquidityProviders: LiquidityProviders[] = [
LiquidityProviders.Scribe,
LiquidityProviders.Horizon,
LiquidityProviders.VVSFlawless,
LiquidityProviders.AerodromeSlipstream,
LiquidityProviders.VelodromeSlipstream,
]
Original file line number Diff line number Diff line change
Expand Up @@ -485,8 +485,7 @@ export abstract class UniswapV3BaseProvider extends LiquidityProvider {
}

getStaticPools(t1: Token, t2: Token): StaticPoolUniV3[] {
const fees = Object.values(this.FEE)
const feeList = fees.splice(fees.length / 2) as number[]
const feeList = Object.values(this.FEE).filter((v) => typeof v === 'number')
const currencyCombinations = getCurrencyCombinations(this.chainId, t1, t2)

const allCurrencyCombinationsWithAllFees: [Type, Type, number][] =
Expand Down Expand Up @@ -570,8 +569,7 @@ export abstract class UniswapV3BaseProvider extends LiquidityProvider {
}

async ensureFeeAndTicks(): Promise<boolean> {
const fees = Object.values(this.FEE)
const feeList = fees.splice(fees.length / 2) as number[]
const feeList = Object.values(this.FEE).filter((v) => typeof v === 'number')
const results = (await this.client.multicall({
multicallAddress: this.client.chain?.contracts?.multicall3
?.address as Address,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { PublicClient } from 'viem'
import { ChainId } from '../../chain/index.js'
import { LiquidityProviders } from './LiquidityProvider.js'
import { VelodromeSlipstreamBaseProvider } from './VelodromeSlipstreamBase.js'

export class VelodromeSlipstreamProvider extends VelodromeSlipstreamBaseProvider {
constructor(chainId: ChainId, web3Client: PublicClient) {
const factory = {
[ChainId.OPTIMISM]: '0xCc0bDDB707055e04e497aB22a59c2aF4391cd12F',
} as const
const customSwapFeeModule = {
[ChainId.OPTIMISM]: '0x7361E9079920fb75496E9764A2665d8ee5049D5f',
} as const
const poolImplementation = {
[ChainId.OPTIMISM]: '0xc28aD28853A547556780BEBF7847628501A3bCbb',
} as const
const tickLens = {
[ChainId.OPTIMISM]: '0x49C6FDCb3D5b2CecD8baff66c8e94b9B261ad925',
} as const
super(
chainId,
web3Client,
factory,
tickLens,
poolImplementation,
customSwapFeeModule,
)
}
getType(): LiquidityProviders {
return LiquidityProviders.VelodromeSlipstream
}
getPoolProviderName(): string {
return 'VelodromeSlipstream'
}
}
Loading

0 comments on commit be72205

Please sign in to comment.