1

Is there a way to access the balance(of EOS or any token for that matter) of a given account using smart contract in the new CDT?

Thank you

2

In latest token contracts to get balance you need to use a static function:

auto balance = eosio::token::get_balance(token_contract, token_holder_name, symbol_code);
1

try this command to get balance through cleos tool cleos get table eosio.token user accounts as shown in this snippet you can use your contract name instead of eosio.token and use user's account by replacing user in snippet to get your token balance.

  • thank you for your reply! I am aware of the cleos command, I was more interested in directly accessing the eosio.token balance through an external smart contract – junep89 Dec 10 '18 at 8:56
  • can you share exactly what you trying to do ? – Mr.Y Dec 10 '18 at 9:12
  • I am developing a smart-contract which returns EOS after a command. I wanted to check the balance for EOS to see if enough EOS is available to return – junep89 Dec 11 '18 at 2:57
  • Have look at this it may helpful for you github.com/EOSIO/eos/issues/4360 – Mr.Y Dec 11 '18 at 4:48
  • Anytime brother :) – Mr.Y Dec 11 '18 at 5:22

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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