The formulae

The integer maths the contract runs, in the order it runs it.

Orbis contributorsDraftUpdated 2026-10-257 min read

PropertyValue
nameformulae
scale1e36
mirrorpackages/shared/src/streaming.ts

All amounts are integers in wei. Division rounds down. Every remainder is carried forward, so nothing is created or lost in rounding.

Epochs

epoch(t)      = (t - GENESIS) / STREAM_PERIOD
epochStart(e) = GENESIS + e * STREAM_PERIOD

Release within an epoch

released(t) = streaming * (t - epochStart(epoch(t))) / STREAM_PERIOD
delta       = released(t) - releasedSoFar

Accumulator

eligible     = totalSupply - excludedSupply
numerator    = delta * SCALE + remainder
accPerToken += numerator / eligible
remainder    = numerator % eligible

A holder's amount

owedScaled[a] += balance[a] * (accPerToken - accPaid[a])   // on every balance change
accPaid[a]     = accPerToken
claimable(a)   = owedScaled[a] / SCALE                       // whole wei

Conservation

After every call the tests check, exactly:

deposited * SCALE = claimed * SCALE + Σ owedScaled + (streaming - released + queued) * SCALE + remainder

Dust: what cannot be paid in whole wei stays in the contract, under 1 wei per holder plus under 1 wei overall.