Skip to content
Business logic Audit finding Beginner

Incorrect APY calculation in MYTStrategy::_approxAPY() causes underreported yields

The APY approximation function divides the squared APR term by twice the number of seconds in a year instead of by two, so the compounding component becomes negligible. Users and allocators relying on the reported yield see an APY that is almost identical to the APR, understating the true compounded rate.

Gakarot Follow

Originally disclosed on Immunefi

Informational View original
  • Disclosed after under an hour

56348 sc insight incorrect apy calculation in mytstrategy approxapy causes underreported yields

Submitted on Oct 14th 2025 at 20:05:31 UTC by @Gakarot for Audit Comp | Alchemix V3

Description

Brief/Intro

MYTStrategy::_approxAPY() incorrectly divides the squared APR term by 2 * SECONDS_PER_YEAR, instead of just 2, effectively nullifying compounding growth in APY approximation. This leads to misreported yield rates across strategies.

Impact Details

APY and APR become near identical, misleading users and allocators relying on the snapshotYield() results for decision making or display.

References

Link to Code ---> https://github.com/alchemix-finance/v3-poc/blob/b2e2aba046c36ff5e1db6f40f399e93cd2bdaad0/src/MYTStrategy.sol#L230-L234

Mitigation

To correct the APY miscalculation, the squared APR term should not be divided by SECONDS_PER_YEAR. The denominator should only be 2, restoring the correct compounding approximation formula. Specifically, in MYTStrategy::_approxAPY(), replace:

Solidity
-return apr + aprSq / (2 * SECONDS_PER_YEAR);
+return apr + aprSq / 2;

Proof of Concept

Proof of Concept

  • Paste this test in file location: v3-poc/src/test/MYTStrategy.t.sol
  • Runnable Command: MAINNET_RPC_URL="https://eth-mainnet.g.alchemy.com/v2/YOUR\\_KEY" forge test --mt test_POC_IncorrectAPYCalculation -vvvvv
  • Note: This PoC runs on a local Foundry mainnet fork using a read only Alchemy RPC key.
Solidity
function test_POC_IncorrectAPYCalculation() public view {
        // Setup a base per-second rate that equals roughly 5% APR
        uint256 ratePerSecWad = 1.585e9; // 0.05 / 31_557_600 * 1e18

        // Simulate what snapshotYield() would call internally
        uint256 secondsPerYear = strategy.SECONDS_PER_YEAR();
        uint256 apr = ratePerSecWad * secondsPerYear;
        uint256 aprSq = (apr * apr) / 1e18;

        // Buggy formula used in strategy
        uint256 buggyApy = apr + (aprSq / (2 * secondsPerYear));

        // Correct compounding approximation
        uint256 correctApy = apr + (aprSq / 2);

        console.log("Proof of Incorrect APY Calculation");
        console.log("Base APR (should be ~5%):", apr);
        console.log("Buggy APY (contract formula):", buggyApy);
        console.log("Correct APY (mathematical):", correctApy);

    }

The original report as published on Immunefi, by Gakarot. Images and videos are our own copies; raw HTML is shown as text. View it on Immunefi.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely a copy or scaling mistake in the approximation formula: the squared APR term is divided by 2 * SECONDS_PER_YEAR rather than by 2, so the compounding term is scaled down by roughly 31.5 million.

Impact

APY and APR become near identical, so users and allocators relying on snapshotYield() results for decisions or display are misled about the actual yield.

What the attacker needed

Access to the deployed strategy contract; ability to read snapshotYield() output

The fix

The squared APR term should be divided by 2 only, not by 2 * SECONDS_PER_YEAR, to restore the correct compounding approximation.

How it was found

  1. Set a per-second rate that corresponds to roughly 5% APR.
  2. Compute the APR by multiplying the per-second rate by the number of seconds in a year.
  3. Compute the squared APR term scaled by 1e18.
  4. Calculate the APY using the contract's formula, which divides the squared term by twice the seconds per year.
  5. Calculate the correct APY by dividing the squared term by two only.
  6. Compare the two results to see the contract's APY is far below the correct compounded value.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

APY is the yearly return including the effect of interest earning interest (compounding), while APR is the simpler yearly rate without compounding. The contract tries to estimate APY from APR with a small formula, but it divides one part by a huge number (the seconds in a year), which makes that part almost zero. As a result, the displayed APY looks the same as the APR and understates what users would actually earn.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More from Alchemix V3

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.