11import { describe , expect , test } from 'vitest' ;
2- import { getStartBlockForContract } from './abi.js' ;
2+ import { NetworksRegistry } from '@pinax/graph-networks-registry' ;
3+ import { ContractService } from './contracts' ;
34
45// An object with some test cases for contract deployment block numbers
56const TEST_CONTRACT_START_BLOCKS = {
6- 'arbitrum-goerli' : {
7- '0xde438d54c7b75f798985ae38a4d07b5431702077' : 4_488_583 ,
8- } ,
97 'arbitrum-one' : {
108 '0xF4d73326C13a4Fc5FD7A064217e12780e9Bd62c3' : 226_981 ,
119 } ,
@@ -18,9 +16,6 @@ const TEST_CONTRACT_START_BLOCKS = {
1816 fantom : {
1917 '0xf731202A3cf7EfA9368C2d7bD613926f7A144dB5' : 28_771_200 ,
2018 } ,
21- goerli : {
22- '0xff02b7d59975E76F67B63b20b813a9Ec0f6AbD60' : 226_385 ,
23- } ,
2419 mainnet : {
2520 '0xc2EdaD668740f1aA35E4D8f227fB8E17dcA888Cd' : 10_736_242 ,
2621 } ,
@@ -36,6 +31,33 @@ const TEST_CONTRACT_START_BLOCKS = {
3631 optimism : {
3732 '0xc35DADB65012eC5796536bD9864eD8773aBc74C4' : 7_019_815 ,
3833 } ,
34+ celo : {
35+ '0x8084936982D089130e001b470eDf58faCA445008' : 10186627 ,
36+ } ,
37+ 'celo-alfajores' : {
38+ '0xc857ea98ab2dae9877c9fd23971152cd2776d0e4' : 9_142_263 ,
39+ } ,
40+ chapel : {
41+ '0x549fb5626025237351446ac502decdf2f3a4c570' : 25_509_955 ,
42+ } ,
43+ 'fantom-testnet' : {
44+ '0xa40f1c7cc67180aa941e9ef66ee32f704e9600a6' : 13_679_941 ,
45+ } ,
46+ fuji : {
47+ '0x7a2b3f2ca3e0b5867d44ef8bc5ba316f98e05f05' : 18_710_858 ,
48+ } ,
49+ gnosis : {
50+ '0xdDCbf776dF3dE60163066A5ddDF2277cB445E0F3' : 16655565 ,
51+ } ,
52+ aurora : {
53+ '0x76FA7f90D3900eB95Cfc58AB12c916984AeC50c8' : 77431034 ,
54+ } ,
55+ 'aurora-testnet' : {
56+ '0x76FA7f90D3900eB95Cfc58AB12c916984AeC50c8' : 77431034 ,
57+ } ,
58+ fuse : {
59+ '0x3dB01570D97631f69bbb0ba39796865456Cf89A5' : 1000000 ,
60+ } ,
3961
4062 // Skipping these networks for now because they do not support the latest etherscan contracts API or is blockScout based
4163
@@ -87,14 +109,20 @@ const TEST_CONTRACT_START_BLOCKS = {
87109} ;
88110
89111// skip this test since its time consuming
90- describe . skip ( 'getStartBlockForContract' , ( ) => {
112+ describe . sequential ( 'getStartBlockForContract' , async ( ) => {
113+ const registry = await NetworksRegistry . fromLatestVersion ( ) ;
114+ const contractService = new ContractService ( registry ) ;
91115 for ( const [ network , contracts ] of Object . entries ( TEST_CONTRACT_START_BLOCKS ) ) {
92116 for ( const [ contract , startBlockExp ] of Object . entries ( contracts ) ) {
93- test ( `Returns the start block ${ network } ${ contract } ${ startBlockExp } ` , async ( ) => {
94- //loop through the TEST_CONTRACT_START_BLOCKS object and test each network
95- const startBlock = await getStartBlockForContract ( network , contract ) ;
96- expect ( startBlock ) . toBe ( startBlockExp ) ;
97- } ) ;
117+ test (
118+ `Returns the start block ${ network } ${ contract } ${ startBlockExp } ` ,
119+ async ( ) => {
120+ //loop through the TEST_CONTRACT_START_BLOCKS object and test each network
121+ const startBlock = await contractService . getStartBlock ( network , contract ) ;
122+ expect ( parseInt ( startBlock ) ) . toBe ( startBlockExp ) ;
123+ } ,
124+ { timeout : 10000 } ,
125+ ) ;
98126 }
99127 }
100128} ) ;
0 commit comments