eos icon indicating copy to clipboard operation
eos copied to clipboard

eosio.token transfer succeeds or fails depending on decimal digits count

Open moskvanaft opened this issue 8 years ago • 2 comments

EOS created with

cleos push action eosio.token create '{"issuer": "anton", "maximum_supply": "1000000.0000 EOS", "can_freeze": 0, "can_recall": 0, "can_whitelist": 0}' -p eosio.token

transfer 7 EOS succeeds

cleos push action eosio.token transfer "{ \"from\": \"anton\", \"to\": \"anton\", \"quantity\": \"7 EOS\", \"memo\": \"transfer $I\" }" -p anton
executed transaction: a6b7d58438d482478f16f363c2cf25e8974ec4856082de8e20fcb2e53380d055  264 bytes  109568 cycles
#   eosio.token <= eosio.token::transfer        {"from":"anton","to":"anton","quantity":"7 EOS","memo":"transfer "}
>> transfer
#         anton <= eosio.token::transfer        {"from":"anton","to":"anton","quantity":"7 EOS","memo":"transfer "}
anton@ubuntu:~/eos/build$ cleos push action eosio.token transfer "{ \"from\": \"anton\", \"to\": \"anton\", \"quantity\": \"7.000 EOS\", \"memo\": \"transfer $I\" }" -p anton

transfer 7.01 EOS fails

cleos push action eosio.token transfer "{ \"from\": \"anton\", \"to\": \"anton\", \"quantity\": \"7.01 EOS\", \"memo\": \"transfer $I\" }" -p anton
Error 3030000: transaction validation exception
Ensure that your transaction satisfy the contract's constraint!
Error Details:
condition: assertion failed: unable to find key

transfer 7.0001 succeeds

cleos push action eosio.token transfer "{ \"from\": \"anton\", \"to\": \"anton\", \"quantity\": \"7.0001 EOS\", \"memo\": \"transfer $I\" }" -p anton
executed transaction: 75f003fb6047a047cf3db20e9a1de3f6fde0bbeea54ae13e2f20fcc7e0401ac0  264 bytes  109568 cycles
#   eosio.token <= eosio.token::transfer        {"from":"anton","to":"anton","quantity":"7.0001 EOS","memo":"transfer "}
>> transfer
#         anton <= eosio.token::transfer        {"from":"anton","to":"anton","quantity":"7.0001 EOS","memo":"transfer "}

moskvanaft avatar Apr 11 '18 15:04 moskvanaft

@moskvanaft this is fixed in #2291. But you need to use the same precision as when the token was created, otherwise transfer/issue will fail saying comparison of assets with different symbols is not allowed since precision is included in the token symbol.

elmato avatar Apr 12 '18 03:04 elmato

@elmato Yep, I checked this by creating a currency in whole numbers and another with 4 decimals spaces, both named "EOS". I then issued them to my account, and when I passed get currency token balance <my-account-name> I got something like: 1000000 EOS 1000000.0000 EOS

jchung00 avatar Apr 13 '18 02:04 jchung00