[Feature] Macros to parse Ether and other units from string to U256
Ouverte
enhancement
- Langage dominant
- Rust
- Étoiles
- 966
- Forks
- 274
- Merge moyen
- 1 j 21 h
- PR mergées (30 j)
- 15
Description
### Component
primitives
### Describe the feature you would like
Often you have fixed values that could already be parsed during compile time. Currently I am initializing those values using lazy_static. My proposal would be to have macros to parse ether, wei, etc. from a string to U256.
Currently you will write:
```rust
let val: U256 = parse_units("0.01", "ether").unwrap().get_absolute();
```
Proposal:
```rust
let val: U256 = ether!("0.01");
```
If the parsing fails it will throw an error during compile time.
### Additional context
_No response_
Guide de contribution
Ouvrir le guide de contribution
Évaluation
Cette issue n'a pas encore été évaluée.