Skip to document
§ 05

PROGRAMMABLE FEE FLOW

One swap, followed all the way through to a smaller supply. Each arrow is a step that happens on-chain, not an intention.

SWAP → SUPPLY REDUCTIONFIG. 6
SWAP
PROGRAMMABLE HOOK
FEE LOGIC
FEE CAPTURE
BUYBACK
BURN
SUPPLY REDUCTION
“THE FEE IS PROGRAMMABLE INPUT.”
STEP BY STEP
01
SWAPinput enters the pool
02
PROGRAMMABLE HOOKthe pool calls attached code
03
FEE LOGICthe rule decides what is taken
04
FEE CAPTUREvalue is accounted to the protocol
05
BUYBACKcaptured value is routed back into the token
06
BURNtokens are sent to an irreversible sink
07
SUPPLY REDUCTIONS(t+1) < S(t)

A fee, in this arrangement, is not overhead. It is the input to a program. The programmable layer decides what happens to it, and what happens to it is a permanent, measurable change in the token's supply.

§ 08

FEE ENGINE

The parameters of the rule, and what the rule has actually moved. Values are read from the configured network — never estimated.

PARAMETERS
BASE FEE
HOOK FEE
TOTAL FEES
CONTRACT ABI NOT CONFIGUREDfee parameters live in the Hook. Supply src/lib/contracts/hookAbi.ts and these fields populate from chain state.
FLOW
RUNTIME RETIRED VIA THE LOOP
FEES CAPTURED
FEES USED
MEASUREMENTTRANSFERS INTO SINK
HOOKNOT CONFIGURED
DATA UNAVAILABLEno figure is shown rather than a guessed one
SYNTHETIC DATA
a fee that does nothing is a cost. a fee that runs is an input.
§ 04

PROGRAMMABLE ECONOMICS

If logic can attach to liquidity, then economic behaviour can be expressed as logic. That is the entire subject of this section.

FIG. 4 — RULE TO STATE
RULE
CODE
HOOK
EXECUTION
ECONOMIC STATE
an economy written as a call stack

Most token economics are policy: a document describing what a team intends to do with revenue, executed later by people. RUNTIME asks what the same idea looks like when it is compiled — when the rule is a function the pool calls rather than a paragraph someone honours.

The mechanisms below are the vocabulary of that compiled economy. Each is labelled with its actual status in this experiment. Nothing is described as implemented unless it is.

FEE LOGICPENDING VERIFICATION

The rule that decides what a swap contributes. Uniswap v4 permits custom and dynamic fee behaviour; what RUNTIME applies is read from chain, not asserted here.

ACCOUNTINGIMPLEMENTED

Captured value is attributed to the protocol rather than distributed back into the curve. Accounting is the bridge between a swap and an economic consequence.

BUYBACKIMPLEMENTED

Captured value is routed back into $RUNTIME. The protocol becomes a buyer of its own token as a function of activity, not of discretion.

BURNIMPLEMENTED

Acquired tokens are sent to an irreversible sink. There is no recovery path and no administrative key that reverses it.

STATE UPDATEIMPLEMENTED

The result is written. Supply after the transaction is smaller than supply before it, and the difference is publicly verifiable.