use alloy::primitives::{address, U256}; use alloy::providers::ProviderBuilder; use alloy_erc20::Erc20ProviderExt; use dotenv::dotenv; use std::env; #[tokio::main(flavor = "current_thread")] async fn main() { dotenv().ok(); let eth_rpc = env::var("ETH_RPC").unwrap(); let provider = ProviderBuilder::new().on_http(eth_rpc.parse().unwrap()); // Just retrieve a token from its address let dai = provider .retrieve_token(address!("6B175474E89094C44Da98b954EedeAC495271d0F")) // DAI .await .unwrap(); // Compute a balance as a BigDecimal from a U256 let balance = dai.get_balance(U256::from(1000000000000_u64)); println!("Balance: {balance}") }