Skip to content

Commit bd98d88

Browse files
committed
fix: code fixes
1 parent ed6a4d6 commit bd98d88

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/events/rewards/rewards.constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ export const LIDO_EL_REWARDS_RECEIVED_EVENT = 'event ELRewardsReceived(uint256 a
44
export const LIDO_WITHDRAWALS_RECEIVED_EVENT = 'event WithdrawalsReceived(uint256 amount)';
55
export const LIDO_TOKEN_REBASED_EVENT =
66
'event TokenRebased(uint256 indexed reportTimestamp, uint256 timeElapsed, uint256 preTotalShares, uint256 preTotalEther, uint256 postTotalShares, uint256 postTotalEther, uint256 sharesMintedAsFees)';
7+
8+
export const ONE_WEEK_HOURS = 24 * 7;

src/events/rewards/rewards.service.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
LIDO_ETH_DESTRIBUTED_EVENT,
1515
LIDO_TOKEN_REBASED_EVENT,
1616
LIDO_WITHDRAWALS_RECEIVED_EVENT,
17+
ONE_WEEK_HOURS,
1718
} from './rewards.constants';
1819
import { BigNumber } from '@ethersproject/bignumber';
1920
import { LOGGER_PROVIDER, LoggerService } from '../../common/logger';
@@ -91,15 +92,16 @@ export class RewardsService {
9192
const { clRewards, elRewards } = await this.getRewardsByBlockNumber(blockNumber, frames);
9293

9394
return {
94-
clRewards: clRewards,
95-
elRewards: elRewards,
95+
clRewards,
96+
elRewards,
9697
};
9798
}),
9899
);
99100

100101
let minCL = rewards[0].clRewards;
101102
let minEL = rewards[0].elRewards;
102103

104+
// find minimum for last week
103105
rewards.forEach((r) => {
104106
if (minCL.lt(r.clRewards)) {
105107
minCL = r.clRewards;
@@ -110,7 +112,7 @@ export class RewardsService {
110112
}
111113
});
112114

113-
const allRewards = minEL.add(minEL);
115+
const allRewards = minEL.add(minCL);
114116

115117
this.logger.log(`rewardsPerFrame are updated to ${allRewards.toString()}`, {
116118
service: RewardsService.SERVICE_LOG_NAME,
@@ -246,7 +248,7 @@ export class RewardsService {
246248

247249
// reports can be skipped, so we need timeElapsed (time from last report)
248250
protected async getFramesFromLastReports() {
249-
const weekAgoBlock = await this.getHoursAgoBlock(24 * 7);
251+
const weekAgoBlock = await this.getHoursAgoBlock(ONE_WEEK_HOURS);
250252

251253
const res = this.contractLido.filters.TokenRebased();
252254

0 commit comments

Comments
 (0)