Function revm::interpreter::primitives::alloy_primitives::utils::parse_ether

source ·
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);