diff --git a/manifest.template.yaml b/manifest.template.yaml index f022e50..d5bf08f 100644 --- a/manifest.template.yaml +++ b/manifest.template.yaml @@ -349,6 +349,62 @@ dataSources: - event: GaugeCreated(indexed address) handler: handleRootGaugeCreated {{/if}} + {{#if avalancheRootGaugeV2Factory}} + - kind: ethereum/contract + name: AvalancheRootGaugeV2Factory + # prettier-ignore + network: {{network}} + source: + address: '{{avalancheRootGaugeV2Factory.address}}' + abi: AvalancheRootGaugeV2Factory + # prettier-ignore + startBlock: {{ avalancheRootGaugeV2Factory.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 # required for binding + - name: AvalancheRootGaugeV2Factory + file: ./abis/OptimismRootGaugeV2Factory.json # has the same GaugeCreated event + entities: + - RootGauge + eventHandlers: + - event: GaugeCreated(indexed address) + handler: handleRootGaugeCreated + {{/if}} + {{#if polygonZkEVMRootGaugeV2Factory}} + - kind: ethereum/contract + name: PolygonZkEVMRootGaugeV2Factory + # prettier-ignore + network: {{network}} + source: + address: '{{polygonZkEVMRootGaugeV2Factory.address}}' + abi: PolygonZkEVMRootGaugeV2Factory + # prettier-ignore + startBlock: {{ polygonZkEVMRootGaugeV2Factory.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 # required for binding + - name: PolygonZkEVMRootGaugeV2Factory + file: ./abis/OptimismRootGaugeV2Factory.json # has the same GaugeCreated event + entities: + - RootGauge + eventHandlers: + - event: GaugeCreated(indexed address) + handler: handleRootGaugeCreated + {{/if}} {{#if childChainGaugeFactory}} - kind: ethereum/contract name: ChildChainLiquidityGaugeFactory diff --git a/networks.yaml b/networks.yaml index 60564d5..7028dbf 100644 --- a/networks.yaml +++ b/networks.yaml @@ -76,6 +76,12 @@ mainnet: gnosisRootGaugeV2Factory: address: "0x2a18B396829bc29F66a1E59fAdd7a0269A6605E8" startBlock: 16687758 + avalancheRootGaugeV2Factory: + address: "0x10f3e79911A490aa5B5D5CDA6F111029c4Eab5AC" + startBlock: 17396953 + polygonZkEVMRootGaugeV2Factory: + address: "0x9bF951848288cCD87d06FaC426150262cD3447De" + startBlock: 17295833 authorizerAdaptorEntrypoint: address: "0xf5dECDB1f3d1ee384908Fbe16D2F0348AE43a9eA" startBlock: 16042168 diff --git a/schema.graphql b/schema.graphql index c02ded4..379782a 100644 --- a/schema.graphql +++ b/schema.graphql @@ -147,6 +147,8 @@ enum Chain { Gnosis Polygon Optimism + Avalanche + zkEVM } type RootGauge @entity { diff --git a/src/gaugeFactory.ts b/src/gaugeFactory.ts index 9d644fa..91a6d38 100644 --- a/src/gaugeFactory.ts +++ b/src/gaugeFactory.ts @@ -14,9 +14,11 @@ import { getPoolEntity, getPoolId, isPoolRegistered } from './utils/misc'; import { RewardsOnlyGaugeCreated } from './types/ChildChainLiquidityGaugeFactory/ChildChainLiquidityGaugeFactory'; import { isArbitrumFactory, + isAvalancheFactory, isGnosisFactory, isOptimismFactory, isPolygonFactory, + isPolygonZkEVMFactory, } from './utils/constants'; import { GaugeCreated as LiquidityGaugeCreated } from './types/GaugeV2Factory/GaugeV2Factory'; import { GaugeCreated as RootGaugeCreated } from './types/ArbitrumRootGaugeV2Factory/ArbitrumRootGaugeV2Factory'; @@ -181,6 +183,10 @@ export function handleRootGaugeCreated(event: RootGaugeCreated): void { gauge.chain = 'Polygon'; } else if (isGnosisFactory(factoryAddress)) { gauge.chain = 'Gnosis'; + } else if (isAvalancheFactory(factoryAddress)) { + gauge.chain = 'Avalanche'; + } else if (isPolygonZkEVMFactory(factoryAddress)) { + gauge.chain = 'zkEVM'; } gauge.save(); diff --git a/src/utils/constants.ts b/src/utils/constants.ts index f55569a..9de7c75 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -73,6 +73,12 @@ export const OPTIMISM_ROOT_GAUGE_V2_FACTORY = Address.fromString( export const POLYGON_ROOT_GAUGE_V2_FACTORY = Address.fromString( '0xa98Bce70c92aD2ef3288dbcd659bC0d6b62f8F13', ); +export const AVALANCHE_ROOT_GAUGE_V2_FACTORY = Address.fromString( + '0x10f3e79911A490aa5B5D5CDA6F111029c4Eab5AC', +); +export const POLYGON_ZKEVM_ROOT_GAUGE_V2_FACTORY = Address.fromString( + '0x9bF951848288cCD87d06FaC426150262cD3447De', +); export function isArbitrumFactory(factory: Address): boolean { return [ARBITRUM_ROOT_GAUGE_FACTORY, ARBITRUM_ROOT_GAUGE_V2_FACTORY].includes( @@ -107,3 +113,11 @@ export function isPolygonFactory(factory: Address): boolean { export function isGnosisFactory(factory: Address): boolean { return factory == GNOSIS_ROOT_GAUGE_V2_FACTORY; } + +export function isAvalancheFactory(factory: Address): boolean { + return factory == AVALANCHE_ROOT_GAUGE_V2_FACTORY; +} + +export function isPolygonZkEVMFactory(factory: Address): boolean { + return factory == POLYGON_ZKEVM_ROOT_GAUGE_V2_FACTORY; +}