refactor(chain): retire etherscan client, use RPC balanceOf - #1457
Merged
Conversation
erc20TokenBalance now calls the existing RawErc20TokenBalance (on-chain balanceOf via the RPC client) instead of the etherscan-api TokenBalance call, mirroring the RPC path already proven in RawErc20TokenBalance / tokens.go. Chain.TokenTotalSupply is deleted (orphaned; defi.go already migrated its caller to Alchemy). Drops the scan field, the etherscan.NewCustomized construction, and the apiKey param from NewClient; updates its 3 callers (tokens.go, vaultwallet.go, discordwallet.go) to match. Removes the unused EthereumScan and EthereumScanAPIKey config fields (ETHEREUM_SCAN / ETHEREUM_SCAN_API_KEY env bindings) and the now-unused nanmu42/etherscan-api dependency via go mod tidy.
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.
Final Alchemy-consolidation step: removes the Etherscan dependency from mochi-api entirely.
erc20TokenBalance(fund-path balance check) rewired fromch.scan.TokenBalance(etherscan) to the existingRawErc20TokenBalanceRPC path (erc20.BalanceOfvia eth_call) — same signature/return, callers unchanged. Live-probed: USDC balance for a Circle wallet returns a sane value via RPC.Chain.TokenTotalSupply(defi.go moved to Alchemy earlier), thech.scanetherscan client + its NewClientapiKeyparam (3 callers updated), theetherscan-apidep (go mod tidy).EthereumScanAPIKey+EthereumScanconfig fields (ETHEREUM_SCAN_API_KEY/ETHEREUM_SCANenv), unused anywhere.rg 'ch.scan|nanmu42/etherscan|ETHEREUM_SCAN' pkg/ go.mod→ zero live refs.ETHEREUM_SCAN_API_KEYcan now leave Vault (was already unused by the binary; the etherscan client used the DB chains.api_key column, also now gone). Vault delete is a gated op.CI baseline-broken (see #1438); 4 baseline entities fails unrelated.
🤖 Generated with Claude Code