11import { expect } from 'chai'
22import hre , { ethers } from 'hardhat'
33import { NamedAccounts } from '../../../gre/type-extensions'
4+ import GraphChain from '../../../gre/helpers/network'
45
56describe ( 'Controller configuration' , ( ) => {
6- const { contracts , getNamedAccounts } = hre . graph ( )
7- const { Controller } = contracts
7+ const graph = hre . graph ( )
8+ const { Controller } = graph . contracts
89
9- const proxyContracts = [
10+ const l1ProxyContracts = [
1011 'Curation' ,
1112 'GNS' ,
1213 'DisputeManager' ,
@@ -17,10 +18,21 @@ describe('Controller configuration', () => {
1718 'L1GraphTokenGateway' ,
1819 ]
1920
21+ const l2ProxyContracts = [
22+ 'Curation' ,
23+ 'GNS' ,
24+ 'DisputeManager' ,
25+ 'EpochManager' ,
26+ 'RewardsManager' ,
27+ 'Staking' ,
28+ 'L2GraphToken' ,
29+ 'L2GraphTokenGateway' ,
30+ ]
31+
2032 let namedAccounts : NamedAccounts
2133
2234 before ( async ( ) => {
23- namedAccounts = await getNamedAccounts ( )
35+ namedAccounts = await graph . getNamedAccounts ( )
2436 } )
2537
2638 const proxyShouldMatchDeployed = async ( contractName : string ) => {
@@ -30,7 +42,7 @@ describe('Controller configuration', () => {
3042 const address = await Controller . getContractProxy (
3143 ethers . utils . solidityKeccak256 ( [ 'string' ] , [ name ] ) ,
3244 )
33- expect ( address ) . eq ( contracts [ contractName ] . address )
45+ expect ( address ) . eq ( graph . contracts [ contractName ] . address )
3446 }
3547
3648 it ( 'should be owned by governor' , async function ( ) {
@@ -44,6 +56,7 @@ describe('Controller configuration', () => {
4456 } )
4557
4658 describe ( 'proxy contract' , async function ( ) {
59+ const proxyContracts = GraphChain . isL1 ( graph . chainId ) ? l1ProxyContracts : l2ProxyContracts
4760 for ( const contract of proxyContracts ) {
4861 it ( `${ contract } should match deployed` , async function ( ) {
4962 await proxyShouldMatchDeployed ( contract )
0 commit comments