diff --git a/solidity/contracts/lib/ERC4626Fees.sol b/solidity/contracts/lib/ERC4626Fees.sol index 235d69835..0bc0ee1c4 100644 --- a/solidity/contracts/lib/ERC4626Fees.sol +++ b/solidity/contracts/lib/ERC4626Fees.sol @@ -103,7 +103,7 @@ abstract contract ERC4626Fees is ERC4626Upgradeable { function _feeOnRaw( uint256 assets, uint256 feeBasisPoints - ) private pure returns (uint256) { + ) internal pure returns (uint256) { return assets.mulDiv( feeBasisPoints, @@ -117,7 +117,7 @@ abstract contract ERC4626Fees is ERC4626Upgradeable { function _feeOnTotal( uint256 assets, uint256 feeBasisPoints - ) private pure returns (uint256) { + ) internal pure returns (uint256) { return assets.mulDiv( feeBasisPoints, diff --git a/solidity/contracts/stBTC.sol b/solidity/contracts/stBTC.sol index 34c719dfe..e45d81cb0 100644 --- a/solidity/contracts/stBTC.sol +++ b/solidity/contracts/stBTC.sol @@ -255,7 +255,8 @@ contract stBTC is ERC4626Fees, PausableOwnable { uint256 currentAssetsBalance = IERC20(asset()).balanceOf(address(this)); // If there is not enough assets in stBTC to cover user withdrawals and // withdrawal fees then pull the assets from the dispatcher. - uint256 assetsWithFees = convertToAssets(previewWithdraw(assets)); + uint256 assetsWithFees = assets + + _feeOnRaw(assets, _exitFeeBasisPoints()); if (assetsWithFees > currentAssetsBalance) { dispatcher.withdraw(assetsWithFees - currentAssetsBalance); }