Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/staking_vote_logic' into testnet
Browse files Browse the repository at this point in the history
  • Loading branch information
RootkitKiller committed Feb 22, 2020
2 parents aadc3d9 + 10dbfe9 commit 5761bdf
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
8 changes: 8 additions & 0 deletions libraries/app/database_api_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,14 @@ std::map<std::string, full_account> database_api_impl::get_full_accounts( const
{
acnt.cashback_balance = account->cashback_balance(_db);
}
if (account->contract_call_cashback_vb)
{
acnt.contract_call_cashback_balance = account->contract_call_cashback_balance(_db);
}
if (account->staking_cashback_vb)
{
acnt.staking_cashback_balance = account->staking_cashback_balance(_db);
}
// Add the account's proposals
const auto& proposal_idx = _db.get_index_type<proposal_index>();
const auto& pidx = dynamic_cast<const primary_index<proposal_index>&>(proposal_idx);
Expand Down
4 changes: 4 additions & 0 deletions libraries/app/include/graphene/app/full_account.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ namespace graphene { namespace app {
string lifetime_referrer_name;
vector<variant> votes;
optional<vesting_balance_object> cashback_balance;
optional<vesting_balance_object> contract_call_cashback_balance;
optional<vesting_balance_object> staking_cashback_balance;
vector<account_balance_object> balances;
vector<lock_balance_object> locked_balances;
vector<vesting_balance_object> vesting_balances;
Expand All @@ -61,6 +63,8 @@ FC_REFLECT( graphene::app::full_account,
(lifetime_referrer_name)
(votes)
(cashback_balance)
(contract_call_cashback_balance)
(staking_cashback_balance)
(balances)
(locked_balances)
(vesting_balances)
Expand Down
16 changes: 16 additions & 0 deletions libraries/chain/include/graphene/chain/account_object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,20 @@ namespace graphene { namespace chain {
return db.get(*cashback_vb);
}

template<typename DB>
const vesting_balance_object& contract_call_cashback_balance(const DB& db)const
{
FC_ASSERT(contract_call_cashback_vb);
return db.get(*contract_call_cashback_vb);
}

template<typename DB>
const vesting_balance_object& staking_cashback_balance(const DB& db)const
{
FC_ASSERT(staking_cashback_vb);
return db.get(*staking_cashback_vb);
}

/// @return true if this is a contract account; false otherwise.
bool is_contract_account()const
{
Expand Down Expand Up @@ -521,6 +535,8 @@ FC_REFLECT_DERIVED( graphene::chain::account_object,
(name)(vm_type)(vm_version)(code)(code_version)(abi)(owner)(active)(options)(statistics)(whitelisting_accounts)(blacklisting_accounts)
(whitelisted_accounts)(blacklisted_accounts)
(cashback_vb)
(contract_call_cashback_vb)
(staking_cashback_vb)
(owner_special_authority)(active_special_authority)
(top_n_control_flags)
(allowed_assets)
Expand Down

0 comments on commit 5761bdf

Please sign in to comment.