Skip to content

Commit e41fd24

Browse files
amateimaamateima
andauthored
fix: stop op rebates when threshold is reached (#526)
Co-authored-by: amateima <[email protected]>
1 parent c584d62 commit e41fd24

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/modules/rewards/services/op-rebate-service.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,17 @@ export class OpRebateService {
161161
return;
162162
}
163163

164+
const opRebatesStats = await this.opRewardsStatsRepository.findOne({ where: { id: Not(IsNull()) } });
165+
const opRebatesThreshold = ethers.utils.parseEther("749000");
166+
const isOpRebatesThresholdReached = new BigNumber(
167+
opRebatesStats.totalTokenAmount,
168+
).isGreaterThanOrEqualTo(opRebatesThreshold.toString());
169+
170+
if (isOpRebatesThresholdReached) {
171+
this.logger.verbose(`OP rebate rewards threshold reached. Skipping...`);
172+
return;
173+
}
174+
164175
const deposit: PartialDeposit = await this.depositRepository.findOne({
165176
where: { id: depositPrimaryKey },
166177
select: partialDepositKeys,

0 commit comments

Comments
 (0)