1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use ethereum_types::U256;
pub fn from_ether(value: impl Into<U256>) -> U256 {
value.into() * U256::from(10).pow(18.into())
}
pub fn from_finney(value: impl Into<U256>) -> U256 {
value.into() * U256::from(10).pow(15.into())
}
pub fn from_szabo(value: impl Into<U256>) -> U256 {
value.into() * U256::from(10).pow(12.into())
}
pub fn from_gwei(value: impl Into<U256>) -> U256 {
value.into() * U256::from(10).pow(9.into())
}
pub fn from_mwei(value: impl Into<U256>) -> U256 {
value.into() * U256::from(10).pow(6.into())
}
pub fn from_kwei(value: impl Into<U256>) -> U256 {
value.into() * U256::from(10).pow(3.into())
}