Skip to content

Commit

Permalink
worldchain support (#247)
Browse files Browse the repository at this point in the history
* worldchain support

* keep yaml file set to mainnet
  • Loading branch information
matteenm authored Oct 16, 2024
1 parent ec5afeb commit 813cb4b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
6 changes: 6 additions & 0 deletions networks.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,11 @@
"address": "0x7145F8aeef1f6510E92164038E1B6F8cB2c42Cbb",
"startBlock": 10320368
}
},
"worldchain-mainnet": {
"Factory": {
"address": "0x7a5028BDa40e7B173C278C5342087826455ea25a",
"startBlock": 1603366
}
}
}
23 changes: 23 additions & 0 deletions src/utils/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export enum ChainId {
OPTIMISM = 10,
ZKSYNC_ERA = 324,
ZORA_MAINNET = 7777777,
WORLDCHAIN_MAINNET = 480,
}

// subgraph does not support string enums, hence these constants
Expand All @@ -29,6 +30,7 @@ const MATIC_NETWORK_NAME = 'matic'
const OPTIMISM_NETWORK_NAME = 'optimism'
const ZKSYNC_ERA_NETWORK_NAME = 'zksync-era'
const ZORA_MAINNET_NETWORK_NAME = 'zora-mainnet'
const WORLDCHAIN_MAINNET_NETWORK_NAME = 'worldchain-mainnet'

// Note: All token and pool addresses should be lowercased!
export class SubgraphConfig {
Expand Down Expand Up @@ -410,6 +412,27 @@ export function getSubgraphConfig(): SubgraphConfig {
poolsToSkip: [],
poolMappings: [],
}
} else if (selectedNetwork == WORLDCHAIN_MAINNET_NETWORK_NAME) {
return {
factoryAddress: '0x7a5028bda40e7b173c278c5342087826455ea25a',
stablecoinWrappedNativePoolAddress: '0x5f835420502a7702de50cd0e78d8aa3608b2137e', // WETH/USDC.e 0.05% pool
stablecoinIsToken0: false,
wrappedNativeAddress: '0x4200000000000000000000000000000000000006', // WETH
minimumNativeLocked: BigDecimal.fromString('1'),
stablecoinAddresses: [
'0x79a02482a880bce3f13e09da970dc34db4cd24d1', // USDC.e
],
whitelistTokens: [
'0x4200000000000000000000000000000000000006', // WETH
'0x79a02482a880bce3f13e09da970dc34db4cd24d1', // USDC.e
'0x03c7054bcb39f7b2e5b2c7acb37583e32d70cfa3', // WBTC
'0x2cfc85d8e48f8eab294be644d9e25c3030863003', // WLD
'0x859dbe24b90c9f2f7742083d3cf59ca41f55be5d', // sDAI
],
tokenOverrides: [],
poolsToSkip: [],
poolMappings: [],
}
} else {
throw new Error('Unsupported Network')
}
Expand Down

0 comments on commit 813cb4b

Please sign in to comment.