Skip to content

Commit

Permalink
FIX: add a check that total sub liquidity can be all redeemed
Browse files Browse the repository at this point in the history
  • Loading branch information
bugduino committed Feb 12, 2024
1 parent eb33ecd commit 6c9af2b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/metamorpho/MetaMorphoSnippets.sol
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ contract MetaMorphoSnippets {
);
}

// If there is still some liquidity to remove here it means there is not enough liquidity
// in the vault to cover the requested withdraw amount
if (sub > 0) {
return 0;
}

avgSupplyRate = ratio.mulDivDown(WAD - IMetaMorpho(vault).fee(), newTotalAmount);
}

Expand Down

0 comments on commit 6c9af2b

Please sign in to comment.