Uni-Guardian is a 24/7 AI agent that scores impermanent-loss risk on your Uniswap V3 position. When the math turns negative, it activates a just-in-time EIP-7702 account upgrade and atomically withdraws, swaps to USDC and deposits to Aave — all inside a single transaction, without migrating your wallet.
Concentrated-liquidity providers silently bleed value. By the time a human notices the drawdown on a dashboard, the damage is locked in.
Auto-rebalancers like Arrakis, Gamma and Charm keep positions centered on the current price. They never ask whether fees are still covering impermanent loss — they just keep you invested, even when they shouldn't.
Every 30 seconds, compute projected_IL(σ, t) vs projected_fees(volume, t). When IL > fees + threshold, fire a Type-4 transaction: withdraw, swap to USDC, supply to Aave, log on X Layer. Your EOA becomes a smart account for exactly one block, then reverts.
Uni-Guardian doesn't just use OKX products — it structurally requires them. Remove any of these and the product stops working.
Type-4 tx signed by Agentic Wallet TEE makes your EOA self-call a delegate contract for one atomic batch. No 4337 bundler, no permanent migration.
Every authorization tuple and every batch envelope is signed inside a hardware enclave. Private key never leaves. Pre-flight security tx-scan validates intent before broadcast.
One payment authorization opens a 5-minute / 1000-query session on the IL risk feed. Each subsequent query is ≤100 ms. The facilitator is an x402 V2 drop-in.
UniGuardianLog on X Layer writes one entry per phase (risk, auth, withdrawn, swapped, deposited). Judges verify autonomy by reading the contract.
What happens the moment projected IL crosses the threshold.
monitor.ts ────── x402 session poll
│ ↓
│ risk-engine.decide({ ilBps, feeAprBps, threshold })
│ ↓
│ verdict = UNWIND (dwell-timer met, cooldown expired)
│ ↓
action.ts
┌───────────────────────────────────────────────────────────────────┐
│ 1 gateway nonce → fresh EOA nonce │
│ 2 NPM.positions(tokenId) → live liquidity + ticks │
│ 3 swap quote → OKX Aggregator router │
│ 4 unwindPlanner.build() → 4-call batch │
│ 5 security tx-scan → intent firewall (allow) │
│ 6 wallet sign-typed-data 7702 → TEE signs auth tuple │
│ 7 gateway send-tx --type 4 → Type-4 broadcast │
└───────────────────────┬───────────────────────────────────────────┘
▼
LiquidityUnwindDelegate.executeBatch([
NPM.decreaseLiquidity + collect,
OKXRouter.swap(nonStable → USDC),
AaveV3Pool.supply(USDC, owner, 0),
]) │
▼
UniGuardianLog ←── WITHDRAWN · SWAPPED · DEPOSITED (X Layer)Numbers update during the judging window as the agent runs on mainnet.
Paste these into a block explorer to verify autonomous operation.
TEE signer: 0xb23aab40…b920b · X Layer mainnet · chainId 196
pnpm agent:e2es_72205f231c6d · 120s · 100 queries[3/6]inject risk · ilBps=620 · feeAprBps=90 · σ=1.15[4/6]risk engine → verdict=UNWIND[5/6]Agentic Wallet signs + broadcasts via 4337 EntryPoint[6/6]complete · 21 confirmations · 4 events captured| # | Artifact | Path | Tx Hash |
|---|---|---|---|
| 1 | Agentic Wallet self-transfer 0.01 USDC | wallet send | 0x61d2a65c…fa6321b2 ↗ |
| 2 | OKX DEX swap 0.5 USDC → USDG (QuickSwap V3) | swap execute | 0x725b3560…c7256dc8 ↗ |
| 3 | TEE contract-call approve(self, 1 USDC) | wallet contract-call | 0x516ba062…1826c105 ↗ |
| 4 | TEE contract-call approve(self, 0) revoke | wallet contract-call | 0x84b11ac2…815f2e2d ↗ |
| 5 | OKX DEX reverse swap 0.3 USDG → USDC | swap execute | 0x572ce1ad…93d5cfa2e ↗ |
tx 1 validates the TEE-signed transfer path. tx 2 + 5 validate the OKX DEX aggregator integration in both directions — the same code path the EIP-7702 unwind batch uses for its non-stable → USDC leg. tx 3 + 4 validate the generalized wallet contract-call path that writes UniGuardianLog.logDecision entries once the log contract is deployed.