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

expose address module #1687

Closed
wants to merge 56 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
1f116d6
docs: aggregator stack sequence diagram
matthewlilley Sep 2, 2024
183e623
chore: min lines to 1000 for pruning on everything
matthewlilley Sep 2, 2024
279f67f
chore: pruning for slipstream
matthewlilley Sep 2, 2024
4de9e6c
Merge branch 'api' of https://github.com/sushiswap/sushiswap into api
matthewlilley Sep 2, 2024
59d63c8
chore: count liquidity providers
matthewlilley Sep 2, 2024
935d280
chore: refactor and configure wagmi v3 config
matthewlilley Sep 2, 2024
991d13f
chore: configure elkv2
matthewlilley Sep 2, 2024
dcd54df
chore: print liquidity providers and network
matthewlilley Sep 2, 2024
8835a22
chore: fix elk init codes and structure extractor config
matthewlilley Sep 3, 2024
dc8ecef
config(extractor): apeswap
matthewlilley Sep 3, 2024
f69e823
config(extractor): dfyn
matthewlilley Sep 3, 2024
72c98a6
chore: extractor config templates
matthewlilley Sep 3, 2024
839ac20
config(extractor): dackieswap v2 and v3
matthewlilley Sep 3, 2024
a70a279
fix: .js
matthewlilley Sep 3, 2024
deafe5d
config(extractor): kwikswap
matthewlilley Sep 3, 2024
74bdc2d
config(extractor): shibaswap
matthewlilley Sep 3, 2024
c2afa15
config(extractor): cro defiswap
matthewlilley Sep 3, 2024
3b6181b
Merge remote-tracking branch 'origin/master' into api
matthewlilley Sep 3, 2024
75c2dbe
chore: update file for slipstream pruning
matthewlilley Sep 3, 2024
8748aa1
config(bases): add cro as ethereum base
matthewlilley Sep 3, 2024
a37943b
config(extractor): ethervista
matthewlilley Sep 3, 2024
7159c3e
config(extractor): ethervista is lame
matthewlilley Sep 3, 2024
4a3df86
fix: zod boolean params
Okavango Sep 4, 2024
3d40711
chore: preprocess boolean query params
matthewlilley Sep 4, 2024
5e114cf
feat: /swap/v3.2/ was switched off
Okavango Sep 5, 2024
1d84cbe
feat: preferSishi flag is false by default
Okavango Sep 5, 2024
af59426
chore(k8s): sizing
matthewlilley Sep 6, 2024
7c2c880
config(k8s): ethereum sizing
matthewlilley Sep 6, 2024
4de4c55
chore(k8s): extractor defaults within ratio
matthewlilley Sep 8, 2024
aee1a19
chore(k8s): use standard storage class
matthewlilley Sep 8, 2024
3b80e72
chore: use satisfies for extractor config
matthewlilley Sep 10, 2024
e16f727
config(extractor): 9inch
matthewlilley Sep 10, 2024
1d6b9b1
config(extractor): bakeryswap
matthewlilley Sep 10, 2024
3765dd6
config(extractor): squadswapv2
matthewlilley Sep 10, 2024
095419b
config(extractor): bscswap
matthewlilley Sep 10, 2024
497029b
config(extractor): netswap
matthewlilley Sep 10, 2024
bcebc43
config(extractor): mmfinance
matthewlilley Sep 10, 2024
89072e3
fix: typo
matthewlilley Sep 10, 2024
aaf8217
feat: deploy RP5 to taiko, manta, & mode
0xMasayoshi Sep 10, 2024
135b98e
feat: deploy rp5 to zklink
0xMasayoshi Sep 10, 2024
429d994
fix: + additional info for one tines error
Okavango Sep 11, 2024
d7069cd
chore: disable pruning
matthewlilley Sep 11, 2024
0084bc7
chore: move prune script to extractor api
matthewlilley Sep 11, 2024
d6b75dc
chore: re-enable pruning
matthewlilley Sep 12, 2024
7b4df2c
chore: EddyFinance extractor config on zetachain
0xMasayoshi Sep 12, 2024
fc16228
Merge branch 'api' into feat/extra-rp5-deployments
matthewlilley Sep 13, 2024
51e7424
Merge pull request #1674 from sushiswap/feat/extra-rp5-deployments
matthewlilley Sep 13, 2024
f8d6d33
Merge remote-tracking branch 'origin/master' into api
matthewlilley Sep 13, 2024
536db9c
config(extractor): curtis
matthewlilley Sep 13, 2024
97a3823
config(extractor): curtis stables
matthewlilley Sep 13, 2024
25567ac
config(extractor): curtis extractor supported chain id
matthewlilley Sep 13, 2024
c809418
config(extractor): curtis rp
matthewlilley Sep 13, 2024
b0d9381
fix: skaffold always pass env values
matthewlilley Sep 13, 2024
b8f6bb8
fix: staging values
matthewlilley Sep 13, 2024
52cb945
chore: export address module
matthewlilley Sep 14, 2024
274335e
chore(sushi): expose address module
matthewlilley Sep 14, 2024
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
5 changes: 5 additions & 0 deletions .changeset/cyan-keys-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"sushi": patch
---

