Skip to content

Commit

Permalink
Check for locked tokens existing on the system contract, not token co…
Browse files Browse the repository at this point in the history
…ntract.
  • Loading branch information
aaroncox committed Jan 31, 2025
1 parent c6cba2d commit 5b72cfa
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion contracts/api/src/api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ namespace api {

token_supply api::get_token_supply(const token_definition def)
{
config_table _config(get_self(), get_self().value);
auto config = _config.get_or_default();

token_supply ts = {
.def = def,
.locked = asset(0, def.symbol),
Expand All @@ -133,7 +136,7 @@ token_supply api::get_token_supply(const token_definition def)
ts.max = stats_itr->max_supply;
}

eosio::token::accounts _accounts(def.contract, def.contract.value);
eosio::token::accounts _accounts(def.contract, config.system_contract.value);
auto balance_itr = _accounts.find(def.symbol.code().raw());
if (balance_itr != _accounts.end()) {
ts.locked = balance_itr->balance;
Expand Down

0 comments on commit 5b72cfa

Please sign in to comment.