Skip to content

Commit

Permalink
address 5 Lack of zero address check for INCENTIVES_CONTROLLER
Browse files Browse the repository at this point in the history
  • Loading branch information
kyzia551 committed Oct 24, 2024
1 parent c4d7d15 commit c651e35
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ abstract contract ERC20AaveLMUpgradeable is ERC20Upgradeable, IERC20AaveLM {
IRewardsController public immutable INCENTIVES_CONTROLLER;

constructor(IRewardsController rewardsController) {
if (address(rewardsController) == address(0)) {
revert ZeroIncentivesControllerIsForbidden();
}
INCENTIVES_CONTROLLER = rewardsController;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ interface IERC20AaveLM {
uint248 lastUpdatedIndex;
}

error ZeroIncentivesControllerIsForbidden();
error InvalidClaimer(address claimer);
error RewardNotInitialized(address reward);

Expand Down
5 changes: 5 additions & 0 deletions tests/extensions/static-a-token/ERC20AaveLMUpgradable.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ contract ERC20AaveLMUpgradableTest is TestnetProcedures {
);
}

function test_zeroIncentivesController() external {
vm.expectRevert(IERC20AaveLM.ZeroIncentivesControllerIsForbidden.selector);
new MockERC20AaveLMUpgradeable(IRewardsController(address(0)));
}

function test_noRewardsInitialized() external {
vm.expectRevert(
abi.encodeWithSelector(IERC20AaveLM.RewardNotInitialized.selector, rewardToken)
Expand Down

0 comments on commit c651e35

Please sign in to comment.