# Attested incentive allocator — specification **Report date and source-read date: 2026-10-05 UTC.** ## Recommendation Launch an immutable, quote-token-funded trading-reward allocator for one Uniswap v4 pool, with a small authenticated swap gateway and an observation hook that logs the gateway's actual calling account. Buy one chain-evidence ranking and one independently bound sum for each winner per epoch; store the signed list on chain and pay capped pro-rata rewards through permissionless claims to those exact accounts. Start with ten winners and nominal weekly epochs. This removes the distributor's discretion over recipients, amounts and question selection, but still trusts the oracle service key and its re-execution process; it does not prove that wallets represent distinct people or that trades are organic. Use three new contracts, or four including an optional launch token. Refused or incomplete attestations release no rewards. Economic protection is conditional on an independently defensible lower bound on unrecoverable trading costs; absent that bound, use a zero reward rate rather than claiming a positive budget is wash-proof. ## Decisions table | Question | Choice | Figure | Main reason | |---|---|---|---| | 1. Attribution | Hook event keyed by caller of immutable gateway | `ParticipantVolume(poolId, participant, quoteVolume)`; two hook flags | Authentic account authorization; arbitrary router labels are spoofable | | 2. Payout | Stored top-ten list plus sums; capped pro rata | 11 requests: **5.5 IMD/epoch**; approximately $46.75 only at the brief's assumed exchange value | Order alone cannot establish reward-per-volume bounds | | 3. Washing/sybils | Same quote denomination for volume and rewards; conservative per-volume cap | Illustrative 3000 fee tier, 50% fee recapture: choose 7.5 bp rate; $750 maximum on $1m selected volume | Fees paid to attacker-controlled LPs are not an attacker expense | | 4. Timing | Fixed contiguous block windows, sequential closure | 50,400 blocks; nominal seven days at 12 seconds/block; seven-day response grace | Avoid discretionary endpoint selection and partial payout | | 5. Comparators | Separate distribution integrity from retention and identity | 2025 Uniswap proposal: $24m v4 and $21m initial Unichain requests; 2024/25 LTIPP evaluation: 95.95m ARB claimed across three programmes | Reproducibility does not turn subsidized activity into durable demand | **Evidence legend.** FACT means directly supported by a cited primary document or a pinned input read in this assignment. DESIGN means a proposed rule, not observed production behavior. INFERENCE means reasoning from those facts. UNKNOWN means evidence was unavailable or insufficient. Every IdentityMD-plane assertion below is explicitly an **ASSUMPTION supplied by the brief**, unless identified as a directly inspected pinned-test fact. No live oracle request, signature, deployed consumer, price feed or mainnet transaction was independently exercised. Source pages were read on the date above; historical dates are identified separately. Comparator amounts are not live prices or audited effectiveness estimates. ## 1. Attribution: what the ranking reads FACT: PoolManager `Swap` and `ModifyLiquidity` identify the account calling the manager, not necessarily the beneficial trader or LP. Ranking this field can reward a router or position manager. The ABI documents the sender fields and signed swap deltas. [Uniswap PoolManager interface](https://raw.githubusercontent.com/Uniswap/v4-core/main/src/interfaces/IPoolManager.sol) | Candidate | Honest meaning | Spoofing/measurement failure | Decision | |---|---|---|---| | PoolManager event sender | Immediate manager caller | Common routers aggregate many users | Reject as participant key | | Any router's `msgSender()` | Whatever that router reports | A malicious router can implement the same selector and return anyone | Accept only reviewed immutable integrations | | Address in `hookData` | Caller-supplied label | Anyone can name a victim, distributor or fresh sybil | Never authenticate this alone | | ERC-20 Transfer recipient | Token recipient | Transfers, self-transfers, routers, fee settlements and gifts are not unique pool trades | Reject as trade metric | | Position NFT owner | Owner at a particular moment | Transfers, operators, mint timing and tokenId-to-position linkage matter | Suitable only for a separate carefully defined LP scheme | | Immutable gateway caller | Account authorizing this gateway execution | Contract accounts and sybils remain possible | Selected trading metric | FACT: Universal Router's `Lock` exposes `msgSender()` using its active locker. This is a useful convention, not an authentication standard applicable to every contract. [Universal Router Lock source](https://raw.githubusercontent.com/Uniswap/universal-router/main/contracts/base/Lock.sol) DESIGN: Gateway `swap` accepts no participant argument. It locks against reentry, records `msg.sender`, calls PoolManager through its unlock callback, settles the trade and clears the account before returning. Hook `afterSwap` requires PoolManager as its own caller. If the hook's `sender` is the gateway, it reads the gateway's active account and emits exactly one event for a nonzero quote-side delta. If the sender is another router, the pool trade still succeeds but earns no reward and emits no qualifying event. Unknown integrations therefore cannot forge rewarded identities or halt ordinary routing. `tx.origin` is never used. A Safe or other account contract earns as that contract; an aggregator earns as the aggregator unless a future separately reviewed integration preserves authenticated user authorization. ```solidity event ParticipantVolume( bytes32 indexed poolId, address indexed participant, uint256 quoteVolume ); ``` `quoteVolume` is the absolute executed quote-currency balance delta, in the quote token's native integer units, obtained from the callback's final swap delta. It is not the requested input, a dollar estimate or the sum of both token legs. Both directions count the quote leg once. The specification excludes zero-volume events and any other pool. The gateway permits one swap per invocation, exact-input or exact-output with bounded input/output and a deadline; partial execution counts the actual result. Failed settlement reverts the entire transaction and its logs. No extra accounting delta or hook fee is introduced. Quote delta may include input fee effects; the economic lower bound must use this exact measured-volume denominator rather than an approximate gross-volume dashboard definition. **ASSUMPTION (IdentityMD):** `log-rank` can group this event by `participant`, sum `quoteVolume`, apply `topN`, and return an ordered `address[]` without sums. Each subsequent `log-sum` filters the same pool and one participant over the exact same inclusive block window. Required rank semantics are descending aggregate sum, then ascending numeric address for ties, exclusion of zero totals, and fewer than N results when fewer participants exist. These are proposed definitions; actual tie and filter support require developer confirmation. Refusal is preferable to a service silently implementing different semantics. LP incentives are deliberately a different metric. FACT: PositionManager contains NFT position operations, liquidity modifications and ownership checks; its internal call sequencing must be examined before attempting to recover owners in callbacks. [PositionManager source](https://raw.githubusercontent.com/Uniswap/v4-periphery/main/src/PositionManager.sol) INFERENCE: summing liquidity additions rewards repeated deposit/withdrawal rather than sustained useful liquidity. An honest LP product needs position identity, historical ownership including transfers, in-range liquidity and time integration. An owner lookup at epoch close retroactively assigns earlier activity to buyers. A hook cannot assume every position manager exposes a callback-safe tokenId or that a minted NFT already exists when the callback runs. The supported recipe list supplied here does not establish an exact ownership-aware liquidity-time integral. Do not relabel deposit sums as liquidity mining; ship trading rewards first and commission an LP metric separately. The hook **is one of the contract count**, using `BaseHook` behavior with **beforeInitialize and afterSwap only**, mask `0x2040` (8256). All other twelve flags, including every ReturnDelta flag, are false. FACT: v4 encodes permissions in the low fourteen address bits. [Hooks library](https://raw.githubusercontent.com/Uniswap/v4-core/main/src/libraries/Hooks.sol) The pinned Hook protected test independently requires an initialization callback, matching flags, restricted callers, runtime size at most 24,576 bytes and no executable SELFDESTRUCT, DELEGATECALL or CALLCODE. It does not run a pool lifecycle; that omission must never be reported as a lifecycle pass. ## 2. Payout shape and cost **ASSUMPTION (IdentityMD):** a request costs 0.5 IMD, approximately $4.25 at the brief's reference value, and rank results contain order but no amounts. USD conversions below use that assumed value only; no current IMD market price was verified. | Shape | Requests for N winners | Payout rule | Principal limitation | |---|---:|---|---| | Fixed rank tiers | 1 | N=10: 30%, 20%, 15%, 10%, 7%, 5%, 4%, 3%, 3%, 3% = 100% | Economically unsafe without volume floors; compare only | | Pro rata among ranked winners | N+1 | `B * V_i / sum(V_j)` | Extra cost, partial-answer liveness and fee recapture | | Selected capped pro rata | N+1 | `min(B * V_i / S, r * V_i)` | Can leave much of budget undistributed; still has a top-N boundary | Tiers for N=50/100 would need separate immutable vectors. If fewer winners exist, selected pro rata uses those actual winners; fixed tiers should leave missing positions unspent rather than renormalizing upward. Avoid winner-takes-all lottery semantics. | topN | Rank tiers | Rank plus N sums | Assumed USD tiers / pro rata | |---:|---:|---:|---:| | 10 | 0.5 IMD | 5.5 IMD | $4.25 / $46.75 | | 50 | 0.5 IMD | 25.5 IMD | $4.25 / $216.75 | | 100 | 0.5 IMD | 50.5 IMD | $4.25 / $429.25 | Those are successful first-attempt request costs, excluding gas, operator work, funding and any retry charges. For k