# Tokenize an agent's income

An ERC-8004 agent can be paid at a door that forwards every payment to a revenue token. The agent mints the token from its own wallet, and the token's holders share what is paid at the door.

## The pieces

| Piece | What it does |
| --- | --- |
| The agent income door | The address the agent is paid at. Native ETH and USDG sent to it by plain transfer wait there. |
| The token's sync | Forwards everything the door holds to the token, which counts it as that door's income. |
| Hookr's leg | 5% of what the door delivers at each sync, rounded down. |
| The agent's record | Names the token under `revenueToken` on the identity registry [`0x8004A169FB4a3325136EB29fA0ceB6D2e539a432`](https://robin.etherscan.io/address/0x8004A169FB4a3325136EB29fA0ceB6D2e539a432). |

## What to know first

- The agent chooses to be paid at the door. Nothing on chain makes it, and it can stop at any time.
- The door cannot tell a customer's payment from the agent's own transfer. Both count as the door's income.
- Pay the door only after the mint. Nothing leaves the door before the mint, and money sent to a door whose token is never minted, or never takes the door, stays there for good.
- USDG must be one of the token's listed currencies, and the app lists it in the token's terms at the mint. USDG paid to a door whose token does not list it goes to the token's drop box, less Hookr's leg.
- Only the door factory's `isDoor(door)` says Hookr's factory made a door. That says who the door was made for, and nothing about what is paid to it.
- A door is made for one tokenizer, and a token of another tokenizer cannot take it.

## Steps on /tokenize

1. Open [Tokenize](/tokenize) on the Agent income tab with the agent's own wallet: the wallet the identity registry names as the id's agent wallet.
2. Type the agent id and check it.
3. Set the token's terms. The token's address follows from the wallet and the terms.
4. Make the door. One transaction makes the door for that address, before the token exists.
5. Tokenize. The token is minted with USDG listed and the door as its stream.
6. On the token's page, open "Made by an agent? Link it" and link the token to the agent.
7. Point the agent's payments at the door.
8. Raeto record starts on: after the mint, sign one USDG permit for Raeto's record fee, or switch it off.

Terms changed after step 4 are another token's address, so the page makes that token's door first.

## Raeto's record fee

Raeto keeps a public income record for an agent and charges the agent's wallet a record fee in USDG. On the Agent income card the step starts on and the minter can switch it off; nothing is signed until the minter presses Sign, and the mint does not wait on it.

| Fact | Value |
| --- | --- |
| The collector, the permit's spender | `0x37f2fBD0a375C367c26b2C6487Ab6060321a563b` |
| Most per take | 0.05 USDG |
| Shortest wait between takes | 12 hours for each wallet |
| What the app signs for | 36.50 USDG in all, an EIP-2612 permit that can be relayed for 24 hours |
| The permit's domain | name `Global Dollar`, version `1`, on USDG |

The fee, the wait and where the fee goes are fixed in the collector. Its source is not verified on an explorer, its owner can replace the operator that takes the fee, and nothing on chain checks that a fee is owed. `approve(collector, 0)` on USDG stops it, and `cancelPermits(1)` on USDG voids a permit that was signed and not yet relayed. The step needs a plain key wallet.

## From a script

`hookr_build_agent_income` on the [MCP server](/docs/mcp) builds the same calls, one stage per call: the door, the mint, then the link. Pass the same terms on every call, send the stage's calls, and call again. Its answer names the token and the door, and `doorTakesPayments` is true once the token holds the door.

The calls, in order, from the agent's own wallet:

| Call | On | What it does |
| --- | --- | --- |
| `predictToken(creator, terms)` | the tokenizer [`0x08de138e558a9258c6b4077e8bdeb9ad1fb46a4b`](https://robin.etherscan.io/address/0x08de138e558a9258c6b4077e8bdeb9ad1fb46a4b) | The token's address before it exists. List USDG among the terms' assets. |
| `create(revenueToken, agentId, tokens)` | the door factory [`0xc24ca4cdc35689b9cd41c64e4f9ffcb772fdaab7`](https://robin.etherscan.io/address/0xc24ca4cdc35689b9cd41c64e4f9ffcb772fdaab7) | Makes the door for that address, with USDG as its one token. `predict` gives the door's address first. |
| `tokenize(terms, streams, market)` | the tokenizer | Mints the token with the door as its one outside door, USDG among the terms' assets and `listAssets` false. |
| `link(agentId)` | the Agent gate | Links the wallet to its agent id, where it is not linked yet. |
| `setMetadata(agentId, "revenueToken", value)` | the identity registry | Adds the token to the agent's record. Only the id's owner or an operator it approved can send it. |

The factory takes `create` only from the agent's owner or its agent wallet, and refuses any other caller with `NotAgent`. Mint from the agent's wallet, so the token's creator is the agent's own wallet.

The app and the tool mint with a one-day release period and a 1% sync tip on ETH. The tool gives each call a fixed gas limit: 2,000,000 for the door, 10,000,000 for the mint and 500,000 for the record.

## Reading a door

| Call | Answer |
| --- | --- |
| `isDoor(door)`, on the door factory [`0xc24ca4cdc35689b9cd41c64e4f9ffcb772fdaab7`](https://robin.etherscan.io/address/0xc24ca4cdc35689b9cd41c64e4f9ffcb772fdaab7) | True only for a door Hookr's factory made. Ask it first: everything a door answers about itself, any contract can answer. |
| `agentId()` | The agent the door was made for. |
| `revenueToken()` | The token every pull pays. |
| `admitted()` | True once the token is minted and holds the door. Pay the door only then. |
| `assets()` | Native ETH, then USDG. |
| `ends()` | Revocable with no date: the agent can stop paying in at any time. |
| `pendingIncome()` | What the door holds now, before Hookr's leg. |

`bound()` answers whether the tokenizer has minted the door's token, so it is false before the mint: read `admitted()` instead. Nothing leaves the door before the mint: the token's `pull()` reverts with `NotAdmitted`, and so does `dropStray` of an ERC-20.

An agent id can change hands after a door is made, so also check that the id's own `revenueToken` record names the token.

[Explorers and indexers](/docs/revenue-tokenizer/integrate-indexers) has how to count a door's income, and [Doors for new platforms](/docs/revenue-tokenizer/build-a-door) the rules every door keeps.

---

This page: https://hookr.fun/docs/revenue-tokenizer/tokenize-an-agents-income. Every docs page as Markdown: https://hookr.fun/docs.md.
