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

Function parse_ether

pub fn parse_ether(eth: &str) -> Result<Uint<256, 4>, UnitsError>
Expand description

Converts the input to a U256 and converts from Ether to Wei.

ยงExamples

use alloy_primitives::{
    utils::{parse_ether, Unit},
    U256,
};

let eth = Unit::ETHER.wei();
assert_eq!(parse_ether("1").unwrap(), eth);