Keepers and bots
Syncing revenue tokens for the tip: the 1% cap and the 0.001 ETH floor, gas per door, pages of doors, and syncSome.
A revenue token's income reaches its holders when someone calls sync(). Anyone can, at any time, and the caller is paid the token's tip. A token works without a keeper, since a holder or the token's page can sync too; a keeper is whoever syncs first when the doors hold enough to pay the tip.
The tip
tipBps()of the ETH the pulled doors deliver after Hookr's leg, fixed at the mint and at most 1%. The app mints every token with 1%.- Paid only when the doors deliver at least
MIN_TIP_PULL(), 0.001 ETH. - Never paid on a bonus or on ETH that was already in the token: a plain send, or what an outside door pushed between syncs.
- Paid to the caller,
msg.sender, in ETH. A keeper that syncs through a contract of its own must be able to take ETH there. sync()gives back the tip, so aneth_callof it says what a sync would pay now.Synced(by, pulledEth, tip, bridged)records what it paid.
Fee NFT doors
A pools.trade fee NFT's income sits in its pool's fee splitter until collectFees runs on it. The fee NFT door does that itself: before it claims from its vault, it has the splitter collect the position, so a sync needs nothing sent first.
Gas
- Before each door the sync needs that door's stipend,
doors(start, count)[i].gas, plusSYNC_RESERVE_GAS(), 8,000,000, left. Short of it, the sync reverts withSyncStarved(door, needed)rather than skip the door. - The stipends are fixed when each door is added, by kind of door: 250,000 for a Rules ledger, 1,700,000 for a fee NFT door, 12,000,000 for the family door and for a revenue token door, 10,500,000 for a Pons door, 6,800,000 for a Long door, and for a position door 150,000 plus 1,643,809 per position plus 2,340,000 per currency up to two, at most 12,000,000 (a v3 door adds 160,000). Any other outside door asks its own, 100,000 to 12,000,000.
- A token with more doors than one transaction carries is synced in pages:
syncRange(start, count)pulls doorsstarttostart + count - 1with the same tip and the same recognition. The state view'ssyncPlan(token, gasBudget, start, count)groups the doors into pages that each fitgasBudget, and marks a door that is past the budget on its own.
A door that fails
- Each door is pulled on its own. One that reverts or runs out of its stipend fails alone,
DoorPulled(i, false), and the sync goes on. - A door that burns its whole stipend every time makes every sync pay for it.
syncSome(doors)pulls only the doors listed, in that order, with the same tip and the same recognition. - Nobody can pull a door ahead of a sync: the tokenizer's doors take
pull()from their token alone (OnlyRevenueToken).pullSome(ids)on a position door collects into the door, and what it collected reaches the token at the next sync, with Hookr's leg where the door carries one. - No sync runs while the Uniswap v4 PoolManager is unlocked: one sent from inside an unlock reverts with
PoolManagerUnlocked.
Other upkeep
Income reaches a token's time shares when someone rolls them, from the token's page or a direct call, and a roll that books at least 0.001 ETH pays its caller a small part of it. Arb recapture a pool takes in a currency other than its two sides waits in the pool's Rules until someone calls addRulesCredits(i, member) on the token's family door, which anyone may; the next sync then claims it. A token minted with a Fee Bridge also has drips to run: Fee Bridge.
Run a sync keeper puts all of this in a script.