Documentation · Learn
Regeneration
How REGENERATION funds and runs a bounded buyback-and-burn near the all-time-low price, and how it behaves on the genesis curve.
REGENERATION is the third gene. Once expressed, it diverts a share of ETH fees into a separate reserve and lets anyone trigger a small buyback of GENE from the pool, which the hook then burns. It is the only way the protocol shrinks GENE's supply after launch, besides the dust burned at launch (GeneHook.sol:262-263, :308). Any holder can also burn its own balance (GeneToken.sol:21-23).
A buyback runs while the price is no more than about 1% above the all-time-low price; outside that window regenerate() spends nothing (GeneHook.sol:574-577; Genome.sol:46). See why it does little early on.
#Expression
REGENERATION needs METABOLISM expressed first, a minimum epoch, a consecutive run of epochs with enough revenue and active blocks, and enough cumulative ETH committed to bid Mass (Genome.sol:68-74). See genes and the thresholds on parameters.
#Funding
From the first harvest after expression, a fixed share of every ETH fee harvest goes to regenReserve instead of ethReserve (parameters) (GeneHook.sol:707-718). Once the gene is expressed, the METABOLISM bid budget is reduced by the same share (GeneHook.sol:816), and a buyback may spend at most that share of the previous epoch's bid budget (GeneHook.sol:567).
#What regenerate() does
Anyone may call regenerate() once the gene is expressed (GeneHook.sol:296-298). Inside one unlock the hook (GeneHook.sol:561-591):
- Sizes the allotment as the smallest of: the REGENERATION reserve, the per-call cap, what is left of the per-epoch cap, and what is left of the net-flow allowance, which is the REGENERATION share of the previous epoch's bid budget (regen_cap_call, regen_cap_epoch). Fee income from churn funds no buyback.
- Stops early if the allotment is below the minimum (min_deploy_eth).
- Sets a price limit a fixed number of ticks above the ATL price (regen_premium_ticks). If the price is already at or above that limit, it buys nothing.
- Swaps ETH for GENE exact-in, with that limit. The hook is the swapper, so the PoolManager skips the hook's own swap callbacks (Hooks.sol:253).
- Settles by burning the hook's ETH claims for the ETH spent and taking the GENE bought to itself, then emits
Regenerated(GeneHook.sol:585-589).
After the unlock, the hook burns the GENE it bought (GeneHook.sol:308; GeneToken.sol:21-23).
#The cooldown
The cooldown (cooldown_blocks) starts only when a call spends its whole allotment (GeneHook.sol:304-307). A call that spends nothing, has no allotment, or is stopped early by the price limit leaves it untouched. This stops anyone from locking REGENERATION out with cheap no-op or dust calls (RegenCooldown.t.sol). A consequence: when the price limit stops a buyback early, regenerate() can be called again in the same block. Every call is still bounded by the premium over the ATL and by all the caps, so the total per epoch is unchanged.
#Why it does little early on
REGENERATION buys only within its small premium over the ATL, which is the launch price or lower. Near the ATL the genesis curve holds very little GENE for sale, so the price limit usually binds before the per-call cap, and the single-epoch allowance stays below the per-epoch cap until Mass deepens the book. In a market trading well above its ATL, a call buys nothing and the ETH stays in reserve.
Sellers pay the 1% LP fee in GENE, and that GENE is placed as asks above the price (GeneHook.sol:541-552). RC4 tests reach a buyback after adding GENE to a seller's balance with a test cheatcode (RegenCooldown.t.sol:60; Rc4Rules.t.sol:58; SecurityCaps.t.sol:118). ETH that is not spent stays in regenReserve, which only regenerate() can spend.
Audit scope note: whether the buyback window is reachable with supply-faithful balances; in a local rehearsal where every GENE in circulation came from the pool, full selling left the price about 11% to 13% outside the window (see Security).
REGENERATION is a bounded buyback anchored at the all-time low, and it buys only within about 1% of that price. See anchors and limitations explained.
Sources (14)
- src/Genome.sol:40-49
- src/Genome.sol:46
- src/Genome.sol:68-74
- src/GeneHook.sol:145
- src/GeneHook.sol:262-263
- src/GeneHook.sol:293-309
- src/GeneHook.sol:561-591
- src/GeneHook.sol:707-718
- src/GeneHook.sol:808-817
- src/GeneToken.sol:21-23
- lib/v4-core/src/libraries/Hooks.sol:253
- test/unit/RegenCooldown.t.sol:60
- test/unit/Rc4Rules.t.sol:58
- test/unit/SecurityCaps.t.sol:118
Paths are relative to the GENE repository at tag rc4-audit-candidate (aca5fcd).