# DEXs, lending markets and vaults

A revenue token trades and moves like any ERC-20. What a DEX, an aggregator, a lending market or a vault has to know is who earns while the token sits with it, because income goes to the address that holds the token and only that address, or an operator it names, can claim it.

## The token

- A fixed supply, minted once: no mint after it, no burn function and no rebase. 18 decimals.
- No transfer fee, no pause and no blocklist. A transfer moves exactly the amount sent and calls nothing outside the token.
- A transfer to the token's own address or to any of its doors reverts with `InvalidRecipient`.
- A transfer costs more gas than a plain ERC-20's: before the balances move it releases each asset's due income, settles both sides and writes the balance checkpoints drops are paid from. Estimate gas for it rather than use a fixed figure.

## Who earns

| Holder | Earns | Who can claim |
| --- | --- | --- |
| A wallet, or any contract | Yes | That address: `claim` and `claimAll` pay the caller's own income, a signed claim needs its signature, through ERC-1271 for a contract, and an operator it named with `setOperator` claims for it |
| The Uniswap v4 PoolManager, which holds every v4 pool's tokens, the token's own market included | No | Nothing accrues to it; its part goes to every other holder |
| 0xdead, the token's drop box, the token itself, its tokenizer and Hookr's leg collector | No | Nothing accrues to them |

So:

- Revenue tokens in a Uniswap v4 pool earn nothing while they are in it. An LP who adds them gives up their income for that time.
- A Uniswap v2 pair, a v3 pool or any other contract with no way to call `claim` or `setOperator` earns income and drops that nobody can ever take.
- With a release period, income is released by the second and a drop goes by balances at the end of the block before, so a router, an aggregator's executor or a flash loan gets neither.
- With no release period, income a sync brings in is due to whoever holds at that moment, and a holder can buy, sync, claim and sell in one block. No sync runs while the PoolManager is unlocked, so a swap cannot do that with the pool's own tokens.

## The market opened at mint

- A token minted with a market has one pool on the Hookr root between the revenue token and its quote, native ETH or an ERC-20 such as HOOKR. `MarketOpened(token, familyId, poolId, seed, bridge, bridgeBps)` names it, the PoolManager's `Initialize` for that pool id gives its key, and `tokenizations(token).marketFamilyId` is its family. Against ETH the revenue token is `currency1`. The tokenizer's `defaultMarket` sets tick spacing 60 and arbitrage recapture on.
- The pool's LP is locked in the token's launch door, for good or until the family's unlock block. The account that locked it can move that block later or to forever, never earlier.
- The pool starts with revenue tokens only, its seed, taken from the supply. Buyers can take them for the quote from the first block, and sellers can sell into it once buys have left the quote there.
- Its LP fees, its royalty, its Hook Block take and its arbitrage recapture go to the token: the quote side becomes income at the next sync. The side paid in the revenue token is retired: the launch door takes it as an ERC-6909 claim in the PoolManager, which earns nothing, and anyone's `flushClaims(token)` on the door sends it to 0xdead.
- Arbitrage recapture on the market is on by default, so a swap on it carries the lane's gas floor. It pays the token once the lane has another venue of the token, or a sibling pool in its family, to trade against. [Swapping and quoting](/docs/guides/swapping-and-quoting#the-lane-gas-floor) has the routes, the quoter and the floor.

## Lending markets and vaults

- A deposit is a transfer, so it settles first: the depositor keeps the income released before it, and from then on the income accrues to the contract.
- The contract must claim it: `claimAll(to)` or `claim(asset, to)` called by the contract, and its drops from the drop box with `claim(dropIds, to)`. Or it names an operator with `setOperator(operator, true)`, its own call, and the operator claims for it with `claimFrom(holder, asset, to)`, `claimAllFrom(holder, to)` and the drop box's `claimFrom(holder, dropIds, to)`. A contract that answers ERC-1271 can instead sign a claim that anyone sends. Without any of these, the income and the drops stay owed to the contract for good.
- Tokens lent out earn for the borrower while it holds them. A liquidation is a transfer like any other: the account liquidated keeps what was released before it.
- ETH is paid with a plain call, so a contract that claims ETH to itself must be able to take ETH.
- To pass income on to depositors, follow the [add-ons](/docs/revenue-tokenizer/build-examples-and-apis#the-add-ons-as-examples): Compound's vault, held for now, holds revenue tokens, claims for its holders and hands the income on.

[Before you send revenue tokens anywhere](/docs/revenue-tokenizer/holding-a-revenue-token#before-you-send-revenue-tokens-anywhere) is the same warning for holders.

---

This page: https://hookr.fun/docs/revenue-tokenizer/integrate-markets-and-vaults. Every docs page as Markdown: https://hookr.fun/docs.md.
