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

Delete pending cap when removing a market #348

Merged
merged 19 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
1 change: 1 addition & 0 deletions src/MetaMorpho.sol
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ contract MetaMorpho is ERC4626, ERC20Permit, Ownable2Step, Multicall, IMetaMorph
}

delete config[id];
delete pendingCap[id];
Copy link
Contributor

@QGarchery QGarchery Dec 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[optional] I realize now that these changes (both config[id] and pendingCap[id]) may be difficult to follow offchain with events. This requires to do the difference of sets to know which markets were removed. Maybe emitting an event here would be nice for offchain purposes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jean-Grimal marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down
6 changes: 5 additions & 1 deletion test/forge/MarketTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,10 @@ contract MarketTest is IntegrationTest {
function testUpdateWithdrawQueueRemovingDisabledMarket() public {
_setCap(allMarkets[2], 0);

vm.prank(CURATOR);
vm.startPrank(CURATOR);
vault.submitMarketRemoval(allMarkets[2].id());
vault.submitCap(allMarkets[2], CAP + 1);
vm.stopPrank();

vm.warp(block.timestamp + TIMELOCK);

Expand All @@ -179,6 +181,8 @@ contract MarketTest is IntegrationTest {
assertEq(Id.unwrap(vault.withdrawQueue(1)), Id.unwrap(expectedWithdrawQueue[1]));
assertEq(Id.unwrap(vault.withdrawQueue(2)), Id.unwrap(expectedWithdrawQueue[2]));
assertFalse(vault.config(allMarkets[2].id()).enabled);
assertEq(vault.pendingCap(allMarkets[2].id()).value, 0, "pendingCap.value");
assertEq(vault.pendingCap(allMarkets[2].id()).validAt, 0, "pendingCap.validAt");
}

function testSubmitMarketRemoval() public {
Expand Down
Loading