Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow up to 6 decimals in transfer values #152

Merged
merged 3 commits into from
Oct 20, 2023

Conversation

platfowner
Copy link
Member

Change summary:

  • Allow up to 6 decimals in transfer values
  • Add countDecimals() util function

Related issues:

Copy link
Member

@jiyoung-an jiyoung-an left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with some comments! Thanks!

expect(Wallet.countDecimals(100001)).toBe(0);
expect(Wallet.countDecimals(1000001)).toBe(0);
expect(Wallet.countDecimals(10000001)).toBe(0);
expect(Wallet.countDecimals(100000001)).toBe(0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q. What does these test cases mean? (11, 101, ..., 100000001)

Copy link
Member Author

@platfowner platfowner Oct 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is '1.00000001e8' case.

expect(Wallet.countDecimals(1.0000003)).toBe(7);
expect(Wallet.countDecimals(1.00000003)).toBe(8);
expect(Wallet.countDecimals(1.000000003)).toBe(9);
expect(Wallet.countDecimals(1.0000000003)).toBe(10);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor) How about adding test cases in the 'e-' format?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0.0000000012 is actually '1.2e-9' case. toString() converts 0.0000000012 to '1.2e-9'.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just added toString() results as comments. Thanks!

@platfowner
Copy link
Member Author

Thanks for the review! @jiyoung-an Now merging..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants