From 813cb4bfb363c2128a4e290f990657355f537e5a Mon Sep 17 00:00:00 2001 From: matteen Date: Wed, 16 Oct 2024 14:45:07 -0400 Subject: [PATCH 1/2] worldchain support (#247) * worldchain support * keep yaml file set to mainnet --- networks.json | 6 ++++++ src/utils/chains.ts | 23 +++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/networks.json b/networks.json index 1a9d863d..e2d3d019 100644 --- a/networks.json +++ b/networks.json @@ -64,5 +64,11 @@ "address": "0x7145F8aeef1f6510E92164038E1B6F8cB2c42Cbb", "startBlock": 10320368 } + }, + "worldchain-mainnet": { + "Factory": { + "address": "0x7a5028BDa40e7B173C278C5342087826455ea25a", + "startBlock": 1603366 + } } } diff --git a/src/utils/chains.ts b/src/utils/chains.ts index a0a86154..438b284a 100644 --- a/src/utils/chains.ts +++ b/src/utils/chains.ts @@ -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 @@ -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 { @@ -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') } From d44aac9c30ba20a8b1e91858400126111a172f3c Mon Sep 17 00:00:00 2001 From: matteen Date: Wed, 16 Oct 2024 18:57:45 -0400 Subject: [PATCH 2/2] add sepolia support --- networks.json | 6 ++++++ src/utils/chains.ts | 23 +++++++++++++++++++++++ subgraph.yaml | 8 ++++---- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/networks.json b/networks.json index e2d3d019..822ddcb7 100644 --- a/networks.json +++ b/networks.json @@ -70,5 +70,11 @@ "address": "0x7a5028BDa40e7B173C278C5342087826455ea25a", "startBlock": 1603366 } + }, + "sepolia": { + "Factory": { + "address": "0x0227628f3F023bb0B980b67D528571c95c6DaC1c", + "startBlock": 3518270 + } } } diff --git a/src/utils/chains.ts b/src/utils/chains.ts index 438b284a..692c8399 100644 --- a/src/utils/chains.ts +++ b/src/utils/chains.ts @@ -16,6 +16,7 @@ export enum ChainId { ZKSYNC_ERA = 324, ZORA_MAINNET = 7777777, WORLDCHAIN_MAINNET = 480, + SEPOLIA = 11155111, } // subgraph does not support string enums, hence these constants @@ -31,6 +32,7 @@ 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' +const SEPOLIA_NETWORK_NAME = 'sepolia' // Note: All token and pool addresses should be lowercased! export class SubgraphConfig { @@ -433,6 +435,27 @@ export function getSubgraphConfig(): SubgraphConfig { poolsToSkip: [], poolMappings: [], } + } else if (selectedNetwork == SEPOLIA_NETWORK_NAME) { + return { + factoryAddress: '0x0227628f3f023bb0b980b67d528571c95c6dac1c', + stablecoinWrappedNativePoolAddress: '0x6418eec70f50913ff0d756b48d32ce7c02b47c47', // USDC/WETH 1% pool + stablecoinIsToken0: true, + wrappedNativeAddress: '0xfff9976782d46cc05630d1f6ebab18b2324d6b14', // WETH + minimumNativeLocked: BigDecimal.fromString('1'), + stablecoinAddresses: [ + '0x1c7d4b196cb0c7b01d743fbc6116a902379c7238', // USDC + '0xaa8e23fb1079ea71e0a56f48a2aa51851d8433d0', // USDT + ], + whitelistTokens: [ + '0xfff9976782d46cc05630d1f6ebab18b2324d6b14', // WETH + '0x1c7d4b196cb0c7b01d743fbc6116a902379c7238', // USDC + '0xaa8e23fb1079ea71e0a56f48a2aa51851d8433d0', // USDT + '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984', // UNI, + ], + tokenOverrides: [], + poolsToSkip: [], + poolMappings: [], + } } else { throw new Error('Unsupported Network') } diff --git a/subgraph.yaml b/subgraph.yaml index 395f99b4..d7546bce 100644 --- a/subgraph.yaml +++ b/subgraph.yaml @@ -9,11 +9,11 @@ features: dataSources: - kind: ethereum/contract name: Factory - network: mainnet + network: sepolia source: - address: '0x1F98431c8aD98523631AE4a59f267346ea31F984' + address: "0x0227628f3F023bb0B980b67D528571c95c6DaC1c" abi: Factory - startBlock: 12369621 + startBlock: 3518270 mapping: kind: ethereum/events apiVersion: 0.0.7 @@ -39,7 +39,7 @@ dataSources: templates: - kind: ethereum/contract name: Pool - network: mainnet + network: sepolia source: abi: Pool mapping: