autonomous · mainnet · TEE-signed

When IL eats your fees,
your EOA upgrades for one block.

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.

Existing LP tools keep you in-range. None exit you when the math breaks.

Concentrated-liquidity providers silently bleed value. By the time a human notices the drawdown on a dashboard, the damage is locked in.

What everyone else does

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.

What Uni-Guardian does

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.

Four primitives, one autonomous loop.

Uni-Guardian doesn't just use OKX products — it structurally requires them. Remove any of these and the product stops working.

Eip-7702 · pectra

JIT account upgrade

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.

Okx · agentic wallet

TEE-bound signatures

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.

X402 · v2 reusable sessions

Pay-as-you-monitor feed

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.

X layer · chain 196

Zero-gas audit ledger

UniGuardianLog on X Layer writes one entry per phase (risk, auth, withdrawn, swapped, deposited). Judges verify autonomy by reading the contract.

One trigger. One transaction. Four protocols.

What happens the moment projected IL crosses the threshold.

  monitor.ts  ──────  x402 session poll
      │                ↓
      │            risk-engine.decide({ ilBps, feeAprBps, threshold })
      │                ↓
      │               (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)

Every decision is on-chain.

Numbers update during the judging window as the agent runs on mainnet.

7
OKX products integrated
≤1 s
x402 query latency
1 tx
Withdraw + swap + deposit
≈50%
Gas saved vs EIP-4337

Tx hashes, not screenshots.

Paste these into a block explorer to verify autonomous operation.

TEE signer: 0xb23aab40…b920b · X Layer mainnet · chainId 196

Autonomous e2e run · pnpm agent:e2e

x402 payment → risk engine → TEE signature → mainnet tx, in 1.8 s

[1/6]boot x402 mock server on :18402[2/6]open reusable session · s_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
Tx hash
0x215a0c17dec30156c84152ee474ff1e147ae3daaa676db436889e0921cbbd4be ↗
Per-primitive path validation
#ArtifactPathTx Hash
1Agentic Wallet self-transfer 0.01 USDCwallet send0x61d2a65c…fa6321b2 ↗
2OKX DEX swap 0.5 USDC → USDG (QuickSwap V3)swap execute0x725b3560…c7256dc8 ↗
3TEE contract-call approve(self, 1 USDC)wallet contract-call0x516ba062…1826c105 ↗
4TEE contract-call approve(self, 0) revokewallet contract-call0x84b11ac2…815f2e2d ↗
5OKX DEX reverse swap 0.3 USDG → USDCswap execute0x572ce1ad…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.