Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(accept): dont prevent accepting parameters #145

Merged
merged 1 commit into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/MetaMorpho.sol
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ contract MetaMorpho is ERC4626, ERC20Permit, Ownable2Step, Multicall, IMetaMorph
}
}

function acceptTimelock() external timelockElapsed(pendingTimelock.submittedAt) onlyOwner {
function acceptTimelock() external timelockElapsed(pendingTimelock.submittedAt) {
_setTimelock(pendingTimelock.value);
}

Expand All @@ -178,7 +178,7 @@ contract MetaMorpho is ERC4626, ERC20Permit, Ownable2Step, Multicall, IMetaMorph
}
}

function acceptFee() external timelockElapsed(pendingFee.submittedAt) onlyOwner {
function acceptFee() external timelockElapsed(pendingFee.submittedAt) {
_setFee(pendingFee.value);
}

Expand Down Expand Up @@ -207,7 +207,7 @@ contract MetaMorpho is ERC4626, ERC20Permit, Ownable2Step, Multicall, IMetaMorph
}
}

function acceptGuardian() external timelockElapsed(pendingGuardian.submittedAt) onlyOwner {
function acceptGuardian() external timelockElapsed(pendingGuardian.submittedAt) {
_setGuardian(pendingGuardian.value);
}

Expand All @@ -231,7 +231,7 @@ contract MetaMorpho is ERC4626, ERC20Permit, Ownable2Step, Multicall, IMetaMorph
}
}

function acceptCap(Id id) external timelockElapsed(pendingCap[id].submittedAt) onlyRiskManager {
function acceptCap(Id id) external timelockElapsed(pendingCap[id].submittedAt) {
_setCap(id, pendingCap[id].value);
}

Expand Down
14 changes: 0 additions & 14 deletions test/forge/FeeTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -245,18 +245,4 @@ contract FeeTest is BaseTest {
vm.expectRevert(ErrorsLib.AlreadySet.selector);
vault.submitFee(FEE);
}

function testAcceptFeeNotOwner(uint256 fee) public {
fee = bound(fee, FEE + 1, MAX_FEE);

_setTimelock(1);

vm.prank(OWNER);
vault.submitFee(fee);

vm.warp(block.timestamp + 1);

vm.expectRevert("Ownable: caller is not the owner");
vault.acceptFee();
}
}
20 changes: 0 additions & 20 deletions test/forge/TimelockTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ contract TimelockTest is BaseTest {

vm.warp(block.timestamp + TIMELOCK);

vm.prank(OWNER);
vault.acceptTimelock();

uint256 newTimelock = vault.timelock();
Expand All @@ -91,18 +90,6 @@ contract TimelockTest is BaseTest {
vault.acceptTimelock();
}

function testAcceptTimelockNotOwner(uint256 timelock) public {
timelock = bound(timelock, 0, TIMELOCK - 1);

vm.prank(OWNER);
vault.submitTimelock(timelock);

vm.warp(block.timestamp + TIMELOCK);

vm.expectRevert("Ownable: caller is not the owner");
vault.acceptTimelock();
}

function testAcceptTimelockTimelockNotElapsed(uint256 timelock, uint256 elapsed) public {
timelock = bound(timelock, 0, TIMELOCK - 1);
elapsed = bound(elapsed, 1, TIMELOCK - 1);
Expand All @@ -112,7 +99,6 @@ contract TimelockTest is BaseTest {

vm.warp(block.timestamp + elapsed);

vm.prank(OWNER);
vm.expectRevert(ErrorsLib.TimelockNotElapsed.selector);
vault.acceptTimelock();
}
Expand All @@ -126,7 +112,6 @@ contract TimelockTest is BaseTest {

vm.warp(block.timestamp + elapsed);

vm.prank(OWNER);
vm.expectRevert(ErrorsLib.TimelockExpirationExceeded.selector);
vault.acceptTimelock();
}
Expand Down Expand Up @@ -167,7 +152,6 @@ contract TimelockTest is BaseTest {

vm.warp(block.timestamp + TIMELOCK);

vm.prank(OWNER);
vault.acceptFee();

uint256 newFee = vault.fee();
Expand All @@ -192,7 +176,6 @@ contract TimelockTest is BaseTest {

vm.warp(block.timestamp + elapsed);

vm.prank(OWNER);
vm.expectRevert(ErrorsLib.TimelockNotElapsed.selector);
vault.acceptFee();
}
Expand All @@ -206,7 +189,6 @@ contract TimelockTest is BaseTest {

vm.warp(block.timestamp + elapsed);

vm.prank(OWNER);
vm.expectRevert(ErrorsLib.TimelockExpirationExceeded.selector);
vault.acceptFee();
}
Expand All @@ -226,7 +208,6 @@ contract TimelockTest is BaseTest {

vm.warp(block.timestamp + TIMELOCK);

vm.prank(RISK_MANAGER);
vault.acceptCap(id);

(uint192 newCap, uint64 withdrawRank) = vault.config(id);
Expand All @@ -253,7 +234,6 @@ contract TimelockTest is BaseTest {

vm.warp(block.timestamp + elapsed);

vm.prank(RISK_MANAGER);
vm.expectRevert(ErrorsLib.TimelockNotElapsed.selector);
vault.acceptCap(allMarkets[0].id());
}
Expand Down
3 changes: 0 additions & 3 deletions test/forge/helpers/BaseTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ contract BaseTest is Test {

vm.warp(block.timestamp + timelock);

vm.prank(OWNER);
vault.acceptTimelock();
}

Expand All @@ -239,7 +238,6 @@ contract BaseTest is Test {

vm.warp(block.timestamp + timelock);

vm.prank(OWNER);
vault.acceptFee();
}

Expand All @@ -256,7 +254,6 @@ contract BaseTest is Test {

vm.warp(block.timestamp + timelock);

vm.prank(RISK_MANAGER);
vault.acceptCap(id);
}
}