feat: add Ethereum chain support#116
Open
Ridwannurudeen wants to merge 2 commits intoOpenGradient:mainfrom
Open
feat: add Ethereum chain support#116Ridwannurudeen wants to merge 2 commits intoOpenGradient:mainfrom
Ridwannurudeen wants to merge 2 commits intoOpenGradient:mainfrom
Conversation
a3cc476 to
5f4bffc
Compare
- ETH portfolio fetcher with Alchemy API + web3.py fallback - Uniswap V3 protocol (top pools by TVL, fee-based APR) - Aave V3 protocol (lending reserves, USD-denominated TVL) - Token metadata for ETH ecosystem (WETH, USDC, USDT, DAI) - Configurable subgraph URLs via env vars - Integration tests for ETH protocols and portfolio
5f4bffc to
db846de
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Ethereum chain support alongside the existing Solana infrastructure, covering the three items in #48:
EthereumPortfolioFetcherwith dual-mode support: auto-detects Alchemy endpoints and usesalchemy_getTokenBalancesfor complete ERC20 coverage in a single RPC call, with graceful fallback to individualbalanceOfqueries for 10 well-known tokens (USDC, USDT, DAI, WETH, WBTC, LINK, UNI, AAVE, CRV, stETH)search_token()shortcut matching, backed by existing DexScreener API (already chain-agnostic)TokenMetadataRepoAlso adds Ethereum DeFi protocol implementations for pool discovery:
liquidityRate(RAY units), USD-denominated TVL viapriceInEth * ETH/USD * supplyArchitecture
Follows existing patterns exactly:
ProtocolABC and register withProtocolRegistrysolana_portfolio.pystructureretrieve_ethereum_poolstool added to investor agent toolkitChain.ETHEREUMenum already existed — no type changes neededNew files
onchain/portfolio/ethereum_portfolio.pyonchain/pools/ethereum/uniswap_v3_protocol.pyonchain/pools/ethereum/aave_protocol.pyonchain/pools/ethereum/test_ethereum_protocols.pyModified files
onchain/tokens/metadata.py— ETH hardcoded tokensagent/tools.py—retrieve_ethereum_poolstoolserver/fastapi_server.py— register ETH protocols + portfolio fetchermain.py— ETH protocol names.env.example—ETH_RPC_URL,UNISWAP_V3_SUBGRAPH_URL,AAVE_V3_SUBGRAPH_URLKey improvements over initial implementation
alchemy_getTokenBalancesprovides complete ERC20 token discovery without maintaining a hardcoded list; falls back gracefully to individualbalanceOfcalls for non-Alchemy RPCspriceInEth * ETH/USDfrom DexScreener, rather than raw token countsDependencies
web3>=7.3.0— already in requirements.txtaiohttp— already in requirements.txtTest plan
retrieve_ethereum_poolstool filters by Chain.ETHEREUMCloses #48