Skip to content

feat: add token-safety command using GeckoTerminal gt_score#19

Closed
StanleytheGoat wants to merge 1 commit intocoingecko:mainfrom
StanleytheGoat:feat/token-safety
Closed

feat: add token-safety command using GeckoTerminal gt_score#19
StanleytheGoat wants to merge 1 commit intocoingecko:mainfrom
StanleytheGoat:feat/token-safety

Conversation

@StanleytheGoat
Copy link
Copy Markdown

@StanleytheGoat StanleytheGoat commented Mar 20, 2026

Summary

Adds 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 accessible through the GeckoTerminal web UI. This PR 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_pos, arbitrum, bsc, optimism, avalanche)
  • JSON output (-o json) for programmatic use
  • --dry-run support
  • No API key required, uses the public GeckoTerminal API

Usage

# Check USDC on Ethereum
cg token-safety 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48

# Check a token on Base
cg token-safety 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 --network base

# JSON output
cg token-safety <address> --network sol -o json

Score Interpretation

Score Risk Level Meaning
80-100 Low Risk Established token with deep liquidity
50-79 Medium Risk Review before interacting
20-49 High Risk Proceed with extreme caution
0-19 Critical Risk Likely malicious or abandoned

Implementation

  • New files:
    • cmd/token_safety.go - command handler with table/JSON output
    • cmd/token_safety_test.go - tests (dry-run, JSON output, network flag, score classification)
    • internal/api/geckoterminal.go - GeckoTerminal API client
    • internal/api/geckoterminal_types.go - response types
  • Modified: cmd/commands.go - added command metadata
  • Follows existing patterns: Cobra command structure, display.PrintTable, outputJSON, isDryRun, testable client factory
  • Concurrent token info + pools fetch for speed

Motivation

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 pass
  • go test ./internal/api/ -run TestGecko - API client tests pass
  • Manual: cg token-safety 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 shows USDC safety data
  • Manual: cg token-safety <address> --network base -o json returns valid JSON
  • Manual: cg token-safety <address> --dry-run shows request preview without API call

@StanleytheGoat StanleytheGoat requested a review from a team March 20, 2026 08:14
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
@StanleytheGoat StanleytheGoat deleted the feat/token-safety branch March 20, 2026 08:35
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