Build #003: a holder rebate that pays out from creator fees

A share of creator fees set aside every week and claimable by wallets that held through the snapshot.

Build #003 cover
fig. 00 · build #003 · 212 words

The rule: a quarter of the creator fees goes back to people who hold. The hard part isn't the maths; it's making sure nobody can game the snapshot. This is an example build, not a deployed hook.

The spec

  • Every 7 days, 25% of the creator fees collected that week moves into a rebate pool.
  • Wallets holding at least 0.05% of supply at a random block inside the week can claim.
  • Claims are pull-based: the hook never sends tokens on its own.
  • Unclaimed rebates roll over to the next week.

The hook

Fees are accounted in afterSwap; claims live in a separate contract so the swap path stays cheap.

function afterSwap(address, PoolKey calldata key, SwapParams calldata, BalanceDelta, bytes calldata)
    external override onlyPoolManager
    returns (bytes4, int128)
{
    uint256 creatorFee = feeFor(key);
    uint256 toRebate = creatorFee * REBATE_BPS / 10_000; // 2_500 = 25%
    rebatePool[currentEpoch()] += toRebate;
    return (this.afterSwap.selector, 0);
}

Tests

Fuzzing focuses on the attack the spec worries about: buying just before the snapshot and selling just after. With a random snapshot block revealed only after the week closes, the attack stops paying in every simulated run.

What it will never do

Push tokens to wallets, use a predictable snapshot, or pay out more than the fees it has actually received.