Skip to content

feat(chains): add TVL by asset command via DefiLlama#4

Merged
ggonzalez94 merged 3 commits intomainfrom
feat/chains-assets-tvl
Feb 22, 2026
Merged

feat(chains): add TVL by asset command via DefiLlama#4
ggonzalez94 merged 3 commits intomainfrom
feat/chains-assets-tvl

Conversation

@ggonzalez94
Copy link
Owner

@ggonzalez94 ggonzalez94 commented Feb 22, 2026

Summary

  • add chains assets command to expose chain-level TVL broken down by asset
  • implement MarketDataProvider.ChainsAssets and DefiLlama adapter support
  • require DEFI_DEFILLAMA_API_KEY for chains.assets capability and surface it in provider metadata
  • add deterministic sorting/aggregation and canonical asset_id population when known
  • document key requirement in README/AGENTS and add changelog entries

API / Contract

  • new command: defi chains assets --chain <chain> [--asset <asset>] [--limit N]
  • new model row fields: rank, chain, chain_id, asset, asset_id, tvl_usd
  • no breaking changes to existing commands or envelope contract

Validation

  • go test ./...
  • go test -race ./...
  • go vet ./...
  • smoke: defi chains top --limit 2 --results-only
  • smoke: defi chains assets --chain 1 --asset USDC --results-only without key returns auth error (exit code 10)

Note

Medium Risk
Adds a new CLI surface area and a DefiLlama Pro API integration that is key-gated and involves parsing/aggregating loosely typed JSON, which could cause edge-case failures if the upstream payload shape changes.

Overview
Adds a new defi chains assets command that returns chain-level TVL broken down by asset (optionally filtered via --asset) and caches results with the same 5m TTL as other chain/protocol lookups.

Implements MarketDataProvider.ChainsAssets plus a DefiLlama-backed adapter that requires DEFI_DEFILLAMA_API_KEY, aggregates breakdown categories, sorts deterministically, and fills asset_id when the token is known. Updates provider capability metadata, adds the ChainAssetTVL model + tests, and documents the new command and key requirement in README.md/AGENTS.md/CHANGELOG.md.

Written by Cursor Bugbot for commit 97a2f7d. This will update automatically on new commits. Configure here.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 42e10e7c9e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ggonzalez94 ggonzalez94 merged commit 3b4f6eb into main Feb 22, 2026
18 of 19 checks passed
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