One event, three chains, one fee
Parallax has two on-chain halves, both EIP-2535 diamonds. The reactive diamond on Lasna turns Base Sepolia swaps into callbacks. The hook diamond on Unichain Sepolia turns callbacks into a fee that follows the cross-chain gap.
- 01Base Sepolia200 ms blocksUniswap v4 PoolManager
Reference pool pETH/pUSD · static 0.05% fee, no hook
emits Swap(id, sender, …, sqrtPriceX96, liquidity, tick, fee) - 02Reactive Lasna~1 s blocks, instant finalityParallax reactive diamond
Subscribed to Swap with topic1 = reference pool id. react() normalises the tick, applies a 10-tick threshold, derives the origin time in ms from the block number
requestCallbackV_1_0 → onReference(seq, tick, origin block, origin ms, origin tx, …) - 03Unichain Sepolia1 s blocksParallax hook diamond
Callback proxy → CallbackReceiverFacet checks the proxy and the injected reactive sender, stores the reference
beforeSwap: arbitrage toward the reference pays base + surge; other flow pays the base fee
Who pays the surge
Prices are compared as canonical ticks: the tick of pETH quoted in pUSD, whichever token sorts first on either chain. One tick is about one basis point. In beforeSwap the hook reads the pool tick from the PoolManager and the direction from zeroForOne:
- A swap that moves the pool toward the reference is the arbitrage leg. It pays base + gap × capture × decay.
- A swap that moves the pool away from the reference, or any swap inside a 5-tick deadband, pays the base fee.
- The control pool records the same decision but always charges the base fee.
The fee goes back to the PoolManager as fee | OVERRIDE_FEE_FLAG, so it applies only to that swap. Pools without a dynamic fee are rejected in afterInitialize.
Decay is 2^(−t / 20 s), where t is time since the callback landed, read from Unichain's block.timestamp. It never depends on block counts or on clocks agreeing across chains. As the fee falls, arbitrageurs effectively bid for the right to rebalance, and LPs collect most of the gap as fees.
Surge = divergence × 90% capture × 2−t/20s, on top of the base fee, capped at 10%. The grey curve is t = 0. Time is measured with block timestamps, never block counts, because a Base Sepolia block is 200 ms.
Diamonds on both chains
Reactive diamond
Reactive Lasna · 5318007Hook diamond
Unichain Sepolia · 1301Reactive diamond (Lasna)
- The initializer subscribes the diamond to
Swapon the Base Sepolia PoolManager, withtopic1 = poolId. ReactFacet.react()runs behinddelegatecall. Reactive Omni runsreact()as an ordinary transaction on the contract's own state, so facets work as on any EVM chain, and the system contract sees the diamond as both subscriber and requester.- Forwards only moves of 10 or more ticks. It derives the origin time in milliseconds from the Base block number (200 ms blocks) because a
LogRecordcarries no timestamp. AbstractReactivefrom reactive-lib-omni providesonlySystemandpay(). Its immutable sits in the facet bytecode and survivesdelegatecall.
Hook diamond (Unichain Sepolia)
- Deployed with CREATE2 at a mined address whose low bits are exactly
AFTER_INITIALIZE|BEFORE_SWAP. - The PoolManager calls the diamond. The fallback delegates to HookFacet, where msg.sender is still the PoolManager.
onReferencerequires the Reactive callback proxy as caller and our reactive diamond as the injected first argument. Callbacks that arrive out of order never move the reference backwards.- Storage follows the diamond-storage pattern, so facets can be upgraded without moving the hook address.