58497 sc low the amount of weth redeemed is not calculated properly in morphoyearnogweth
Submitted on Nov 2nd 2025 at 19:25:54 UTC by @Josh4324 for Audit Comp | Alchemix V3
Report ID: #58497
Report Type: Smart Contract
Report severity: Low
Target: https://github.com/alchemix-finance/v3-poc/blob/immunefi_audit/src/strategies/mainnet/MorphoYearnOGWETH.sol
Impacts:
Contract fails to deliver promised returns, but doesn't lose value
Description
Brief/Intro
The amount of WETH redeemed is not accurately calculated; this will make the WETH redeemed always zero, and the contract will always emit StrategyDeallocationLoss( when it didn't deallocate at a loss.
Vulnerability Details
The root cause of the issue is that the vault.withdraw function is called before the wethBalanceBefore value is queried. This means that wethBalanceBefore and wethBalanceAfter is always equal and uint256 wethRedeemed = wethBalanceAfter - wethBalanceBefore; will always be zero.
function _deallocate(uint256 amount) internal override returns (uint256) {
@-> vault.withdraw(amount, address(this), address(this));
@-> uint256 wethBalanceBefore = TokenUtils.safeBalanceOf(address(weth), address(this));
@-> uint256 wethBalanceAfter = TokenUtils.safeBalanceOf(address(weth), address(this));
@-> uint256 wethRedeemed = wethBalanceAfter - wethBalanceBefore;
if (wethRedeemed < amount) {
emit StrategyDeallocationLoss("Strategy deallocation loss.", amount, wethRedeemed);
}
require(wethRedeemed + wethBalanceBefore >= amount, "Strategy balance is less than the amount needed");
require(TokenUtils.safeBalanceOf(address(weth), address(this)) >= amount, "Strategy balance is less than the amount needed");
TokenUtils.safeApprove(address(weth), msg.sender, amount);
return amount;
}
Since wethRedeemed is always zero, this will always be emitted.
Impact Details
The current impact is that any off-chain system that is listening to this StrategyDeallocationLoss event will always think that the contract is at a loss.
References
https://github.com/alchemix-finance/v3-poc/blob/immunefi_audit/src/strategies/mainnet/MorphoYearnOGWETH.sol?utm_source=immunefi#L50
Proof of Concept
Proof of Concept
Add to test/strategy/MorphoYearnOGWETHStrategy.t.sol
OUTPUT
Was this helpful?