Skip to content

Commit

Permalink
fix: use preview withdraw
Browse files Browse the repository at this point in the history
  • Loading branch information
Schlagonia committed Sep 30, 2024
1 parent 018cb81 commit efff0e2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Bases/4626Compounder/Base4626Compounder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ contract Base4626Compounder is BaseHealthCheck {
* @param _amount, The amount of 'asset' to be freed.
*/
function _freeFunds(uint256 _amount) internal virtual override {
uint256 shares = vault.convertToShares(_amount);
// Use previewWithdraw to round up.
uint256 shares = vault.previewWithdraw(_amount);

uint256 vaultBalance = balanceOfVault();
if (shares > vaultBalance) {
Expand Down

0 comments on commit efff0e2

Please sign in to comment.