Conversational execution on Base — adapters, trust, builder identity, oracles, and non-custodial signing. Same engine the product runs.
Agentic DeFi OS
What is Mentra?
Mentra is the first Conversational DeFi Operating System on Base. You describe an intent in natural language — open a perp, swap a token, supply a vault, inspect trust — and Mentra maps that utterance onto a typed on-chain action without taking custody of funds.
The OS sits above protocol adapters (Avantis, Aerodrome, Morpho) and intelligence engines (trust, reputation, builder score). Agents execute through the same confirmation cards a human trader sees. Nothing is signed until you approve it in your wallet.
Conversational pipeline
The fragmentation problem
Core problem solved: fragmented DeFi UIs. Instead of hopping across DEX frontends, perp terminals, and lending dashboards, you chat once. Mentra classifies the intent, runs pre-flight checks (min size, max leverage, slippage, oracle freshness), then presents a two-step confirmation card.
The Conversational Action Engine is Mentra’s chat-to-execution path. Natural language is parsed into a typed ActionPayload (open, close, update TP/SL, swap, supply, borrow). Protocol adapters then simulate, quote, and — only after you confirm — submit via the connected wallet.
Intent classification
Intent classification maps natural-language prompts onto a closed set of typed on-chain actions. Unknown markets, sub-minimum collateral, or leverage above pairMaxLeverage fail in prose before a wallet popup appears. Last-referenced market is remembered across turns so “close 50%” resolves to the pair you just discussed.
Conversational perpetual leverage on Avantis: open and close longs/shorts, set dynamic take-profit / stop-loss, and surface liquidation distance from mark, leverage, and maintenance math. Execution fees are quoted from live Pyth Hermes VAAs plus AvantisAdapter.getExecutionFee() so the overlay matches what the contract will charge.
Markets: ETH-USD, BTC-USD, SOL-USD, DOGE-USD and the live Avantis catalog.
Pre-flight: minimum $10 USDC collateral and pair max leverage from pairStorage.
Oracle: Hermes latest + VAA bytes for updatePriceFeeds; bilingual EN/FA revert decoding on failure.
After fill: mentra:trade-executed event refreshes portfolio positions.
Aerodrome Protocol Integration
Conversational token swaps on Base via universal routers. Mentra quotes the route, applies pre-flight slippage bounds, and will not submit a swap that exceeds the user’s stated tolerance. The same confirmation card pattern applies: review quote → approve token if needed → sign.
Morpho Protocol Integration
Yield optimization and conversational lending/borrowing vaults. Supply, withdraw, borrow, and repay are expressed as chat intents, then bound to Morpho market params and asset amounts in base units. The agent never guesses a vault that is not on the connected Base deployment.
Action Confirmation Cards
Two-step confirmation
Confirmation cards implement a two-step security model. Step 1: USDC (or token) allowance approval to the protocol spender, exact amount when possible. Step 2: atomic contract execution (open market order, swap, or Morpho market call). Mentra never batches those two signatures into a single opaque “approve all” flow.
Mentra Trust Score is a 0–100 algorithmic assessment of a Base project’s on-chain hygiene. It is stored intelligence — never a vibes overlay. The quant risk matrix folds LP lock duration, ownership renounce status, whale concentration, and contract upgradeability into a single shield used by project cards, share copy, and agent warnings.
Quant risk matrix
Score inputs
LP lock duration — longer, verifiable locks raise trust; unlocked liquidity is a penalty.
Ownership renounce — ownerless or timelocked admin is healthier than an EOA with mint rights.
Upgradeability — proxy admins and open implementation slots are scored as change-risk, not as a ban.
Pre-trade risk
On the trading path, Mentra adds liquidation proximity alerts and margin health calculators. For Avantis perps this is computed from mark (Pyth), position size, leverage, and maintenance margin — not from a guessed “safe” buffer. If mark is stale or Hermes is unavailable, the engine refuses to invent a price.
Builder identity binds a Base wallet to a GitHub account (Privy OAuth). Mentra then scores the pair with a deterministic composite: 40% Code Velocity and 60% On-Chain Traction. Metrics are fetched — never invented. Missing GitHub or on-chain data simply zeros that component.
Builder composite
Composite scoring algorithm
40% Code Velocity — GitHub commit consistency (90d), active public repos, merged PRs via Privy-linked OAuth.
60% On-Chain Traction — contract deployments on Base, unique user interactions, processed volume (USD).
Log-normalized so a single whale deploy does not dominate a consistent public builder.
Rank tiers are cut from that 0–1000 score: Top 1% Base Architect (≥900), Top 5% Ecosystem Builder (≥700), Active Base Developer otherwise. Dynamic social badges and the Intelligence Card share flow (X / Telegram / Warpcast) stamp rank + Mentra Trust without fabricating volume.
Execution quality depends on fresh marks. Mentra integrates Pyth Network Hermes for sub-second price updates and automated execution-fee quotes. The browser talks to a same-origin POST /api/pyth/latest proxy so PYTH_API_KEY never ships in the client bundle. Feed ids stay in the JSON body — not in multi-kilobyte GET query strings.
Oracle & RPC layers
Pyth Hermes
Hermes latest + stream for marks; VAA bytes (hex) feed Pyth updatePriceFeeds on Avantis opens.
Server chunks Hermes at 40 ids; client POSTs up to 200 unique 32-byte feed ids.
AvantisAdapter.getExecutionFee() is overlaid on the trade card so users see oracle cost before signing.
Triple-layer fallback for reads: Base Mainnet RPC (primary, plus public Base endpoints) → DexScreener-style market metadata when a pair catalog is needed → internal cache (indexed positions, last-good marks). If every layer fails, Mentra surfaces an error — it does not hallucinate a last price.
User funds remain 100% in user custody at all times. Mentra is a conversation layer and a transaction assembler. USDC, collateral, and vault shares sit in the connected address. There is no Mentra hot wallet, no deposit contract for “chat balance,” and no server-side signer.
Custody boundary
Client-side signing
Client-side transaction signing via Wagmi / Viem on Base (chain id 8453).
Zero private key retention — no keys in localStorage, cookies, or API logs.
Session (Privy / NextAuth) identifies the builder; it cannot move funds without a wallet popup.
Allowances are per-spender and preferably exact-amount; revoke anytime from your wallet.
signing boundary
// Browser — unsigned call data only
const hash = await writeContract(wagmiConfig, {
address: trading,
abi: tradingAbi,
functionName: "openTrade",
args: [tradeTuple],
value: executionFeeWei,
})
// Mentra servers never receive the private key.
// They may store public tx hashes after you broadcast.