How it works

A trader uses an ordinary Uniswap v4 pool. The pool holds no liquidity of its own: the WalletIndex hook quotes the swap against every listed wallet through a SwapVM router and fills it from the best one, straight out of that maker's wallet via 1inch Aqua.

Traderany Uniswap userUniswap v4 poolWETH/USDC, no own liquidityWalletIndex hookbest quote of all walletsSwapVM router1inch opcodes + opcode 34Chainlink ETH & BTCfresh, or no quote at allalice's walletvia 1inch Aquabob's walletvia 1inch Aquacarol's walletvia 1inch Aquaagent retunes the wallets on-chain

Illustration: the hook asks every wallet, the router prices each with opcode 34 against Chainlink, the cheapest fills.

Opcode 34 · try it

The instruction values the whole basket at Chainlink prices, measures how far it sits from its targets before and after the trade, and moves the spread by the difference. The wallet is paid to rebalance.

ETH
45% / 30%
USDC
35% / 50%
cbBTC
20% / 20%
Trader buys ETH from the wallet1 bps
Trader sells ETH to the wallet28 bps

Simulation of the on-chain formula (port of PortfolioSkewInstruction.sol, deployed parameters: base 8 bps, min 1, max 40, gain 100). Tick = base spread.

The program

salt 22 len base·min·max·gain·maxAge·assets…

Opcode 0x22 = 34 is appended to 1inch's official SwapVM opcode table. Settings live in the program args, so quote() and swap() run the same code.

base 2 Bspread with no rebalancing effect
min · max 2 B · 2 Bclamp, 1 and 40 bps
gain 4 Bbps of spread per bp of imbalance change × 10⁴
maxAge 4 Bolder Chainlink answer → no quote
n × asset 43 B eachtoken · feed · decimals · target weight

The agent's rule

Each tick it reads the last 8 Chainlink rounds on Base and retunes every wallet's base spread on-chain (Aqua dock, ship, replace the hook listing).

calmlargest move < 15 bpstighten
normal15–40 bpsdefault
jumpy≥ 40 bpswiden

A keeper sweeps the hook's settled claims back into its working float. Stale price past the freshness limit: every wallet refuses to quote.