Hereโs the updated architecture.md
content with the image embedded properly using Markdown syntax. You can place this in your docs-site/docs/architecture.md
:
๐๏ธ Protocol Architecture
This yield optimization protocol combines smart contract-based vaults with an AI agent and Chainlink Automation to intelligently allocate funds based on market conditions and user risk preference.
๐ผ๏ธ System Diagram
๐งฉ Components
๐ค User
- Interacts via a simple Frontend UI.
- Can view balances and deposit into AI-driven vaults.
๐ป Frontend UI
-
Contains two main tabs:
-
Assets
โ view deposits, APY, etc. AI Vault
โ deposit into Low or High risk vaults.
๐ค AI Agent (ElizaOS Plugin)
- Uses 7-day and 25-day market trend analysis.
-
Fetches DeFi data from:
-
CoinGecko (price history)
-
DeFiLlama (APYs, TVLs)
-
Stores chosen strategy in ElizaOS KV Store.
โ๏ธ Chainlink Automation
- Periodically or immediately calls
allocateFunds()
on the vaults. - Triggers allocation only if AI agent has posted a valid strategy in ElizaOS KV.
๐ AutomationOwner Contract
- Trusted controller that mediates access from Chainlink Automation to
YVault
. - Ensures only secure, scheduled execution of allocation logic.
๐ฆ Vaults
Two Yearn V2-style vaults:
LowRiskVault
โ interacts with Aave-based strategy.HighRiskVault
โ interacts with Morpho Blue strategy.
๐ Strategies
LowRiskAaveStrategy
โ invests in a mocked Aave USDC pool.HighRiskMorphoStrategy
โ invests in a mocked Morpho Blue pool.- Strategies are modular and upgradable by governance.
๐ Fund Flow Summary
- User deposits USDC into either vault.
- AI Agent selects optimal pool based on market signal.
- Result is stored in ElizaOS KV (off-chain).
- Chainlink Automation triggers fund allocation via
AutomationOwner
. - Funds are routed from the vault into the selected strategy.
- Strategy contract executes on the corresponding protocol (mocked for testing).
Let me know if you'd like a sidebar entry for this or if you're using mkdocs.yml
โI can help configure that too.