expose address module
2 changes: 1 addition & 1 deletion Dockerfile.extractor-init
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM node:22-alpine

WORKDIR /app

COPY scripts/prune.ts prune.ts
COPY apis/extractor/scripts/prune.ts prune.ts

RUN npm i -g tsx@latest

Expand Down
52 changes: 52 additions & 0 deletions apis/extractor/scripts/count-liquidity-providers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/env -S pnpm tsx

import { ChainId, ChainKey } from 'sushi'
import { EXTRACTOR_CONFIG } from '../src/config'

let count = 0

const liquidityProviders: string[] = []

for (const [
chainId,
{ factoriesV2, factoriesV3, factoriesAlgebra, factoriesAerodromeSlipstream },
] of Object.entries(EXTRACTOR_CONFIG)) {
if (factoriesV2?.length) {
count += factoriesV2.length
for (const factory of factoriesV2) {
liquidityProviders.push(
`${factory.provider} (${ChainKey[chainId as keyof typeof ChainId]})`,
)
}
}
if (factoriesV3?.length) {
count += factoriesV3.length
for (const factory of factoriesV3) {
liquidityProviders.push(
`${factory.provider} (${ChainKey[chainId as keyof typeof ChainId]})`,
)
}
}
if (factoriesAlgebra?.length) {
count += factoriesAlgebra.length
for (const factory of factoriesAlgebra) {
liquidityProviders.push(
`${factory.provider} (${ChainKey[chainId as keyof typeof ChainId]})`,
)
}
}
if (factoriesAerodromeSlipstream?.length) {
count += factoriesAerodromeSlipstream.length
for (const factory of factoriesAerodromeSlipstream) {
liquidityProviders.push(
`${factory.provider} (${ChainKey[chainId as keyof typeof ChainId]})`,
)
}
}
}

