Constrained Autonomous Agent Spending on Sui + ENS Integration
Give your AI a wallet. With limits.
AgentVault enables autonomous AI agents to execute transactions and trades within hard, on-chain spending constraints. Built on Sui blockchain with DeepBook v3 integration, and featuring a novel ENS-powered constraint profile system.
|
DeepBook v3 Integration
|
Most Creative Use of ENS for DeFi
|
┌──────────────────────────────────────────────────────────────────┐
│ VAULT CONSTRAINTS │
├──────────────────────────────────────────────────────────────────┤
│ │
│ Daily Limit │████████████████░░░░│ $100/day │
│ Per-TX Limit │████████░░░░░░░░░░░░│ $25/transaction │
│ Alert Threshold │████████████████░░░░│ $80 (triggers event)│
│ Min Balance │██░░░░░░░░░░░░░░░░░░│ $10 (floor) │
│ Emergency Pause │ ○ OFF │ Owner can halt │
│ │
│ ✓ Enforced by Move VM - Cannot be bypassed │
│ ✓ No backend, no multisig, pure smart contract │
│ │
└──────────────────────────────────────────────────────────────────┘
Instead of manually entering constraints, load pre-configured profiles from ENS names:
Why this is creative:
- Goes beyond name→address mapping
- Uses ENS as a decentralized DeFi configuration store
- Profiles are shareable and composable
- Your risk tolerance, stored on-chain!
| Layer | Technology | Purpose |
|---|---|---|
| Smart Contracts | Move (Sui) | Vault logic, constraint enforcement |
| DEX | DeepBook v3 | On-chain CLOB trading |
| Name Resolution | ENS (Ethereum) | Human-readable names, constraint profiles |
| Backend | Express.js + TypeScript | Transaction building, intent parsing |
| Frontend | React 18 + Vite | User interface |
| Wallet | Sui dapp-kit | Wallet connection |
| ENS Library | viem | ENS resolution |
agentvault2/
├── contracts/ # Move smart contracts
│ ├── sources/
│ │ ├── vault.move # Core vault + constraint logic
│ │ └── events.move # Event definitions
│ └── Move.toml
│
├── backend/ # Express API server
│ └── src/
│ ├── routes/ # API endpoints
│ │ ├── vault.ts # Vault operations
│ │ └── swap.ts # DeepBook swaps
│ ├── services/
│ │ ├── suiClient.ts # Sui SDK wrapper
│ │ ├── intentParser.ts # NLP to constraints
│ │ └── swapService.ts # DeepBook integration
│ └── config/
│
├── frontend/ # React web app
│ └── src/
│ ├── App.tsx # Main application
│ ├── styles.css # Brutalist styling
│ ├── services/
│ │ └── ensService.ts # 🔷 ENS resolution
│ └── hooks/
│ └── useENS.ts # 🔷 ENS React hooks
│
└── scripts/
└── demo-agent.ts # Autonomous agent demo
- Node.js 18+
- Sui wallet with testnet SUI
- (Optional) DEEP tokens for trading fees
# Clone repository
git clone https://github.com/your-repo/agentvault2.git
cd agentvault2
# Install backend
cd backend && npm install
# Install frontend
cd ../frontend && npm install# Backend (.env)
PACKAGE_ID=0x9eb66e8ef73279472ec71d9ff8e07e97e4cb3bca5b526091019c133e24a3b434
SUI_NETWORK=testnet
# Frontend (.env)
VITE_API_BASE=http://localhost:3001
VITE_PACKAGE_ID=0x9eb66e8ef73279472ec71d9ff8e07e97e4cb3bca5b526091019c133e24a3b434# Terminal 1: Backend
cd backend && npm run dev
# Terminal 2: Frontend
cd frontend && npm run dev┌────────────────────────────────────────────────────────────┐
│ CREATE TAB │
├────────────────────────────────────────────────────────────┤
│ │
│ 🔷 Load ENS Profile │
│ ┌──────────────────────────────────────────────────────┐ │
│ │ ┌────────────┐ ┌────────────┐ ┌────────────┐ │ │
│ │ │Conservative│ │ Moderate │ │ Aggressive │ ← Click │ │
│ │ │ $50/day │ │ $200/day │ │ $1000/day │ │ │
│ │ └────────────┘ └────────────┘ └────────────┘ │ │
│ └──────────────────────────────────────────────────────┘ │
│ │
│ Or enter custom ENS: [myprofile.eth ] [Load] │
│ │
│ ─────────────── OR ─────────────── │
│ │
│ 📝 Manual: "Spend $100/day, max $25 per trade" │
│ │
└────────────────────────────────────────────────────────────┘
┌────────────────────────────────────────────────────────────┐
│ AGENT ADDRESS ENS ✓ │
├────────────────────────────────────────────────────────────┤
│ │
│ [trading-bot.eth ] │
│ │
│ ┌────────────────────────────────────────────────────┐ │
│ │ 🖼️ trading-bot.eth │ │
│ │ 0x742d35Cc6634C0532925a3b... │ │
│ │ ✅ Verified │ │
│ └────────────────────────────────────────────────────┘ │
│ │
└────────────────────────────────────────────────────────────┘
┌────────────────────────────────────────────────────────────┐
│ 💸 EXECUTE PAYMENT │
├────────────────────────────────────────────────────────────┤
│ │
│ Recipient: [vitalik.eth ] │
│ │
│ ┌────────────────────────────────────────────────────┐ │
│ │ 🖼️ vitalik.eth │ │
│ │ 0xd8dA6BF26964aF9D7eEd9e03... │ │
│ │ ✅ Verified │ │
│ └────────────────────────────────────────────────────┘ │
│ │
│ Amount: [10.00 ] SUI │
│ │
│ [ Send Payment ] │
│ │
└────────────────────────────────────────────────────────────┘
// Create vault with constraints
public entry fun create_vault<T>(
initial_deposit: Coin<T>,
agent: address,
daily_limit: u64,
per_tx_limit: u64,
alert_threshold: u64,
yield_enabled: bool,
min_balance: u64,
clock: &Clock,
ctx: &mut TxContext
)
// Agent executes payment (checked against constraints)
public entry fun execute_payment<T>(
vault: &mut Vault<T>,
recipient: address,
amount: u64,
clock: &Clock,
ctx: &mut TxContext
)
// Agent executes swap on DeepBook v3
public entry fun execute_swap<BaseAsset, QuoteAsset>(
vault: &mut Vault<QuoteAsset>,
pool: &mut Pool<BaseAsset, QuoteAsset>,
quantity: u64,
min_base_out: u64,
deep_in: Coin<DEEP>,
is_bid: bool,
clock: &Clock,
ctx: &mut TxContext
)public entry fun update_constraints<T>(vault, daily_limit, per_tx_limit, ...)
public entry fun set_paused<T>(vault, paused: bool, ...)
public entry fun set_agent<T>(vault, new_agent: address, ...)
public entry fun deposit<T>(vault, coin, ...)
public entry fun withdraw<T>(vault, amount, ...)Store constraint profiles in ENS text records:
| Key | Value | Description |
|---|---|---|
agentvault.dailyLimit |
"100" |
Max daily spending |
agentvault.perTxLimit |
"25" |
Max per transaction |
agentvault.alertThreshold |
"80" |
Alert trigger point |
agentvault.minBalance |
"10" |
Minimum vault balance |
agentvault.yieldEnabled |
"true" |
Enable yield routing |
description |
"..." |
Human-readable description |
// Resolve ENS name to address
await resolveENSName("vitalik.eth") // → "0xd8dA6BF26964aF..."
// Load constraint profile from ENS
await loadENSConstraintProfile("conservative.agentvault.eth")
// → { dailyLimit: 50, perTxLimit: 10, ... }
// Full resolution with avatar
await resolveENSOrAddress("alice.eth")
// → { address: "0x...", ensName: "alice.eth", avatar: "https://..." }┌─────────────────────────────────────────────────────────────────────────────────┐
│ CONSTRAINT VALIDATION FLOW │
├─────────────────────────────────────────────────────────────────────────────────┤
│ │
│ Agent calls execute_swap(vault, pool, quantity=30, ...) │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
│ │ 1. CHECK: sender == vault.agent? │ │
│ │ └── ❌ Abort: ENotAgent │ │
│ │ └── ✅ Continue │ │
│ └─────────────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
│ │ 2. CHECK: vault.paused == false? │ │
│ │ └── ❌ Abort: EVaultPaused │ │
│ │ └── ✅ Continue │ │
│ └─────────────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
│ │ 3. CHECK: quantity <= per_tx_limit (25)? │ │
│ │ └── 30 > 25 ❌ Abort: EExceedsPerTxLimit │ │
│ │ └── ✅ Continue │ │
│ └─────────────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
│ │ 4. CHECK: spent_today + quantity <= daily_limit (100)? │ │
│ │ └── 45 + 30 = 75 ≤ 100 ✅ Continue │ │
│ └─────────────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
│ │ 5. CHECK: balance - quantity >= min_balance (10)? │ │
│ │ └── 500 - 30 = 470 ≥ 10 ✅ Continue │ │
│ └─────────────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
│ │ 6. CHECK: spent_today + quantity >= alert_threshold (80)? │ │
│ │ └── 75 < 80 → No alert │ │
│ │ └── If ≥ 80 → Emit AlertTriggered event │ │
│ └─────────────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
│ │ 7. EXECUTE: DeepBook swap │ │
│ │ └── Update spent_today = 75 │ │
│ │ └── Emit SwapExecuted event │ │
│ └─────────────────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────────┘
| Event | Description |
|---|---|
VaultCreated |
New vault deployed |
PaymentExecuted |
Agent made a payment |
SwapExecuted |
Agent executed a swap |
AlertTriggered |
Spending exceeded alert threshold |
ConstraintsUpdated |
Owner changed limits |
VaultPaused |
Owner paused/unpaused vault |
FundsDeposited |
Owner added funds |
FundsWithdrawn |
Owner removed funds |
| Network | Package ID |
|---|---|
| Sui Testnet | 0x9eb66e8ef73279472ec71d9ff8e07e97e4cb3bca5b526091019c133e24a3b434 |
| Pair | Pool ID |
|---|---|
| DEEP/SUI | 0x0064034cf7f797e298bd9cd506f0e127ce511a798b3d9113e2f0cdb7e2c049f6 |
| SUI/DBUSDC | 0xe05dafb5133bcffb8d59f4e12465dc0e9faeaa05e3e342a08fe135800e3e4407 |
| DEEP/DBUSDC | 0xf948981b806057580f91622417534f491da5f61aeaf33d0ed8e69fd5691c95ce |
| Feature | Implementation |
|---|---|
| On-chain enforcement | Constraints checked by Move VM, not backend |
| Shared objects | Agents can transact without owner signature |
| Daily reset | Spending limits reset every 24 hours automatically |
| Emergency pause | Owner can halt all activity instantly |
| No key sharing | Agent uses its own keypair |
| ENS verification | Resolved addresses shown with verification badge |
- Real ENS subdomain deployment for profiles
- Yield routing integration (Scallop, Navi)
- Multi-agent vaults
- Time-based constraints
- Whitelist/blacklist for recipients
- Mainnet deployment
# Run the demo agent
cd scripts
npm install
npm run agent-demoETHGlobal HackMoney 2026
MIT
Built with ❤️ on Move and Sui