-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
[Bug]: cannot send tokens with decimals > 20 #14481
Labels
area-customNetworks
area-transactions
release-11.4.0
Issue or pull request that will be included in release 11.4.0
team-assets
type-enhancement
Comments
I have the same problem. Is it solved? |
I also have the same problem when using metamask with this token Is there any fix ? |
14 tasks
salimtb
added a commit
that referenced
this issue
Oct 11, 2023
## **Description** Now MetaMask cannot send tokens with decimals larger than 20, this fix allows MetaMask to send tokens with tokens whose decimals <= 32. the solution was to config `bigNumber` and set decimals to 36 ## **Manual testing steps** 1 - Import token with decimals > 20 2 - Try to send an amount of this token using the send button ## **Screenshots/Recordings** ### **Before** https://github.com/MetaMask/metamask-extension/assets/26223211/b96d65b8-2373-49ee-ab11-ee737187d08d ### **After** https://github.com/MetaMask/metamask-extension/assets/26223211/afef0d44-b6a0-4b24-9880-084cd7ffa7d3 ## **Related issues** _Fixes #14481 ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [x] I've clearly explained: - [x] What problem this PR is solving. - [x] How this problem was solved. - [x] How reviewers can test my changes. - [x] I’ve indicated what issue this PR is linked to: Fixes #??? - [x] I’ve included tests if applicable. - [ ] I’ve documented any added code. - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). - [x] I’ve properly set the pull request status: - [ ] In case it's not yet "ready for review", I've set it to "draft". - [x] In case it's "ready for review", I've changed it from "draft" to "non-draft". ## **Pre-merge reviewer checklist** - [x] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [x] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
k-g-j
pushed a commit
that referenced
this issue
Nov 1, 2023
## **Description** Now MetaMask cannot send tokens with decimals larger than 20, this fix allows MetaMask to send tokens with tokens whose decimals <= 32. the solution was to config `bigNumber` and set decimals to 36 ## **Manual testing steps** 1 - Import token with decimals > 20 2 - Try to send an amount of this token using the send button ## **Screenshots/Recordings** ### **Before** https://github.com/MetaMask/metamask-extension/assets/26223211/b96d65b8-2373-49ee-ab11-ee737187d08d ### **After** https://github.com/MetaMask/metamask-extension/assets/26223211/afef0d44-b6a0-4b24-9880-084cd7ffa7d3 ## **Related issues** _Fixes #14481 ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [x] I've clearly explained: - [x] What problem this PR is solving. - [x] How this problem was solved. - [x] How reviewers can test my changes. - [x] I’ve indicated what issue this PR is linked to: Fixes #??? - [x] I’ve included tests if applicable. - [ ] I’ve documented any added code. - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). - [x] I’ve properly set the pull request status: - [ ] In case it's not yet "ready for review", I've set it to "draft". - [x] In case it's "ready for review", I've changed it from "draft" to "non-draft". ## **Pre-merge reviewer checklist** - [x] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [x] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area-customNetworks
area-transactions
release-11.4.0
Issue or pull request that will be included in release 11.4.0
team-assets
type-enhancement
Describe the bug
Problem
When I'm trying to transfer $NEAR (also called WNEAR) in Aurora mainnet network, I cannot input the amount in the Send page in MetaMask. No matter what number I input, the value on the Send page will be
0
. So I cannot transfer any $NEAR token in Aurora network with MetaMask.decimals
is24
, which makes it special.Analysis
The the issue is that when converting the value in the below function, the
rate
will become0
, and make the returnedconvertedValue
to be0
always.metamask-extension/shared/modules/conversion.utils.js
Lines 117 to 120 in 3732c5f
The root cause is, in LINE 118,
conversionRate
is1e24
because $NEAR's decimals is24
, but the defaultDECIMAL_PLACES
ofBigNumber
is20
, as stated here https://mikemcl.github.io/bignumber.js/#decimal-placesAs a result, any number smaller than
1e-20
will become0
. That's why any input for $NEAR amount will become 0.A quick fix is to specify a large enough
DECIMAL_PLACES
inBigNumber
.Reference
DECIMAL_PLACES
setting inbignumber.js
: https://mikemcl.github.io/bignumber.js/#decimal-placesSteps to reproduce
We can reproduce the issue on Aurora testnet:
Error messages or log output
Version
10.12.4
Build type
No response
Browser
Chrome
Operating system
MacOS
Hardware wallet
No response
Additional context
Besides $NEAR, this should also happen to other tokens on Aurora with decimals = 24
The text was updated successfully, but these errors were encountered: