Skip to content

Integrate revenue tokens

Where an integration starts: the tokenizer's record, the two block numbers Robinhood Chain counts, and reading hookr.fun's routes from another app.

On this page

A revenue token is an ERC-20 on Robinhood Chain (4663), so anything that handles ERC-20s can hold, show and move one.

These pages are for apps that do more with it:

  • a wallet that shows a holder's income;
  • an explorer or an indexer that keeps its books;
  • a DEX or a lending market that lists it;
  • a launch platform that mints one for its creators;
  • a keeper that syncs it for the tip. The calls themselves are listed in Build on revenue tokens.

Start from the tokenizer

Every fact about a revenue token can be read from the chain, starting at the tokenizer, 0xfb3c1501c727f30883cd7b36ec380381af7412ef:

  • tokenCount() and tokenAt(i) list every revenue token it made, oldest first. The list only grows, so tokenAt(i) never changes.
  • tokenizations(token) is a token's record: who made it, which way in, its term and Hookr's leg. It is all zeros for a token the tokenizer did not make, which tells a revenue token apart from an ERC-20 that only says it is one.
  • streamsOf(token) lists each stream and how it ends, read live.

The tokenizer was deployed in Robinhood Chain block 92,671,598, the rollup's own block number. Soon after each mint, Hookr submits to Sourcify the contracts that its tokenizer and its Pons and Long door factories made for the token: the token, its drop box and those doors. Any other door is its builder's to verify.

Two block numbers

Robinhood Chain gives every block two numbers, and the tokenizer counts one of them:

  • The parent chain's height. Inside a contract, block.number is Ethereum's block number, one about every 12 seconds. A family's term (unlockBlock, at least MIN_TERM_BLOCKS, 50,400 blocks, past the current one), a drop's snapshotBlock and balanceAt all count it. Read it as the latest block's l1BlockNumber, or with Multicall3's getBlockNumber() in an eth_call.
  • The rollup's own height. eth_blockNumber, and the block an explorer shows for a transaction, count about ten blocks a second and are far higher.

An unlock block worked out from eth_blockNumber passes the tokenizer's check and locks the family for decades. Position doors and the release period count seconds instead.

Reading hookr.fun from another app

The JSON routes in Add-ons and read APIs are built for hookr.fun's own pages:

  • They send no CORS headers, and every answer carries Cross-Origin-Resource-Policy: same-origin, so a browser keeps it from a page on another site.
  • A request made from a page on another origin is refused with 403: the routes check Origin, Referer and Sec-Fetch-Site.
  • Each visitor has a small budget of reads, and a read past it is refused with 429.

A browser app on another site reads the chain through its own RPC instead; a server can call the routes within the budget. The token's mark carries the same Cross-Origin-Resource-Policy, so a page on another site cannot draw it from hookr.fun: fetch it on your server and serve your own copy.

The public RPC, https://rpc.mainnet.chain.robinhood.com, keeps recent state only, so a read at an older block fails there. Read history from an archive node.

Guides by kind of app

Walkthroughs

Each one does a job step by step: the app's path where there is one, the calls in order, then short TypeScript with viem. Walkthrough setup has the client and the ABIs they share.