From b69f00fba36cb71ca9da67fd1e4ad0009cda5782 Mon Sep 17 00:00:00 2001 From: mendesfabio Date: Tue, 11 Jun 2024 09:49:23 -0300 Subject: [PATCH] add frax root gauge --- manifest.template.yaml | 28 ++++++++++++++++++++++++++++ networks.yaml | 7 +++++-- schema.graphql | 1 + src/gaugeFactory.ts | 3 +++ src/utils/constants.ts | 8 ++++++++ 5 files changed, 45 insertions(+), 2 deletions(-) diff --git a/manifest.template.yaml b/manifest.template.yaml index 40c9e4d..9b57172 100644 --- a/manifest.template.yaml +++ b/manifest.template.yaml @@ -349,6 +349,34 @@ dataSources: - event: GaugeCreated(indexed address) handler: handleRootGaugeCreated {{/if}} + {{#if fraxtalRootGaugeV2Factory}} + - kind: ethereum/contract + name: FraxtalRootGaugeV2Factory + # prettier-ignore + network: {{network}} + source: + address: '{{fraxtalRootGaugeV2Factory.address}}' + abi: OptimismRootGaugeV2Factory + # prettier-ignore + startBlock: {{ fraxtalRootGaugeV2Factory.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 9546561..6fa6b74 100644 --- a/networks.yaml +++ b/networks.yaml @@ -32,8 +32,8 @@ mainnet: network: mainnet supportTraces: true graft: - base: QmbfxmF1pMSQPRtk4y4GC6Y946fNy7bjraJEp6aYpojTDt - block: 17331264 + base: QmNjLuUukf1QcSDWyYYAvSpNThLKjX3KubckiS3H2mn6rG + block: 19994775 EventEmitter: address: "0x1ACfEEA57d2ac674d7E65964f155AB9348A6C290" startBlock: 16419620 @@ -88,6 +88,9 @@ mainnet: polygonZkEVMRootGaugeV2Factory: address: "0x9bF951848288cCD87d06FaC426150262cD3447De" startBlock: 17295833 + fraxtalRootGaugeV2Factory: + address: "0x18CC3C68A5e64b40c846Aa6E45312cbcBb94f71b" + startBlock: 19994775 authorizerAdaptorEntrypoint: address: "0xf5dECDB1f3d1ee384908Fbe16D2F0348AE43a9eA" startBlock: 16042168 diff --git a/schema.graphql b/schema.graphql index e3ed3bf..01edd9a 100644 --- a/schema.graphql +++ b/schema.graphql @@ -150,6 +150,7 @@ enum Chain { Avalanche PolygonZkEvm Base + Fraxtal } type RootGauge @entity { diff --git a/src/gaugeFactory.ts b/src/gaugeFactory.ts index 722d21c..e560a3e 100644 --- a/src/gaugeFactory.ts +++ b/src/gaugeFactory.ts @@ -16,6 +16,7 @@ import { isArbitrumFactory, isAvalancheFactory, isBaseFactory, + isFraxtalFactory, isGnosisFactory, isOptimismFactory, isPolygonFactory, @@ -193,6 +194,8 @@ export function handleRootGaugeCreated(event: RootGaugeCreated): void { gauge.chain = 'PolygonZkEvm'; } else if (isBaseFactory(factoryAddress)) { gauge.chain = 'Base'; + } else if (isFraxtalFactory(factoryAddress)) { + gauge.chain = 'Fraxtal'; } gauge.save(); diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 717f6e0..de8ca2f 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -89,6 +89,10 @@ export const POLYGON_ZKEVM_ROOT_GAUGE_V2_FACTORY = Address.fromString( '0x9bF951848288cCD87d06FaC426150262cD3447De', ); +export const FRAXTAL_ROOT_GAUGE_V2_FACTORY = Address.fromString( + '0x18CC3C68A5e64b40c846Aa6E45312cbcBb94f71b', +); + export function isArbitrumFactory(factory: Address): boolean { return [ARBITRUM_ROOT_GAUGE_FACTORY, ARBITRUM_ROOT_GAUGE_V2_FACTORY].includes( factory, @@ -140,3 +144,7 @@ export function isPolygonZkEVMFactory(factory: Address): boolean { export function isBaseFactory(factory: Address): boolean { return factory == BASE_ROOT_GAUGE_V2_FACTORY; } + +export function isFraxtalFactory(factory: Address): boolean { + return factory == FRAXTAL_ROOT_GAUGE_V2_FACTORY; +}