YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
ποΈ Dynamic RWA Yield Router
Mantle Turing Test Hackathon 2026 β Phase 2 "AI Awakening" β AI Γ RWA Track
An autonomous AI agent that dynamically allocates capital across Mantle's Real World Asset (RWA) stack using reinforcement learning + LSTM yield prediction, with MEV-protected execution, auto-compounding, social sentiment analysis, and all decisions recorded on-chain via ERC-8004 agent identity NFTs. Ships with a Binance-grade Next.js dashboard.
π₯ What Makes This 10x Different
| Innovation | Description | Status |
|---|---|---|
| Ensemble AI Engine | PPO RL optimizer + LSTM yield predictor + sentiment analyzer working in concert | β Active |
| MEV Protection Layer | Sandwich detection, trade splitting, private mempool routing, optimal slippage | β Active |
| Auto-Compounding | Gas-optimized yield restaking with mathematically optimal compound frequency | β Active |
| LSTM Yield Predictor | 7-day yield forecasting with MC Dropout confidence intervals & regime detection | β Active |
| Social Sentiment | Real-time crypto sentiment aggregation (Fear & Greed, social volume, news) | β Active |
| ERC-8004 Agent Identity | Soulbound NFT with capabilities, attestations, reputation scoring, decision history | β On-chain |
| zkML-Ready Architecture | Verifiable inference proofs for on-chain AI transparency (EZKL/Giza compatible) | π Planned |
| Binance-Grade Dashboard | Next.js + Tailwind + Recharts with full Binance design system (dark theme, trading UI) | β Built |
π Portfolio Assets
| Asset | Type | Target APY | Risk | Protocol |
|---|---|---|---|---|
| USDY | Tokenized US T-Bills | ~4.25% + lending | Low | Ondo Finance |
| mETH | Liquid Staked ETH | ~3.9% + lending | Medium | Mantle LSP |
| MI4 | Tokenized Index Fund | ~5.4% + lending | Medium | Securitize |
The agent captures base yield + lending yield (Aave V3 supply) for each asset, achieving total APYs of 4.7-6.2%.
ποΈ Architecture
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β DYNAMIC RWA YIELD ROUTER v2.0 β
β β
β ββββββββββββββ ββββββββββββββ ββββββββββββββ ββββββββββββββ β
β β OBSERVE βββ PREDICT βββ REASON βββ PLAN β β
β β β β β β β β β β
β β DeFiLlama β β LSTM Yield β β PPO Policy β β Rebalance β β
β β CoinGecko β β Predictor β β + Ensembleβ β + MEV Opt β β
β β Mantle RPCβ β + Sentimentβ β β β + Splitter β β
β β FRED/News β β + Regime β β β β β β
β ββββββββββββββ ββββββββββββββ ββββββββββββββ ββββββββββββββ β
β β β β
β ββββββββββββββ ββββββββββββββ ββββββββββββββ ββββββββββββββ β
β β AUTHORIZE βββ EXECUTE βββAUTOCOMPOUNDβββ VERIFY β β
β β β β β β β β β β
β β 6-Layer β β Unsigned Txβ β Gas-Optimalβ β On-chain β β
β β Risk Mgr β β + MEV Prot β β Restaking β β + ERC-8004 β β
β β + Sentimentβ β + Whitelistβ β Automation β β Attestationβ β
β ββββββββββββββ ββββββββββββββ ββββββββββββββ ββββββββββββββ β
β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β ON-CHAIN CONTRACTS β β
β β YieldRouterAgent.sol β AgentIdentity8004.sol β RiskRegistry.solβ β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β BINANCE-STYLE NEXT.JS DASHBOARD β β
β β Portfolio β Markets β AI Optimizer β Risk β Agent Identity β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
8-Stage Agent Pipeline (v2.0)
- OBSERVE β Fetch real-time yield, price, macro, and sentiment data
- PREDICT β LSTM yield forecasting with MC Dropout confidence + regime detection
- REASON β PPO policy + ensemble (combine RL action with LSTM prediction + sentiment)
- PLAN β Compute trades with MEV analysis (sandwich detection, trade splitting)
- AUTHORIZE β 6-layer risk manager (depeg, volatility, concentration, drawdown, circuit breaker, sentiment)
- EXECUTE β Construct MEV-protected unsigned transactions (private mempool, optimal deadline)
- AUTO-COMPOUND β Gas-optimized yield restaking at mathematically optimal frequency
- VERIFY β Confirm on-chain, update ERC-8004 reputation, generate strategy report
π§ AI/ML Stack
PPO Reinforcement Learning
- Algorithm: Proximal Policy Optimization with Actor-Critic MLP
- State Space: 18-dimensional (yields, prices, macro, risk signals, portfolio weights)
- Action Space: 3-dimensional continuous β softmax β weights [USDY, mETH, MI4]
- Reward: Risk-adjusted Sharpe ratio - drawdown penalty - depeg penalty - gas costs
LSTM Yield Predictor (Novel)
- Architecture: 2-layer LSTM with attention mechanism
- Input: Yield history, price momentum, fed rate, volatility, sentiment
- MC Dropout: 50 forward passes for uncertainty estimation (confidence intervals)
- Regime Detection: Bull/Bear/Sideways classification head
- Feature Importance: Attention weights reveal which features drove the prediction
Social Sentiment Analyzer (Novel)
- Sources: Fear & Greed Index, social volume, news sentiment
- Integration: Sentiment score feeds into both LSTM predictor and risk manager
- Impact: High fear β increase USDY (safe haven), High greed β lean into mETH/MI4
π‘οΈ Novel Risk & Execution Features
MEV Protection Layer (Novel)
- Sandwich Attack Detection: Estimates price impact per trade
- Trade Splitting: Automatically splits large trades to reduce MEV exposure
- Private Mempool: Routes high-impact trades through private channels
- Optimal Deadlines: Shorter deadlines for high-risk trades, longer for low-risk
Auto-Compounding Engine (Novel)
- Optimal Frequency: Calculates gas-optimal compound interval using calculus optimization
- Formula:
n* = β(APY Γ Principal / (2 Γ GasCost))compounds per year - Break-even: Computes minimum principal where compounding beats simple yield
- Smart Triggers: Only compounds when accumulated yield > 3Γ gas cost
6-Layer Risk Management
| Layer | Description | Trigger |
|---|---|---|
| Depeg Detection | USDY/USD and mETH/ETH peg monitoring | >0.5% / >2% |
| Volatility Guard | Dynamic exposure reduction in high-vol regimes | ETH 30d vol >80% |
| Concentration Limits | Position size enforcement | >60% or <5% |
| Smart Contract Risk | Protocol-weighted risk scoring | Per-protocol scores |
| Drawdown Protection | Circuit breaker on portfolio losses | DD >10% |
| Sentiment Guard (Novel) | Reduces risky exposure on extreme fear | Score <20 |
π¨ Dashboard (Next.js + Binance Design)
Full-featured financial dashboard built with the Binance Design System:
- Dark canvas (#0b0e11) with card surfaces (#1e2329)
- Binance Yellow (#FCD535) accent for CTAs and brand elements
- Trading green/red (#0ecb81/#f6465d) for price direction semantics
- BinancePlex substitute (JetBrains Mono) for all financial numbers
- 6 dashboard sections: Portfolio, Markets, AI Optimizer, Risk Monitor, Reports, Agent Identity
Dashboard Features
- π Real-time portfolio value chart with timeframe selector
- π₯§ Live allocation pie chart + weight history area chart
- π RWA markets table with yield comparison bar chart
- π§ LSTM yield predictions with confidence bars + AI recommendations
- π‘οΈ Social sentiment gauge with source breakdown
- π‘οΈ Risk score ring, protection layer status, activity log
- π€ ERC-8004 agent identity card with reputation, capabilities, attestations
- π± Fully responsive (mobile hamburger, tablet 2-up, desktop full layout)
# Run the dashboard
cd dashboard && npm install && npm run dev
π Quick Start
# Clone from HuggingFace
git clone https://huggingface.co/muthuk1/mantle-rwa-yield-router
cd mantle-rwa-yield-router
# Install Python dependencies
pip install -r requirements.txt
# Run demo (3 cycles with live data)
python scripts/demo.py
# Train RL agent
python scripts/train.py
# Run continuous agent
python -m agent.main --mode run --interval 3600 --capital 100000
# Run tests (25 passing)
pytest tests/ -v
# Run dashboard
cd dashboard && npm install && npm run dev
π Project Structure
mantle-rwa-yield-router/
βββ agent/
β βββ main.py # 8-stage orchestrator pipeline
β βββ data_pipeline.py # Real-time data aggregation (8 sources)
β βββ rl_optimizer.py # PPO agent + Gymnasium environment
β βββ risk_manager.py # 6-layer risk management
β βββ executor.py # MEV-protected unsigned tx builder
β βββ strategy_reporter.py # LLM strategy letter generator
β βββ novel_features.py # LSTM predictor, MEV shield, auto-compound, sentiment
βββ contracts/
β βββ YieldRouterAgent.sol # On-chain allocation router
β βββ AgentIdentity8004.sol # ERC-8004 soulbound agent identity
β βββ RiskRegistry.sol # On-chain risk parameters
βββ dashboard/ # Next.js Binance-style UI
β βββ src/app/page.tsx # Main dashboard page
β βββ src/components/ # TopNav, Charts, RiskMonitor, AIOptimizer, AgentIdentity
β βββ src/lib/data.ts # Data generators and mock data
βββ telegram_bot/
β βββ bot.py # Telegram UI (/status, /yields, /risk)
βββ config/
β βββ constants.py # All contract addresses, ABIs, parameters
βββ scripts/
β βββ demo.py # Demo runner
β βββ train.py # RL training script
βββ tests/
β βββ test_agent.py # 25 unit + integration tests
βββ requirements.txt
βββ .env.example
βββ README.md
π Smart Contracts
YieldRouterAgent.sol
On-chain allocation records, position limits, circuit breaker, operator authorization.
AgentIdentity8004.sol (ERC-8004)
Soulbound agent identity NFT: capabilities, attestations, reputation (0-10000), decision history.
RiskRegistry.sol
On-chain risk parameters, depeg event tracking, allocation validation.
π Contract Addresses (Mantle Mainnet, Chain ID 5000)
| Contract | Address |
|---|---|
| USDY (Ondo) | 0x5bE26527e817998A7206475496fDE1E68957c5A6 |
| mETH | 0xcDA86A272531e8640cD7F1a92c01839911B90bb0 |
| USDC | 0x09Bc4E0D864854c6aFB6eB9A9cdF58aC190D0dF9 |
| WMNT | 0x78c1b0C915c4FAA5FffA6CAbf0219DA63d7f4cb8 |
| Fluxion Router | 0x5628a59df0ecac3f3171f877a94beb26ba6dfaa0 |
| Agni Router | 0x319B69888b0d11cEC22caA5034e25FfFBDc88421 |
| Aave V3 Pool | 0x458F293454fE0d67EC0655f3672301301DD51422 |
π Key Design Decisions
- Construct-Only Safety β Never holds private keys. All outputs are unsigned tx payloads.
- Ensemble Intelligence β PPO + LSTM + Sentiment provide richer signals than any single model.
- MEV-Aware β Every trade goes through sandwich detection + optimal splitting.
- Gas-Optimized Compounding β Mathematical optimization of compound frequency vs gas costs.
- On-Chain Audit Trail β ERC-8004 records every decision with content hashes.
- Binance-Grade UI β Production dashboard, not a demo. Full dark theme, live charts, responsive.
π Hackathon Track
Mantle Turing Test Hackathon 2026 β Phase 2 "AI Awakening"
- Track: AI Γ RWA ($100K prize pool)
- Focus: Autonomous AI agents managing tokenized real-world assets
- Key Tech: RL optimization, LSTM prediction, ERC-8004, MEV protection, Mantle L2
π License
MIT
Built with π€ for the Mantle Turing Test Hackathon 2026