[R&D review] Complex and duplicated computation
QGarchery opened this issue · comments
This computation appears twice as is in this contract. This is a complex computation that computes the new index, compares it to the user index, and computes the user share of the reward. We could split this computation.
Also remark that this kind of computation appears a third time in _accrueUnclaimedRewards
, although here it is splitted in two:
- the computation of
rewardsIndexMem
- the computation of
accruedRewards
One solution would be to define a function to take care of this computation at only one place
Yep good suggestion