# Token A Rust interface for interacting with ERC20 token contracts. Provides basic token operations like checking balances and managing allowances. ## Quick Reference ```rust // Initialize token let token = Token::new("USDC", "0x1234...", provider)?; // Check balance let balance = token.balance_of(&user_address).await?; // Check & update allowance let current_allowance = token.allowance(&user, &spender).await?; let tx_hash = token.increase_allowance(&spender, &amount).await?; ``` ## Error Types ```rust pub enum TokenError { AllowanceError, } ``` ## Methods ### Constructor ```rust pub fn new(name: &str, address: &str, provider: P) -> Result ``` Creates new Token instance with specified name and contract address. ### Read Methods ```rust // Get token contract address pub fn address(&self) -> Address // Get total token supply pub async fn token_supply(&self) -> Result // Get balance for specific address pub async fn balance_of(&self, user: &Address) -> Result // Get current allowance pub async fn allowance(&self, user: &Address, spender: &Address) -> Result ``` ### Write Methods ```rust // Increase allowance for spender pub async fn increase_allowance(&self, spender: &Address, amount: &U256) -> Result, Error> ``` ## Notes - All amounts are handled as U256 values - Uses ERC20 standard interface - Methods return transaction hashes for write operations - Supports standard allowance pattern for token approvals