-
Notifications
You must be signed in to change notification settings - Fork 2
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
Update lastTotalAsset in updateWithdrawQueue #2
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -152,7 +152,59 @@ contract MarketTest is IntegrationTest { | |
assertEq(Id.unwrap(vault.withdrawQueue(3)), Id.unwrap(expectedWithdrawQueue[3])); | ||
} | ||
|
||
function testUpdateWithdrawQueueRemovingDisabledMarket() public { | ||
function testUpdateWithdrawQueueRemovingDisabledMarket(uint256 firstAmountSupplied, uint256 secondAmountSupplied) | ||
public | ||
{ | ||
firstAmountSupplied = bound(firstAmountSupplied, MIN_TEST_ASSETS, MAX_TEST_ASSETS); | ||
secondAmountSupplied = bound(secondAmountSupplied, MIN_TEST_ASSETS, MAX_TEST_ASSETS); | ||
|
||
_setCap(allMarkets[0], firstAmountSupplied); | ||
_setCap(allMarkets[1], secondAmountSupplied); | ||
|
||
Id[] memory supplyQueue = new Id[](2); | ||
supplyQueue[0] = allMarkets[0].id(); | ||
supplyQueue[1] = allMarkets[1].id(); | ||
|
||
_setCap(allMarkets[0], firstAmountSupplied); | ||
_setCap(allMarkets[1], secondAmountSupplied); | ||
vm.prank(ALLOCATOR); | ||
vault.setSupplyQueue(supplyQueue); | ||
|
||
loanToken.setBalance(SUPPLIER, firstAmountSupplied + secondAmountSupplied); | ||
|
||
vm.prank(SUPPLIER); | ||
vault.deposit(firstAmountSupplied + secondAmountSupplied, ONBEHALF); | ||
|
||
_setCap(allMarkets[1], 0); | ||
|
||
vm.prank(CURATOR); | ||
vault.submitMarketRemoval(allMarkets[1].id()); | ||
|
||
vm.warp(block.timestamp + TIMELOCK); | ||
|
||
uint256[] memory indexes = new uint256[](3); | ||
indexes[0] = 0; | ||
indexes[1] = 1; | ||
indexes[2] = 3; | ||
|
||
Id[] memory expectedWithdrawQueue = new Id[](3); | ||
expectedWithdrawQueue[0] = idleParams.id(); | ||
expectedWithdrawQueue[1] = allMarkets[0].id(); | ||
expectedWithdrawQueue[2] = allMarkets[2].id(); | ||
|
||
vm.expectEmit(); | ||
emit EventsLib.SetWithdrawQueue(ALLOCATOR, expectedWithdrawQueue); | ||
Comment on lines
+195
to
+196
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cool to have tested this here but I think it's out of context, better than removing it now, but next time I think it's better to have isolated purpose tests 😁 |
||
vm.prank(ALLOCATOR); | ||
vault.updateWithdrawQueue(indexes); | ||
|
||
assertEq(Id.unwrap(vault.withdrawQueue(0)), Id.unwrap(expectedWithdrawQueue[0])); | ||
assertEq(Id.unwrap(vault.withdrawQueue(1)), Id.unwrap(expectedWithdrawQueue[1])); | ||
assertEq(Id.unwrap(vault.withdrawQueue(2)), Id.unwrap(expectedWithdrawQueue[2])); | ||
assertFalse(vault.config(allMarkets[1].id()).enabled); | ||
assertEq(vault.totalAssets(), firstAmountSupplied); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And we need to check lastTotalAssets! And check that the fee accrued after the next interaction is as expected! |
||
} | ||
|
||
function testUpdateWithdrawQueueRemovingDisabledMarketWithSupply() public { | ||
_setCap(allMarkets[2], 0); | ||
|
||
vm.prank(CURATOR); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it done twice?