From d03e770be97b8230ed04d5d0a02d3b09c6070a4c Mon Sep 17 00:00:00 2001 From: MerlinEgalite <44097430+MerlinEgalite@users.noreply.github.com> Date: Mon, 2 May 2022 10:29:32 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20(setters)=20Add=20test=20setters?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test-foundry/compound/TestGovernance.t.sol | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/test-foundry/compound/TestGovernance.t.sol b/test-foundry/compound/TestGovernance.t.sol index 52b3684d9..b819fd9cc 100644 --- a/test-foundry/compound/TestGovernance.t.sol +++ b/test-foundry/compound/TestGovernance.t.sol @@ -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(); @@ -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); + } }