Skip to content
Business logic Audit finding Intermediate

`Voter::finalize()` incorrect rewards distribution due to transfering WETH before calling `distributor::setTokensPerInterval()`

The Voter contract transfers WETH rewards before updating the reward rate, causing the previous rate to be applied to the new funds. An attacker could exploit this to instantly claim a large portion of rewards, leaving honest stakers with less over the week.

0x73696d616f Follow

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2025-09-bmx-deli-swap-judging/issues/242

Found by

0x73696d616f

Summary

Voter::finalize() transfers the WETH, and then calls distributor.setTokensPerInterval(). However, this order of operations is incorrect and it will lead to the previous reward rate being applied for the transferred WETH, doing an instantaneous rewards increase that will be arbitraged and stolen.

As can be seen below, RewardsDistributor::setTokensPerInterval() calls RewardTracker::updateRewards(), which calls RewardsDistributor::distribute(). Now, if pendingRewards() will apply the last tokensPerInterval, accrue for the last time called, and send to users if there is enough balance. Due to having sent the WETH before calling setTokensPerInterval(), it will instantly distribute this rewards as soon as the function is called, and there won't be enough rewards for the next week. Thus, past stakers (and bots or attackers that knew about this) will steal instant rewards, and honest stakers will not collect them over the full week.

RewardsDistributor

Solidity
    function setTokensPerInterval(uint256 _amount) external onlyAdmin {
        require(lastDistributionTime != 0, "RewardDistributor: invalid lastDistributionTime");
        IRewardTracker(rewardTracker).updateRewards();
        tokensPerInterval = _amount;
        emit TokensPerIntervalChange(_amount);
    }

    function pendingRewards() public view override returns (uint256) {
        if (block.timestamp == lastDistributionTime) {
            return 0;
        }

        uint256 timeDiff = block.timestamp.sub(lastDistributionTime);
        return tokensPerInterval.mul(timeDiff);
    }

    function distribute() external override returns (uint256) {
        require(msg.sender == rewardTracker, "RewardDistributor: invalid msg.sender");
        uint256 amount = pendingRewards();
        if (amount == 0) { return 0; }

        lastDistributionTime = block.timestamp;

        uint256 balance = IERC20(rewardToken).balanceOf(address(this));
        if (amount > balance) { amount = balance; }

        IERC20(rewardToken).safeTransfer(msg.sender, amount);

        emit Distribute(amount);
        return amount;
    }

RewardTracker

Solidity
    function updateRewards() external override nonReentrant {
        _updateRewards(address(0));
    }

    function _updateRewards(address _account) private {
        uint256 blockReward = IRewardDistributor(distributor).distribute();
    ...

Root Cause

In Voter.sol:262, it transfers WETH before calling setTokensPerInterval().

Internal Pre-conditions

None

External Pre-conditions

None

Attack Path

  1. Admin finalizes an epoch, sends WETH and sets the tokens per interval to distribute this amount of WETH over 1 week.
  2. Due to the logic above, part of this WETH, if not all, will be consumed instantly and rewards won't be distributed over the full week.

Impact

Stolen rewards.

PoC

No response

Mitigation

First call setTokensPerInterval(), then transfer the WETH.

Discussion

sherlock-admin2

The protocol team fixed this issue in the following PRs/commits: https://github.com/morphex-labs/deli-swap-contracts/pull/20

The original report as published on Sherlock, by 0x73696d616f. 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

Root cause

The contract transfers WETH before updating the reward rate, so the old rate is applied to the new funds.

Impact

Past stakers or attackers could steal instant rewards, and honest stakers would not collect them over the full week.

What the attacker needed

None

The fix

The fix is to call setTokensPerInterval() before transferring the WETH.

How it was found

  1. Admin finalizes an epoch, sending WETH and setting the tokens per interval.
  2. The WETH is transferred before the rate update, so the old rate applies.
  3. Rewards are distributed instantly using the old rate, consuming the new WETH.

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.

In a reward system, the rate at which rewards are paid out is set by a function. If new funds are added before the rate is updated, the old rate is used for the new funds, causing a sudden payout. This lets someone grab rewards meant for a longer period.

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 0x73696d616f

View all

172 more disclosed reports, best first.

More from BMX Deli Swap

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.