Protocol
Formulas
fee = max(baseFee, proposal_1 ... proposal_n) x (100 - max rebate_i) / 100
royalty_i = |unspecified amount| x royaltyBps_i / 10,000, with sum(royaltyBps_i) <= 30
author_i = royalty_i x 0.8, vesting 7 days
reserve += royalty_i - author_i
a hook may run only if gasleft >= gasLimit x 64 / 63 + 30,000, else the swap reverts
repay per unit (Q128) += seized x 2^128 / total LP units of the pool
Invariants
| Claims held by the ledger equal what it owes, per currency | invariant test, 64 runs x 40 calls |
| Royalties never exceed 30 bps of a swap | fuzz test, 256 runs |
| An honest hook never fails because a caller sent too little gas | fuzz over 60,000 to 1,500,000 gas |
| Fee composition is the max of proposals less the largest rebate | fuzz test, 256 runs |
| Only createDam can initialise a pool on the hook stack | unit test |
| The four house hooks run on live chain state without a failed run | fork test on the live PoolManager |
Parameters
| Parameter | Value | Where |
|---|---|---|
| v4 hooks per pool | 5 | Dam.MAX_LOGS |
| Royalty per hook | 0 to 10 bps | Storefronts.MAX_ROYALTY_BPS |
| Stack royalty cap | 30 bps | Dam.MAX_STACK_ROYALTY_BPS |
| Stack gas budget | 400,000 | Dam.STACK_GAS_BUDGET |
| Gas per fee hook | 10,000 to 80,000 | Storefronts.MAX_FEE_LOG_GAS |
| afterSwap stipend | 40,000 | Dam.AFTER_SWAP_GAS |
| Royalty split | 80% author, 20% burn reserve | RoyaltyLedger.AUTHOR_SHARE_BPS |
| Vesting | 7 days, daily buckets | RoyaltyLedger.VEST |
| Stake to list | 10,000 $V4M (50,000 for a hook that holds funds) | Storefronts.MIN_STAKE |
| Failed-run slash | 10% at 3 failed runs in 7 days, hook removed | Storefronts.CRACK_SLASH_BPS |
| Exploit slash | up to 100% after a 48 h challenge window | Storefronts.CHALLENGE_WINDOW |
| Stack change delay | 48 hours | Dam.STACK_CHANGE_DELAY |
| burnBuy | once an hour, 3 hops, 0.5% price move a hop, 1% tip | RoyaltyLedger |
| Timelock | 48 hours, 14 days grace | Timelock.DELAY |
| Simulator over x402 | 0.002 USDG a call | /api/simulate |
Contracts
| Hook stack (Dam) | 0xfa80B85CD044Be80795e3344bE1A7435Dbb3fAcc |
| Storefronts | 0xd497D8327554ad8c2fd0B3F7E8c100Bb1773dA00 |
| Royalty ledger | 0xd065aAC3419a018Def2e1f118ADa0aCf6A439468 |
| Router | 0x951C76d97f80355Fe8f3aAEbd6F7f1D2bA9e8DB5 |
| Timelock | 0x09A4322b9857FC53a6035D35C009d752E4F575D9 |
| v4 PoolManager | 0x8366a39cc670b4001a1121b8f6a443a643e40951 |
Timelock queue
Every parameter change waits 48 hours here before it can run.
| Call | Target | Executable from | |
|---|---|---|---|
| Nothing queued. | |||