Skip to content

Commit

Permalink
support base root gauge factory
Browse files Browse the repository at this point in the history
  • Loading branch information
mendesfabio committed Sep 6, 2023
1 parent ea82261 commit 63cc35a
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 0 deletions.
28 changes: 28 additions & 0 deletions manifest.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions networks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ mainnet:
avalancheRootGaugeV2Factory:
address: "0x22625eEDd92c81a219A83e1dc48f88d54786B017"
startBlock: 18064732
baseRootGaugeV2Factory:
address: "0x8e3B64b3737097F283E965869e3503AA20F31E4D"
startBlock: 18077886
polygonZkEVMRootGaugeV2Factory:
address: "0x9bF951848288cCD87d06FaC426150262cD3447De"
startBlock: 17295833
Expand Down
1 change: 1 addition & 0 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ enum Chain {
Optimism
Avalanche
PolygonZkEvm
Base
}

type RootGauge @entity {
Expand Down
3 changes: 3 additions & 0 deletions src/gaugeFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { RewardsOnlyGaugeCreated } from './types/ChildChainLiquidityGaugeFactory
import {
isArbitrumFactory,
isAvalancheFactory,
isBaseFactory,
isGnosisFactory,
isOptimismFactory,
isPolygonFactory,
Expand Down Expand Up @@ -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();
Expand Down
7 changes: 7 additions & 0 deletions src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
);
Expand Down Expand Up @@ -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;
}

0 comments on commit 63cc35a

Please sign in to comment.