58149 sc low morphoyearnogweth incorrectly reports loss and triggers strategydeallocationloss event

Submitted on Oct 30th 2025 at 23:30:44 UTC by @magtentic for Audit Comp | Alchemix V3arrow-up-right

  • Report ID: #58149

  • 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

MorphoYearnOGWETH will always emit the StrategyDeallocationLoss event as the calculations done will always lead to 0.

Vulnerability Details

Currently in _deallocate, the contract checks a wethBalanceBefore and wethBalanceAfter, the problem with this is that the contract does this sequentially rather than before calling vault.withdraw. What this effectively does is that it will have the same value resulting in wethRedeemed always been 0.

    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);
        }
...

When this occurs, this triggers the event StrategyDeallocationLoss. Further down, there is then also a duplication of the check which would effectively be the same calculated values.

Impact Details

  • No user funds are lost, and the function executes correctly. However, it emits misleading StrategyDeallocationLoss events, which may confuse monitoring systems or off-chain analytics.

References

https://github.com/alchemix-finance/v3-poc/blob/immunefi_audit/src/strategies/mainnet/MorphoYearnOGWETH.sol

Proof of Concept

Proof of Concept

The following logs have been added to the output to show this. The logs confirm that the wethRedeemed value is 0 as per provided image.

Proof Of Concept to trigger the above logs.

Was this helpful?