Skip to content

Commit

Permalink
zksync support
Browse files Browse the repository at this point in the history
  • Loading branch information
matteenm committed Jul 2, 2024
1 parent 99a325a commit c43107d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
6 changes: 6 additions & 0 deletions networks.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,11 @@
"address": "0x1F98431c8aD98523631AE4a59f267346ea31F984",
"startBlock": 0
}
},
"zksync-era": {
"Factory": {
"address": "0x8FdA5a7a8dCA67BBcDd10F02Fa0649A937215422",
"startBlock": 12637075
}
}
}
25 changes: 25 additions & 0 deletions src/utils/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export enum ChainId {
MAINNET = 1,
MATIC = 137,
OPTIMISM = 10,
ZKSYNC_ERA = 324,
}

// subgraph does not support string enums, hence these constants
Expand All @@ -25,6 +26,7 @@ const CELO_NETWORK_NAME = 'celo'
const MAINNET_NETWORK_NAME = 'mainnet'
const MATIC_NETWORK_NAME = 'matic'
const OPTIMISM_NETWORK_NAME = 'optimism'
const ZKSYNC_ERA_NETWORK_NAME = 'zksync-era'

// Note: All token and pool addresses should be lowercased!
export class SubgraphConfig {
Expand Down Expand Up @@ -358,6 +360,29 @@ export function getSubgraphConfig(): SubgraphConfig {
],
poolMappings: OPTIMISM_POOL_MAPPINGS,
}
} else if (selectedNetwork == ZKSYNC_ERA_NETWORK_NAME) {
return {
factoryAddress: '0x8fda5a7a8dca67bbcdd10f02fa0649a937215422',
stablecoinWrappedNativePoolAddress: '0x3e3dd517fec2e70eddba2a626422a4ba286e8c38', // USDC.e/WETH 0.05% pool
stablecoinIsToken0: true,
wrappedNativeAddress: '0x5aea5775959fbc2557cc8789bc1bf90a239d9a91', // WETH
minimumNativeLocked: BigDecimal.fromString('1'),
stablecoinAddresses: [
'0x3355df6d4c9c3035724fd0e3914de96a5a83aaf4', // USDC.e
'0xa07028b453a1f6ac277e93f3a0ea73b4be5c7d63', // USDT
'0x1d17cbcf0d6d143135ae902365d2e5e2a16538d4' // USDC
],
whitelistTokens: [
'0x5aea5775959fbc2557cc8789bc1bf90a239d9a91', // WETH
'0x3355df6d4c9c3035724fd0e3914de96a5a83aaf4', // USDC.e
'0xa07028b453a1f6ac277e93f3a0ea73b4be5c7d63', // USDT
'0x1d17cbcf0d6d143135ae902365d2e5e2a16538d4', // USDC
'0x5a7d6b2f92c77fad6ccabd7ee0624e64907eaf3e', // ZK
],
tokenOverrides: [],
poolsToSkip: [],
poolMappings: [],
}
} else {
throw new Error('Unsupported Network')
}
Expand Down

0 comments on commit c43107d

Please sign in to comment.