Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Add Decimal support to ethers::utils::parse_units #463

Merged
merged 4 commits into from
Sep 20, 2021

Conversation

odyslam
Copy link
Contributor

@odyslam odyslam commented Sep 20, 2021

  • Depends on Change wei from 1 to 0 #460 so that it parses wei accurately.
  • It converts the number to float, performs the necessary computation, and finally, it returns U256 as it should
  • It uses String as an intermediate step between f64 and U256 .
  • I am unsure of the generic error that it returns. I added that because there are 2 types of Errors it could return (either from parsing string-->Float or from string-->U256).

If we agree with the general approach, I will change parse_ethers to be syntactic sugar for: parse_units with ether as the unit. This will add decimal support for that function as well.

PR Checklist

  • Added Tests
  • Added Documentation
  • Updated the changelog

@odyslam odyslam marked this pull request as ready for review September 20, 2021 17:26
@gakonst gakonst merged commit 2236798 into gakonst:master Sep 20, 2021
@odyslam odyslam deleted the decimal-support branch September 20, 2021 21:08
meetmangukiya pushed a commit to meetmangukiya/ethers-rs that referenced this pull request Mar 21, 2022
* fix: fuzzer now generates ints in correct range

* fix: overflowing_sub gives the right encoding so sign caused a bug
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants