@@ -14,6 +14,7 @@ import {
14
14
LIDO_ETH_DESTRIBUTED_EVENT ,
15
15
LIDO_TOKEN_REBASED_EVENT ,
16
16
LIDO_WITHDRAWALS_RECEIVED_EVENT ,
17
+ ONE_WEEK_HOURS ,
17
18
} from './rewards.constants' ;
18
19
import { BigNumber } from '@ethersproject/bignumber' ;
19
20
import { LOGGER_PROVIDER , LoggerService } from '../../common/logger' ;
@@ -91,15 +92,16 @@ export class RewardsService {
91
92
const { clRewards, elRewards } = await this . getRewardsByBlockNumber ( blockNumber , frames ) ;
92
93
93
94
return {
94
- clRewards : clRewards ,
95
- elRewards : elRewards ,
95
+ clRewards,
96
+ elRewards,
96
97
} ;
97
98
} ) ,
98
99
) ;
99
100
100
101
let minCL = rewards [ 0 ] . clRewards ;
101
102
let minEL = rewards [ 0 ] . elRewards ;
102
103
104
+ // find minimum for last week
103
105
rewards . forEach ( ( r ) => {
104
106
if ( minCL . lt ( r . clRewards ) ) {
105
107
minCL = r . clRewards ;
@@ -110,7 +112,7 @@ export class RewardsService {
110
112
}
111
113
} ) ;
112
114
113
- const allRewards = minEL . add ( minEL ) ;
115
+ const allRewards = minEL . add ( minCL ) ;
114
116
115
117
this . logger . log ( `rewardsPerFrame are updated to ${ allRewards . toString ( ) } ` , {
116
118
service : RewardsService . SERVICE_LOG_NAME ,
@@ -246,7 +248,7 @@ export class RewardsService {
246
248
247
249
// reports can be skipped, so we need timeElapsed (time from last report)
248
250
protected async getFramesFromLastReports ( ) {
249
- const weekAgoBlock = await this . getHoursAgoBlock ( 24 * 7 ) ;
251
+ const weekAgoBlock = await this . getHoursAgoBlock ( ONE_WEEK_HOURS ) ;
250
252
251
253
const res = this . contractLido . filters . TokenRebased ( ) ;
252
254
0 commit comments