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

  • When do you see the odd output in comparison to the "normal" output? – Phillip Hamnett - EOS42 Jul 11 '19 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 – Phillip Hamnett - EOS42 Jul 11 '19 at 10:16
  • that was a typo in the post. the code has a comma – ekkis Jul 11 '19 at 19:45
  • Ah ok. What about using qty.symbol.code().to_string(), does that work? – Phillip Hamnett - EOS42 Jul 11 '19 at 20:54
  • that prints USD only – ekkis Jul 11 '19 at 23:07
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

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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