aave / aave-utilities

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Remove incentive calculation from generalized methods.

sakulstra opened this issue · comments

commented

Currently formatReserves does a lot besides formatting the reserve. Reward incentive calculation should not be part of it, because:
a) most reserves don't have rewards
b) you might not be interested in rewards
c) in the future we might have multiple rewards per reserve

Therefore my suggestion would be to not do it at all in formatReserves and move the responsibility to userland via calculateAPYs or similar. Once we know exactly how this will work in the future we might add an additional helper method to calculate multiple incentives at once, but that's not needed yet.

  • remove incentive calculation from formatReserve
  • remove incentive calculation from formatUserReserve
  • expose helper methods to do it on demand for a reserve or userReserve

I would not put it in user, as the incentives are per reserve. I would create another separate method specific to calculate the incentives of a reserve.

The incentives part regarding the user. its only to calculate the reward that a user has, so its completely different than the reserve incentive api.

In my opinion, i think that doing a helper specific for this is the way to go. In fact it could also have methods for the user reward calculation, as i think this should also be extracted, as if the network does not have incentives, it doesnt make sense for the user to calculate its rewards

@aschmidt20 once PR above is done you can use that in your user reserve one