cast::revm::interpreter::primitives::alloy_primitives::utils

Function format_ether

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");