bigdecimal-ethers-ext 0.2.1

Library allowing conversion between BigDecimal and ethers
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# bigdecimal-ethers-ext
[BigDecimal][0] interoperability with [ethers-rs][1] types.

# Example
```rs
let big_decimal = BigDecimal::from_f64(10.5).unwrap();
// Convert to an u256 with 18 decimals.
let u256 = big_decimal.to_ethers_u256(18).unwrap();
println!("{u256}");
// 10500000000000000000
// Convert from an u256 with 18 decimals to a BigDecimal.
let to_big_decimal = BigDecimal::from_ethers_u256(&u256, 18).unwrap();
println!("{to_big_decimal}");
// 10.500000000000000000
```

[0]: https://github.com/akubera/bigdecimal-rs
[1]: https://github.com/gakonst/ethers-rs