Skip to content

feat(yield): EVM yield aggregation — read-only layer (HCLI port 4/5) - #29

Open
JaeLeex wants to merge 1 commit into
mainfrom
feat/yield-aggregation
Open

feat(yield): EVM yield aggregation — read-only layer (HCLI port 4/5)#29
JaeLeex wants to merge 1 commit into
mainfrom
feat/yield-aggregation

Conversation

@JaeLeex

@JaeLeex JaeLeex commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Part 4 of 5 of the HCLI → agent-cli port. Brings the EVM yield aggregator from nunchi-cli-evm-yield in as hl yield .... This is Ethereum + Base on-chain yield — fully independent of the Hyperliquid trading domain.

What's new

  • hl yield scan / aggregate — discover yield opportunities across Ethereum + Base (DeFiLlama https://yields.llama.fi/pools), risk-scored.
  • hl yield rank — rank by net APY = apy_base + apy_reward − gas_amortized − risk_haircut.
  • hl yield optimize --budget N — greedy allocation under constraints (≤40%/protocol, ≤6 positions). --json for machine-readable plans.

Scope: read-only layer only (intentional)

The pure layer is ported verbatim from source (models / risk / optimizer / sources.base / sources.defillama); aggregator.py wraps the on-chain-adapter import in try/except ImportError so the execution layer auto-enables once the EVM substrate lands — zero further edits.

The execution layer (position / route / rebalance) is deferred because agent-cli lacks the substrate it needs, and I will not fabricate it:

  • common.evm (EvmClient / Multicall / TxExecutor / Erc20 / abi_loader) — absent
  • trading.dex (Uniswap v3 binding) — absent
  • (common.credentials.resolve_private_key already exists — not a blocker.)

A follow-up PR can port router.py + sources/onchain/* + the bundled real address-book JSONs once that substrate is added. The read-only layer is self-contained (pydantic + requests + stdlib).

Verification (live)

  • Imports clean (proven to import even with web3/common.evm/trading all absent → ONCHAIN_ADAPTERS=[]).
  • hl yield scan --chain all3521 real pools (Ethereum + Base), sorted by gross APY; bluechip filter correctly ranks deep-TVL safe (maple/aave/ondo).
  • hl yield optimize --budget 500000 --max-risk 0.3 --min-tvl 200000000 → diversified morpho-blue/lido/maple plan, caps enforced.

Notes

  • Based off main, independent of the other HCLI-port PRs.

`hl yield scan|aggregate|rank|optimize` — discover + rank + greedily allocate
Ethereum+Base yield (DeFiLlama; net-APY = base+reward−gas−risk_haircut; ≤40%/
protocol, ≤6 positions). Pure modules ported verbatim from nunchi-cli-evm-yield
(models/risk/optimizer/sources.base/sources.defillama); aggregator wraps the
on-chain adapter import in try/except so it auto-enables once the EVM substrate lands.

Execution layer (position/route/rebalance) deferred: agent-cli lacks common.evm
(EvmClient/Multicall/TxExecutor) + trading.dex (Uniswap v3). Read-only layer is
self-contained (pydantic + requests). Verified live: 3521 real pools.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant