# Doors for new platforms

A door is a small contract that holds a fee right and pushes its income into a revenue token on every sync. Hookr ships doors for Hookr pools (a pool's core door, and launches locked behind a door of the token's own), Uniswap v4 and v3 positions, pools.trade fee NFTs, shares of other revenue tokens, Pons and Long. A new platform plugs in with a door of its own, and nothing about the token or the tokenizer changes.

## The interface

A door for an outside platform implements `IHookrRevenueSource`, and the token pulls it as a door of kind `SOURCE`:

| Call | What it answers |
| --- | --- |
| `revenueToken()` | The token every pull pays, fixed at construction, so the door can exist before the token at its predicted address. |
| `assets()` | Every currency a pull may deliver, up to eight. The token lists those it can when the call that adds the door asks it to; the rest reach holders through the drop box. |
| `bound()` | Whether the door holds its fee right and is ready to pay. |
| `ends()` | How and when the stream ends: forever, at a block, at a time, revocable, or ended. |
| `pullGas()` | The gas stipend the token calls `pull()` with, 100,000 to 12,000,000. |
| `pull()` | Collects what the fee right has earned and pushes it into the token. |
| `pendingIncome()` | What a pull would deliver now, by currency, before Hookr's leg. Optional: the tokenizer never calls it, and the app reads it under a gas cap. |
| `sourceKind()` / `label()` | A constant id for the kind of door and a name the app shows. |

## Rules a door keeps

- `pull()` takes calls from the revenue token alone (`OnlyRevenueToken`), and never reverts on an empty collection.
- It pays only a token that holds it as a door (`isDoor`), so the fee right never feeds a token that takes no leg for it: the Pons and Long doors revert their first pull with `NotADoor` when the token does not list them.
- A currency the token lists goes straight to the token, where the sync measures Hookr's leg. Anything the token does not list goes into the token's drop box: transfer to the box, then the box's `dropStray`, after paying `legOf(door)` of it to `legCollector()`. A pull never calls the token's own `dropStray`.
- A door that reverts, runs out of gas or answers with garbage fails only itself: the sync goes on and records `DoorPulled(i, false)`.

## How the tokenizer admits a door

A door is added at the mint, in `tokenize`, or later with `addStreams` by the token's stream manager. Either way the tokenizer reads the door's views with at most 200,000 gas each and refuses it when it has no code, is already one of the token's doors, names another revenue token, declares more than eight assets or the revenue token itself among them, or declares a `pullGas()` out of bounds. It also needs `bound()` true, an `ends()` that is not ended, no pending revocation, and a dated end at least seven days ahead. Hookr's leg is fixed on the door as it is added.

The order is: predict the token's address with `predictToken(creator, terms)`, deploy the door pointed at it, hand the fee right to the door, then call `tokenize` with the door among its streams. For a token that already exists, deploy the door pointed at the token and call `addStreams`. If the setup stops before the add, a door can hand the fee right back to the wallet that made it (a Long door only for a share of more than half of the launch's fee shares); once a token holds the door, there is no way back.

A door of this kind is off the Hookr hook, so it carries Hookr's leg of 5%, taken from what it delivers at each sync.

## The agent income door

The agent income door is a door of this kind with no fee right behind it: an ERC-8004 agent is paid at its address, and each pull forwards the ETH and USDG the door holds. Its `ends()` is revocable with no date, since the agent chooses to be paid there and can stop. Its `bound()` answers whether the tokenizer has minted the door's token, false before the mint and true from it on, so nothing reads it before the mint.

Hookr's factory, [`0xc24ca4cdc35689b9cd41c64e4f9ffcb772fdaab7`](https://robin.etherscan.io/address/0xc24ca4cdc35689b9cd41c64e4f9ffcb772fdaab7), makes one for an agent's owner or agent wallet with `create(revenueToken, agentId, tokens)`. Nothing leaves the door before the mint: the token's `pull()`, and `dropStray` of an ERC-20, revert with `NotAdmitted` until the tokenizer has minted the token. A door made for one tokenizer cannot be added to a token of another.

Only the factory's `isDoor(door)` says Hookr's factory made a door: a door's own `factory()`, `sourceKind()`, `label()` and `agentId()` are what any contract can answer. The app shows the agent a door was made for only where that `isDoor` is true, and marks such a door neither verified nor unverified. [Tokenize an agent's income](/docs/revenue-tokenizer/tokenize-an-agents-income) has the steps.

## Verified and unverified

The app marks a door verified when the tokenizer's own Pons or Long door factory made it and the token holds it. Every other door shows as unverified, and what it calls itself is its own claim. Holders read `doorAt(i)` and the door's code before they rely on it.

---

This page: https://hookr.fun/docs/revenue-tokenizer/build-a-door. Every docs page as Markdown: https://hookr.fun/docs.md.
