Skip to content

Instantly share code, notes, and snippets.

@Aboudjem
Last active March 30, 2026 08:06
Show Gist options
  • Select an option

  • Save Aboudjem/1020917276d4367e603b52223f952835 to your computer and use it in GitHub Desktop.

Select an option

Save Aboudjem/1020917276d4367e603b52223f952835 to your computer and use it in GitHub Desktop.
Integra PRD: 08-portfolio-agent (HTML)
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1.0"><title>PRD: Portfolio Agent</title><style>*{margin:0;padding:0;box-sizing:border-box}body{background:#0A0A1A;color:#E8E8F0;font-family:'Inter',system-ui,sans-serif;line-height:1.7}a{color:#00CEC9;text-decoration:none}a:hover{text-decoration:underline}.hero{padding:48px 32px 36px;border-bottom:1px solid #2A2A4A;background:linear-gradient(135deg,#0A0A1A 0%,#1A1040 50%,#0A0A1A 100%)}.hero h1{font-size:2rem;font-weight:800;color:#fff;margin-bottom:8px}.hero .meta{display:flex;gap:10px;flex-wrap:wrap;margin-bottom:12px}.badge{display:inline-block;padding:4px 12px;border-radius:6px;font-size:12px;font-weight:700}.badge-owner{background:rgba(108,92,231,0.15);color:#A29BFE;border:1px solid rgba(108,92,231,0.3)}.badge-week{background:rgba(0,206,201,0.15);color:#00CEC9;border:1px solid rgba(0,206,201,0.3)}.badge-est{background:rgba(0,184,148,0.15);color:#00B894;border:1px solid rgba(0,184,148,0.3)}.container{max-width:900px;margin:0 auto;padding:32px 24px}.section{background:#12122A;border:1px solid #2A2A4A;border-radius:12px;padding:24px;margin-bottom:20px}.section h2{font-size:0.8rem;font-weight:700;color:#8888AA;text-transform:uppercase;letter-spacing:1.5px;margin-bottom:14px;padding-bottom:8px;border-bottom:1px solid #2A2A4A}.section h3{font-size:0.95rem;font-weight:600;color:#E8E8F0;margin:12px 0 6px}.section p{font-size:0.95rem;margin-bottom:8px}.section ul{list-style:none;padding:0}.section ul li{padding:6px 0 6px 20px;position:relative;font-size:0.95rem}.section ul li::before{content:'>';position:absolute;left:0;color:#A29BFE;font-weight:700;font-family:monospace}.section code{background:rgba(108,92,231,0.1);padding:2px 6px;border-radius:4px;font-size:0.88rem;color:#A29BFE}table{width:100%;border-collapse:collapse;font-size:0.9rem;margin:8px 0}th{text-align:left;padding:8px 12px;background:rgba(108,92,231,0.08);color:#A29BFE;font-size:0.75rem;text-transform:uppercase;letter-spacing:1px;border-bottom:1px solid #2A2A4A}td{padding:8px 12px;border-bottom:1px solid rgba(42,42,74,0.5)}.checklist li::before{content:'\2610' !important;color:#8888AA !important;font-family:inherit !important}.back{display:inline-block;margin-bottom:16px;color:#8888AA;font-size:0.9rem}.footer{text-align:center;padding:24px;color:#555577;font-size:0.82rem;border-top:1px solid #2A2A4A;margin-top:32px}</style></head><body><div class="hero"><a class="back" href="https://gist.githack.com/Aboudjem/0af8c2ce9d5b62038a18eeff09603553/raw/integra-testnet-master-plan.html">&larr; Back to Master Plan</a><h1>Portfolio Agent</h1><div class="meta"><span class="badge badge-owner">Kalki</span><span class="badge badge-week">Week 2-3</span><span class="badge badge-est">0.5-1d</span></div><p style="color:#8888AA;font-size:0.9rem">portfolio-agent.integralayer.com</p></div><div class="container"><div class="section"><h2>Overview</h2><div class=""><p>An AI agent that monitors a user's IRWA holdings, tracks yields across Lending and GOB, and auto-rebalances the portfolio based on user-defined exit conditions. Supports price targets, time-based exits, and allocation caps. Turns passive IRWA holders into active portfolio managers without effort, generating recurring transactions across multiple Integra protocols.</p></div></div>
<div class="section"><h2>Features</h2><div class=""><ul><li><strong>Auto-Detection</strong> — agent discovers all IRWA holdings and lending positions on wallet connect</li></ul><ul><li><strong>Portfolio Dashboard</strong> — total value, allocation breakdown (pie chart), unrealized PnL, and yield per asset</li></ul><ul><li><strong>Target Allocation</strong> — user sets desired allocation percentages per asset; agent maintains the balance</li></ul><ul><li><strong>Drift-Based Rebalancing</strong> — triggers rebalance when allocation drifts beyond a configurable threshold (default 5%)</li></ul><ul><li><strong>Price Target Exits</strong> — auto-sells when an asset hits a user-defined price target</li></ul><ul><li><strong>Time-Based Exits</strong> — auto-sells after a user-defined holding period expires</li></ul><ul><li><strong>Concentration Limits</strong> — prevents any single asset from exceeding a max allocation percentage</li></ul><ul><li><strong>Cross-Protocol Execution</strong> — executes trades on GOB and moves funds to/from Lending in a single rebalance</li></ul><ul><li><strong>PnL Tracking</strong> — historical performance chart with realized and unrealized gains</li></ul><ul><li><strong>Action History</strong> — full log of every agent action with on-chain tx hashes</li></ul><ul><li><strong>Pause Controls</strong> — user can pause rebalancing or revoke AgentAuth at any time</li></ul></div></div>
<div class="section"><h2>Functions</h2><div class=""><ul><li><code>setAllocation</code> — define target allocation percentages for each token in the portfolio</li></ul><ul><li><code>setExitCondition</code> — configure price target and/or deadline for a specific token</li></ul><ul><li><code>rebalance</code> — evaluate current allocation drift and execute trades to restore targets</li></ul><ul><li><code>getPortfolioValue</code> — return total portfolio value and per-token position breakdown</li></ul><ul><li><code>depositToLending</code> — move idle funds into Lending for yield</li></ul><ul><li><code>withdrawFromLending</code> — pull funds from Lending for rebalancing or exit</li></ul><ul><li><code>pauseRebalancing</code> — halt all automated rebalancing without revoking auth</li></ul></div></div>
<div class="section"><h2>User Flow</h2><div class=""><ul><li>Connect wallet via Web3Auth; agent auto-detects all IRWA holdings and lending positions</li></ul><ul><li>Review current portfolio: holdings, allocation %, unrealized PnL, yield per asset</li></ul><ul><li>Set rebalancing rules: target allocation %, price targets, time exits, max concentration</li></ul><ul><li>Grant AgentAuth authorization for GOB trading and Lending moves with IRL limit</li></ul><ul><li>Agent monitors positions on a polling interval, triggers rebalance when rules fire</li></ul><ul><li>Agent executes trades on GOB and moves funds to/from Lending as needed</li></ul><ul><li>Dashboard updates in real-time: portfolio value, allocation drift, recent actions, PnL chart</li></ul><ul><li>User can pause, adjust rules, or revoke at any time</li></ul></div></div>
<div class="section"><h2>Deliverables</h2><div class="checklist"><ul class="checklist"><li>Auto-detection of all IRWA holdings and lending positions</li></ul><ul class="checklist"><li>Portfolio dashboard with value, allocation chart, PnL, and yield breakdown</li></ul><ul class="checklist"><li>Target allocation configuration per asset</li></ul><ul class="checklist"><li>Exit condition configuration (price target, deadline, concentration cap)</li></ul><ul class="checklist"><li>Drift-based rebalancing engine with configurable threshold</li></ul><ul class="checklist"><li>Cross-protocol execution: GOB trades + Lending deposits/withdrawals</li></ul><ul class="checklist"><li>Action history page with tx hashes for every agent action</li></ul><ul class="checklist"><li>Pause and revocation controls</li></ul><ul class="checklist"><li>Agent Arena registration as portfolio type with PnL and rebalance stats</li></ul></div></div>
<div class="section"><h2>Integration Points</h2><div class=""><ul><li><strong>Depends on:</strong> IRWAToken (balance reads), GOB (buy/sell for rebalancing), Lending (deposit/withdraw for yield), AgentAuth (multi-protocol delegation), Asset Passport ERC-721 (valuation metadata)</li></ul><ul><li><strong>Used by:</strong> Agent Arena (catalog), No-Code Launchpad (template)</li></ul><ul><li><strong>Explorer:</strong> Integra Explorer (github.com/Integra-layer/integra-explorer)</li></ul></div></div>
<div class="section"><h2>XP Rewards</h2><div class=""><table><thead><tr><th>Action</th><th>Points</th></tr></thead><tbody><tr><td>Connect portfolio (auto-detect holdings)</td><td>25 XP</td></tr><tr><td>Configure rebalancing rules</td><td>50 XP</td></tr><tr><td>Execute a rebalance action</td><td>30 XP</td></tr><tr><td>Hit a price target exit</td><td>100 XP</td></tr><tr><td>Portfolio active for 7 days+</td><td>75 XP</td></tr></tbody></table></div></div>
<div class="section"><h2>Success Metrics</h2><div class=""><table><thead><tr><th>Metric</th><th>Target</th></tr></thead><tbody><tr><td>Portfolios connected in first week</td><td>40+</td></tr><tr><td>Avg rebalance actions per agent per week</td><td>> 3</td></tr><tr><td>Manual override rate</td><td>< 20%</td></tr><tr><td>Portfolio retention (agent active 7+ days)</td><td>> 60%</td></tr></tbody></table></div></div>
</div><div class="footer">Integra Testnet PRD — Portfolio Agent — Chain: integra-testnet-1 (EVM 26218)</div></body></html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment