Skip to content

How income accrues

Arrival and release over the release period, what a transfer settles, who earns, and drops by the block before.

On this page

Arrival, then release

Income reaches a revenue token in two ways: a sync pulls the doors, and anyone can push an asset in (a bonus, or a plain transfer that the next sync recognizes). The token recognizes each arrival by its balance change, never in receive(), and releases it to holders over the token's release period, streamSeconds(), fixed at the mint: zero, so each arrival is claimable at once, or any period up to 14 days.

Each asset keeps an index: income released per earning token, scaled by SCALE() (1e36). A holder's claimable is the index's growth since the holder's last settlement, times its balance. With a release period, the release runs every second, so claimable grows between syncs without anyone calling anything.

A new arrival while an earlier one is still releasing joins it: what is left of the old one and the new amount release together, until an end set by their amount-weighted average of the old one's time left and a full release period.

Listed assets

Native ETH is always asset 0, and the token lists up to seven ERC-20s beside it: the ones named at the mint, its market's quote, the currencies a stream brings when the call that adds it asks to list them, and any the stream manager adds later with addAsset. The list only grows, and an asset listed later earns from the block it was listed. Income in a currency the token does not list reaches holders through the drop box instead: at once when the release period is under an hour, otherwise in slices over the release period.

Transfers settle both sides

Every transfer, including one by permit or authorization, settles the sender and the receiver at the current index before the balances move. Income already released stays with the wallet that held the token while it was released; the buyer earns only from the transfer on. A contract building on the token never has to snapshot balances itself.

Who earns

Only the earning supply earns. The Uniswap v4 PoolManager, 0xdead, the token's drop box, the token itself, its leg collector and its tokenizer are left out, so the token's own pool liquidity is not paid twice and burned tokens do not dilute. earns(account) answers for any address, and the rule is fixed at deploy. A transfer to the token or to one of its doors is refused.

Any other contract that holds revenue tokens earns like a wallet, but only it, or an operator it approved with setOperator, can claim. A contract you build that holds them must call claim or claimAll itself, name an operator, or hand the claim on. A pool outside the v4 PoolManager that holds the token never claims, so its share stays in the token for good.

Drops

The drop box is separate from income. Anyone drops ETH or any ERC-20 into it with drop(asset, amount), and each drop is shared by the balances at the end of the block before it landed (balanceAt, earningSupplyAt). Holders claim each drop from the box with claim(dropIds, to), a signed claim, or an operator's claimFrom. A contract that holds revenue tokens earns a share of every drop too, and needs a path to claim it from the box.

What a builder can count on

  • received per asset only ever goes up, and paid never passes it.
  • No one can change the supply, the release period, the tip or the Fee Bridge after the mint, and no door, once added, is ever changed or removed, nor Hookr's leg on it. Streams and listed currencies are only ever added: by the stream manager, or by anyone for Hookr pools, fee NFTs, positions and revenue token shares when the token was minted open.
  • A claim pays the lesser of what is owed and what the token holds; the rest stays owed.
  • A door that fails on its own never stops a sync: each door is pulled on its own, and DoorPulled(i, false) says which one failed. A sync sent with too little gas for a door's stipend and the reserve after it reverts with SyncStarved(door, needed).