The Hook is the programmable layer
Not a wrapper, not a keeper bot, not a script watching from outside. The pool itself calls into the Hook at defined lifecycle points. Anything the Hook does happens because the pool asked it to.
PROGRAMMABLE LIQUIDITY.
CODE BECOMES EXECUTION.
Liquidity has been treated as passive infrastructure: capital that sits in a pool and waits. Uniswap v4 changes what can be attached to that pool. Code can now run at the moments a pool changes state — and once code runs, a rule stops being documentation and becomes an event.
RUNTIME is the study of that shift: what happens when liquidity becomes PROGRAMMABLE.
Liquidity does not have to remain passive.
An automated market maker is, at bottom, a rule about how a reserve responds to a trade. For most of the history of on-chain markets that rule was fixed by the protocol: the pool was a container, and the container had no opinions. Liquidity providers deposited capital and the curve did the rest.
Uniswap v4 introduces Hooks: contracts that a pool calls at defined points in its own lifecycle. A Hook is deployed to an address whose bits encode which of those points it wants, and from then on the pool consults it. The pool still prices the trade — but a second body of code now runs alongside it, in the same transaction, with access to the same state.
That is a structural change, not a feature. It means a protocol can express economic behaviour as executable logic attached to liquidity itself, rather than as a process that someone runs afterwards. The Hook becomes a PROGRAMMABLE layer around the pool.
RULES ARE EXECUTABLE · LIQUIDITY CAN BE PROGRAMMED
The distinction matters. A platform capability is not a protocol claim. RUNTIME uses a narrow slice of what v4 makes possible, and this table is the honest boundary between the two.
| CAPABILITY | UNISWAP V4 | RUNTIME |
|---|---|---|
| Attach custom code to pool lifecycle points The core premise of the experiment. The Hook is the programmable layer. | ENABLED | IMPLEMENTED |
| Custom / dynamic fee logic on swaps Displayed values are read from chain. Nothing is asserted before the ABI confirms it. | ENABLED (OPT-IN) | PENDING VERIFICATION |
| Protocol-side fee capture and accounting Fee capture is the input to the economic loop described in PROGRAMMABLE FEE FLOW. | ENABLED (OPT-IN) | IMPLEMENTED |
| Buyback executed from captured fees Routing captured value back into $RUNTIME. | ENABLED (OPT-IN) | IMPLEMENTED |
| Permanent burn / supply reduction Measured directly from transfers into the configured burn sink. | ENABLED (OPT-IN) | IMPLEMENTED |
| Custom accounting via the singleton PoolManager Available at the platform level. Not part of EXPERIMENT #001. | ENABLED | NOT IMPLEMENTED |
| Custom curves / alternative pricing logic Out of scope. RUNTIME does not modify the pricing curve. | ENABLED (OPT-IN) | NOT IMPLEMENTED |
| Permissioned or gated swap access The pool is open. No access rule is attached. | ENABLED (OPT-IN) | NOT IMPLEMENTED |
The central claim of this experiment: liquidity is not only capital sitting in a pool. It is capital wrapped in code that runs.
CODE → HOOK → EXECUTION → STATE
Not a wrapper, not a keeper bot, not a script watching from outside. The pool itself calls into the Hook at defined lifecycle points. Anything the Hook does happens because the pool asked it to.
Instead of liquidity being only a passive pool of assets, the system attaches custom logic to pool activity. Every swap becomes a trigger for whatever rule the protocol has chosen to encode.
The rule does not describe an intention to act. It acts — atomically, inside the transaction that triggered it. What comes out the other side is new on-chain state, and state is the only thing that counts.
Why Hooks matter: they are the point at which a pool stops being a container and starts being a host for code.
In Uniswap v4 every pool lives inside a single settlement contract, and each pool may be created with a Hook attached. The Hook's address itself encodes which lifecycle points it subscribes to — the permissions are structural, not a runtime setting. From deployment onward, the pool calls that contract at exactly those points.
This is what makes the layer PROGRAMMABLE in a technical sense rather than a marketing one. The logic is not observing the pool from outside and reacting later. It is invoked by the pool, inside the same transaction, before the state transition is final. There is no window in which someone could decide not to run it.
RUNTIME uses that property for one purpose: to make an economic rule — capture, buy back, burn — inseparable from the activity that triggers it.
beforeSwap()Runs before the pool applies the swap. The programmable pre-condition.CONCEPTUALafterSwap()Runs after the swap settles. Where fee accounting and state updates land.CONCEPTUALIf logic can attach to liquidity, then economic behaviour can be expressed as logic. That is the entire subject of this section.
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.
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.
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.
Captured value is routed back into $RUNTIME. The protocol becomes a buyer of its own token as a function of activity, not of discretion.
Acquired tokens are sent to an irreversible sink. There is no recovery path and no administrative key that reverses it.
The result is written. Supply after the transaction is smaller than supply before it, and the difference is publicly verifiable.
One swap, followed all the way through to a smaller supply. Each arrow is a step that happens on-chain, not an intention.
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.
Four stages. Each one is a binding between something abstract and something that actually exists on-chain. Hover a stage to expand it.
A program is not a document about what should happen. Once it is deployed, running it is the happening.
function execute() {
hook();
captureFee();
updateState();
}CONCEPTUAL UI ONLY — NOT THE DEPLOYED CONTRACT SOURCE
In an ordinary system, a rule is written down and something else carries it out — a job, an operator, a multisig. The gap between the two is where discretion lives, and discretion is where systems drift from their own descriptions.
A Hook removes the gap. The rule and its execution occupy the same transaction. What the code says is what the chain does, in the same block, without an intermediary step in which anyone could choose otherwise.
The parameters of the rule, and what the rule has actually moved. Values are read from the configured network — never estimated.
What the loop removes and does not give back. Supply reduction is the only output of this experiment that cannot be undone.
Three terms, one relation. Written as it would appear in the margin of a notebook, because that is what it is.
The model has one direction. F drives B, B reduces S, and S never increases as a result of this loop. That monotonicity is the whole point: an economic rule whose only permitted effect on supply is subtraction.
F(t) is displayed as — until fee accounting can be read from the Hook. An unmeasured term is left unmeasured.
S plotted against t. One axis is time; the other is how much of the token still exists.
Each row is one irreversible event. Nothing is summarised away; the log is the primary record.
The instrument panel. Configuration on the left, chain readings on the right, and an honest status line at the top.
The experiment, narrating itself. Each line corresponds to something that happened on-chain.
The whole protocol restated as a single observation: what goes in, what runs, and what is different afterwards.
The unit the loop acts on. Everything here is either read from the contract or left blank.
Circulating supply is derived, not asserted: it is total supply as reported by the contract, with tokens sitting at the burn sink treated as removed. Where that derivation is not possible, the field stays empty.