KhomDev VeForge
// VOTE-ESCROWED TOKENOMICS · GAUGE CONTROLLER · VYPER 0.4.3
A modernized Vyper 0.4 reference implementation of vote-escrowed tokenomics. Modeled after Curve Finance's canonical veCRV mechanics but rewritten for the Vyper 0.4 module system and hardened with Snekmate modules. Includes vote-escrow locks, weight-based gauge voting, and both direct and Merkle-proof bribe distribution.
Vyper 0.4.3
Snekmate
Moccasin
Titanoboa
Hypothesis
veToken
Merkle Proofs
4
Core Contracts
95%+
Coverage
7d
Gauge Epoch
4y
Max Lock
Components
VeForge ships four production-grade contracts that compose into a complete veTokenomics stack — locks, voting, and reward distribution at any scale.
- VotingEscrow.vy — Linear-decay vote-escrowed locks with EIP-712 permit, checkpoint history, and binary-search historical lookups
- GaugeController.vy — Weight-based gauge voting with weekly epochs and vote-weight caps
- BribeDistributor.vy — Direct bribe distribution for smaller user sets, pull-payment based
- BribeDistributorMerkle.vy — Merkle-proof claim distribution for large recipient sets, off-chain indexed
Security Hardening
Every contract is composed from Snekmate primitives where possible. State mutations follow checks-effects-interactions; ownership uses the 2-step transfer pattern to prevent accidental key loss.
- Reentrancy Guard — Snekmate
reentrancy_guard on every payable / withdraw path
- Checkpoint Binary Search — O(log n) historical balance / weight lookups; no unbounded loops
- EIP-712 Permit — Gasless approvals on escrowed token
- Pull Payment Pattern — Reward claims initiated by the recipient; no push transfers
- Merkle Claim Verification — Distributor verifies inclusion proofs against a frozen root per epoch
- Vote Weight Caps — Per-gauge weight ceilings prevent governance hijack
Test Coverage
- Unit tests — Lock creation, extension, withdrawal, decay curve accuracy
- GaugeController — Vote allocation, weight caps, epoch transitions, weight history
- BribeDistributor — Reward accounting, double-claim prevention, partial claims
- Merkle distributor — Proof validation, root rotation, invalid-proof rejection
- Hypothesis fuzzing — Stateful invariants over sequences of locks, votes, and claims
Key Features
- Full veCRV-compatible voting mechanics, modernized for Vyper 0.4 modules
- Two distribution flavors — pick direct for tens of recipients, Merkle for thousands
- EIP-712 / EIP-2612 standards-compliant
- Snekmate-hardened reentrancy and ownership primitives
- Titanoboa + Hypothesis stateful test harness