Index contracts
IndexToken.sol
IndexToken accounts for holding time and pays daily dividends. The findings below cover rewards rolled forward from empty epochs and dividends accrued by contracts that cannot claim them.
Reviewed source: src/index/IndexToken.sol at commit 38f14ff.
Findings
| ID | Severity | Finding |
|---|---|---|
| B-19 | Low | A dust holder can capture dividends rolled over from an empty day |
| B-20 | Low | Dividends accrue to contracts that cannot claim them |
[LOW] B-19 · A dust holder can capture dividends rolled over from an empty day
B-19 · Low
Rollover moves dividends from a day with no eligible holders into the current day. A tiny position held just before that day ends can claim the whole amount.
IndexToken.rollover is permissionless and moves rewards from an earlier epoch with zero eligible token-seconds into the current epoch. The current day's reward calculation is proportional to token-seconds and has no minimum denominator.
If nobody else holds during that day, a dust position acquired shortly before midnight contributes all eligible holding time. The holder can claim the entire rolled reward after the day closes, despite supplying almost no capital for almost no time.
Impact
Dividends intended to remain available for future holders can be captured by an opportunistic dust holder during bootstrap or another empty-holder period. Existing holders are not deprived of an earned share: any other eligible holder in the same epoch shares pro rata. That narrow precondition supports the Low rating.
Affected code
Locations refer to the reviewed commit, 38f14ff.
src/index/IndexToken.sol:94–110— Empty-day rewards are moved into the current epoch.src/index/IndexToken.sol:130–136— Rewards use token-seconds without a minimum floor.
From src/index/IndexToken.sol:94–110:
function rollover(uint[] calldata epochs) external nonReentrant {
_batch(epochs.length);
uint nowEpoch = currentEpoch();
for (uint i; i < epochs.length; ++i) {
uint epoch = epochs[i];
if (epoch >= nowEpoch || _epochSeconds(epoch) != 0) {
revert InvalidRequest();
}
uint amount = epochRewards[epoch];
if (amount == 0) {
continue;
}
epochRewards[epoch] = 0;
_fund(nowEpoch, amount);
emit DividendsRolledOver(epoch, nowEpoch, amount);
}
}
Proof of concept
IndexAudit.t.sol::test_C_zeroHolderDividendsCapturedByDust funds an epoch with no eligible holders, rolls its reward forward, and buys a 1,000-wei position just before the current day closes. That position claims all 2,250,000,000,000,001 wei of funded dividends.
With another eligible holder, the same calculation splits the reward pro rata rather than giving the dust position everything.
The test source is poc/IndexAudit.t.sol in the Solidity evidence bundle. Follow the reproduction setup, then run:
FOUNDRY_GAS_LIMIT=1000000000000 forge test --match-path 'test/audit/IndexAudit.t.sol' -vv
Recommended solution
Release stranded epochs gradually over later days, or require a minimum aggregate amount of token-seconds before releasing the rolled reward. Keep the treatment of bootstrap periods explicit in the dividend model.
[LOW] B-20 · Dividends accrue to contracts that cannot claim them
B-20 · Low
IndexToken counts custody contracts as dividend holders unless they are one of four fixed exclusions. If the contract cannot call claim, its accrued ETH has no payout path.
Every holder other than the zero address, index fund, PoolManager and token contract accumulates token-seconds. The contract that holds the tokens owns the corresponding entitlement.
claim always reads the entitlement for msg.sender. It accepts a receiver, but no caller can claim on behalf of a different holder. A third-party pool or bridge with no claim integration can therefore accrue rewards that it cannot withdraw. Rollover does not help because those days have eligible holding time.
Impact
The dividends attributable to tokens in an incompatible custody contract remain permanently in IndexToken. Other holders still receive their pro-rata entitlement, and PoolManager is already excluded. An EOA or a contract that can call claim can receive its share normally.
Affected code
Locations refer to the reviewed commit, 38f14ff.
src/index/IndexToken.sol:62–64— Only four fixed addresses are excluded.src/index/IndexToken.sol:151–176— Claims read the caller's entitlement.
From src/index/IndexToken.sol:151–167:
function claim(uint[] calldata epochs, address payable receiver) external nonReentrant returns (uint amount) {
_batch(epochs.length);
if (receiver == address(0)) {
revert InvalidRequest();
}
for (uint i; i < epochs.length; ++i) {
uint epoch = epochs[i];
if (epoch >= currentEpoch()) {
revert InvalidRequest();
}
if (claimed[msg.sender][epoch]) {
revert AlreadyClaimed();
}
uint reward = rewardOf(msg.sender, epoch);
claimed[msg.sender][epoch] = true;
amount += reward;
emit DividendClaimed(msg.sender, receiver, epoch, reward);
Proof of concept
IndexTokenImplementation.t.sol::test_dividendsOfNonClaimingContractHolderAreStranded transfers a majority of the supply to a holder contract with no claim function, accrues a day's reward and lets the remaining holder claim. Three of four ETH remain attributable to the contract and cannot be claimed by anyone else.
The test source is poc/IndexTokenImplementation.t.sol in the Solidity evidence bundle. Follow the reproduction setup, then run:
FOUNDRY_GAS_LIMIT=1000000000000 forge test --match-path 'test/audit/IndexTokenImplementation.t.sol' -vv
Recommended solution
Allow prospective exclusion of incompatible custody addresses, or introduce a defined expiry and redistribution policy for unclaimed entitlements. Explain the custody requirement before holders move tokens to other venues. A receiver parameter alone does not solve the missing authority to claim for the holder.