OPNet · Bitcoin L1 · VibeCoding Week 2

Permissionless Fee-to-Vesting
on Bitcoin L1

Anyone can lock tokens for any beneficiary. Protocol fees deposited by any address flow proportionally to all locked-token holders — no owner, no bridges, no L2.

View on GitHub
OPNet Testnet — LIVE
🔓 Permissionless
⚡ O(1) distribution
₿ Bitcoin L1
✓ 0 Critical findings
🛡️ StoredBoolean guard
🔒
Total Locked
💰
Revenue Distributed
Block Height
O(1)
Distribution Complexity

Permissionless vesting in 5 steps

FeeVest combines public vesting creation with Synthetix-style revenue sharing — entirely on Bitcoin L1. No owner required for the core flow.

01
⚙️

Deploy & Initialize

Deploy the WASM contract. Owner calls initialize(revenueToken) once to set the single OP_20 token used for both vesting and revenue distribution.

02
🔓

Anyone Deposits & Vests

No owner needed. Any address calls depositAndVest(amount, beneficiary, cliff, duration). Tokens pulled via transferFrom and locked immediately.

03
💰

Deposit Protocol Revenue

Any address (fee router, DAO, individual) deposits revenue tokens. The global rewardPerToken accumulator updates in O(1) — zero iteration over beneficiaries.

04

Cliff Passes

Once the cliff block is reached, tokens begin vesting linearly. getPendingRelease = vested − already released. Computed per-block from immutable block height.

05
🎯

Release & Claim Revenue

Beneficiary calls release() for vested tokens and claimRevenue() for their proportional revenue share. CEI enforced. Reentrancy-protected.

Built for correctness

Every design decision in FeeVest prioritizes safety, permissionlessness, and mathematical correctness on Bitcoin L1.

🔓

Permissionless Creation

Any address can fund a vesting schedule for any beneficiary. No owner restriction on depositAndVest(). Griefing mitigated by single-schedule-per-beneficiary guard.

depositAndVest(amount, beneficiary, cliff, dur)
📊

Synthetix Accumulator

Revenue distributed via rewardPerToken global accumulator. Each deposit is O(1). Claims computed instantly from stored debt snapshots — no loops ever.

rewardPerToken += (amount × 1e18) / totalLocked
🛡️

Persistent Reentrancy Guard

Lock flag is a StoredBoolean in blockchain persistent storage — not in-memory. Survives per-call class re-instantiation unique to OPNet's execution model.

StoredBoolean(_locked, false)

Block-Based Vesting

Cliff + linear release computed purely from block numbers — no timestamps, no oracle. Deterministic and manipulation-resistant on Bitcoin L1.

Blockchain.block.numberU256

Strict CEI Pattern

State written before every external Blockchain.call(). Checks (including computeReleasable) → Effects (updateReward + state) → Interactions. Audited line-by-line.

checks → updateReward() → state → callTransfer()
🔢

SafeMath Everywhere

All arithmetic uses SafeMath.add/sub/mul/div. Zero floating point. No raw u256 operators. Rounding truncates toward zero, favoring the protocol.

SafeMath.mul(amount, PRECISION)

Revenue distribution — verified

Example: Alice 70% locked, Bob 30% locked. Two revenue deposits of 1 000 and 700 tokens.

Alice & Bob — end-state snapshot
Participant Locked Share Deposit 1 (1 000) Deposit 2 (700) Total earned
🟠 Alice 7 000 70% 700 400 (4000 locked) 1 100 ✓
🔵 Bob 3 000 30% 300 600 (3000 locked) 600 ✓
Σ Total 10 000 100% 1 000 700 1 700 ✓
Initial Deposit
rewardPerToken += 1000 × 10¹⁸ / 10000 = 10¹⁷

Global accumulator updated in O(1). No loops over beneficiaries.

Claim (Alice — 7 000 locked)
earned = 7000 × 10¹⁷ / 10¹⁸ = 700

Bob earns 300. Total = 1 000. No dust left.

After partial release (Alice releases 3 000)
stored pending = 700 (captured first) lockedBalance = 7000 − 3000 = 4000 rewardDebt = currentRpt

Next deposit of 700 tokens:

rewardPerToken += 700 × 10¹⁸ / 7000 = 10¹⁷ Alice new earn = 4000 × 10¹⁷ / 10¹⁸ = 400 Alice total = 700 + 400 = 1100 ✓ Bob total = 3000 × 2×10¹⁷ / 10¹⁸ = 600 ✓ Grand total = 1700 = deposited ✓

Result: 1100 + 600 = 1700 — perfectly balanced.

Interact with FeeVest

Connect your OP Wallet to vest tokens, release vested amounts, claim revenue, or deposit protocol fees.

Contract Configuration
FeeVest Contract Vault
Token Address OP_20
Your Wallet Auto-filled

Connect your OP Wallet

View your vesting schedule, pending revenue, and interact with FeeVest directly from your browser.

AI-assisted audit — 0 critical findings

All 29 critical vulnerability patterns and 20 OPNet-specific attack surfaces checked. Audited by OPNet Bob MCP.

0
Critical
0
High
0
Medium
1
Low (design)
2
Info
SafeMath — all u256 arithmetic ops
StoredBoolean — persistent reentrancy guard
Strict CEI — computeReleasable before updateReward
tx.sender — never tx.origin
No loops — O(1) accumulator pattern
No floats — pure integer arithmetic
Block height — no timestamp oracle
BytesWriter — buffer sizes match writes
increaseAllowance — ATK-05 mitigated in frontend
AddressMemoryMap — no unsafe built-in Map