Skip to content

ortegarod/moltfi

Repository files navigation

MoltFi — Scoped access for AI agent trading

Give your AI agent an API key to trade crypto — with on-chain guardrails it physically cannot bypass. Prompt injection can confuse a model. It cannot bypass a smart contract. You set the limits. Smart contracts enforce them. You stay in control.

🔗 Live demo: moltfi-production.up.railway.app

MoltFi Dashboard

How it works

  1. You connect your wallet and create a vault — You deposit funds and set spending limits: max trade size, daily volume cap, which tokens are allowed. These get written to a smart contract on Base.

  2. Your agent gets a scoped API key — Your agent reads a skill file, registers with MoltFi, and gets an API key. It can trade within your vault — but only within your limits. No private keys, no direct blockchain access.

  3. Your agent sends trade requests in plain English — "Swap 0.01 WETH to USDC." MoltFi interprets the request via Venice AI, then the smart contract checks it against your limits before any funds move.

  4. Smart contracts enforce every limit — Within limits → trade executes on Uniswap V3. Over limits → transaction reverts automatically. Every trade has a Basescan link you can verify.

Your Agent → MoltFi API → AgentPolicy (checks limits) → Uniswap V3 (executes swap)
   (API key)    (Venice AI)     (on-chain)                    ↑
                                                     Reverts if over limits

Trading policies (on-chain)

You configure these. Smart contracts enforce them on every trade.

  • Max per trade — Every swap is checked against your per-trade limit
  • Daily spending cap — Cumulative daily volume tracked on-chain, resets every 24h
  • Token allowlist — Only tokens you approved can be traded
  • Instant freeze — Revoke all agent trading with one transaction

Smart contracts

Base Mainnet (production)

Contract Address Basescan
AgentPolicy 0x9f5C...e38a View
AgentGuardRouter 0xDBF6...b5F9 View
VaultFactory 0x5AFC...a4F6 View

Live vault holds real wstETH (Lido) earning ~2.5% APR, swapped via guardrail-enforced Uniswap V3:

Base Sepolia (testnet)

Contract Address Basescan
AgentPolicy 0x6364...06Fbc View
AgentGuardRouter 0x5Cc0...77E6 View
VaultFactory 0x672E...9774 View

Dual-chain support

All API routes support both Base Mainnet and Base Sepolia. Add ?chain=mainnet to any GET endpoint or "chain": "mainnet" to POST bodies to target mainnet. Default is Sepolia (testnet).

The dashboard includes an in-app network switcher — click the network badge to switch between chains without leaving the app.

Agent integration

If your agent can make HTTP calls, it can use MoltFi. No SDK, no blockchain knowledge required.

# Register (once)
curl -X POST https://moltfi-production.up.railway.app/api/agent/register \
  -H "Content-Type: application/json" \
  -d '{"humanWallet": "0x...", "agentName": "MyAgent"}'

# Returns: API key (mf_...) + vault address

# Trade (anytime)
curl -X POST https://moltfi-production.up.railway.app/api/agent \
  -H "Authorization: Bearer mf_..." \
  -H "Content-Type: application/json" \
  -d '{"message": "swap 0.001 WETH to USDC"}'

Or give your agent the skill file: curl -s https://moltfi-production.up.railway.app/api/skill

API

Endpoint Method What
/api/agent/register POST Register agent, get API key
/api/agent POST Send plain English trade requests
/api/vault/status GET On-chain balances + policy state
/api/vault/swap POST Execute swap through guardrails
/api/vault/deposit POST Deposit ETH into vault
/api/vault/stake POST Stake ETH via Lido (mainnet-ready)
/api/vault/policy POST Update guardrails on-chain
/api/vault/activity GET On-chain trade history
/api/vault/freeze POST Emergency freeze — revoke all trading
/api/vault/tokens POST Manage token allowlist (approve/remove)
/api/rates GET Live ETH price, Lido APR, Base gas
/api/skill GET Skill file for agents

Built with

  • Uniswap V3 — Swap execution via AgentGuardRouter wrapping SwapRouter02
  • Lido — Live wstETH integration on Base mainnet. Vault holds real wstETH earning ~2.5% APR. WETH↔wstETH swaps through guardrail-enforced router on Uniswap V3 (0.01% fee tier for correlated pairs). Dashboard shows real-time Lido APR, estimated yearly yield, and copy-paste staking instructions for AI agents.
  • Venice AI — Zero-retention inference for trade processing. Agent reasoning stays private, trades are public on-chain
  • Base — Contracts deployed on both Base Sepolia and Base mainnet
  • OpenClaw — Agent runtime & skill harness

Architecture

┌─────────────┐     ┌──────────────┐     ┌───────────────┐     ┌────────────┐
│  Your Agent  │────▶│  MoltFi API  │────▶│  AgentPolicy  │────▶│ Uniswap V3 │
│  (API key)   │     │  (Venice AI) │     │  (on-chain)   │     │  (swap)    │
└─────────────┘     └──────────────┘     └───────────────┘     └────────────┘
                           │                     │
                    Interprets plain       Checks: max trade,
                    English request        daily cap, token
                                          allowlist. Reverts
                                          if violated.

┌─────────────┐     ┌──────────────┐
│  You (human) │────▶│  Dashboard   │──── Deposit, withdraw, set limits,
│  (wallet)    │     │  (Next.js)   │     monitor activity, verify on Basescan
└─────────────┘     └──────────────┘

Hackathon tracks

Track Sponsor Prize
Open Track Synthesis Community $28,134
Private Agents, Trusted Actions Venice $11,500
Agentic Finance Uniswap $5,000
Autonomous Trading Base $5,000
Agent Services on Base Base $5,000
stETH Agent Treasury Lido $3,000

Running locally

npm install
npm run dev

Environment variables needed:

  • AGENT_PRIVATE_KEY — Server-side signing key for trade execution
  • VENICE_API_KEY — Venice AI inference
  • UNISWAP_API_KEY — Uniswap Trading API quotes

Team

Built by Kyro (AI agent) & Rodrigo Ortega (human) for The Synthesis 2026.

About

On-chain guardrails for AI agent trading on Base. Smart contracts enforce spending limits — your agent trades in a vault, the blockchain enforces your rules.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages