Skip to content

Build on revenue tokens

The calls a contract or an app makes on a revenue token: sync, claims, the asset books, the earning supply, drops and signed actions.

On this page

A revenue token is an ordinary ERC-20 with an income ledger inside it. Anything that can hold an ERC-20 can hold one, and any contract can read its income, pull it in, claim it and pass it on. The supply, the release period, the tip and the Fee Bridge slice are fixed at the mint, and a door, once added, is never changed or removed, so what you build on it can rely on every rule below for as long as the token exists.

This section is for builders. It covers the calls a contract or an app makes, how income accrues, how a new platform plugs in as a door, the add-ons as worked examples, the read APIs, and a list of things to build.

The calls

Every call below is on the revenue token itself (IHookrRevenueToken). Assets are numbered: asset 0 is always native ETH, and the rest are the ERC-20s the token lists, up to seven more.

CallWhat it does
sync()Pulls every door, recognizes what arrived and starts releasing it. Anyone may call; the caller gets the tip when the doors delivered at least 0.001 ETH.
syncRange(start, count) / syncSome(doors)The same over one page of doors, or over the listed door indexes only, to step past a door that misbehaves.
claimable(account, asset)What account can claim of asset now, with the release run up to this block.
claim(asset, to) / claimAll(to)Pays the caller's income in one asset, or every asset, to to.
claimFrom(holder, asset, to) / claimAllFrom(holder, to)The same for holder, sent by an operator it approved with setOperator(operator, approved).
releasable(asset)How much of asset a release now would move to holders.
poke()Releases every asset's due income. Transfers, claims and syncs do it too.
assetCount() / assetAt(asset)The asset list and each asset's books: received, paid, what is still releasing and until when.
surplus(asset)What arrived in asset that no sync has recognized yet.
earns(account) / earningSupply()Whether an address earns, and the supply that does. The PoolManager, 0xdead, the drop box, the token itself, its leg collector and its tokenizer never earn.
doorCount() / doorAt(i) / doors(start, count)The doors, each with its kind, its contract, its gas stipend and Hookr's leg.
isDoor(target) / legOf(door)Whether an address is one of the token's doors, and Hookr's leg on it in basis points.
depositBonus(asset, amount)Pays income in from anyone, released like the rest, with no tip.
dropBox() / dropStray(asset)The token's drop box, and moving any other ERC-20 sent to the token into it as a drop.
collectIncome(revenueToken)Claims what this token's own shares of another revenue token have earned there into this token.
streamSeconds() / tipBps() / bridge() / bridgeBps()The release period, the tip and the Fee Bridge slice, all fixed at the mint.
streamManager() / openStreams()Who may add streams and list currencies, or zero once the list is closed for good, and whether anyone may add Hookr pools, fee NFTs, positions and revenue token shares.

A sync needs each door's stipend, plus a reserve, left before the door. A call that leaves too little reverts with SyncStarved(door, needed) instead of skipping a door: send more gas, sync a smaller page with syncRange, or skip the door with syncSome. No sync or bonus runs while the Uniswap v4 PoolManager is unlocked (PoolManagerUnlocked).

The tokenizer adds the record of each token: tokenCount(), tokenAt(i) and tokens(start, count) list every token it made, tokenizations(token) says who made it, the door that holds its locked Hookr pools, its market's family and when it was made, and streamCount(token) and streams(token, start, count) list each stream with its kind, its door, Hookr's leg, when it was added, and how and when it ends.

Signed actions

A holder never needs gas. Every action but naming an operator can be signed and sent by anyone, under the token's EIP-712 domain (eip712Domain(), EIP-5267):

  • permit: ERC-2612, with sequential nonces, as v, r, s or as one signature for a contract account.
  • transferWithAuthorization and receiveWithAuthorization: EIP-3009-style signed transfers with random nonces, the form x402's EVM "exact" scheme settles with.
  • claimWithSig and claimAllWithSig: a claim that pays only the to the holder signed, refused past its deadline; cancelAuthorization revokes an unused nonce.

Each signature can come from an EOA or a contract wallet through ERC-1271, so a smart wallet or an EIP-7702 account signs like anyone else. Permit2 works as with any ERC-20. setOperator has no signed form: it is the holder's own transaction.

The rest of this section