Calculators
LiveCalculator.sol
LiveCalculator uses a rolling price average and holder floors to unlock levels. Its primary findings concern unreachable upper levels and the use of launch supply after tokens are burned.
Reviewed source: src/calculators/LiveCalculator.sol at commit bcd45b2.
Findings
| ID | Severity | Finding |
|---|---|---|
| DICES-02 | Medium | Game levels 9 and 10 can never unlock |
| DICES-14 | Informational | Levels price the coin on a supply that burning changes |
[MEDIUM] DICES-02 · Game levels 9 and 10 can never unlock
Affected modules: DicesHook.sol, DicesCoin.sol, LiveCalculator.sol.
Severity: Medium. Type: specification, arithmetic.
Affected code: src/DicesCoin.sol:32; src/DicesHook.sol:71; src/calculators/LiveCalculator.sol:252, :373-375.
Description
A level needs the coin to have at least its floor of qualifying holders, and a qualifying holder is an address with at least 300,000 coins. The supply is fixed at 1,000,000,000 coins, so no more than 1,000,000,000 ÷ 300,000 = 3,333 addresses can qualify at once, whatever happens.
| Level | Holder floor | Coins that must sit in qualifying wallets | Possible |
|---|---|---|---|
| 7 | 1,700 | 510M | Yes |
| 8 | 2,500 | 750M | Only if about three quarters of all coins are in qualifying wallets |
| 9 | 3,800 | 1,140M | No: more than the supply |
| 10 | 5,800 | 1,740M | No: more than the supply |
The practical ceiling is lower than 3,333, because the hook, the PoolManager, the swap pool and the bankroll address are not counted (src/DicesCoin.sol:247-249) and the pool always holds some coins. At level 8's market cap about 982M coins can be outside the pool at most.
_levelAt lowers the level until the floor is met (src/calculators/LiveCalculator.sol:373-375), so a coin whose average market cap is above $51M or $102M stays at level 8 or below.
Impact
Two of the ten games in the client's table (9 November update) cannot be reached by any coin. Level 8 is reachable only with an unusually flat distribution. No funds are at risk.
The project's tests do not catch this because the tests that reach level 10 use a stand-in coin whose holder count is set directly (test/utils/Fixtures.sol:83-99).
Evidence
testPoC9_levelsNineAndTenNeedMoreHoldersThanTheSupplyAllows passes: it prints the table above from the deployed constants and asserts that floors 9 and 10 exceed totalSupply() / HOLDER_THRESHOLD().
Recommendation
This needs a decision from the client, since both the floors and the 300,000-coin threshold came out of AGENT.md open question 5:
- lower the threshold (for 5,800 holders to be possible at all it must be under about 172,000 coins, and much lower to be practical), or
- lower the floors for the upper levels, or
- define the floor for upper levels differently, for example as a count of addresses above a smaller balance.
Then add a test that every level's floor × threshold fits within the coins that can be in circulation at that level's market cap.
Reported independently by the token-integration (TI-01) and guidelines (F-01) reviews and by the calculator context review.
Recorded test source and output: poc-tests.md.
Source finding: findings.md, DICES-02.
[INFORMATIONAL] DICES-14 · Levels price the coin on a supply that burning changes
Affected modules: DicesCoin.sol, LiveCalculator.sol.
Severity: Informational.
LiveCalculator multiplies price by a constant SUPPLY = 1e27 (src/calculators/LiveCalculator.sol:94, :208). DicesCoin.burn lowers totalSupply() (src/DicesCoin.sol:182-184), and a buy-and-burn recipient exists to do exactly that. After burns, the "market cap" that levels use is price × launch supply. Recommendation: confirm with the client that level targets are meant as price targets, and say so in AGENT.md, which currently states "supply is fixed".
Source finding: findings.md, DICES-14.
Shared findings
- DICES-03 · Medium: The owner can change the fee, the split and the level of existing pools without bound or delay — The hook can replace the calculator globally and accepts levels above ten.
- DICES-07 · Low: A calculator that returns malformed data halts every swap; the level is not bounded — Malformed return data is not contained by the hook's catch block.
- DICES-17 · Informational: Documentation and comments promise things the code does not do — The level clock, holder-read failure behavior and fixed-supply comments need correction.
- DICES-20 · Informational: Blind spots in the test suite — Level tests do not enforce the real supply-constrained holder counts.
- DICES-21 · Informational: Design limits the team already documents — A patient buyer can meet average-price and holder conditions; documented downward manipulation can delay levels.