Previewyielddistribution reverts instead of returning zero when no tokens are in circulation
The previewYieldDistribution function in ArcToken.sol reverts with NoTokensInCirculation when the token supply is zero, instead of returning zero amounts for all holders. This blocks normal edge cases and can cause integrations that rely on previewing yield to fail.
Originally disclosed on Immunefi
- Disclosed after under an hour
52129 sc low previewyielddistribution reverts instead of returning zero when no tokens are in circulation
Submitted on Aug 8th 2025 at 07:49:22 UTC by @Afriauditor for Attackathon | Plume Network
- Report ID: #52129
- Report Type: Smart Contract
- Report severity: Low
- Target: https://github.com/immunefi-team/attackathon-plume-network/blob/main/arc/src/ArcToken.sol
- Impacts:
- Contract fails to deliver promised returns, but doesn't lose value
Description
Brief/Intro
The previewYieldDistribution function in ArcToken.sol reverts when the token supply is zero, instead of returning zero amounts for all holders. This unnecessarily blocks normal edge cases and can cause integrations to fail when previewing yield.
Vulnerability Details
Inside previewYieldDistribution, the code explicitly checks:
if (supply == 0) {
revert NoTokensInCirculation();
}
The correct behavior should be to return arrays of holders and amounts where each amount is 0 if the total supply is 0. This ensures that preview calls work in all states and avoids breaking logic that rely on the function.
Impact Details
Contract fails to deliver promised returns in scenarios where preview functionality is relied upon to return a value.
Proof of Concept
{% stepper %} {% step %}
Setup
Have ArcToken in a state where totalSupply() == 0 (e.g., no mints yet or everything burned).
{% endstep %}
{% step %}
Action
Call previewYieldDistribution(amount) with any non-zero amount.
{% endstep %}
{% step %}
Observed Behavior
The function reads supply = totalSupply() and hits:
if (supply == 0) {
revert NoTokensInCirculation();
}
The call reverts instead of returning arrays filled with zeros. {% endstep %} {% endstepper %}
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 the function explicitly reverts when totalSupply() is zero rather than returning zero amounts.
Impact
Contract fails to deliver promised returns in scenarios where preview functionality is relied upon to return a value.
What the attacker needed
TotalSupply() equals zero
The fix
The function should return arrays of holders and zero amounts when totalSupply() is zero instead of reverting.
How it was found
- Put ArcToken in a state where totalSupply() is zero.
- Call previewYieldDistribution with any non-zero amount.
- Observe the call reverts with NoTokensInCirculation instead of returning zero arrays.
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 smart contract has a function that lets you preview how much yield each holder would get. If no tokens exist yet, the function crashes with an error instead of simply saying everyone gets zero. This can break other programs that call it expecting a normal answer.
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.