Technical whitepaper

bald: A 5× Leveraged ETH
Peg via Uniswap v4 Hooks

Base Mainnet Uniswap v4 Chainlink ETH/USD
Abstract. bald is an ERC-20 token whose market price is continuously pegged to a 5× leveraged long position on ETH/USD. The peg is enforced entirely on-chain through a Uniswap v4 hook that intercepts every swap, reads a Chainlink oracle, computes a target price, charges dynamic fees that penalize trades widening the gap, and executes autonomous rebalancing swaps funded by those fees. No keeper, no funding rate, no liquidation risk.
1 — Background

The problem with leveraged tokens

Existing leveraged tokens rely on centralized rebalancing engines, daily NAV resets, or off-chain keepers. This introduces counterparty risk, rebalance lag, funding costs, and liquidation exposure. Perpetual futures require margin, carry funding rates, and can be liquidated.

bald replaces all of this with a single Uniswap v4 hook. The hook is the keeper. Every trade triggers the rebalance logic. There is no external party, no cron job, no trusted operator.

2 — Price target formula

How the peg is computed

At pool initialization, the hook records two values: the initial ETH/USD price P₀ (from Chainlink) and the initial pool sqrtPrice S₀ (from the Uniswap v4 PoolManager). These serve as the leverage baseline — the point of zero synthetic move.

ETH move percentage

ETH move since inception Δeth = (Pt − P0) / P0

Where Pt is the current Chainlink price and P0 is the price at pool creation.

Synthetic move with leverage

Leveraged move Δsynth = L × Δeth where L = 5 (leverage multiplier)

The synthetic move is capped at ±25% per evaluation to limit extreme oracle moves from causing pathological behavior.

Target sqrtPrice

Uniswap v4 represents prices as sqrtPriceX96 — the square root of the price ratio, scaled by 2⁹⁶. The target sqrtPrice is derived from the initial sqrtPrice scaled by the square root of the leverage ratio:

Target sqrtPrice Starget = S0 × √(1 + Δsynth)

This is computed using a Babylonian integer square root to stay fully on-chain with no floating point:

Solidity implementation ratioWad = WAD + synthMove sqrtRatio = √(ratioWad × WAD) / 1e9 Starget = S0 × sqrtRatio / 1e9
Example. ETH rises 2% from inception. With 5× leverage: Δsynth = 0.10. Target sqrtPrice = S₀ × √1.10 ≈ S₀ × 1.0488. The bald pool price should be ~10.25% higher than at launch.
3 — Dynamic fee mechanism

Penalizing trades that widen the gap

When the pool price is below the oracle target, selling bald pushes it further off peg. The hook charges a dynamic penalty fee on sells proportional to the gap between current and target sqrtPrice.

Gap calculation

Gap as fraction of target gap = (Starget − Scurrent) / Starget

Operating on sqrtPrices rather than raw prices avoids overflow and naturally scales with the pool's internal representation.

Extra fee

Dynamic sell penalty (in pips, where 1,000,000 = 100%) feeextra = min(gap × feeScale, maxExtraFee) feeScale = 300,000 pips (30% per unit gap) maxExtraFee = 100,000 pips (10%)

Total fee by direction

DirectionBase feeDynamic feeMax total
Buy bald1%none1%
Sell bald (at peg)1%0%1%
Sell bald (below peg)1%0–10%11%

Fees are collected in WETH. The base 1% is sent instantly to the protocol via take() inside the PoolManager. The dynamic portion is minted as ERC-6909 claims inside the PoolManager, accumulating in the hook's treasury balance.

Asymmetric incentive. Buying bald when it is below peg is always cheap (1%). Selling bald when it is below peg becomes progressively expensive. This asymmetry creates a natural attractor — rational traders are incentivized to buy the dip rather than dump into it.
4 — Autonomous rebalancing

The hook as on-chain market maker

After every swap, the hook evaluates whether the pool price is meaningfully below the oracle target. If it is, and the treasury holds WETH, the hook executes a buy of bald directly inside the same transaction — no external call, no keeper, no delay.

Rebalance trigger condition

Trigger condition Scurrent < Starget AND gappipsthreshold (default: 0.1%) AND treasury > 0

Rebalance execution

The hook calls poolManager.swap() directly — it is already inside the PoolManager's unlock context from the user's swap, so no nested unlock is needed. A reentrancy guard (_rebalancing flag) prevents the hook from triggering itself recursively.

Rebalance swap parameters direction: WETH → bald (zeroForOne depends on token ordering) amountIn: min(treasury, maxWethPerRebalance) sqrtPriceLimit: Starget (don't push price above target)

The price limit prevents the rebalance from overshooting — if the treasury has more WETH than needed to reach the target, the swap stops at the target and unused WETH is returned to the treasury balance.

Settlement

After the swap, the hook burns WETH ERC-6909 claims to cover the WETH it sold to the pool, and takes the purchased bald. The bald accumulates in the hook's address as protocol inventory.

Self-funding loop. Dynamic sell fees → treasury WETH → autonomous buys → price closer to peg → smaller gap → lower fees. The system is designed to converge. The more aggressive the selling, the more the treasury fills, and the stronger the next rebalance.
5 — Hook architecture

Uniswap v4 integration

Hook permissions

The hook address encodes its required permissions in the low 14 bits, enforced by the Uniswap v4 PoolManager at registration time:

PermissionBitPurpose
afterInitialize0x1000Capture baseline price and oracle reference
beforeSwap0x0080Compute dynamic fee, collect fee on buys
afterSwap0x0040Collect fee on sells, trigger rebalance
beforeSwapReturnDelta0x0008Absorb WETH input on buys (fee deduction)
afterSwapReturnDelta0x0004Absorb WETH output on sells (fee deduction)

Required hook address suffix: 0x10CC. The contract address is mined via CREATE2 until the suffix matches.

LP fee override

The pool is initialized with DYNAMIC_FEE_FLAG. The hook overrides the LP fee to zero on every swap via OVERRIDE_FEE_FLAG | 0 — LPs receive no fee. All fees are taken by the hook and distributed as described above.

Oracle staleness protection

If the Chainlink oracle has not been updated within the staleness window (default 2 days), all swaps revert with OracleStale. This prevents the hook from acting on a stale price target. The pool can also be paused instantly by the owner.

6 — Deployments

Contract addresses

ContractAddress
bald token0x2F8934007eeE3947e9Daf0959f0c673f8E1C5CB2
Hook0xB1c22fbbb4e520D9Be683cF093C9A7789C0CD0CC
Oracle (Chainlink ETH/USD)0x71041dddad3595F9CEd3DcCFBe3D1F4b0a16Bb70
Pool Manager0x498581fF718922c3f8e6A244956aF099B2652b2b