Skip to main content

Module tokens

Module tokens 

Source
Expand description

Token alias storage for saving token lookups.

Allows users to reference tokens by friendly names instead of full contract addresses.

§Token Alias Storage

This module provides storage and retrieval of token aliases, allowing users to reference tokens by friendly names instead of full contract addresses.

§Storage Location

Token aliases are stored in ~/.scope-bca/data/tokens.yaml (see crate::paths).

§Usage

use scope::tokens::TokenAliases;

// Load existing aliases
let mut aliases = TokenAliases::load();

// Add an alias
aliases.add("USDC", "ethereum", "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", "USD Coin");

// Look up an alias
if let Some(info) = aliases.get("USDC", Some("ethereum")) {
    println!("USDC address: {}", info.address);
}

// Save aliases
aliases.save().unwrap();

Structs§

TokenAliases
Collection of token aliases.
TokenInfo
A saved token alias with its address and metadata.

Constants§

STABLECOIN_SYMBOLS
Symbols treated as USD stablecoins, in upper case. Market pair parsing reads them as quote currencies too (market::pair).

Functions§

is_stablecoin_price
Whether price (in USD) looks like a stablecoin’s price.
is_stablecoin_symbol
Whether symbol is a known USD stablecoin (case-insensitive). The one symbol list: insights, the monitor and the ticker volume rules use it.