UHI9 capstone · HK-UHI9-0888 · Impermanent Loss & Yield Systems

Impermanent loss, deleted in the algebra

One Uniswap v4 hook, one Euler credit account, leverage pinned at the single point where LP value is a straight line in price. Not hedged, not averaged out: removed from the formula.

Uniswap v4Uniswap v4EulerEulerChainlinkChainlinkReactiveReactiveUnichainUnichainYieldBasisYieldBasis
yb · one balance sheet
watching drift
wethEuler collateral · WETH$3,000
usdcEuler debt · USDC$1,500
usdcstable inventory · USDC$1,500
nav = collateral − debt + inventory$3,000 invariant

chainlinkETH/USD · chainlink

$2,412

LTV · target 50%

50.0%

chainlinkETH/USD answer updated, age 14s

A constant-product pool loses to every price move. Pin leverage at exactly two, and value becomes a straight line. The loss is not reduced. It is deleted.

the loss

Every pool pays for volatility.

price move

+100%

vanilla LP

-5.72%

YB

0.00%

-75%-50%0+100%+300%YB at L = 2constant product

Loss against simply holding, for any move r. The curve is 2√r/(1+r) − 1. The violet line is not a small number. It is the term deleted.

the algebra

Three lines, and the loss term is gone.

c = p · ycollateral at the Chainlink price
x₀ = 9/8 ( c + √( c² − 16/9 c d ) )
d = c/2 → V = c/2 ∝ p

At target the AMM spot equals the oracle exactly, so every off-target quote pays arbitrage to restore the line. Parity-tested against Egorov's AMM.vy, compiled with real Vyper 0.4.3.

1230.511.52price ratio rLP value VL=0.5L=1L=2L=3
v(r, L) = r^(L/2)L = 2 is the straight line

the mechanism

One balance sheet does everything.

Deposits, credit, swaps, and exits are four moves on the same Euler account.

01

WETH in. Shares on NAV.

The hook supplies your WETH into Euler from its own account and mints yb shares on net asset value. A new depositor can never dilute the LPs already in.

deposit(rawCollateral, minShares, deadline)

deposit flowtransferring WETH

wallet

wethWETH10.0
shares0.0
2 WETH

yb hook

ownsaccount
pricesNAV
supply

euler

ewetheWETH40.0
sendsupplymint
02

The stable side is borrowed.

USDC is drawn against the same account and parked as inventory. Borrow and inventory move together, so share value never flinches on a rebalance.

rebalanceBorrow(rawAmount, id)

euler accounton target
wethcollateral · WETH$3,000
usdcdebt · USDC$1,200
usdcinventory · USDC$1,200
NAV = c − d + i$3,000 · invariant
holdrebalance
03

Trades hit the balance sheet.

USDC in repays debt and releases WETH. WETH in is supplied, and inventory or fresh credit pays out. The v4 pool itself holds nothing.

previewQuote(i, j, inAmount)

swap routingUSDC → WETH

trader

sendsUSDC
getsWETH
USDC in
WETH out

yb hook

debtrepaid
WETHreleased
USDC repays debtWETH draws credit
04

Leave with your slice.

Pro-rata collateral out, pro-rata debt repaid from your own inventory slice only. Every rounding in the system favors the LPs who stay.

withdraw(shares, minCollateralOut, maxRawStableCharge, deadline)

pro-rata settlementslicing 25%

stayers · 75%

30 WETH
$42,750 debt
$42,750 inv

your slice · 25%

10 WETH
$14,250 debt
$14,250 inv
sliceoffsetpayout

One primitive, four protocols

Every integration is load-bearing. Remove any one and the line stops being straight.

Via Uniswap v4

The hook is the venue: custom accounting, no pool reserves, every swap settles on the balance sheet.

swap routing

USDC inrepays debt, releases WETH
WETH insupplied, USDC paid from inventory

the v4 pool itself holds nothing

Via Euler

One credit account owns collateral, debt, and stable inventory. Same address, no adapters.

one account

collateral · eWETH

debt · eUSDC

inventory · USDC

Via Chainlink

Every quote, share mint, and LTV reading prices through ETH/USD, normalized to 10¹⁸. Stale answers revert.

price path

ETH / USDYB hook10¹⁸ · age checkedstale → revert

Via Reactive

Three loops keep L = 2 without bots or keepers, each callback gated by sender, RVM id, and a replay key.

three loops

drift watcherborrow low · repay high
cron heartbeatreads pendingRebalance()
solvency watcherwarn, then halt

Exactly what passes locally

Numbers from the local suite, with nothing claimed that has not run.

0

Foundry tests, 10 suites

0

randomized ops per invariant

0

Vyper parity examples, exact

0%

line coverage on the math

line coverage on the math

YB.sol95%
YBLib.sol96%
YBReactive.sol97%
ChainlinkPriceOracle.sol100%
YBSolvencyReactive.sol100%
not claimed

No live deployment until addresses and tx hashes land in docs/VERIFICATION.md. The app is an honest preview against simulated state until then.

the route

Pinned by a fork gate before any deployment is claimed.

collateralwethUnichain WETH0x4200000000000000000000000000000000000006
debtusdcUnichain native USDC0x078D782b760474a361dDA0AF3839290b0EF57AD6
collateral vaultewethAlphaGrowth eWETH-10x1f3134C3f3f8AdD904B9635acBeFC0eA0D0E1ffC
debt vaulteusdcAlphaGrowth eUSDC-10x6eAe95ee783e4D862867C4e0E4c3f4B95AA682Ba
oraclechainlinkChainlink ETH/USD0xBcE70e194940a157f3A80566505a7E96f5238CCa
limitsborrow 8600 bps · liquidation 8800 bps · YB target 5000

See the balance sheet hold its line.

Open the app, or read the source and follow the math end to end.