Skip to content
This repository has been archived by the owner on Nov 15, 2021. It is now read-only.

Fix Prompt Bug with Sending NEP-5 Tokens #990

Merged
merged 2 commits into from
Jul 22, 2019

Conversation

brianlenz
Copy link
Contributor

What current issue(s) does this address, or what feature is it adding?

  • Fixed a bug where sending NEP-5 tokens via the Prompt CLI did not properly handle the NEP-5 decimal conversion. Thus, previously, you'd have to enter the amount as a "raw" value without a decimal in order for the proper amount of tokens to be sent.

How did you solve this problem?

Added the proper conversion of the user-entered decimal amount to the raw value based on the NEP-5 token's decimals. This fix is mirrored off of the approve command, which was already handling the conversion properly.

How did you make sure your solution works?

Tested it.

Are there any special changes in the code that we should be aware of?

No.

Please check the following, if applicable:

  • Did you add any tests?
  • Did you run make lint?
  • Did you run make test?
  • Are you making a PR to a feature branch or development rather than master?
  • Did you add an entry to CHANGELOG.rst? (if not, please do)

Brian Lenz added 2 commits July 19, 2019 17:01
* Fixed a bug where sending NEP-5 tokens via the Prompt CLI did not properly handle the NEP-5 decimal conversion. Thus, previously, you'd have to enter the amount as a "raw" value without a decimal in order for the proper amount of tokens to be sent.

This fix is mirrored off of the ``approve`` command, which was already handling the conversion properly.
@coveralls
Copy link

coveralls commented Jul 20, 2019

Coverage Status

Coverage increased (+0.0005%) to 85.264% when pulling 813249d on brianlenz:fix_nep5_token_send_decimals into 42e7820 on CityOfZion:development.

@ixje
Copy link
Member

ixje commented Jul 22, 2019

Sounds ok from the description, but I'd like to make sure understand the issue.

Say we have a Token with 2 decimals. Previously we could not provide 1.1 as the value on the console but had to use 110 (integral (1) + fractional (10) concatenated). Is that the right understanding?

@brianlenz
Copy link
Contributor Author

Sorry, @ixje, I should have exhibited with an example which makes it very obvious. Yes, your assessment is correct. Here's an example with NRVE, which has 8 decimals:

Before Fix

neo> wallet token send NRVE AXXX AXXX 1
-----------------------------------------------------------
Will transfer 0.00000001 NRVE from AXXX to AXXX
Transfer fee: 0.0001
-------------------------------------------------------------

Enter your password to send to the network
[Password]>
incorrect password
neo> wallet token send NRVE AXXX AXXX 100000000
 
-----------------------------------------------------------
Will transfer 1.00000000 NRVE from AXXX to AXXX
Transfer fee: 0.0001
-------------------------------------------------------------

Enter your password to send to the network
[Password]>

After Fix

neo> wallet token send NRVE AXXX AXXX 1

-----------------------------------------------------------
Will transfer 1.00000000 NRVE from AXXX to AXXX
Transfer fee: 0.0001
-------------------------------------------------------------

Enter your password to send to the network
[Password]>

incorrect password
neo> wallet token send NRVE AXXX AXXX 100000000
could not transfer tokens

@ixje
Copy link
Member

ixje commented Jul 22, 2019

thanks 👍

@ixje ixje merged commit 34eeb8a into CityOfZion:development Jul 22, 2019
@brianlenz brianlenz deleted the fix_nep5_token_send_decimals branch July 22, 2019 15:33
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.

3 participants