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§
- Token
Aliases - Collection of token aliases.
- Token
Info - 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
symbolis a known USD stablecoin (case-insensitive). The one symbol list: insights, the monitor and the ticker volume rules use it.