Function revm::precompile::primitives::alloy_primitives::utils::format_ether

source ·
pub fn format_ether<T>(amount: T) -> String
where T: Into<ParseUnits>,
Expand description

Formats the given number of Wei as an Ether amount.

§Examples

use alloy_primitives::{utils::format_ether, U256};

let eth = format_ether(1395633240123456000_u128);
assert_eq!(format_ether(1395633240123456000_u128), "1.395633240123456000");