Skip to content
Business logic Audit finding Intermediate

Strategy main ticks are not symmetric when the tick spacing is one due to incorrect isLowerSided inequality

The strategy's tick-alignment logic misclassifies ticks as lower-sided when the tick spacing is one, so the main position's lower and upper ticks are not symmetric around the current price. This causes the position to allocate less liquidity on one side and miss out on fees when the price moves there.

000000 Follow with 0x73696d616f, armoking32 and 1 other

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2025-02-yieldoor-judging/issues/94

Found by

000000, 0x73696d616f, armoking32, bladeee

Summary

Strategy main position ticks are set according to:

Solidity
function _setMainTicks(int24 tick) internal {
    int24 halfWidth = int24(positionWidth / 2);
    int24 modulo = tick % tickSpacing;
    if (modulo < 0) modulo += tickSpacing; // if tick is negative, modulo is also negative
    bool isLowerSided = modulo < (tickSpacing / 2);

    int24 tickBorder = tick - modulo;
    if (!isLowerSided) tickBorder += tickSpacing;
    mainPosition.tickLower = tickBorder - halfWidth;
    mainPosition.tickUpper = tickBorder + halfWidth;

    emit NewMainTicks(tickBorder - halfWidth, tickBorder + halfWidth);
}

As can be seen, when the tick spacing is 1, the tick will be deemed lower sided, which adds a tick spacing (1) to the tick border. So, if the current tick is -1769, the ticks will be -1770 to -1766, which is not symmetric and will miss out on fees.

Root Cause

In Strategy:236, is lower sided check is incorrect.

Internal Pre-conditions

None.

External Pre-conditions

None.

Attack Path

  1. Protocol rebalances but main ticks are not symmetric and will miss out on fees when the price moves to the side that has less liquidity allocated.

Impact

Loss of fees.

PoC

Solidity
    // in setup
    IUniswapV3Pool pool = IUniswapV3Pool(0x20E068D76f9E90b90604500B84c7e19dCB923e7e);
    IERC20 wbtc = IERC20(0x4200000000000000000000000000000000000006); // token0
    IERC20 usdc = IERC20(0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452); // token1
    address uniRouter = address(0x2626664c2603336E57B271c5C0b26F421741e481);
    vm.createSelectFork(vm.envString("RPC_URL_BASE"), 26874136);

function test_POC_WrongTicks_DueToIsLowerSide() public {
    skip(10 minutes);
    vm.startPrank(rebalancer);
    IStrategy(strategy).rebalance();

    IStrategy.Position memory mainPos = IStrategy(strategy).getMainPosition();
    (, int24 tick,,,,,) = pool.slot0();
    //@audit position is not symmetric, harming long term fees
    assertEq(tick, -1769);
    assertEq(mainPos.tickLower, -1770);
    assertEq(mainPos.tickUpper, -1766);
}

Mitigation

bool isLowerSided = modulo <= (tickSpacing / 2);

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

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

Impact

The position is lopsided and could miss out on fees when the price moves to the side with less liquidity.

What the attacker needed

Tick spacing of one; rebalance occurs

The fix

The comparison should be changed to less-than-or-equal so ticks are classified correctly.

How it was found

  1. Advance time and call rebalance as the rebalancer.
  2. Read the main position's lower and upper ticks.
  3. Compare them with the pool's current tick and observe the asymmetry.

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.

A liquidity position is a price range where funds earn trading fees. The code decides where to place the edges of that range, and a wrong comparison makes the range lopsided, so one side earns less than it should.

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 by 000000

View all

32 more disclosed reports, best first.

More from Yieldoor

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.