Architecture
How Mensa works: the contracts, the agent loop, and why every piece is on Mantle.
The thesis
You can't trust an AI with your money if you can't verify its reasoning.
Mensa solves this with three primitives. Every decision is logged on-chain. Every decision is explained in plain English. Every decision is challenged by humans in a head-to-head tournament. The results are a permanent, verifiable record of whether the AI deserves your funds.
Flow
Contracts
MensaAgent
0xAcA925...2CCe49The treasury. Holds user-deposited mETH and USDY. AI operator triggers executeAllocation() to rebalance, log a decision, and open a tournament round atomically.
Risk caps: max 95% in single asset, min 2% rebalance threshold, AI operator address can only execute pre-approved actions.
DecisionLog
0xD889B7...6788FePermanent on-chain record of every agent decision. Each decision stores action, confidence, reasoning hash, and parameters. Full reasoning text is emitted as event data for indexers.
Append-only. Only the agent contract can write. Mantle's low gas makes per-decision logging economically viable.
TournamentVault
0x92E6B4...77d122The Turing Test mechanic. Each round opens with the AI's allocation snapshot. Anyone can vote with their human allocation. After settlement, performance is computed on-chain and outcome (AI_WINS / HUMAN_WINS / TIE) recorded.
Settler role can settle rounds and supply human allocation aggregate. In production, this would use a price oracle and a median of human votes.
Reputation
0x10A519...6b4E5fTracks each voter's on-chain history: total votes, correct votes (rounds they beat the AI), reputation score, first-participation timestamp. Read by TournamentVault to compute sqrt-weighted vote weight.
Only TournamentVault can update scores. Sqrt weighting caps the influence of any single account, mitigating Sybil attacks and whale dominance.
BountyPool
0x06460f...A55f39Receives 15% of yield as performance fee from MensaAgent. On each settled round, distributes a share to humans who outperformed the AI. Split: 50% to round winners, 30% to a reputation pool (top monthly), 20% to ops.
Pull-based claim pattern (no push transfers) — winners must claim, no reentrancy surface. Only MensaAgent funds it; only TournamentVault triggers payouts.
MensaBadges
0x22867d...61144ESoulbound (non-transferable) ERC-721 badges minted automatically on milestones: First Vote, Beat AI 10x, Beat AI 100x, 5-Win Streak, Reputation 500, Reputation 1000, Top 10 Monthly.
Transfer functions disabled (transfer reverts). Only TournamentVault can mint. No admin burn.
MensaAgentIdentity (ERC-8004)
0x6671E5...8560B6ERC-8004 IdentityRegistry implementation. The Mensa agent is registered as agentId #1 with a tokenURI pointing to a discoverable agent card (capabilities, services, model, contracts) served from /api/agent-card. Any A2A-compatible agent or protocol can read this NFT to discover what Mensa is and how to compose with it.
Spec-compliant with eips.ethereum.org/EIPS/eip-8004 — register / setAgentURI / setMetadata / getAgentWallet. EIP-712 wallet rotation deferred (standard ERC-721 transfer is sufficient for the MVP).
Stack
Why Mantle
Hackathon tracks
Mantle Turing Test 2026 · Phase 2 (AI Awakening). Mensa is submitted to multiple tracks (a single BUIDL can be entered into several, but only one prize wins).
Path B — end-user-facing AI × RWA product. Mensa is exactly an "intelligent RWA portfolio management agent" managing mETH (Mantle LST) and USDY (Ondo tokenized T-bills), the two RWAs the track explicitly names.
Cross-track. Scores Technical Depth (AI × on-chain integration, 6 verified contracts), Innovation (Turing tournament + verifiable alpha), Mantle Ecosystem Contribution (RWA-native, low-gas decision logging), and Product Completeness (live deployed app, autonomous loop).
Path B — trading strategy with verifiable on-chain Alpha. Every decision and outcome is settled on-chain; cumulative alpha vs 50/50 baseline is computed from contract reads, not self-reported.
Clean dark Mantle-aligned design with sage accent. AI interaction surfaced via the live decision card with reasoning. Fully responsive.
First-come, first-served. Mensa hits all bars: 6 contracts deployed and verified on Mantle Mainnet, AI-powered function (executeAllocation) callable on-chain, public frontend, open-source repo with README.
Compliance posture
Mensa is a non-custodial smart-contract treasury. The protocol itself doesn't collect or hold off-chain user data, but RWAs come with jurisdictional rails. How we think about it:
Ondo's USDY is itself KYC-gated at issuance — only whitelisted addresses can receive newly-minted USDY directly from Ondo. Mensa never mints USDY; we accept it from depositors who already hold it. The KYC perimeter sits with Ondo, not us, which is the standard pattern for DeFi protocols composing with permissioned RWAs.
For institutional adoption we'd wire a sanctions hook into deposit() and withdraw() that consults Chainalysis Oracle (or equivalent) and reverts on hits. Cost: ~30k gas per call on Mantle, a few cents. Designed but not yet wired into the MVP contract.
The smart contracts are jurisdiction-neutral, but the frontend can refuse to render deposit UI for IPs in restricted regions (US persons for unregistered RWAs, etc.). Cloudflare Workers / Vercel Edge config — standard pattern, deferred until we have a real go-to-market plan.
Source is open under MIT. GitHub repo with Foundry tests. All 6 contracts verified on Mantlescan (linked in the Contracts section above). A formal audit by a Web3 audit firm (Spearbit / Trail of Bits / Macro) is part of any production launch checklist — not done at hackathon stage.
Mantle yield landscape
The broader DeFi yield universe Mensa monitors on Mantle. Today the agent allocates only to mETH (liquid staking) and USDY (T-bills). Aave, Lendle, and Fluxion are listed for context — adding them to the allocation set is gated on the share-model upgrade in the roadmap below. Click a pool for APY history.
Mantle yield markets
Live APY for protocols Mensa can allocate to. Click a pool for history.
MVP scope & roadmap
Mensa is a hackathon-stage prototype focused on the AI's decision-making loop and the Turing tournament. The treasury layer is intentionally minimal — production-ready features are listed below.
executeAllocation() updates a target allocation variable, opens a tournament round, and logs reasoning on-chain. It does notswap underlying tokens. The treasury holds whatever assets users deposited; the AI's decision is measured against price moves of mETH and USDY but no actual swap is executed.
Why:rebalancing on a single round without slippage controls would be dangerous. Better to first prove the AI's allocation calls beat baseline (which the alpha stat does), then add execution.
userDeposits[address]is a single accumulator that doesn't distinguish mETH from USDY. The MVP is safe because TVL is small / zero, but in a multi-user mainnet deployment a depositor of mETH could in theory withdraw another user's USDY. Not exploited in the demo, but a known design gap.
Replace the unified balance with shares minted at deposit and burned at withdraw, proportional to USD value of the treasury at the time. Every depositor owns a slice of the entire pool, regardless of asset composition. executeAllocation then routes a real swap via a DEX aggregator with slippage caps and a sanity check on price.
DEX reality check: we surveyed Merchant Moe V2 (router 0xeaEE...232a) for live mETH↔USDY routing. No direct pool. Multi-hop via USDC is technically possible but pool reserves are thin (mETH/USDC ≈ $6 TVL, USDC/USDY ≈ $22 TVL as of this run) — any meaningful swap would slip 30-50%. Real execution is gated less on our code and more on Mantle DEX liquidity maturity. Velora aggregator on mainnet is the production path; until then the tournament mechanism measures the AI's allocation quality on theoretical returns, which is what alpha tracking does.
The auto-settle script currently passes a fixed 50% as the human aggregate when no voters showed up — which makes the "Human" column actually a 50/50 baseline. Once voting picks up we'll compute the reputation-weighted average of votes off-chain and pass that into settleRound. Until then the tournament UI labels it as "Baseline 50/50" for honesty.
Right now humans only score against the AI. A future iteration feeds the reputation-weighted human consensus back into the next Claude call as a soft input, turning Mensa into a hybrid where the AI learns from voters who consistently outperform it.