Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct accounts
- {
- eosio::asset balance;
- uint64_t primary_key() const {return balance.symbol.code().raw();}
- };
- eosio::multi_index< eosio::name("accounts"), accounts > accounts_table;
- accounts_table tmp(eosio::name("TOKEN_CONTRACT"), eosio::name("ACCOUNT_NAME"));
- eosio::symbol TOKEN_SYMBOL = whatever the token symbol is;
- auto itr = tmp.find(TOKEN_SYMBOL.code().raw());
- eosio::check(itr != tmp.end(), "The token doesn't exist in the token contract, or the account doesn't own any of these tokens");
- auto balance = itr->balance;
- eosio::print("My balance is ",balance);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement