2

I have a method like this:

void token::test(asset qty) {
    print("\n", qty);
    print("\n", qty.symbol);
}

and the output I get is something like this:

10.00000000 XXX

8,XXX3

why the 3? I have the value XXX stored in a table but the lookup fails because apparently it's looking for XXX3. what is wrong with this picture?

-- Edit I --

I also see odd output like:

10.00 TTX

2,TTX.00 TTX3

I don't understand what's going on???

-- Edit II --

this gets more bizarre. if I pass "10.00 USDC", I get back:

3,USDCu000b4

9
  • When do you see the odd output in comparison to the "normal" output? Commented Jul 11, 2019 at 10:15
  • Maybe try changing the second print statement to have a comma between the newline and the symbol too, see if its some kind of bug to do with that Commented Jul 11, 2019 at 10:16
  • that was a typo in the post. the code has a comma
    – ekkis
    Commented Jul 11, 2019 at 19:45
  • Ah ok. What about using qty.symbol.code().to_string(), does that work? Commented Jul 11, 2019 at 20:54
  • that prints USD only
    – ekkis
    Commented Jul 11, 2019 at 23:07

1 Answer 1

2

It's a bug. eosio::symbol::print needs to call eosio::printl, but calls eosio::print by mistake. The PR on following link fixes this:

https://github.com/EOSIO/eosio.cdt/pull/552

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.