-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: bigint units & decimalplaces from db
This commit makes two significant changes. 1. It uses the new `bigint` type - supported as of node LTS v14 - for internal representations of the base "units" of any currencies/tokens. ETH wei, having 10^18 units per ether, can exceed the capacity of javascript's `number` type and lead to unexpected rounding or scientific notation when converting to string that has required hacky workarounds. Using `bigint` gives us native integer support for base tokens for all tokens, regardless of how many decimal places they can be split into. 2. It reads the aforementioned decimal places from the database for every token. Previously, we hardcoded the units per tokens for a handful of known ERC20 tokens. Adding other currencies to be supported by xud would have required a code change. Now, new tokens can be supported with changes to the database via rpc calls, without requiring code updates. Closes #1054. Closes #1888.
- Loading branch information
Showing
24 changed files
with
380 additions
and
288 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.