Skip to content

Commit

Permalink
✅ (setters) Add test setters
Browse files Browse the repository at this point in the history
  • Loading branch information
MerlinEgalite committed May 2, 2022
1 parent 5764004 commit d03e770
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions test-foundry/compound/TestGovernance.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,17 @@ contract TestGovernance is TestSetup {
assertEq(address(morpho.positionsManager()), address(positionsManagerV2));
}

function testOnlyOwnerShouldSetRewardsManager() public {
IRewardsManager rewardsManagerV2 = new RewardsManager(address(morpho));

hevm.prank(address(0));
hevm.expectRevert("Ownable: caller is not the owner");
morpho.setRewardsManager(rewardsManagerV2);

morpho.setRewardsManager(rewardsManagerV2);
assertEq(address(morpho.rewardsManager()), address(rewardsManagerV2));
}

function testOnlyOwnerShouldSetInterestRates() public {
IInterestRates interestRatesV2 = new InterestRates();

Expand All @@ -136,4 +147,31 @@ contract TestGovernance is TestSetup {
morpho.setInterestRates(interestRatesV2);
assertEq(address(morpho.interestRates()), address(interestRatesV2));
}

function testOnlyOwnerShouldSetIncentivesVault() public {
IIncentivesVault incentivesVaultV2 = new IncentivesVault(
address(morpho),
address(morphoToken),
address(1),
address(dumbOracle)
);

hevm.prank(address(0));
hevm.expectRevert("Ownable: caller is not the owner");
morpho.setIncentivesVault(incentivesVaultV2);

morpho.setIncentivesVault(incentivesVaultV2);
assertEq(address(morpho.incentivesVault()), address(incentivesVaultV2));
}

function testOnlyOwnerShouldSetTreasuryvault() public {
address treasuryVaultV2 = address(2);

hevm.prank(address(0));
hevm.expectRevert("Ownable: caller is not the owner");
morpho.setTreasuryVault(treasuryVaultV2);

morpho.setTreasuryVault(treasuryVaultV2);
assertEq(address(morpho.treasuryVault()), treasuryVaultV2);
}
}

0 comments on commit d03e770

Please sign in to comment.