Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. struct accounts
  2. {
  3. eosio::asset balance;
  4. uint64_t primary_key() const {return balance.symbol.code().raw();}
  5. };
  6. eosio::multi_index< eosio::name("accounts"), accounts > accounts_table;
  7.  
  8. accounts_table tmp(eosio::name("TOKEN_CONTRACT"), eosio::name("ACCOUNT_NAME"));
  9. eosio::symbol TOKEN_SYMBOL = whatever the token symbol is;
  10. auto itr = tmp.find(TOKEN_SYMBOL.code().raw());
  11. eosio::check(itr != tmp.end(), "The token doesn't exist in the token contract, or the account doesn't own any of these tokens");
  12. auto balance = itr->balance;
  13. eosio::print("My balance is ",balance);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement