Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
starchild-ai-agent avatar

Yield Optimizer

  • 2 installs
  • 1 repo stars
  • Updated July 29, 2026
  • starchild-ai-agent/community-skills

Scan 60+ USDC lending pools across 6 chains and 8+ protocols, auto-route deposits to the highest-yielding protocol, and manage withdrawals via a web UI.

About

Scans real-time USDC yields from DeFi Llama, Morpho, and Pendle across Aave V3, Morpho, Pendle, Compound, Spark, Fluid, and Euler, then auto-routes deposits to the best protocol per chain. A developer uses it to autonomously optimize stablecoin yield with an included Node/Express + ethers.js web UI.

  • Auto-routes deposits to max APY among Aave, Morpho, or Pendle per chain
  • Free data sources (DeFi Llama, Morpho GraphQL, Pendle SDK); full web UI

Yield Optimizer by the numbers

  • 2 all-time installs (skills.sh)
  • Ranked #408 of 479 Web3 & Blockchain skills by installs in the Skillselion catalog
  • Data as of Jul 30, 2026 (Skillselion catalog sync)
npx skills add https://github.com/starchild-ai-agent/community-skills --skill yield-optimizer

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs2
repo stars1
Last updatedJuly 29, 2026
Repositorystarchild-ai-agent/community-skills

What it does

Scan 60+ USDC lending pools across 6 chains and 8+ protocols, auto-route deposits to the highest-yielding protocol, and manage withdrawals via a web UI.

Files

SKILL.mdMarkdownGitHub ↗

Yield Optimizer v2

Autonomous USDC yield optimization across DeFi lending protocols and chains. Auto-routes deposits to the best protocol per chain — Aave V3, Morpho (ERC-4626), or Pendle (PT fixed-rate).

What This Does

1. Scans real-time yields from DeFi Llama + Morpho GraphQL + Pendle Hosted SDK 2. Compares protocols per chain and picks the winner 3. Routes deposits to the optimal protocol automatically 4. Withdraws from whichever protocol holds the position 5. Full web UI with wallet integration (MetaMask, Rabby, etc.)

Data sources: DeFi Llama Yields API, Morpho GraphQL API, Pendle Hosted SDK API (all free, no key).

Supported Protocols & Chains

ProtocolTypeDeposit MethodChains
Aave V3Lending poolpool.supply(asset, amount, onBehalfOf, 0)ETH, ARB, Base, OP, Polygon, Avax
MorphoERC-4626 vaultsvault.deposit(assets, receiver)ETH, ARB, Base, OP
PendlePT fixed-rateHosted SDK → router swapETH, ARB, Base
Compound V3Lendingcomet.supply(asset, amount)ETH, ARB, Base, OP, Polygon
Spark / SkyLendingpool.supply(...)ETH
FluidLendingvault.deposit(...)ETH
EulerLendingvault.deposit(...)ETH, ARB, Base

Stablecoins tracked: USDC, USDT, DAI, USDS, sDAI, sUSDe, GHO

Architecture

Backend (Node.js / Express)

server.js
├── /api/pools          — best protocol per chain (Aave vs Morpho vs Pendle)
├── /api/chains         — supported chain list
├── /api/tvl            — total TVL from DeFi Llama
├── /api/agent-activity — recent deposit/withdraw log
├── /api/vault/:addr    — user positions across all protocols
├── /api/deposit        — record deposit event
├── /api/withdraw       — record withdraw event
├── /api/usdc-balance/:addr — cross-chain USDC balance (RPC reads)
└── /api/pendle-swap    — get Pendle SDK calldata for PT swap

Frontend (Vanilla JS + ethers.js)

public/
├── index.html   — landing page + dashboard
├── styles.css   — dark theme, glass-morphic UI
├── app.js       — dashboard logic, deposit/withdraw modals
└── wallet.js    — multi-protocol deposit routing

Protocol Routing Logic

For each chain:
  1. Fetch Aave V3 APY from DeFi Llama
  2. Fetch Morpho vault APY from GraphQL (if vault exists on chain)
  3. Fetch Pendle PT implied APY from Hosted SDK (if market exists on chain)
  4. Return winner = max(aave_apy, morpho_apy, pendle_apy)

On deposit:
  IF winner == "aave"   → approve USDC → pool.supply()
  IF winner == "morpho"  → approve USDC → vault.deposit()
  IF winner == "pendle"  → approve USDC → router.swapExactTokenForPt()

On withdraw:
  Read user balances across all protocols
  IF has aTokens      → pool.withdraw()
  IF has Morpho shares → vault.withdraw() or vault.redeem()
  IF has Pendle PT     → router swap PT → USDC (or redeem at maturity)

Core Workflows

1. Scan & Report (CLI)

When user asks "what are the best yields?" or "where should I put my USDC?":

1. Run python3 skills/yield-optimizer/scripts/scan_pools.py 2. Present top opportunities grouped by risk tier 3. Highlight the best rate per chain and the overall best

python3 skills/yield-optimizer/scripts/scan_pools.py                     # Full report
python3 skills/yield-optimizer/scripts/scan_pools.py --json              # JSON for automation
python3 skills/yield-optimizer/scripts/scan_pools.py --chain Arbitrum    # Filter by chain
python3 skills/yield-optimizer/scripts/scan_pools.py --protocol pendle   # Filter by protocol
python3 skills/yield-optimizer/scripts/scan_pools.py --amount 10000 --risk balanced  # Allocation

2. Launch Web UI

For the full visual experience with wallet connection:

cd output/yield-agent-v4
npm install
node server.js    # starts on port 3456

Then use preview_serve to expose it.

3. Execute Deposit (Programmatic)

When user confirms a recommendation:

1. Check wallet balances via wallet skill 2. If USDC is on wrong chain, suggest bridging (across-bridge skill) 3. Determine best protocol for target chain (from /api/pools) 4. Execute the protocol-specific deposit flow 5. Verify position via balance read

Prerequisites: Load wallet-policy skill and propose standard wildcard policy before on-chain ops.

4. Monitor & Rebalance

For scheduled autonomous operation:

1. Scan yields every hour 2. Compare current position APY vs best available 3. If delta > 1% AND gas cost < 0.1% of position → recommend rebalance 4. Log all decisions with reasoning

schedule_task(
  command="python3 skills/yield-optimizer/scripts/scan_pools.py --json",
  schedule="every 1 hour"
)

Risk Tiers

TierProtocolsCharacteristics
🟢 SafeAave V3, Compound V3, SparkEstablished, audited, >$100M TVL
🟡 ModerateMorpho, Euler, FluidNewer but audited, ERC-4626, >$10M TVL
🔴 AggressivePendleHigher yields via PT fixed-rate, maturity risk

Contract Addresses

See references/contracts.json for:

  • Aave V3 pool addresses per chain
  • USDC token addresses per chain
  • aToken addresses per chain
  • RPC endpoints per chain

Morpho vault addresses:

  • Ethereum: 0xBEEF01735c132Ada46AA9aA4c54623cAA92A64CB (Steakhouse USDC)
  • Base: 0xc1256Ae5FF1cf2719D4937adb3bbCCab2E00A2Ca (Steakhouse USDC)
  • Arbitrum: 0x2C8FBB630Bae56bBC27E286d0D4816D62e4C1509 (Steakhouse USDC)
  • Optimism: 0x7BfA7e0e3De0e3a6B4399F9CAa1E444Dd3d55c54 (Gauntlet USDC Prime)

Key Gotchas

  • APY ≠ APR. DeFi Llama returns APY (compounded). Don't double-compound.
  • Reward APY is temporary. apyReward (token incentives) can vanish. Weight apyBase higher.
  • TVL matters. High APY + low TVL = unsustainable. Filter >$100K minimum, prefer >$10M.
  • Gas costs eat small positions. Ethereum mainnet ≈ $5-15. Don't rebalance $500 for 0.3% more.
  • Pendle PT has maturity dates. Full implied APY only if held to maturity. Early exit via AMM may differ.
  • Morpho vaults are ERC-4626. Standard deposit/withdraw, but shares ≠ assets (use convertToAssets).
  • Bridge time. Cross-chain moves take 2-15 minutes via Across. Don't show as instant.
  • USDC decimals. Always 6 decimals. parseUnits(amount, 6) not 18.

Integration with Other Skills

SkillPurpose
walletBalance checks, transaction execution
across-bridgeCross-chain USDC transfers when rebalancing
wallet-policyEnsure wallet policy is set before on-chain ops
coinglass / market-dataBroader market context for yield decisions
chartingVisualize yield trends over time

Related skills

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.