@@ -7,6 +7,7 @@ This Source Code Form is subject to the terms of the Mozilla Public License, v.
77This Source Code Form is “Incompatible With Secondary Licenses”, as defined by the Mozilla Public License, v. 2.0.
88*/
99import PeriodicWorker from './periodic_worker' ;
10+ import Builder from '../builder' ;
1011
1112const BUNDLES_VERIFY_WORK_TYPE = 'BundlesVerify' ;
1213const STORAGE_PERIOD_DURATION = 13 * 28 * 86400 ; // in seconds
@@ -20,8 +21,6 @@ export default class HermesBundlesValidatorWorker extends PeriodicWorker {
2021 this . bundleRepository = bundleRepository ;
2122 this . bundleStoreWrapper = bundleStoreWrapper ;
2223 this . shelteringWrapper = shelteringWrapper ;
23- this . bundleStoreContract = null ;
24- this . shelteringContract = null ;
2524 }
2625
2726 async periodicWork ( ) {
@@ -33,8 +32,6 @@ export default class HermesBundlesValidatorWorker extends PeriodicWorker {
3332 }
3433 try {
3534 this . logInfo ( `Validation start` ) ;
36- this . bundleStoreContract = await this . bundleStoreWrapper . contract ( ) ;
37- this . shelteringContract = await this . shelteringWrapper . contract ( ) ;
3835
3936 const hermresBundles = await this . bundleRepository . getHermesBundles ( 0 ) ;
4037 this . logInfo ( `Hermes bundles count ${ hermresBundles . length } ` ) ;
@@ -44,7 +41,7 @@ export default class HermesBundlesValidatorWorker extends PeriodicWorker {
4441 if ( this . now ( ) > expirationTime ) {
4542 continue ; // skip expired bundles
4643 }
47- const shelterers = await this . bundleStoreContract . methods . getShelterers ( bundleId ) . call ( ) ;
44+ const shelterers = await Builder . contracts . bundleStoreWrapperContract . methods . getShelterers ( bundleId ) . call ( ) ;
4845 if ( shelterers . length === 0 ) {
4946 this . logInfo ( `No shelterers: ${ bundleId } ` ) ;
5047 }
@@ -62,7 +59,7 @@ export default class HermesBundlesValidatorWorker extends PeriodicWorker {
6259
6360 async validateAndRestoreBundle ( bundleId , shelterer ) {
6461 try {
65- const sheltererExpirationTime = await this . shelteringContract . methods . getShelteringExpirationDate ( bundleId , shelterer ) . call ( ) ;
62+ const sheltererExpirationTime = await Builder . contracts . shelteringWrapperContract . methods . getShelteringExpirationDate ( bundleId , shelterer ) . call ( ) ;
6663 if ( this . now ( ) > sheltererExpirationTime ) {
6764 throw new Error ( 'Bundle expired' ) ; // skip expired bundles (when sheltererExpirationTime < expirationTime)
6865 }
0 commit comments