From 63cc35a6b9d7002a5afcea3ed2fe6d5f02a6c02b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Mendes?= Date: Wed, 6 Sep 2023 13:28:44 -0300 Subject: [PATCH] support base root gauge factory --- manifest.template.yaml | 28 ++++++++++++++++++++++++++++ networks.yaml | 3 +++ schema.graphql | 1 + src/gaugeFactory.ts | 3 +++ src/utils/constants.ts | 7 +++++++ 5 files changed, 42 insertions(+) diff --git a/manifest.template.yaml b/manifest.template.yaml index a0a6bcb..72847a6 100644 --- a/manifest.template.yaml +++ b/manifest.template.yaml @@ -321,6 +321,34 @@ dataSources: - event: GaugeCreated(indexed address) handler: handleRootGaugeCreated {{/if}} + {{#if baseRootGaugeV2Factory}} + - kind: ethereum/contract + name: BaseRootGaugeV2Factory + # prettier-ignore + network: {{network}} + source: + address: '{{baseRootGaugeV2Factory.address}}' + abi: OptimismRootGaugeV2Factory + # prettier-ignore + startBlock: {{ baseRootGaugeV2Factory.startBlock }} + mapping: + kind: ethereum/events + apiVersion: 0.0.5 + language: wasm/assemblyscript + file: ./src/gaugeFactory.ts + abis: + - name: LiquidityGauge + file: ./abis/LiquidityGaugeV2.json + - name: ArbitrumRootGauge + file: ./abis/ArbitrumRootGauge.json + - name: OptimismRootGaugeV2Factory + file: ./abis/OptimismRootGaugeV2Factory.json + entities: + - RootGauge + eventHandlers: + - event: GaugeCreated(indexed address) + handler: handleRootGaugeCreated + {{/if}} {{#if gnosisRootGaugeV2Factory}} - kind: ethereum/contract name: GnosisRootGaugeV2Factory diff --git a/networks.yaml b/networks.yaml index ff0092e..34131ad 100644 --- a/networks.yaml +++ b/networks.yaml @@ -79,6 +79,9 @@ mainnet: avalancheRootGaugeV2Factory: address: "0x22625eEDd92c81a219A83e1dc48f88d54786B017" startBlock: 18064732 + baseRootGaugeV2Factory: + address: "0x8e3B64b3737097F283E965869e3503AA20F31E4D" + startBlock: 18077886 polygonZkEVMRootGaugeV2Factory: address: "0x9bF951848288cCD87d06FaC426150262cD3447De" startBlock: 17295833 diff --git a/schema.graphql b/schema.graphql index c3535b9..74b0044 100644 --- a/schema.graphql +++ b/schema.graphql @@ -149,6 +149,7 @@ enum Chain { Optimism Avalanche PolygonZkEvm + Base } type RootGauge @entity { diff --git a/src/gaugeFactory.ts b/src/gaugeFactory.ts index 4a79462..722d21c 100644 --- a/src/gaugeFactory.ts +++ b/src/gaugeFactory.ts @@ -15,6 +15,7 @@ import { RewardsOnlyGaugeCreated } from './types/ChildChainLiquidityGaugeFactory import { isArbitrumFactory, isAvalancheFactory, + isBaseFactory, isGnosisFactory, isOptimismFactory, isPolygonFactory, @@ -190,6 +191,8 @@ export function handleRootGaugeCreated(event: RootGaugeCreated): void { gauge.chain = 'Avalanche'; } else if (isPolygonZkEVMFactory(factoryAddress)) { gauge.chain = 'PolygonZkEvm'; + } else if (isBaseFactory(factoryAddress)) { + gauge.chain = 'Base'; } gauge.save(); diff --git a/src/utils/constants.ts b/src/utils/constants.ts index f9ea278..717f6e0 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -76,6 +76,9 @@ export const GNOSIS_ROOT_GAUGE_V2_FACTORY = Address.fromString( export const OPTIMISM_ROOT_GAUGE_V2_FACTORY = Address.fromString( '0x866D4B65694c66fbFD15Dd6fa933D0A6b3940A36', ); +export const BASE_ROOT_GAUGE_V2_FACTORY = Address.fromString( + '0x8e3B64b3737097F283E965869e3503AA20F31E4D', +); export const POLYGON_ROOT_GAUGE_V2_FACTORY = Address.fromString( '0xa98Bce70c92aD2ef3288dbcd659bC0d6b62f8F13', ); @@ -133,3 +136,7 @@ export function isAvalancheFactory(factory: Address): boolean { export function isPolygonZkEVMFactory(factory: Address): boolean { return factory == POLYGON_ZKEVM_ROOT_GAUGE_V2_FACTORY; } + +export function isBaseFactory(factory: Address): boolean { + return factory == BASE_ROOT_GAUGE_V2_FACTORY; +}