aave/protocol-v2

Make StaticATokenLM compatible with aTokens without a incentives controller

LHerskind opened this issue · 0 comments

The current StaticATokenLM contract is unable to wrap aTokens that do not have an incentives controller.

To handle those aTokens, the contract should have some functions be noop and others return 0 when the incentives controller is undefined.

A try is added in the initialize to handle the case where no incentives controller exists in the aToken.

Functions that are made noop when no incentives controller:

  • _beforeTokenTransfer()
  • _updateRewards()
  • collectAndUpdateRewards
  • claimRewardsOnBehalf()
  • claimRewards()
  • claimRewardsToSelf()

Functions to return 0 with no incentives controller:

  • _getPendingRewards()
  • getTotalClaimableRewards()

claimRewardsOnBehalf will not be able to look for the user approved claimer because it doesn't know the incentives controller. It will therefore pass but perform noop, to not break any contracts relying on the claim.