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 Answers 2

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.

5
  • 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
    Commented Dec 10, 2018 at 8:56
  • can you share exactly what you trying to do ?
    – Mr.Y
    Commented Dec 10, 2018 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
    Commented Dec 11, 2018 at 2:57
  • Have look at this it may helpful for you github.com/EOSIO/eos/issues/4360
    – Mr.Y
    Commented Dec 11, 2018 at 4:48
  • Anytime brother :)
    – Mr.Y
    Commented Dec 11, 2018 at 5:22

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.