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

Sherlock fix https://github.com/sherlock-audit/2023-03-Y2K-judging/issues/418 #133

Merged
merged 3 commits into from
May 10, 2023
Merged
Changes from 1 commit
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
15 changes: 9 additions & 6 deletions src/v2/Carousel/Carousel.sol
Original file line number Diff line number Diff line change
@@ -397,8 +397,16 @@ contract Carousel is VaultV2 {
uint256 executions = 0;

while ((index - prevIndex) < (_operations)) {

// skip the rollover for the user if the assets cannot cover the relayer fee instead of revert.
if (queue[index].assets < relayerFee) {
index++;
continue;
}

// only roll over if last epoch is resolved and user rollover position is valid
if (epochResolved[queue[index].epochId] && queue[index].assets > 0) {

uint256 entitledAmount = previewWithdraw(
queue[index].epochId,
queue[index].assets
@@ -408,12 +416,7 @@ contract Carousel is VaultV2 {
uint256 diff = entitledAmount - queue[index].assets;
// get diff amount in assets
uint256 diffInAssets = diff.mulDivUp(finalTVL[queue[index].epochId], claimTVL[queue[index].epochId]);
// skip the rollover for the user if the assets cannot cover the relayer fee instead of revert.
if (queue[index].assets < relayerFee) {
index++;
continue;
}


uint256 originalDepositValue = queue[index].assets - diffInAssets;
// @note we know shares were locked up to this point
_burn(