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

zksync era support #238

Merged
merged 7 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from 6 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
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
'0x493257fd37edb34451f62edf8d2a0c418852ba4c', // USDT
'0x1d17cbcf0d6d143135ae902365d2e5e2a16538d4', // USDC
],
whitelistTokens: [
'0x5aea5775959fbc2557cc8789bc1bf90a239d9a91', // WETH
'0x3355df6d4c9c3035724fd0e3914de96a5a83aaf4', // USDC.e
'0x493257fd37edb34451f62edf8d2a0c418852ba4c', // USDT
'0x1d17cbcf0d6d143135ae902365d2e5e2a16538d4', // USDC
'0x5a7d6b2f92c77fad6ccabd7ee0624e64907eaf3e', // ZK
],
tokenOverrides: [],
poolsToSkip: [],
poolMappings: [],
}
} else {
throw new Error('Unsupported Network')
}
Expand Down
8 changes: 4 additions & 4 deletions subgraph.yaml
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keeping the mainnet version of this checked-in. but when deployed this was set to ZKSync.

Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ features:
dataSources:
- kind: ethereum/contract
name: Factory
network: base
network: mainnet
source:
address: '0x1F98431c8aD98523631AE4a59f267346ea31F984'
abi: Factory
address: "0x33128a8fC17869897dcE68Ed026d694621f6FDfD"
startBlock: 2009445
startBlock: 12369621
mapping:
kind: ethereum/events
apiVersion: 0.0.7
Expand All @@ -39,7 +39,7 @@ dataSources:
templates:
- kind: ethereum/contract
name: Pool
network: base
network: mainnet
source:
abi: Pool
mapping:
Expand Down
Loading