11import farmed from "../farming.json" ;
2+ import farmed2 from "../farming2.json" ;
3+ import farmed3 from "../farming3.json" ;
4+ import farmed4 from "../farming4.json" ;
5+ import farmed5 from "../farming5.json" ;
6+ import farmed6 from "../farming6.json" ;
7+ import farmed7 from "../farming7.json" ;
8+ import farmed8 from "../farming8.json" ;
9+ import farmed9 from "../farming9.json" ;
10+ import farmed10 from "../farming10.json" ;
11+ import farmed11 from "../farming11.json" ;
12+ import farmed12 from "../farming12.json" ;
13+
214import { ethers , network } from "hardhat" ;
315import { chunk } from "lodash" ;
416import contracts from "../releases/deployment.json" ;
@@ -7,16 +19,78 @@ const main = async () => {
719 const signer = ( await ethers . getSigners ( ) ) [ 0 ] ;
820
921 console . log ( "signer" , signer . address ) ;
22+ if ( signer . address !== "0x88c11F1fFF51a7D3843Bdf1D9d16eafAda01e0f0" ) {
23+ console . error ( "Please use the correct signer with the ADMIN_KEY environment variable" ) ;
24+ return ;
25+ }
1026 const whitelist = await ethers . getContractAt ( "BulkWhitelist" , contracts [ network . name ] . BulkWhitelist ) ;
11- const chunks = chunk ( farmed , 300 ) ;
27+ const notReVerified = farmed12 . filter (
28+ addr =>
29+ ! (
30+ farmed11 . includes ( addr ) ||
31+ farmed10 . includes ( addr ) ||
32+ farmed9 . includes ( addr ) ||
33+ farmed8 . includes ( addr ) ||
34+ farmed7 . includes ( addr ) ||
35+ farmed6 . includes ( addr ) ||
36+ farmed5 . includes ( addr ) ||
37+ farmed . includes ( addr ) ||
38+ farmed2 . includes ( addr ) ||
39+ farmed3 . includes ( addr ) ||
40+ farmed4 . includes ( addr )
41+ )
42+ ) ;
43+ console . log ( `not re-verified count out of ${ farmed12 . length } :` , notReVerified . length ) ;
44+ const chunks = chunk ( notReVerified , 100 ) . slice ( 0 ) ;
45+ let nonce = await signer . getTransactionCount ( ) ;
46+ let batchSize = 2 ;
47+ let gasLimit = 6000000 ;
48+ let txs = [ ] ;
49+ console . log ( "starting nonce:" , nonce ) ;
50+ switch ( network . name ) {
51+ case "production-celo" :
52+ batchSize = 10 ; // to avoid tx replacement
53+ break ;
54+ case "production-xdc" :
55+ batchSize = 20 ;
56+ gasLimit = 10000000 ;
57+
58+ break ;
59+ case "production" :
60+ batchSize = 10 ;
61+ break ;
62+ }
1263 for ( let batch of chunks ) {
13- console . log ( "whitelisting batch of" , batch . length , batch [ 0 ] , batch [ batch . length - 1 ] ) ;
14- const res = await ( await whitelist . connect ( signer ) . removeWhitelisted ( batch , { gasLimit : 25000000 } ) ) . wait ( ) ;
15- console . log ( "tx:" , res . transactionHash ) ;
64+ console . log ( "remove whitelisting batch of" , batch . length , batch [ 0 ] , batch [ batch . length - 1 ] , { nonce } ) ;
65+ if ( batchSize > 1 ) {
66+ txs . push (
67+ whitelist
68+ . connect ( signer )
69+ . removeWhitelisted ( batch , { gasLimit, nonce : nonce ++ } )
70+ . then ( _ => _ . wait ( ) )
71+ ) ;
72+ if ( txs . length < batchSize && batch . length === 100 ) continue ;
73+ console . log ( "queued txs:" , txs . length ) ;
74+ const results = await Promise . allSettled ( txs ) ;
75+ const success = results . filter ( r => r . status === "fulfilled" ) . map ( _ => _ . value ) ;
76+ console . log (
77+ `completed txs: ${ success . length } /${ txs . length } ` ,
78+ success . map ( r => r . transactionHash )
79+ ) ;
80+ nonce = await signer . getTransactionCount ( ) ;
81+
82+ txs = [ ] ;
83+ } else {
84+ const res = await ( await whitelist . connect ( signer ) . removeWhitelisted ( batch , { gasLimit } ) ) . wait ( ) ;
85+ console . log ( "tx:" , res . transactionHash ) ;
86+ }
1687 }
1788} ;
1889
1990const checkReVerified = async ( ) => {
91+ // get intersection of farmed and farmed2
92+ const reVerified = farmed3 . filter ( addr => farmed . includes ( addr ) || farmed2 . includes ( addr ) ) ;
93+ console . log ( "re-verified count:" , reVerified . length ) ;
2094 const chunks = chunk ( farmed , 300 ) ;
2195 let total = 0 ;
2296 for ( let batch of chunks ) {
@@ -27,5 +101,5 @@ const checkReVerified = async () => {
27101 }
28102 console . log ( `total: ${ total } /${ farmed . length } ` ) ;
29103} ;
30- checkReVerified ( ) ;
31- // main().catch(console.log);
104+ // checkReVerified();
105+ main ( ) . catch ( console . log ) ;
0 commit comments