Pre-launch. RC4 code-frozen for external audit (rc4-audit-candidate, aca5fcd). Report pending. Status, updated 2026-10-08
GENESpecimen 001

Documentation · Learn

Net-flow budgets

How GENE decides how much ETH it may place in an epoch, and why wash trading and round trips fund nothing near spot.

Fees pile up in reserves, but reserves do not decide how much ETH the protocol places. Each epoch's ETH placements are limited by budgets (a GENE term) created when the previous epoch closed. The budgets are built from net directional flow, so trading that ends where it started funds nothing near the market.

#Why net flow

A budget sized on gross volume or gross fees could be inflated by anyone willing to trade back and forth. The protocol would then place bids that the same trader could sell into. GENE measures something a round trip cannot inflate: the net amount of GENE that left the pool's curve (GeneHook.sol:35-38).

#Measuring net flow on the curve

Every swap adds a signed amount to the open epoch's netGeneMicro (GeneHook.sol:113, :378-383):

  • a buy counts the GENE it took out;
  • a sell counts the GENE it put in, net of the LP fee, because the fee accrues to positions and never enters the curve.

So the sign and size follow the price move. A round trip that restores the price nets to zero, whoever trades it and in however many swaps.

#Counting each unit once

Net flow is also counted against cumulative history. The hook keeps the running total of net GENE out since launch (nc), its all-time high (hwm) and the lowest level since that high (lwm) (GeneHook.sol:213-221). When an epoch closes (GeneHook.sol:840-858):

  • flow that lifts the total above its high funds a bid budget, and both marks move up;
  • flow that pushes the total below the low since that high funds an IMMUNITY budget, and the low moves down;
  • anything in between funds nothing.

A unit of net flow therefore funds a budget at most once, across any number of epochs, addresses or routers (GeneHook.sol:213-214).

#Valuing it

The newly funded GENE is valued in ETH at pLow, the epoch's cheapest price over its block starts and its closing price (GeneHook.sol:758-761). The budget is the LP-fee share of that value (parameters) (GeneHook.sol:860-864). Because the flow traded at pLow or better, a budget never exceeds the fee its own flow paid (GeneHook.sol:835-836). Only one of the two budgets is non-zero for a given epoch, and the FlowBudgets event reports it (GeneHook.sol:866-872).

#Three ETH channels

In epoch e, metabolize() spends from three separate channels, each read from epoch e - 1 (GeneHook.sol:479-539, :808-832):

  • METABOLISM bids: the bid budget, reduced by the REGENERATION share once that gene is expressed. ethBudget() returns it.
  • IMMUNITY: the IMMUNITY budget, spent only under IMMUNITY's deployment test. See immunity.
  • Churn tier: the closed epoch's revenue metric minus its bid budget. This is the part of the revenue metric that net buying did not fund (wash, churn, round trips). It can still become Permanent Mass, within the shared epoch cap and the ETH reserve, placed at the all-time-low anchor (GeneHook.sol:509-513, :526-539).

Each channel also has per-call and per-epoch caps (bid_cap_call, bid_cap_epoch, immunity_cap_call, immunity_cap_epoch); METABOLISM bids place at most BID_CAP_EPOCH per epoch, and the churn tier only within BID_CAP_EPOCH minus the bids and churn already placed (GeneHook.sol:481, :535-536; Genome.sol:31-37). Audit scope note: whether bids and churn together can exceed BID_CAP_EPOCH in one epoch (see Security). Caps reset when the epoch changes (GeneHook.sol:794-800). Placements below the minimum (min_deploy_eth) are skipped.

Budgets are not carried over. ETH above the budgets stays in ethReserve. Audit scope note: treatment of the net flow of an epoch that closes late, after a whole epoch with no touch (see Security).

#What this costs

Valuing at the epoch's cheapest price keeps every budget within the fee its own flow paid. In young markets with large price impact, that makes budgets small. See limitations explained. To read the live figures, use GeneLens.flowBudgets, ethBudgets and cumulativeFlow (GeneLens.sol:158-200); see read state.

Sources (11)
  • src/GeneHook.sol:35-38
  • src/GeneHook.sol:113
  • src/GeneHook.sol:199-221
  • src/GeneHook.sol:378-383
  • src/GeneHook.sol:458-476
  • src/GeneHook.sol:479-539
  • src/GeneHook.sol:758-761
  • src/GeneHook.sol:794-800
  • src/GeneHook.sol:808-873
  • src/Genome.sol:31-52
  • src/GeneLens.sol:158-200

Paths are relative to the GENE repository at tag rc4-audit-candidate (aca5fcd).