console.log('Total number of liquidity providers: ', count)
console.log(
'Liquidity providers:\n',
liquidityProviders.reduce((acc, provider) => `${acc}\n${provider}`, ''),
)
29 changes: 27 additions & 2 deletions scripts/prune.ts → apis/extractor/scripts/prune.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function percentage(x: number, y: number, fixed = 2) {
async function prune(
path: string,
accessors: 'address' | ('token0' | 'token1')[],
minLines = 0,
minLines = 1000,
): Promise<[number, number, number, number]> {
let valid = 0
let invalid = 0
Expand Down Expand Up @@ -112,7 +112,7 @@ async function prune(
console.log(`Analyzing cache for chain ${chainId}...`)

const [validTokens, invalidTokens, duplicateTokens, removedTokens] =
await prune(`${cacheDir}/tokens-${chainId}`, 'address', 200)
await prune(`${cacheDir}/tokens-${chainId}`, 'address')
console.log(
`Tokens, Valid: ${validTokens} Invalid: ${invalidTokens} Duplicate: ${duplicateTokens} Removed: ${removedTokens} (${percentage(
removedTokens,
Expand Down Expand Up @@ -193,4 +193,29 @@ async function prune(
} catch (_e) {
// console.error(e)
}

try {
const [
validSlipstreamPools,
invalidSlipstreamPool,
duplicateSlipstreamPool,
removedSlipstreamPool,
] = await prune(`${cacheDir}/slipstreamV3Pools-${chainId}`, [
'token0',
'token1',
])
console.log(
`Slipstream, Valid: ${validSlipstreamPools} Invalid: ${invalidSlipstreamPool} Duplicate: ${duplicateSlipstreamPool} Removed: ${removedSlipstreamPool} (${percentage(
removedSlipstreamPool,
validSlipstreamPools,
)}%) Remaining: ${
validSlipstreamPools - removedSlipstreamPool
} (${percentage(
validSlipstreamPools - removedSlipstreamPool,
validSlipstreamPools,
)}%)`,
)
} catch (_e) {
// console.error(e)
}
})()
38 changes: 38 additions & 0 deletions apis/extractor/src/config/apeswap.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { ChainId, LiquidityProviders } from 'sushi'
import { Address, Hex } from 'viem'

const APESWAP_V2_SUPPORTED_CHAIN_IDS = [
ChainId.BSC,
ChainId.POLYGON,
ChainId.ETHEREUM,
ChainId.ARBITRUM,
ChainId.TELOS,
] as const
type ApeSwapV2ChainId = (typeof APESWAP_V2_SUPPORTED_CHAIN_IDS)[number]
const APESWAP_V2_FACTORY_ADDRESS: Record<ApeSwapV2ChainId, Address> = {
[ChainId.BSC]: '0x0841BD0B734E4F5853f0dD8d7Ea041c241fb0Da6',
[ChainId.POLYGON]: '0xCf083Be4164828f00cAE704EC15a36D711491284',
[ChainId.ETHEREUM]: '0xBAe5dc9B19004883d0377419FeF3c2C8832d7d7B',
[ChainId.ARBITRUM]: '0xCf083Be4164828f00cAE704EC15a36D711491284',
[ChainId.TELOS]: '0x411172Dfcd5f68307656A1ff35520841C2F7fAec',
} as const
const APESWAP_V2_INIT_CODE_HASH: Record<ApeSwapV2ChainId, Hex> = {
[ChainId.BSC]:
'0xf4ccce374816856d11f00e4069e7cada164065686fbef53c6167a63ec2fd8c5b',
[ChainId.POLYGON]:
'0x511f0f358fe530cda0859ec20becf391718fdf5a329be02f4c95361f3d6a42d8',
[ChainId.ETHEREUM]:
'0xe2200989b6f9506f3beca7e9c844741b3ad1a88ad978b6b0973e96d3ca4707aa',
[ChainId.ARBITRUM]:
'0xae7373e804a043c4c08107a81def627eeb3792e211fb4711fcfe32f0e4c45fd5',
[ChainId.TELOS]:
'0x7d4b9bb0d5808344c0184aada7d10aae8f6b0cc8ceb5eba8dd084f63b8c32099',
} as const
export function apeswapV2Factory(chainId: ApeSwapV2ChainId) {
return {
address: APESWAP_V2_FACTORY_ADDRESS[chainId],
provider: LiquidityProviders.ApeSwap,
initCodeHash: APESWAP_V2_INIT_CODE_HASH[chainId],
fee: 0.002, // 2
} as const
}
126 changes: 126 additions & 0 deletions apis/extractor/src/config/dackieswap.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
import { ChainId, LiquidityProviders } from 'sushi'
import { PANCAKESWAP_V3_FEE_SPACING_MAP } from 'sushi/config'
import { Address, Hex } from 'viem'

const DACKIESWAP_V2_SUPPORTED_CHAIN_IDS = [
ChainId.BASE,
ChainId.OPTIMISM,
ChainId.ARBITRUM,
ChainId.BLAST,
// ChainId.INEVM,
// ChainId.MODE,
// ChainId.XLAYER,
ChainId.LINEA,
// ChainId.SCROLL, T.B.D
// ChainId.VICTION, T.B.D
// ChainId.MANTLE, T.B.D
] as const
type DackieSwapV2ChainId = (typeof DACKIESWAP_V2_SUPPORTED_CHAIN_IDS)[number]
const DACKIESWAP_V2_FACTORY_ADDRESS: Record<DackieSwapV2ChainId, Address> = {
[ChainId.BASE]: '0x591f122D1df761E616c13d265006fcbf4c6d6551',
[ChainId.OPTIMISM]: '0xaEdc38bD52b0380b2Af4980948925734fD54FbF4',
[ChainId.ARBITRUM]: '0x507940c2469e6E3B33032F1d4FF8d123BDDe2f5C',
[ChainId.BLAST]: '0xF5190E64dB4cbf7ee5E72B55cC5b2297e20264c2',
// [ChainId.INEVM]: '0x507940c2469e6E3B33032F1d4FF8d123BDDe2f5C',
// [ChainId.MODE]: '0x757cD583004400ee67e5cC3c7A60C6a62E3F6d30',
// [ChainId.XLAYER]: '0x757cD583004400ee67e5cC3c7A60C6a62E3F6d30',
[ChainId.LINEA]: '0x9790713770039CeFcf4FAaf076E2846c9B7a4630',
// [ChainId.SCROLL]: '', T.B.D
// [ChainId.VICTION]: '', T.B.D
// [ChainId.MANTLE]: '', T.B.D
} as const
const DACKIESWAP_V2_INIT_CODE_HASH: Record<DackieSwapV2ChainId, Hex> = {
[ChainId.BASE]:
'0xaaaacde43ad77b69fcbcdc68ccb757c3c634ad20e330a951b4a267f1180c6520',
[ChainId.OPTIMISM]:
'0x6583f40d4a27d36b2f66ec686363a3fc9a3b0f4d748e788cd6e8e2773e4ee898',
[ChainId.ARBITRUM]:
'0x6583f40d4a27d36b2f66ec686363a3fc9a3b0f4d748e788cd6e8e2773e4ee898',
[ChainId.BLAST]:
'0x08b78b4ee8893b0d52edf9be019ea4e261e38b8eb1e0d7be8940645e8f95aa28',
// [ChainId.INEVM]: '0x6583f40d4a27d36b2f66ec686363a3fc9a3b0f4d748e788cd6e8e2773e4ee898',
// [ChainId.MODE]: '0x6583f40d4a27d36b2f66ec686363a3fc9a3b0f4d748e788cd6e8e2773e4ee898',
// [ChainId.XLAYER]: '0x6583f40d4a27d36b2f66ec686363a3fc9a3b0f4d748e788cd6e8e2773e4ee898',
[ChainId.LINEA]:
'0x6583f40d4a27d36b2f66ec686363a3fc9a3b0f4d748e788cd6e8e2773e4ee898',
// [ChainId.SCROLL]: '', T.B.D
// [ChainId.VICTION]: '', T.B.D
// [ChainId.MANTLE]: '', T.B.D
} as const
export function dackieSwapV2Factory(chainId: DackieSwapV2ChainId) {
return {
address: DACKIESWAP_V2_FACTORY_ADDRESS[chainId],
provider: LiquidityProviders.DackieSwapV2,
initCodeHash: DACKIESWAP_V2_INIT_CODE_HASH[chainId],
fee: 0.0025,
} as const
}

const V3_SUPPORTED_CHAIN_IDS = [
ChainId.BASE,
ChainId.OPTIMISM,
ChainId.ARBITRUM,
ChainId.BLAST,
// ChainId.INEVM,
// ChainId.MODE,
// ChainId.XLAYER,
ChainId.LINEA,
// ChainId.SCROLL, T.B.D
// ChainId.VICTION, T.B.D
// ChainId.MANTLE, T.B.D
] as const
type V3ChainId = (typeof V3_SUPPORTED_CHAIN_IDS)[number]
const V3_FACTORY_ADDRESS: Record<V3ChainId, Address> = {
[ChainId.BASE]: '0x3D237AC6D2f425D2E890Cc99198818cc1FA48870',
[ChainId.OPTIMISM]: '0xc2BC7A73613B9bD5F373FE10B55C59a69F4D617B',
[ChainId.ARBITRUM]: '0xaEdc38bD52b0380b2Af4980948925734fD54FbF4',
[ChainId.BLAST]: '0xd1575B2e0C82fba9Eddc3de9c9AAF923AFA670cC',
// [ChainId.INEVM]: '0xf79A36F6f440392C63AD61252a64d5d3C43F860D',
// [ChainId.MODE]: '0xc6f3966E5D08Ced98aC30f8B65BeAB5882Be54C7',
// [ChainId.XLAYER]: '0xc6f3966E5D08Ced98aC30f8B65BeAB5882Be54C7',
[ChainId.LINEA]: '0xc6255ec7CDb11C890d02EBfE77825976457B2470',
// [ChainId.SCROLL]: '', T.B.D
// [ChainId.VICTION]: '', T.B.D
// [ChainId.MANTLE]: '', T.B.D
} as const
const V3_DEPLOYER_ADDRESS: Record<V3ChainId, Address> = {
[ChainId.BASE]: '0x4f205D69834f9B101b9289F7AFFAc9B77B3fF9b7',
[ChainId.OPTIMISM]: '0xa466ebCfa58848Feb6D8022081f1C21a884889bB',
[ChainId.ARBITRUM]: '0xf79A36F6f440392C63AD61252a64d5d3C43F860D',
[ChainId.BLAST]: '0x6510E68561F04C1d111e616750DaC2a063FF5055',
// [ChainId.INEVM]: '0xB9010964301326160173da694c0697a2FcE82F39',
// [ChainId.MODE]: '0xE4EFb979968AE4B85a166E5e083f7B166e70Fe20',
// [ChainId.XLAYER]: '0xE4EFb979968AE4B85a166E5e083f7B166e70Fe20',
[ChainId.LINEA]: '0x46B22CD275967DDf055A567E7f36EC89eE3F1139',
// [ChainId.SCROLL]: '', T.B.D
// [ChainId.VICTION]: '', T.B.D
// [ChainId.MANTLE]: '', T.B.D
} as const
const V3_INIT_CODE_HASH: Record<V3ChainId, Hex> = {
[ChainId.BASE]:
'0x6ce8eb472fa82df5469c6ab6d485f17c3ad13c8cd7af59b3d4a8026c5ce0f7e2',
[ChainId.OPTIMISM]:
'0x6ce8eb472fa82df5469c6ab6d485f17c3ad13c8cd7af59b3d4a8026c5ce0f7e2',
[ChainId.ARBITRUM]:
'0x6ce8eb472fa82df5469c6ab6d485f17c3ad13c8cd7af59b3d4a8026c5ce0f7e2', // might not be right, couldn't verify
[ChainId.BLAST]:
'0x9173e4373ab542649f2f059b10eaab2181ad82cc2e70cf51cf9d9fa8a144a2af',
// [ChainId.INEVM]: '0x6ce8eb472fa82df5469c6ab6d485f17c3ad13c8cd7af59b3d4a8026c5ce0f7e2',
// [ChainId.MODE]: '0x6ce8eb472fa82df5469c6ab6d485f17c3ad13c8cd7af59b3d4a8026c5ce0f7e2',
// [ChainId.XLAYER]: '0x6ce8eb472fa82df5469c6ab6d485f17c3ad13c8cd7af59b3d4a8026c5ce0f7e2',
[ChainId.LINEA]:
'0x6ce8eb472fa82df5469c6ab6d485f17c3ad13c8cd7af59b3d4a8026c5ce0f7e2',
// [ChainId.SCROLL]: '', T.B.D
// [ChainId.VICTION]: '', T.B.D
// [ChainId.MANTLE]: '', T.B.D
} as const
export function dackieSwapV3Factory(chainId: V3ChainId) {
return {
address: V3_FACTORY_ADDRESS[chainId],
provider: LiquidityProviders.DackieSwapV3,
initCodeHash: V3_INIT_CODE_HASH[chainId],
deployer: V3_DEPLOYER_ADDRESS[chainId],
feeSpacingMap: PANCAKESWAP_V3_FEE_SPACING_MAP,
} as const
}
// PoolAddress
34 changes: 34 additions & 0 deletions apis/extractor/src/config/dfyn.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { ChainId, LiquidityProviders } from 'sushi'
import { Address, Hex } from 'viem'

const DFYN_V2_SUPPORTED_CHAIN_IDS = [
ChainId.POLYGON,
ChainId.OKEX,
ChainId.FANTOM,
ChainId.ARBITRUM,
] as const
type DfynV2ChainId = (typeof DFYN_V2_SUPPORTED_CHAIN_IDS)[number]
const DFYN_V2_FACTORY_ADDRESS: Record<DfynV2ChainId, Address> = {
[ChainId.POLYGON]: '0xE7Fb3e833eFE5F9c441105EB65Ef8b261266423B',
[ChainId.OKEX]: '0xE7Fb3e833eFE5F9c441105EB65Ef8b261266423B',
[ChainId.FANTOM]: '0xd9820a17053d6314B20642E465a84Bf01a3D64f5',
[ChainId.ARBITRUM]: '0xA102072A4C07F06EC3B4900FDC4C7B80b6c57429',
} as const
const DFYN_V2_INIT_CODE_HASH: Record<DfynV2ChainId, Hex> = {
[ChainId.POLYGON]:
'0xf187ed688403aa4f7acfada758d8d53698753b998a3071b06f1b777f4330eaf3',
[ChainId.OKEX]:
'0xd9fecb0a9f5bfd6ce2daf90b441ed5860c3fed2fcde57ba9819eb98d2422e418',
[ChainId.FANTOM]:
'0xd3ab2c392f54feb4b3b2a677f449b133c188ad2f1015eff3e94ea9315282c5f5',
[ChainId.ARBITRUM]:
'0xd49917af2b31d70ba7bea89230a93b55d3b6a99aacd03a72c288dfe524ec2f36',
} as const
export function dfynV2Factory(chainId: DfynV2ChainId) {
return {
address: DFYN_V2_FACTORY_ADDRESS[chainId],
provider: LiquidityProviders.Dfyn,
initCodeHash: DFYN_V2_INIT_CODE_HASH[chainId],
fee: 0.003,
} as const
}
Loading
Loading