Documentation · Reference
Parameters
The 43 Genome constants committed by genomeHash, and what each one governs in GeneHook.
Every bound GENE operates under is a compile-time constant in the Genome library. No function takes a genome value as input, so none can be changed after compilation (Genome.sol:4-10). GeneHook.genomeHash() is keccak256(Genome.encode()) (GeneHook.sol:245-246), and test/unit/GenomeHash.t.sol pins the RC4 value 0x39c130f616c32abfb40f8ab51eb54544cffd3e0d99602c71dc336bc8083c36ae (GenomeHash.t.sol:11). GeneLens.genome() returns the exact encoded bytes.
The encoding is the concatenation of nine abi.encode groups, 43 words, in the order written; the order is part of the commitment (Genome.sol:88-115). Units: ETH amounts are in wei (written with the ether suffix in the source), GENE amounts in 18-decimal units, ticks are Uniswap ticks, epochs are numbered from the launch block. Values are rendered from the source below.
#All 43 constants
Pool and placement _encodePool
| Constant | Value | Meaning | Source |
|---|---|---|---|
VERSION | 4 | Genome encoding version (4 = V6g-D all-time-low rule + R1 REGENERATION cooldown) | Genome.sol:12 |
SUPPLY | 1,000,000,000 GENE | Fixed supply, minted once to the hook and seeded into the pool at launch | Genome.sol:15 |
LP_FEE | 10,000 pips (1%) | Static 1.00% LP fee in the PoolKey | Genome.sol:16 |
TICK_SPACING | 60 ticks | Pool tick spacing | Genome.sol:17 |
GENESIS_TICK_UPPER | 178,080 ticks | Opening price: the top of the genesis band | Genome.sol:18 |
GENESIS_TICK_LOWER | 85,920 ticks | 10,000x the opening price: the far edge of the genesis band (a design bound) | Genome.sol:19 |
EPOCH_BLOCKS | 7,200 blocks | Epoch length, about 24 hours | Genome.sol:22 |
MIN_BLOCK_VOLUME | 0.05 ETH | ETH swap volume that makes a block count as active | Genome.sol:23 |
PATH_CLAMP | 200 ticks | Most ticks one block can add to an epoch's path | Genome.sol:24 |
GAP | 60 ticks | Minimum distance of a placement from its reference price | Genome.sol:27 |
GRID | 600 ticks | Placement band edges snap to this grid | Genome.sol:28 |
NEAR_WIDTH | 1,200 ticks | Width of the ETH bands placed at the all-time low | Genome.sol:29 |
Caps and timing _encodeCaps
| Constant | Value | Meaning | Source |
|---|---|---|---|
BID_CAP_CALL | 3 ETH | METABOLISM bids, most ETH per metabolize() call | Genome.sol:34 |
BID_CAP_EPOCH | 10 ETH | METABOLISM bids and churn tier, most ETH per epoch | Genome.sol:35 |
IMMUNITY_CAP_CALL | 1 ETH | IMMUNITY, most ETH per call | Genome.sol:36 |
IMMUNITY_CAP_EPOCH | 1.5 ETH | IMMUNITY, most ETH per epoch | Genome.sol:37 |
ASK_CAP_CALL | 10,000,000 GENE | Ask Mass, most GENE per call | Genome.sol:38 |
ASK_CAP_EPOCH | 30,000,000 GENE | Ask Mass, most GENE per epoch | Genome.sol:39 |
REGEN_CAP_CALL | 0.5 ETH | REGENERATION buyback, most ETH per call | Genome.sol:40 |
REGEN_CAP_EPOCH | 1 ETH | REGENERATION buyback, most ETH per epoch | Genome.sol:41 |
MIN_DEPLOY_ETH | 0.001 ETH | Smallest ETH placement | Genome.sol:42 |
MIN_DEPLOY_GENE | 1,000 GENE | Smallest GENE placement | Genome.sol:43 |
COOLDOWN_BLOCKS | 300 blocks | Blocks between metabolize() calls (and after a full-allotment regenerate()) | Genome.sol:44 |
HARVEST_PER_CALL | 8 | Registry positions poked per metabolize(), plus genesis | Genome.sol:45 |
REGEN_PREMIUM_TICKS | 100 ticks | A buyback never pays more than about 1% over the all-time-low price | Genome.sol:46 |
REGEN_SHARE_BPS | 2,000 bps (20%) | REGENERATION's share of the net-flow bid budget once expressed | Genome.sol:49 |
GENE_COUNT | 4 | Number of genes | Genome.sol:61 |
AUTO_EVOLVE_MAX | 8 | Pending epochs one metabolize() folds before spending | Genome.sol:54 |
Gene conditions _encodeGenes
| Constant | Value | Meaning | Source |
|---|---|---|---|
MET_MIN_EPOCH | 1 epochs | METABOLISM can express from epoch 1 | Genome.sol:64 |
MET_REVENUE | 0.25 ETH | METABOLISM pressure: epoch revenue at least 0.25 ETH | Genome.sol:65 |
MET_OBSERVE | 2 epochs | METABOLISM: 2 consecutive pressure epochs | Genome.sol:66 |
REG_MIN_EPOCH | 14 epochs | REGENERATION can express from epoch 14 | Genome.sol:70 |
REG_REVENUE | 0.25 ETH | REGENERATION pressure: revenue at least 0.25 ETH | Genome.sol:71 |
REG_ACTIVE_BLOCKS | 300 blocks | REGENERATION pressure: at least 300 active blocks | Genome.sol:72 |
REG_OBSERVE | 7 epochs | REGENERATION: 7 consecutive pressure epochs | Genome.sol:73 |
REG_ETH_COMMITTED | 10 ETH | REGENERATION: at least 10 ETH committed to Mass | Genome.sol:74 |
IMM_MIN_EPOCH | 14 epochs | IMMUNITY can express from epoch 14 | Genome.sol:77 |
IMM_REVENUE | 0.1 ETH | IMMUNITY pressure: revenue at least 0.1 ETH | Genome.sol:78 |
IMM_PATH_TICKS | 3,000 ticks | IMMUNITY pressure: price path at least 3,000 ticks | Genome.sol:79 |
IMM_WINDOW | 7 epochs | IMMUNITY: window of the last 7 epochs | Genome.sol:80 |
IMM_REQUIRED | 5 epochs | IMMUNITY: 5 pressure epochs in the window | Genome.sol:81 |
IMM_DEPLOY_REVENUE | 0.5 ETH | IMMUNITY deployment: each confirming epoch earns at least 0.5 ETH | Genome.sol:85 |
IMM_CONFIRM | 2 epochs | IMMUNITY deployment: the last 2 processed epochs both deploy-stressed | Genome.sol:86 |
#Rules with no constant
Three rules have no numeric parameter and are fixed by the verified bytecode instead (Genome.sol:8-10): every protocol buy is anchored at the all-time-low block-start price, asks are anchored at the all-time-high block-start price, and ETH budgets come from net curve flow counted once against cumulative water marks. See Anchors and Net-flow budgets.
The gene ids GENESIS, METABOLISM, REGENERATION and IMMUNITY (Genome.sol:57-60) are labels used by the code and in events. They are not in the encoding; GENE_COUNT is.
#Token and pool
#VERSION
Identifies the encoding (Genome.sol:12). It is hashed but not otherwise read. Each change to the RC4 rules raised it; the history is on the Changelog.
#SUPPLY
The total GENE supply in 18-decimal units (Genome.sol:15). launch() places this amount single-sided in the genesis band (GeneHook.sol:423). GeneToken mints its own constant INITIAL_SUPPLY, which has the same value (GeneToken.sol:12).
#LP_FEE
The pool's LP fee in pips (hundredths of a basis point), static, written into the PoolKey (GeneHook.sol:239). beforeSwap rejects any other fee (GeneHook.sol:362). GeneHook also uses it for two calculations: the buy-side revenue evidence metric (GeneHook.sol:386) and the rate applied to newly funded net flow when budgets are created (GeneHook.sol:863). Sells count net GENE in net of this fee (GeneHook.sol:382).
#TICK_SPACING
The pool's tick spacing, in the PoolKey (GeneHook.sol:240) and checked in beforeSwap (GeneHook.sol:362). It also sets the largest usable tick, MAX_USABLE_TICK (GeneHook.sol:157).
#GENESIS_TICK_UPPER
The opening tick: launch() initializes the pool at it and seeds every BlockState tick with it, including atlTick (GeneHook.sol:257, GeneHook.sol:266). It is the upper edge of the genesis band (GeneHook.sol:422).
#GENESIS_TICK_LOWER
The lower edge of the genesis band (GeneHook.sol:421, GeneHook.sol:272), the highest GENE price the genesis liquidity covers. The source describes it as a design bound, not a claim (Genome.sol:19). Ask bands use it as their lower edge while there is room (GeneHook.sol:788-792).
#Epochs and references
#EPOCH_BLOCKS
Blocks per epoch. The epoch number is (block.number - launchBlock) / EPOCH_BLOCKS (GeneHook.sol:747; GeneLens.sol:104).
#MIN_BLOCK_VOLUME
ETH volume (wei) at which a touched block counts as active: it then adds one to activeBlocks and its clamped start-to-start move to pathTicks (GeneHook.sol:739-745).
#PATH_CLAMP
The most ticks one active block can add to pathTicks (GeneHook.sol:742).
#Mass placement
#GAP
Minimum distance, in ticks, between a band and its reference price. Bids, churn and IMMUNITY start one GAP beyond their anchor; asks end one GAP beyond theirs (GeneHook.sol:484, GeneHook.sol:499, GeneHook.sol:516, GeneHook.sol:545).
#GRID
Placement band edges snap to multiples of this tick count, which bounds the number of distinct positions (GeneHook.sol:484, GeneHook.sol:499, GeneHook.sol:516, GeneHook.sol:545, GeneHook.sol:782-792). Two edges do not: a wide ask band starts at GENESIS_TICK_LOWER (85,920, not a multiple of 600), and neither edge of the genesis band is a multiple (GeneHook.sol:790; Genome.sol:18-19).
#NEAR_WIDTH
Width, in ticks, of every ETH band (METABOLISM bids, churn tier, IMMUNITY) and of an ask band near the genesis lower edge; also the clamp distance from the usable tick limits (GeneHook.sol:500-501, GeneHook.sol:517-518, GeneHook.sol:783-791).
#Caps and timing
#BID_CAP_CALL
Most ETH (wei) each bid tier can place per metabolize() call, applied separately to METABOLISM bids and to the churn tier (GeneHook.sol:482, GeneHook.sol:538; Genome.sol:31-33).
#BID_CAP_EPOCH
Most ETH (wei) METABOLISM bids can place in one epoch (GeneHook.sol:481). The churn tier places only within this cap minus the bids and churn already placed (GeneHook.sol:535-536). Audit scope note: the bids check does not count churn; whether the two together can exceed this cap (see Security).
#IMMUNITY_CAP_CALL
Most ETH (wei) IMMUNITY can place per call (GeneHook.sol:495).
#IMMUNITY_CAP_EPOCH
Most ETH (wei) IMMUNITY can place per epoch (GeneHook.sol:494).
#ASK_CAP_CALL
Most GENE an ask placement can use per call (GeneHook.sol:542).
#ASK_CAP_EPOCH
Most GENE ask placements can use per epoch (GeneHook.sol:542).
#REGEN_CAP_CALL
Most ETH (wei) one REGENERATION buyback can spend (GeneHook.sol:563).
#REGEN_CAP_EPOCH
Most ETH (wei) REGENERATION can spend per epoch (GeneHook.sol:563).
#MIN_DEPLOY_ETH
Smallest ETH amount (wei) for an IMMUNITY, METABOLISM bid or churn placement, or for a REGENERATION buyback; smaller amounts are skipped (GeneHook.sol:483, GeneHook.sol:496, GeneHook.sol:515, GeneHook.sol:571).
#MIN_DEPLOY_GENE
Smallest GENE amount for an ask placement (GeneHook.sol:543).
#COOLDOWN_BLOCKS
Blocks between keeper calls. metabolize() starts it on every call that does not revert; regenerate() starts it only after a full-allotment buyback (GeneHook.sol:285-286, GeneHook.sol:300-307).
#HARVEST_PER_CALL
Registry positions poked round-robin per harvest, in addition to the genesis position (GeneHook.sol:678).
#REGEN_PREMIUM_TICKS
Ticks subtracted from atlTick to form REGENERATION's price limit, so the buyback pays at most about 1% over the all-time-low block-start price (GeneHook.sol:574; Genome.sol:46). Audit scope note: reachability of this window with supply-faithful balances (see Security).
#REGEN_SHARE_BPS
Basis points used three ways. Once REGENERATION is EXPRESSED, it is the share of harvested ETH fees credited to regenReserve instead of ethReserve (GeneHook.sol:709-712) and the reduction applied to ethBudget() (GeneHook.sol:816). It also caps each epoch's REGENERATION spend as a share of epoch e-1's bid budget (GeneHook.sol:567).
#GENE_COUNT
Number of genes. GeneHook's GeneStatus array uses a literal length, and the test suite asserts the two match (GeneHook.sol:192; GenomeHash.t.sol:23).
#AUTO_EVOLVE_MAX
Most pending closed epochs metabolize() processes before spending. ETH placements run only if that catches evolveCursor up to the current epoch (GeneHook.sol:289, GeneHook.sol:465).
#Genes
A gene counts a processed epoch only if its predecessor is EXPRESSED in an earlier epoch and the epoch is at least the gene's minimum (GeneHook.sol:896-899). Revenue below is the closed epoch's EpochRecord.revenue, the buy-side evidence metric, not the fees collected. See Genes.
#METABOLISM
#MET_MIN_EPOCH
First epoch METABOLISM can count (GeneHook.sol:884).
#MET_REVENUE
Revenue (wei) a closed epoch needs to count as METABOLISM pressure (GeneHook.sol:884).
#MET_OBSERVE
Consecutive pressure epochs needed to express METABOLISM; a miss resets the count (GeneHook.sol:884, GeneHook.sol:901-917).
#REGENERATION
#REG_MIN_EPOCH
First epoch REGENERATION can count (GeneHook.sol:889).
#REG_REVENUE
Revenue (wei) a closed epoch needs, together with REG_ACTIVE_BLOCKS, to count as REGENERATION pressure (GeneHook.sol:888).
#REG_ACTIVE_BLOCKS
Active blocks a closed epoch needs, together with REG_REVENUE (GeneHook.sol:888).
#REG_OBSERVE
Consecutive pressure epochs needed to express REGENERATION (GeneHook.sol:890).
#REG_ETH_COMMITTED
Cumulative ETH (wei) committed to bid Mass, read from the expressing epoch's record, required for REGENERATION to express (GeneHook.sol:891, GeneHook.sol:911).
#IMMUNITY expression
#IMM_MIN_EPOCH
First epoch IMMUNITY can count (GeneHook.sol:921).
#IMM_REVENUE
Revenue (wei) a closed epoch needs, together with IMM_PATH_TICKS, to count as stressed for expression (GeneHook.sol:881).
#IMM_PATH_TICKS
pathTicks a closed epoch needs for both expression stress and deployment stress (GeneHook.sol:881-882).
#IMM_WINDOW
Length, in processed epochs, of IMMUNITY's stress history (GeneHook.sol:922-924).
#IMM_REQUIRED
Stressed epochs within the window needed to express IMMUNITY (GeneHook.sol:933).
#IMMUNITY deployment
#IMM_DEPLOY_REVENUE
Revenue (wei) a processed epoch needs, together with IMM_PATH_TICKS, to set a bit in the deployment-stress register immuneStressBits (GeneHook.sol:882-883).
#IMM_CONFIRM
Number of most recent processed epochs that must all be deployment-stressed for immunityActive() to be true; the source notes it can be at most 8 (GeneHook.sol:803-804; Genome.sol:86).
Sources (28)
- src/Genome.sol:4-10
- src/Genome.sol:12-86
- src/Genome.sol:88-115
- src/GeneHook.sol:157
- src/GeneHook.sol:192
- src/GeneHook.sol:239-246
- src/GeneHook.sol:257
- src/GeneHook.sol:272
- src/GeneHook.sol:285
- src/GeneHook.sol:289
- src/GeneHook.sol:300
- src/GeneHook.sol:362
- src/GeneHook.sol:382-386
- src/GeneHook.sol:421-423
- src/GeneHook.sol:479-552
- src/GeneHook.sol:563-575
- src/GeneHook.sol:574-577
- src/GeneHook.sol:678
- src/GeneHook.sol:707-718
- src/GeneHook.sol:739-747
- src/GeneHook.sol:782-792
- src/GeneHook.sol:802-817
- src/GeneHook.sol:863
- src/GeneHook.sol:879-934
- src/GeneLens.sol:104
- src/GeneToken.sol:12
- test/unit/GenomeHash.t.sol:11
- test/unit/GenomeHash.t.sol:23
Paths are relative to the GENE repository at tag rc4-audit-candidate (aca5fcd).