BitShares-Core
7.0.2
BitShares blockchain node software and command-line wallet software
|
Go to the documentation of this file.
31 #include <boost/range/algorithm.hpp>
33 namespace graphene {
namespace chain {
37 auto&
index = get_index_type< primary_index< account_balance_index > >().get_secondary_index<balances_by_account_index>();
38 auto abo =
index.get_account_balance( owner, asset_id );
40 return asset(0, asset_id);
41 return abo->get_balance();
59 auto&
index = get_index_type< primary_index< account_balance_index > >().get_secondary_index<balances_by_account_index>();
60 auto abo =
index.get_account_balance( account, delta.
asset_id );
63 FC_ASSERT( delta.
amount > 0,
"Insufficient Balance: ${a}'s balance of ${b} is less than required ${r}",
64 (
"a",account(*this).name)
76 FC_ASSERT( abo->get_balance() >= -delta,
"Insufficient Balance: ${a}'s balance of ${b} is less than required ${r}",
116 auto& vesting_balances = get_index_type<vesting_balance_index>().indices().get<by_vesting_type>();
118 auto vbo_it = vesting_balances.find(key, key, key);
120 if( vbo_it == vesting_balances.end() )
122 return asset(0, asset_id);
124 return vbo_it->balance;
134 auto& vesting_balances = get_index_type<vesting_balance_index>().indices().get<by_vesting_type>();
136 auto vbo_it = vesting_balances.find(key, key, key);
140 if( vbo_it == vesting_balances.end() )
143 vbo.
owner = account_id;
158 share_type amount, uint32_t req_vesting_seconds,
160 account_id_type req_owner,
161 bool require_vesting )
176 if( require_vesting )
193 _vbo.
owner = req_owner;
210 account_id_type acct_id = acct.
get_id();
217 if( is_reserved_account )
234 if( new_vbid.
valid() )
242 aso.has_cashback_vb = true;
262 if( new_vbid.
valid() )
defines vesting in terms of coin-days accrued which allows for dynamic deposit/withdraw
#define FC_CAPTURE_AND_RETHROW(...)
fc::uint128_t coin_seconds_earned
#define GRAPHENE_RELAXED_COMMITTEE_ACCOUNT
Represents the current committee members.
time_point_sec head_block_time() const
asset get_balance(account_id_type owner, asset_id_type asset_id) const
Retrieve a particular account's balance in a given asset.
void adjust_balance(const asset &delta)
share_type current_supply
The number of shares currently in existence.
#define GRAPHENE_TEMP_ACCOUNT
Represents the canonical account with WILDCARD authority (anybody can access funds in temp account)
account_id_type witness_account
tracks the parameters of an asset
void adjust_balance(account_id_type account, asset delta)
Adjust a particular account's balance in a given asset by a delta.
Tracks the balance of a single account/asset pair.
optional< vesting_balance_id_type > pay_vb
void deposit_witness_pay(const witness_object &wit, share_type amount)
helper to handle witness pay
void deposit(const fc::time_point_sec &now, const asset &amount)
Deposit amount into vesting balance, requiring it to vest before withdrawal.
vesting_policy policy
The vesting policy stores details on when funds vest, and controls when they may be withdrawn.
bool operator()(const vbo_mfs_key &k, const vesting_balance_object &vbo) const
fc::time_point_sec coin_seconds_earned_last_update
tracks the asset information that changes frequently
const asset_dynamic_data_object & get_core_dynamic_data() const
This class represents an account on the object graph.
account_id_type account_id
vbo_mfs_key(const account_id_type &account, const asset_id_type &asset)
optional< vesting_balance_id_type > cashback_vb
string to_pretty_string(const asset &a) const
vesting_balance_type balance_type
type of the vesting balance
void deposit_market_fee_vesting_balance(const account_id_type &account_id, const asset &delta)
#define GRAPHENE_COMMITTEE_ACCOUNT
optional< vesting_balance_id_type > deposit_lazy_vesting(const optional< vesting_balance_id_type > &ovbid, share_type amount, uint32_t req_vesting_seconds, vesting_balance_type balance_type, account_id_type req_owner, bool require_vesting)
Helper to make lazy deposit to CDD VBO.
#define FC_ASSERT(TEST,...)
Checks a condition and throws an assert_exception if the test is FALSE.
asset get_market_fee_vesting_balance(const account_id_type &account_id, const asset_id_type &asset_id)
Retrieve a particular account's market fee vesting balance in a given asset.
uint64_t operator()(const vbo_mfs_key &k) const
#define GRAPHENE_WITNESS_ACCOUNT
Represents the current witnesses.
bool maintenance_flag
Whether need to process this balance object in maintenance interval.
void deposit_vested(const fc::time_point_sec &now, const asset &amount)
Deposit amount into vesting balance, making the new funds vest immediately.
void deposit_cashback(const account_object &acct, share_type amount, bool require_vesting=true)
helper to handle cashback rewards
account_statistics_id_type statistics
uint64_t vbo_mfs_hash(const account_id_type &account_id, const asset_id_type &asset_id)
#define GRAPHENE_NULL_ACCOUNT
Represents the canonical account with NO authority (nobody can access funds in null account)
object_id< SpaceID, TypeID > get_id() const
const global_property_object & get_global_properties() const
account_id_type owner
Account which owns and may withdraw from this vesting balance.
abstract base class for accessing objects indexed in various ways.
void modify(const T &obj, const Lambda &m)