feat: add token-safety command using GeckoTerminal gt_score#19
Closed
StanleytheGoat wants to merge 1 commit intocoingecko:mainfrom
Closed
feat: add token-safety command using GeckoTerminal gt_score#19StanleytheGoat wants to merge 1 commit intocoingecko:mainfrom
StanleytheGoat wants to merge 1 commit intocoingecko:mainfrom
Conversation
Add a new `cg token-safety` command that surfaces GeckoTerminal's gt_score safety data for any token by contract address. GeckoTerminal (owned by CoinGecko) provides a composite safety score (0-100) based on on-chain signals: liquidity depth, pool age, buy/sell tax detection, honeypot risk, and token distribution. This data was previously only available through the GeckoTerminal web UI -- this command brings it to the CLI. Features: - Token overview with price, FDV, and safety score - Color-coded risk classification (Low/Medium/High/Critical) - Top 5 pool safety breakdown with liquidity and volume - Multi-chain support (eth, base, sol, polygon, arbitrum, bsc, etc.) - JSON output for programmatic use - Dry-run support - No API key required (uses GeckoTerminal public API) Usage: cg token-safety 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 cg token-safety <address> --network base -o json
a8af0db to
d0f3070
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 a new
cg token-safetycommand that surfaces GeckoTerminal'sgt_scoresafety data for any token by contract address.GeckoTerminal (owned by CoinGecko) provides a composite safety score (0-100) based on on-chain signals: liquidity depth, pool age, buy/sell tax detection, honeypot risk, and token distribution. This data was previously only accessible through the GeckoTerminal web UI. This PR brings it to the CLI.
Features
eth,base,sol,polygon_pos,arbitrum,bsc,optimism,avalanche)-o json) for programmatic use--dry-runsupportUsage
Score Interpretation
Implementation
cmd/token_safety.go- command handler with table/JSON outputcmd/token_safety_test.go- tests (dry-run, JSON output, network flag, score classification)internal/api/geckoterminal.go- GeckoTerminal API clientinternal/api/geckoterminal_types.go- response typescmd/commands.go- added command metadatadisplay.PrintTable,outputJSON,isDryRun, testable client factoryMotivation
The CoinGecko CLI currently has no safety-related commands. With the rise of token scams and rug pulls across DeFi, surfacing CoinGecko's own GeckoTerminal safety signals directly in the CLI fills a significant gap. This was motivated by building Aegis, an autonomous DeFi safety system, and noticing the CLI lacked any safety features despite CoinGecko already having this data via GeckoTerminal.
Test Plan
go test ./cmd/ -run TestTokenSafety- all tests passgo test ./internal/api/ -run TestGecko- API client tests passcg token-safety 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48shows USDC safety datacg token-safety <address> --network base -o jsonreturns valid JSONcg token-safety <address> --dry-runshows request preview without API call