chapters· The engine
15 · Autocompound

The compound engine

The auto-compounding V3/V4 never had, and the carry that makes sure nothing ever leaks.

The compound share is the auto-compounding concentrated-liquidity venues never gave LPs, selectable as a simple percentage: at every harvest, the budget of both sides is re-minted into the program's own position at the live price. What doesn't fit is never lost — it carries.

The mint attempt

A concentrated-liquidity mint needs both sides in the ratio the current price dictates — so the compound is a mint attempt: whichever side binds caps it, and part of the budget may not fit this time. Whatever the mint does not consume — on either side — is saved on the hook (carryMain / carrySecondary) and added to the next harvest's compound budget.

harvest: compound budget = this slice + the standing carry
mint at the live price — whichever side binds caps it
consumed budget → liquidity in the program's position
unconsumed budget → the carry, retried next harvest· never leaks to the pot or a recipient
the carry's three guarantees

It retries forever — every future harvest adds the carry to its budget. It never leaks — carried value can only ever become liquidity. And it never double-counts — fuel that a harvest already sent to the pot sits in the pot, not in the next compound.

The mint runs in its own isolated frame with a hard budget check: it can never consume more than its budget (the execution is abandoned if a quote and its settlement ever disagree), and a revert simply leaves the whole budget in the carry — the harvest never blocks on the compound. The carry is updated from the mint's real settlement deltas, not re-derived from a second multiplication, so over any sequence of harvests the compound slices equal the mint consumption plus the final carry, per side, to the wei (fuzzed as FM12, 512 runs).

A config edit only changes how future harvests split; the standing carry keeps retrying under the new rules. Even a harvest with zero new fees will retry a standing carry. And because the carry is a per-asset term of the hook's obligationOf accounting, custody covers it at all times.

Why this matters

With a 50% compound share, half of every fee the pool earns becomes more depth without anyone paying gas for it, deciding when, or running a keeper. Deeper liquidity means less slippage, which attracts more volume, which earns more fees — the loop every project wants, running by itself between trades. The simulator on the app page lets you replay a year of trading with and without it.

Reading the compound

Program p = hook.programOf(poolId); p.liquidity // current position size (only ever grows from compounds) p.carryMain // main-side budget waiting to fit p.carrySecondary // secondary-side budget waiting to fit

Go deeper

The compounding math derives the two-sided mint constraint and the geometry of growth; Compound strategies is the practical guide to choosing the share and reading the carry.

FAQ

What does the compound engine actually do?+

At every harvest it takes the configured share of collected fees (plus any carry) and mints it back into the program's own position — the auto-compounding that V3/V4 positions never had natively.

Why does the carry exist?+

A two-sided mint can rarely place BOTH assets exactly — the pool's price fixes their ratio. Whatever can't be placed this round is carried, custody-backed, and retried next harvest. Nothing leaks.

Does compounding cost me anything?+

No extra fee — the engine re-mints your own fees. The only cost is the gas of the harvest that carries it, which the in-swap path amortizes into normal trading.

Can I compound 100% of fees?+

Yes — the 100% corner sends both sides' whole fee stream back into liquidity (recipients get nothing). It's the pure flywheel preset, and the validation accepts it.

Does removing liquidity lose my carry?+

No — the carry survives a full exit, keeps growing from pumps if a compound share is set, and re-mints when liquidity exists again. It's proven by the remove-all-then-remint test.