Graphene::Chain

namespace chain

Typedefs

typedef multi_index_container<account_balance_object, indexed_by<ordered_unique<tag<by_id>, member<object, object_id_type, &object::id>>, ordered_non_unique<tag<by_maintenance_flag>, member<account_balance_object, bool, &account_balance_object::maintenance_flag>>, ordered_unique<tag<by_asset_balance>, composite_key<account_balance_object, member<account_balance_object, asset_id_type, &account_balance_object::asset_type>, member<account_balance_object, share_type, &account_balance_object::balance>, member<account_balance_object, account_id_type, &account_balance_object::owner>>, composite_key_compare<std::less<asset_id_type>, std::greater<share_type>, std::less<account_id_type>>>>> account_balance_object_multi_index_type
typedef generic_index<account_balance_object, account_balance_object_multi_index_type> account_balance_index
typedef multi_index_container<account_object, indexed_by<ordered_unique<tag<by_id>, member<object, object_id_type, &object::id>>, ordered_unique<tag<by_name>, member<account_object, string, &account_object::name>>>> account_multi_index_type
typedef generic_index<account_object, account_multi_index_type> account_index
typedef multi_index_container<account_statistics_object, indexed_by<ordered_unique<tag<by_id>, member<object, object_id_type, &object::id>>, ordered_unique<tag<by_owner>, member<account_statistics_object, account_id_type, &account_statistics_object::owner>>, ordered_unique<tag<by_maintenance_seq>, composite_key<account_statistics_object, const_mem_fun<account_statistics_object, bool, &account_statistics_object::need_maintenance>, member<account_statistics_object, string, &account_statistics_object::name>>>>> account_stats_multi_index_type
typedef generic_index<account_statistics_object, account_stats_multi_index_type> account_stats_index
typedef multi_index_container<asset_bitasset_data_object, indexed_by<ordered_unique<tag<by_id>, member<object, object_id_type, &object::id>>, ordered_non_unique<tag<by_short_backing_asset>, bitasset_short_backing_asset_extractor>, ordered_unique<tag<by_feed_expiration>, composite_key<asset_bitasset_data_object, const_mem_fun<asset_bitasset_data_object, time_point_sec, &asset_bitasset_data_object::feed_expiration_time>, member<asset_bitasset_data_object, asset_id_type, &asset_bitasset_data_object::asset_id>>>, ordered_non_unique<tag<by_cer_update>, const_mem_fun<asset_bitasset_data_object, bool, &asset_bitasset_data_object::need_to_update_cer>>>> asset_bitasset_data_object_multi_index_type
typedef generic_index<asset_bitasset_data_object, asset_bitasset_data_object_multi_index_type> asset_bitasset_data_index
typedef multi_index_container<asset_object, indexed_by<ordered_unique<tag<by_id>, member<object, object_id_type, &object::id>>, ordered_unique<tag<by_symbol>, member<asset_object, string, &asset_object::symbol>>, ordered_unique<tag<by_type>, composite_key<asset_object, const_mem_fun<asset_object, bool, &asset_object::is_market_issued>, member<object, object_id_type, &object::id>>>, ordered_unique<tag<by_issuer>, composite_key<asset_object, member<asset_object, account_id_type, &asset_object::issuer>, member<object, object_id_type, &object::id>>>>> asset_object_multi_index_type
typedef generic_index<asset_object, asset_object_multi_index_type> asset_index
using balance_multi_index_type = multi_index_container<balance_object, indexed_by<ordered_unique<tag<by_id>, member<object, object_id_type, &object::id>>, ordered_non_unique<tag<by_owner>, composite_key<balance_object, member<balance_object, address, &balance_object::owner>, const_mem_fun<balance_object, asset_id_type, &balance_object::asset_type>>>>>
using balance_index = generic_index<balance_object, balance_multi_index_type>
typedef multi_index_container<buyback_object, indexed_by<ordered_unique<tag<by_id>, member<object, object_id_type, &object::id>>, ordered_unique<tag<by_asset>, member<buyback_object, asset_id_type, &buyback_object::asset_to_buy>>>> buyback_multi_index_type
typedef generic_index<buyback_object, buyback_multi_index_type> buyback_index
using committee_member_multi_index_type = multi_index_container<committee_member_object, indexed_by<ordered_unique<tag<by_id>, member<object, object_id_type, &object::id>>, ordered_unique<tag<by_account>, member<committee_member_object, account_id_type, &committee_member_object::committee_member_account>>, ordered_unique<tag<by_vote_id>, member<committee_member_object, vote_id_type, &committee_member_object::vote_id>>>>
using committee_member_index = generic_index<committee_member_object, committee_member_multi_index_type>
typedef multi_index_container<blinded_balance_object, indexed_by<ordered_unique<tag<by_id>, member<object, object_id_type, &object::id>>, ordered_unique<tag<by_commitment>, member<blinded_balance_object, commitment_type, &blinded_balance_object::commitment>>>> blinded_balance_object_multi_index_type
typedef generic_index<blinded_balance_object, blinded_balance_object_multi_index_type> blinded_balance_index
typedef shared_ptr<fork_item> item_ptr
typedef multi_index_container<htlc_object, indexed_by<ordered_unique<tag<by_id>, member<object, object_id_type, &object::id>>, ordered_unique<tag<by_expiration>, composite_key<htlc_object, htlc_object::timelock_extractor, member<object, object_id_type, &object::id>>>, ordered_unique<tag<by_from_id>, composite_key<htlc_object, htlc_object::from_extractor, member<object, object_id_type, &object::id>>>, ordered_unique<tag<by_to_id>, composite_key<htlc_object, htlc_object::to_extractor, member<object, object_id_type, &object::id>>>>> htlc_object_index_type
typedef generic_index<htlc_object, htlc_object_index_type> htlc_index
typedef multi_index_container<limit_order_object, indexed_by<ordered_unique<tag<by_id>, member<object, object_id_type, &object::id>>, ordered_unique<tag<by_expiration>, composite_key<limit_order_object, member<limit_order_object, time_point_sec, &limit_order_object::expiration>, member<object, object_id_type, &object::id>>>, ordered_unique<tag<by_price>, composite_key<limit_order_object, member<limit_order_object, price, &limit_order_object::sell_price>, member<object, object_id_type, &object::id>>, composite_key_compare<std::greater<price>, std::less<object_id_type>>>, ordered_unique<tag<by_account>, composite_key<limit_order_object, member<limit_order_object, account_id_type, &limit_order_object::seller>, member<limit_order_object, price, &limit_order_object::sell_price>, member<object, object_id_type, &object::id>>, composite_key_compare<std::less<account_id_type>, std::greater<price>, std::less<object_id_type>>>>> limit_order_multi_index_type
typedef generic_index<limit_order_object, limit_order_multi_index_type> limit_order_index
typedef multi_index_container<call_order_object, indexed_by<ordered_unique<tag<by_id>, member<object, object_id_type, &object::id>>, ordered_unique<tag<by_price>, composite_key<call_order_object, member<call_order_object, price, &call_order_object::call_price>, member<object, object_id_type, &object::id>>, composite_key_compare<std::less<price>, std::less<object_id_type>>>, ordered_unique<tag<by_account>, composite_key<call_order_object, member<call_order_object, account_id_type, &call_order_object::borrower>, const_mem_fun<call_order_object, asset_id_type, &call_order_object::debt_type>>>, ordered_unique<tag<by_collateral>, composite_key<call_order_object, const_mem_fun<call_order_object, price, &call_order_object::collateralization>, member<object, object_id_type, &object::id>>>>> call_order_multi_index_type
typedef multi_index_container<force_settlement_object, indexed_by<ordered_unique<tag<by_id>, member<object, object_id_type, &object::id>>, ordered_unique<tag<by_account>, composite_key<force_settlement_object, member<force_settlement_object, account_id_type, &force_settlement_object::owner>, member<object, object_id_type, &object::id>>>, ordered_unique<tag<by_expiration>, composite_key<force_settlement_object, const_mem_fun<force_settlement_object, asset_id_type, &force_settlement_object::settlement_asset_id>, member<force_settlement_object, time_point_sec, &force_settlement_object::settlement_date>, member<object, object_id_type, &object::id>>>>> force_settlement_object_multi_index_type
typedef multi_index_container<collateral_bid_object, indexed_by<ordered_unique<tag<by_id>, member<object, object_id_type, &object::id>>, ordered_unique<tag<by_account>, composite_key<collateral_bid_object, const_mem_fun<collateral_bid_object, asset_id_type, &collateral_bid_object::debt_type>, member<collateral_bid_object, account_id_type, &collateral_bid_object::bidder>>>, ordered_unique<tag<by_price>, composite_key<collateral_bid_object, const_mem_fun<collateral_bid_object, asset_id_type, &collateral_bid_object::debt_type>, member<collateral_bid_object, price, &collateral_bid_object::inv_swan_price>, member<object, object_id_type, &object::id>>, composite_key_compare<std::less<asset_id_type>, std::greater<price>, std::less<object_id_type>>>>> collateral_bid_object_multi_index_type
typedef generic_index<call_order_object, call_order_multi_index_type> call_order_index
typedef generic_index<force_settlement_object, force_settlement_object_multi_index_type> force_settlement_index
typedef generic_index<collateral_bid_object, collateral_bid_object_multi_index_type> collateral_bid_index
typedef multi_index_container<operation_history_object, indexed_by<ordered_unique<tag<by_id>, member<object, object_id_type, &object::id>>>> operation_history_multi_index_type
typedef generic_index<operation_history_object, operation_history_multi_index_type> operation_history_index
typedef multi_index_container<account_transaction_history_object, indexed_by<ordered_unique<tag<by_id>, member<object, object_id_type, &object::id>>, ordered_unique<tag<by_seq>, composite_key<account_transaction_history_object, member<account_transaction_history_object, account_id_type, &account_transaction_history_object::account>, member<account_transaction_history_object, uint64_t, &account_transaction_history_object::sequence>>>, ordered_unique<tag<by_op>, composite_key<account_transaction_history_object, member<account_transaction_history_object, account_id_type, &account_transaction_history_object::account>, member<account_transaction_history_object, operation_history_id_type, &account_transaction_history_object::operation_id>>>, ordered_non_unique<tag<by_opid>, member<account_transaction_history_object, operation_history_id_type, &account_transaction_history_object::operation_id>>>> account_transaction_history_multi_index_type
typedef generic_index<account_transaction_history_object, account_transaction_history_multi_index_type> account_transaction_history_index
typedef boost::multi_index_container<proposal_object, indexed_by<ordered_unique<tag<by_id>, member<object, object_id_type, &object::id>>, ordered_unique<tag<by_expiration>, composite_key<proposal_object, member<proposal_object, time_point_sec, &proposal_object::expiration_time>, member<object, object_id_type, &object::id>>>>> proposal_multi_index_container
typedef generic_index<proposal_object, proposal_multi_index_container> proposal_index
typedef multi_index_container<special_authority_object, indexed_by<ordered_unique<tag<by_id>, member<object, object_id_type, &object::id>>, ordered_unique<tag<by_account>, member<special_authority_object, account_id_type, &special_authority_object::account>>>> special_authority_multi_index_type
typedef generic_index<special_authority_object, special_authority_multi_index_type> special_authority_index
typedef multi_index_container<transaction_history_object, indexed_by<ordered_unique<tag<by_id>, member<object, object_id_type, &object::id>>, hashed_unique<tag<by_trx_id>, BOOST_MULTI_INDEX_MEMBER(transaction_history_object, transaction_id_type, trx_id), std::hash<transaction_id_type>>, ordered_non_unique<tag<by_expiration>, const_mem_fun<transaction_history_object, time_point_sec, &transaction_history_object::get_expiration>>>> transaction_multi_index_type
typedef generic_index<transaction_history_object, transaction_multi_index_type> transaction_index
typedef fc::static_variant<linear_vesting_policy, cdd_vesting_policy, instant_vesting_policy> vesting_policy
typedef multi_index_container<vesting_balance_object, indexed_by<ordered_unique<tag<by_id>, member<object, object_id_type, &object::id>>, ordered_non_unique<tag<by_account>, member<vesting_balance_object, account_id_type, &vesting_balance_object::owner>>, hashed_unique<tag<by_vesting_type>, identity<vesting_balance_object>, detail::vesting_balance_object_hash, detail::vesting_balance_object_equal>>> vesting_balance_multi_index_type
typedef generic_index<vesting_balance_object, vesting_balance_multi_index_type> vesting_balance_index
typedef multi_index_container<withdraw_permission_object, indexed_by<ordered_unique<tag<by_id>, member<object, object_id_type, &object::id>>, ordered_unique<tag<by_from>, composite_key<withdraw_permission_object, member<withdraw_permission_object, account_id_type, &withdraw_permission_object::withdraw_from_account>, member<object, object_id_type, &object::id>>>, ordered_unique<tag<by_authorized>, composite_key<withdraw_permission_object, member<withdraw_permission_object, account_id_type, &withdraw_permission_object::authorized_account>, member<object, object_id_type, &object::id>>>, ordered_unique<tag<by_expiration>, composite_key<withdraw_permission_object, member<withdraw_permission_object, time_point_sec, &withdraw_permission_object::expiration>, member<object, object_id_type, &object::id>>>>> withdraw_permission_object_multi_index_type
typedef generic_index<withdraw_permission_object, withdraw_permission_object_multi_index_type> withdraw_permission_index
using witness_multi_index_type = multi_index_container<witness_object, indexed_by<ordered_unique<tag<by_id>, member<object, object_id_type, &object::id>>, ordered_unique<tag<by_account>, member<witness_object, account_id_type, &witness_object::witness_account>>, ordered_unique<tag<by_vote_id>, member<witness_object, vote_id_type, &witness_object::vote_id>>>>
using witness_index = generic_index<witness_object, witness_multi_index_type>
typedef static_variant<refund_worker_type, vesting_balance_worker_type, burn_worker_type> worker_type
typedef multi_index_container<worker_object, indexed_by<ordered_unique<tag<by_id>, member<object, object_id_type, &object::id>>, ordered_non_unique<tag<by_account>, member<worker_object, account_id_type, &worker_object::worker_account>>, ordered_unique<tag<by_vote_for>, member<worker_object, vote_id_type, &worker_object::vote_for>>, ordered_unique<tag<by_vote_against>, member<worker_object, vote_id_type, &worker_object::vote_against>>>> worker_object_multi_index_type
using worker_index = generic_index<worker_object, worker_object_multi_index_type>

Enums

enum graphene_fba_accumulator_id_enum

An object will be created at genesis for each of these FBA accumulators.

Values:

fba_accumulator_id_transfer_to_blind = 0
fba_accumulator_id_blind_transfer
fba_accumulator_id_transfer_from_blind
fba_accumulator_id_count
enum vesting_balance_type

Values:

unspecified
cashback
worker
witness
market_fee_sharing

Functions

void verify_authority_accounts(const database &db, const authority &a)
void verify_account_votes(const database &db, const account_options &options)
share_type cut_fee(share_type a, uint16_t p)
static void validate_new_issuer(const database &d, const asset_object &a, account_id_type new_issuer)
void check_children_of_bitasset(database &d, const asset_update_bitasset_operation &op, const asset_object &new_backing_asset, bool after_hf_922_931)
static bool update_bitasset_object_options(const asset_update_bitasset_operation &op, database &db, asset_bitasset_data_object &bdo, const asset_object &asset_to_update)
void evaluate_buyback_account_options(const database &db, const buyback_account_options &bbo)
void debug_apply_update(database &db, const fc::variant_object &vo)
template<typename Visitor>
void visit_special_authorities(const database &db, Visitor visit)
void update_top_n_authorities(database &db)
void split_fba_balance(database &db, uint64_t fba_id, uint16_t network_pct, uint16_t designated_asset_buyback_pct, uint16_t designated_asset_issuer_pct)
void distribute_fba_balances(database &db)
void create_buyback_orders(database &db)
void deprecate_annual_members(database &db)
void update_call_orders_hf_343(database &db)

Reset call_price of all call orders according to their remaining collateral and debt. Do not update orders of prediction markets because we’re sure they’re up to date.

void update_call_orders_hf_1270(database &db)

Reset call_price of all call orders to (1,1) since it won’t be used in the future. Update PMs as well.

void match_call_orders(database &db)

Match call orders for all bitAssets, including PMs.

void process_hf_1465(database &db)
void update_median_feeds(database &db)
void process_hf_868_890(database &db, bool skip_check_call_orders)
void process_hf_935(database &db)
bool maybe_cull_small_order(database &db, const limit_order_object &order)
GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS(transfer)
GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS(call_order_update)
GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS(account_create)
GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS(account_update)
GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS(asset_reserve)
GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS(proposal_create)
GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS(balance_claim)
GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS(override_transfer)
GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS(blind_transfer)
graphene::chain::GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION(unknown_commitment, blind_transfer, 1, "Attempting to claim an unknown prior commitment")
fc::variant_object get_config()
optional<htlc_options> get_committee_htlc_options(graphene::chain::database &db)
GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS(transfer)
GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS(call_order_update)
GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS(account_create)
GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS(account_update)
GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS(asset_reserve)
GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS(proposal_create)
GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS(balance_claim)
GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS(override_transfer)
GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS(blind_transfer)
graphene::chain::GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION(unknown_commitment, blind_transfer, 1, "Attempting to claim an unknown prior commitment")
void operation_get_impacted_accounts(const graphene::chain::operation &op, fc::flat_set<graphene::chain::account_id_type> &result)
void transaction_get_impacted_accounts(const graphene::chain::transaction &tx, fc::flat_set<graphene::chain::account_id_type> &result)
bool is_authorized_asset(const database &d, const account_object &acct, const asset_object &asset_obj)

Return

true if the account is whitelisted and not blacklisted to transact in the provided asset; false otherwise.

void evaluate_special_authority(const database &db, const special_authority &auth)
bool sum_below_max_shares(const asset &a, const asset &b)
VESTING_VISITOR(on_deposit)
VESTING_VISITOR(on_deposit_vested)
VESTING_VISITOR(on_withdraw)
graphene::chain::VESTING_VISITOR(is_deposit_allowed, const)
graphene::chain::VESTING_VISITOR(is_deposit_vested_allowed, const)
graphene::chain::VESTING_VISITOR(is_withdraw_allowed, const)
graphene::chain::VESTING_VISITOR(get_allowed_withdraw, const)

Variables

const uint32_t skip_expensive = database::skip_transaction_signatures | database::skip_witness_signature | database::skip_merkle_check | database::skip_transaction_dupe_check
class account_balance_object : public graphene::db::abstract_object<account_balance_object>
#include <account_object.hpp>

Tracks the balance of a single account/asset pair

This object is indexed on owner and asset_type so that black swan events in asset_type can be processed quickly.

Public Members

bool maintenance_flag = false

Whether need to process this balance object in maintenance interval.

class account_member_index : public secondary_index
#include <account_object.hpp>

This secondary index will allow a reverse lookup of all accounts that a particular key or account is an potential signing authority.

Public Members

map<account_id_type, set<account_id_type>> account_to_account_memberships

given an account or key, map it to the set of accounts that reference it in an active or owner authority

map<address, set<account_id_type>> account_to_address_memberships

some accounts use address authorities in the genesis block

class account_object : public graphene::db::abstract_object<account_object>
#include <account_object.hpp>

This class represents an account on the object graph

Accounts are the primary unit of authority on the graphene system. Users must have an account in order to use assets, trade in the markets, vote for committee_members, etc.

Unnamed Group

set<account_id_type> whitelisted_accounts

Optionally track all of the accounts this account has whitelisted or blacklisted, these should be made Immutable so that when the account object is cloned no deep copy is required. This state is tracked for GUI display purposes.

TODO: move white list tracking to its own multi-index container rather than having 4 fields on an account. This will scale better because under the current design if you whitelist 2000 accounts, then every time someone fetches this account object they will get the full list of 2000 accounts.

Public Functions

bool is_lifetime_member() const

Return

true if this is a lifetime member account; false otherwise.

bool is_basic_account(time_point_sec now) const

Return

true if this is a basic account; false otherwise.

bool is_annual_member(time_point_sec now) const

Return

true if the account is an unexpired annual member; false otherwise.

Note

This method will return false for lifetime members.

bool is_member(time_point_sec now) const

Return

true if the account is an annual or lifetime member; false otherwise.

Public Members

time_point_sec membership_expiration_date

The time at which this account’s membership expires. If set to any time in the past, the account is a basic account. If set to time_point_sec::maximum(), the account is a lifetime member. If set to any time not in the past less than time_point_sec::maximum(), the account is an annual member.

See is_lifetime_member, is_basic_account, is_annual_member, and is_member

account_id_type registrar

The account that paid the fee to register this account. Receives a percentage of referral rewards.

account_id_type referrer

The account credited as referring this account. Receives a percentage of referral rewards.

account_id_type lifetime_referrer

The lifetime member at the top of the referral tree. Receives a percentage of referral rewards.

uint16_t network_fee_percentage = GRAPHENE_DEFAULT_NETWORK_PERCENT_OF_FEE

Percentage of fee which should go to network.

uint16_t lifetime_referrer_fee_percentage = 0

Percentage of fee which should go to lifetime referrer.

uint16_t referrer_rewards_percentage = 0

Percentage of referral rewards (leftover fee after paying network and lifetime referrer) which should go to referrer. The remainder of referral rewards goes to the registrar.

string name

The account’s name. This name must be unique among all account names on the graph. May not be empty.

authority owner

The owner authority represents absolute control over the account. Usually the keys in this authority will be kept in cold storage, as they should not be needed very often and compromise of these keys constitutes complete and irrevocable loss of the account. Generally the only time the owner authority is required is to update the active authority.

authority active

The owner authority contains the hot keys of the account. This authority has control over nearly all operations the account may perform.

account_statistics_id_type statistics

The reference implementation records the account’s statistics in a separate object. This field contains the ID of that object.

flat_set<account_id_type> whitelisting_accounts

This is a set of all accounts which have ‘whitelisted’ this account. Whitelisting is only used in core validation for the purpose of authorizing accounts to hold and transact in whitelisted assets. This account cannot update this set, except by transferring ownership of the account, which will clear it. Other accounts may add or remove their IDs from this set.

flat_set<account_id_type> blacklisting_accounts

This is a set of all accounts which have ‘blacklisted’ this account. Blacklisting is only used in core validation for the purpose of forbidding accounts from holding and transacting in whitelisted assets. This account cannot update this set, and it will be preserved even if the account is transferred. Other accounts may add or remove their IDs from this set.

optional<vesting_balance_id_type> cashback_vb

Vesting balance which receives cashback_reward deposits.

uint8_t top_n_control_flags = 0

This flag is set when the top_n logic sets both authorities, and gets reset when authority or special_authority is set.

optional<flat_set<asset_id_type>> allowed_assets

This is a set of assets which the account is allowed to have. This is utilized to restrict buyback accounts to the assets that trade in their markets. In the future we may expand this to allow accounts to e.g. voluntarily restrict incoming transfers.

class account_referrer_index : public secondary_index
#include <account_object.hpp>

This secondary index will allow a reverse lookup of all accounts that have been referred by a particular account.

Public Members

map<account_id_type, set<account_id_type>> referred_by

maps the referrer to the set of accounts that they have referred

class account_statistics_object : public graphene::db::abstract_object<account_statistics_object>
#include <account_object.hpp>

This object contains regularly updated statistical data about an account. It is provided for the purpose of separating the account data that changes frequently from the account data that is mostly static, which will minimize the amount of data that must be backed up as part of the undo history everytime a transfer is made.

Public Functions

bool has_some_core_voting() const

Whether this account owns some CORE asset and is voting.

bool has_pending_fees() const

Whether this account has pending fees, no matter vested or not.

bool need_maintenance() const

Whether need to process this account during the maintenance interval.

void process_fees(const account_object &a, database &d) const

Split up and pay out pending_fees and pending_vested_fees.

void pay_fee(share_type core_fee, share_type cashback_vesting_threshold)

Core fees are paid into the account_statistics_object by this method

Public Members

string name

redundantly store account name here for better maintenance performance

account_transaction_history_id_type most_recent_op

Keep the most recent operation as a root pointer to a linked list of the transaction history.

uint64_t total_ops = 0

Total operations related to this account.

uint64_t removed_ops = 0

Total operations related to this account that has been removed from the database.

share_type total_core_in_orders

When calculating votes it is necessary to know how much is stored in orders (and thus unavailable for transfers). Rather than maintaining an index of [asset,owner,order_id] we will simply maintain the running total here and update it every time an order is created or modified.

share_type core_in_balance = 0

redundantly store core balance here for better maintenance performance

bool has_cashback_vb = false

redundantly store this for better maintenance performance

bool is_voting = false

redundately store whether this account is voting for better maintenance performance

share_type lifetime_fees_paid

Tracks the total fees paid by this account for the purpose of calculating bulk discounts.

share_type pending_fees

Tracks the fees paid by this account which have not been disseminated to the various parties that receive them yet (registrar, referrer, lifetime referrer, network, etc). This is used as an optimization to avoid doing massive amounts of uint128 arithmetic on each and every operation.

These fees will be paid out as vesting cash-back, and this counter will reset during the maintenance interval.

share_type pending_vested_fees

Same as pending_fees, except these fees will be paid out as pre-vested cash-back (immediately available for withdrawal) rather than requiring the normal vesting period.

class account_transaction_history_object : public graphene::db::abstract_object<account_transaction_history_object>
#include <operation_history_object.hpp>

a node in a linked list of operation_history_objects

Account history is important for users and wallets even though it is not part of “core validation”. Account history is maintained as a linked list stored on disk in a stack. Each account will point to the most recent account history object by ID. When a new operation relativent to that account is processed a new account history object is allcoated at the end of the stack and intialized to point to the prior object.

This data is never accessed as part of chain validation and therefore can be kept on disk as a memory mapped file. Using a memory mapped file will help the operating system better manage / cache / page files and also accelerates load time.

When the transaction history for a particular account is requested the linked list can be traversed with relatively effecient disk access because of the use of a memory mapped stack.

Public Members

operation_history_id_type operation_id

the account this operation applies to

account_transaction_history_id_type next

the operation position within the given account

class asset_bitasset_data_object : public graphene::db::abstract_object<asset_bitasset_data_object>
#include <asset_object.hpp>

contains properties that only apply to bitassets (market issued assets)

Unnamed Group

price settlement_price

In the event of a black swan, the swan price is saved in the settlement price, and all margin positions are settled at the same price with the siezed collateral being moved into the settlement fund. From this point on no further updates to the asset are permitted (no feeds, etc) and forced settlement occurs immediately when requested, using the settlement price and fund. Price at which force settlements of a black swanned asset will occur

share_type settlement_fund

Amount of collateral which is available for force settlement.

Public Functions

share_type max_force_settlement_volume(share_type current_supply) const

Calculate the maximum force settlement volume per maintenance interval, given the current share supply.

bool has_settlement() const

return true if there has been a black swan, false otherwise

bool need_to_update_cer() const

Whether need to update core_exchange_rate in asset_object.

time_point_sec feed_expiration_time() const

The time when current_feed would expire.

Public Members

asset_id_type asset_id

The asset this object belong to.

bitasset_options options

The tunable options for BitAssets are stored in this field.

flat_map<account_id_type, pair<time_point_sec, price_feed>> feeds

Feeds published for this asset. If issuer is not committee, the keys in this map are the feed publishing accounts; otherwise, the feed publishers are the currently active committee_members and witnesses and this map should be treated as an implementation detail. The timestamp on each feed is the time it was published.

price_feed current_feed

This is the currently active price feed, calculated as the median of values from the currently active feeds.

time_point_sec current_feed_publication_time

This is the publication time of the oldest feed which was factored into current_feed.

price current_maintenance_collateralization

Call orders with collateralization (aka collateral/debt) not greater than this value are in margin call territory. This value is derived from current_feed for better performance and should be kept consistent.

bool is_prediction_market = false

True if this asset implements a Prediction Market.

share_type force_settled_volume

This is the volume of this asset which has been force-settled this maintanence interval.

bool asset_cer_updated = false

Track whether core_exchange_rate in corresponding asset_object has updated.

bool feed_cer_updated = false

Track whether core exchange rate in current feed has updated.

class asset_create_evaluator : public graphene::chain::evaluator<asset_create_evaluator>
#include <asset_evaluator.hpp>

Public Functions

void pay_fee()

override the default behavior defined by generic_evalautor which is to post the fee to fee_paying_account_stats.pending_fees

class asset_dynamic_data_object : public graphene::db::abstract_object<asset_dynamic_data_object>
#include <asset_object.hpp>

tracks the asset information that changes frequently

Because the asset_object is very large it doesn’t make sense to save an undo state for all of the parameters that never change. This object factors out the parameters of an asset that change in almost every transaction that involves the asset.

This object exists as an implementation detail and its ID should never be referenced by a blockchain operation.

Public Members

share_type current_supply

The number of shares currently in existence.

share_type confidential_supply

total asset held in confidential balances

share_type accumulated_fees

fees accumulate to be paid out over time

share_type fee_pool

in core asset

class asset_object : public graphene::db::abstract_object<asset_object>
#include <asset_object.hpp>

tracks the parameters of an asset

All assets have a globally unique symbol name that controls how they are traded and an issuer who has authority over the parameters of the asset.

Public Functions

bool is_market_issued() const

Return

true if this is a market-issued asset; false otherwise.

bool can_force_settle() const

Return

true if users may request force-settlement of this market-issued asset; false otherwise

bool can_global_settle() const

Return

true if the issuer of this market-issued asset may globally settle the asset; false otherwise

bool charges_market_fees() const

Return

true if this asset charges a fee for the issuer on market operations; false otherwise

bool is_transfer_restricted() const

Return

true if this asset may only be transferred to/from the issuer or market orders

asset amount(share_type a) const

Helper function to get an asset object with the given amount in this asset’s type.

asset amount_from_string(string amount_string) const

Convert a string amount (i.e. “123.45”) to an asset object with this asset’s type The string may have a decimal and/or a negative sign.

string amount_to_string(share_type amount) const

Convert an asset to a textual representation, i.e. “123.45”.

string amount_to_string(const asset &amount) const

Convert an asset to a textual representation, i.e. “123.45”.

string amount_to_pretty_string(share_type amount) const

Convert an asset to a textual representation with symbol, i.e. “123.45 USD”.

string amount_to_pretty_string(const asset &amount) const

Convert an asset to a textual representation with symbol, i.e. “123.45 USD”.

template<class DB>
share_type reserved(const DB &db) const

The total amount of an asset that is reserved for future issuance.

Public Members

string symbol

Ticker symbol for this asset, i.e. “USD”.

uint8_t precision = 0

Maximum number of digits after the decimal point (must be <= 12)

account_id_type issuer

ID of the account which issued this asset.

asset_dynamic_data_id_type dynamic_asset_data_id

Current supply, fee pool, and collected fees are stored in a separate object as they change frequently.

optional<asset_bitasset_data_id_type> bitasset_data_id

Extra data associated with BitAssets. This field is non-null if and only if is_market_issued() returns true.

Public Static Functions

static bool is_valid_symbol(const string &symbol)

This function does not check if any registered asset has this symbol or not; it simply checks whether the symbol would be valid.

Return

true if symbol is a valid ticker symbol; false otherwise.

class balance_claim_evaluator : public graphene::chain::evaluator<balance_claim_evaluator>
#include <balance_evaluator.hpp>

Public Functions

void_result do_apply(const balance_claim_operation &op)

Note

the fee is always 0 for this particular operation because once the balance is claimed it frees up memory and it cannot be used to spam the network

class balances_by_account_index : public secondary_index
#include <account_object.hpp>

This secondary index will allow fast access to the balance objects that belonging to an account.

class blind_transfer_evaluator : public graphene::chain::evaluator<blind_transfer_evaluator>
#include <confidential_evaluator.hpp>

Public Functions

void pay_fee()

Routes the fee to where it needs to go. The default implementation routes the fee to the account_statistics_object of the fee_paying_account.

Before pay_fee() is called, the fee is computed by prepare_fee() and has been moved out of the fee_paying_account and (if paid in a non-CORE asset) converted by the asset’s fee pool.

Therefore, when pay_fee() is called, the fee only exists in this->core_fee_paid. So pay_fee() need only increment the receiving balance.

The default implementation simply calls account_statistics_object->pay_fee() to increment pending_fees or pending_vested_fees.

class blinded_balance_object : public graphene::db::abstract_object<blinded_balance_object>
#include <confidential_object.hpp>

tracks a blinded balance commitment

class block_summary_object : public graphene::db::abstract_object<block_summary_object>
#include <block_summary_object.hpp>

tracks minimal information about past blocks to implement TaPOS

When attempting to calculate the validity of a transaction we need to lookup a past block and check its block hash and the time it occurred so we can calculate whether the current transaction is valid and at what time it should expire.

struct burn_worker_type
#include <worker_object.hpp>

A worker who permanently destroys all of his pay.

This worker sends all pay he receives to the null account.

Public Members

share_type total_burned

Record of how much this worker has burned in his lifetime.

class buyback_object : public graphene::db::abstract_object<buyback_object>
#include <buyback_object.hpp>

buyback_authority_object only exists to help with a specific indexing problem. We want to be able to iterate over all assets that have a buyback program. However, assets which have a buyback program are very rare. So rather than indexing asset_object by the buyback field (requiring additional bookkeeping for every asset), we instead maintain a buyback_object pointing to each asset which has buyback (requiring additional bookkeeping only for every asset which has buyback).

This class is an implementation detail.

class call_order_object : public graphene::db::abstract_object<call_order_object>
#include <market_object.hpp>

tracks debt and call price information

There should only be one call_order_object per asset pair per account and they will all have the same call price.

Public Functions

share_type get_max_debt_to_cover(price match_price, price feed_price, const uint16_t maintenance_collateral_ratio, const optional<price> &maintenance_collateralization = optional<price>()) const

Calculate maximum quantity of debt to cover to satisfy target_collateral_ratio.

Return

maximum amount of debt that can be called

Parameters
  • match_price: the matching price if this call order is margin called

  • feed_price: median settlement price of debt asset

  • maintenance_collateral_ratio: median maintenance collateral ratio of debt asset

  • maintenance_collateralization: maintenance collateralization of debt asset, should only be valid after core-1270 hard fork

Public Members

share_type collateral

call_price.base.asset_id, access via get_collateral

share_type debt

call_price.quote.asset_id, access via get_debt

price call_price

Collateral / Debt.

optional<uint16_t> target_collateral_ratio

maximum CR to maintain when selling collateral on margin call

struct cdd_vesting_policy
#include <vesting_balance_object.hpp>

defines vesting in terms of coin-days accrued which allows for dynamic deposit/withdraw

The economic effect of this vesting policy is to require a certain amount of “interest” to accrue before the full balance may be withdrawn. Interest accrues as coindays (balance * length held). If some of the balance is withdrawn, the remaining balance must be held longer.

Public Functions

fc::uint128_t compute_coin_seconds_earned(const vesting_policy_context &ctx) const

Compute coin_seconds_earned. Used to non-destructively figure out how many coin seconds are available.

void update_coin_seconds_earned(const vesting_policy_context &ctx)

Update coin_seconds_earned and coin_seconds_earned_last_update fields; called by both on_deposit() and on_withdraw().

Public Members

fc::time_point_sec start_claim

while coindays may accrue over time, none may be claimed before first_claim date

class chain_property_object : public graphene::db::abstract_object<chain_property_object>
#include <chain_property_object.hpp>

Contains invariants which are set at genesis and never changed.

class collateral_bid_object : public graphene::db::abstract_object<collateral_bid_object>
#include <market_object.hpp>

bids of collateral for debt after a black swan

There should only be one collateral_bid_object per asset per account, and only for smartcoin assets that have a global settlement_price.

class committee_member_object : public graphene::db::abstract_object<committee_member_object>
#include <committee_member_object.hpp>

tracks information about a committee_member account.

A committee_member is responsible for setting blockchain parameters and has dynamic multi-sig control over the committee account. The current set of active committee_members has control.

committee_members were separated into a separate object to make iterating over the set of committee_member easy.

class database : public object_database
#include <database.hpp>

tracks the blockchain state in an extensible manner

Unnamed Group

void globally_settle_asset(const asset_object &bitasset, const price &settle_price)

Market Helpers

All margin positions are force closed at the swan price Collateral received goes into a force-settlement fund No new margin positions can be created for this asset Force settlement happens without delay at the swan price, deducting from force-settlement fund No more asset updates may be issued.

bool apply_order_before_hardfork_625(const limit_order_object &new_order_object, bool allow_black_swan = true)

Process a new limit order through the markets.

This function takes a new limit order, and runs the markets attempting to match it with existing orders already on the books.

Return

true if order was completely filled; false otherwise

Parameters
  • order: The new order to process

Unnamed Group

int match(const limit_order_object &taker, const limit_order_object &maker, const price &trade_price)

Matches the two orders, the first parameter is taker, the second is maker.

0 - no orders were matched 1 - taker was filled 2 - maker was filled 3 - both were filled

Return

a bit field indicating which orders were filled (and thus removed)

Unnamed Group

std::deque<precomputable_transaction> _popped_tx

when popping a block, the transactions that were removed get cached here so they can be reapplied at the proper time

processed_transaction validate_transaction(const signed_transaction &trx)

This method validates transactions without adding it to the pending state.

Return

true if the transaction would validate

Public Functions

void open(const fc::path &data_dir, std::function<genesis_state_type()> genesis_loaderconst std::string &db_version, )

Open a database, creating a new one if necessary.

Opens a database in the specified directory. If no initialized database is found, genesis_loader is called and its return value is used as the genesis state when initializing the new database

genesis_loader will not be called if an existing database is found.

Parameters
  • data_dir: Path to open or create database in

  • genesis_loader: A callable object which returns the genesis state to initialize new databases on

  • db_version: a version string that changes when the internal database format and/or logic is modified

void reindex(fc::path data_dir)

Rebuild object graph from block history and open detabase.

This method may be called after or instead of database::open, and will rebuild the object graph by replaying blockchain history. When this method exits successfully, the database will be open.

void wipe(const fc::path &data_dir, bool include_blocks)

wipe Delete database from disk, and potentially the raw chain as well.

Will close the database before wiping. Database will be closed when this function returns.

Parameters
  • include_blocks: If true, delete the raw chain as well as the database.

bool is_known_block(const block_id_type &id) const

Return

true if the block is in our fork DB or saved to disk as part of the official chain, otherwise return false

bool is_known_transaction(const transaction_id_type &id) const

Only return true if the transaction has not expired or been invalidated. If this method is called with a VERY old transaction we will return false, they should query things by blocks if they are that old.

uint32_t witness_participation_rate() const

Calculate the percent of block production slots that were missed in the past 128 blocks, not including the current block.

bool push_block(const signed_block &b, uint32_t skip = skip_nothing)

Push block “may fail” in which case every partial change is unwound. After push block is successful the block is appended to the chain database on disk.

Return

true if we switched forks as a result of this push.

processed_transaction push_transaction(const precomputable_transaction &trx, uint32_t skip = skip_nothing)

Attempts to push the transaction into the pending queue

When called to push a locally generated transaction, set the skip_block_size_check bit on the skip argument. This will allow the transaction to be pushed even if it causes the pending block size to exceed the maximum block size. Although the transaction will probably not propagate further now, as the peers are likely to have their pending queues full as well, it will be kept in the queue to be propagated later when a new block flushes out the pending queues.

processed_transaction push_proposal(const proposal_object &proposal)

Exceptions
  • fc::exception: if the proposed transaction fails to apply.

void pop_block()

Removes the most recent block from the database and undoes any changes it made.

uint32_t push_applied_operation(const operation &op)

This method is used to track appied operations during the evaluation of a block, these operations should include any operation actually included in a transaction as well as any implied/virtual operations that resulted, such as filling an order. The applied operations is cleared after applying each block and calling the block observers which may want to index these operations.

Return

the op_id which can be used to set the result after it has finished being applied.

witness_id_type get_scheduled_witness(uint32_t slot_num) const

Get the witness scheduled for block production in a slot.

slot_num always corresponds to a time in the future.

If slot_num == 1, returns the next scheduled witness. If slot_num == 2, returns the next scheduled witness after 1 block gap.

Use the get_slot_time() and get_slot_at_time() functions to convert between slot_num and timestamp.

Passing slot_num == 0 returns GRAPHENE_NULL_WITNESS

fc::time_point_sec get_slot_time(uint32_t slot_num) const

Get the time at which the given slot occurs.

If slot_num == 0, return time_point_sec().

If slot_num == N for N > 0, return the Nth next block-interval-aligned time greater than head_block_time().

uint32_t get_slot_at_time(fc::time_point_sec when) const

Get the last slot which occurs AT or BEFORE the given time.

The return value is the greatest value N such that get_slot_time( N ) <= when.

If no such N exists, return 0.

void initialize_indexes()

Reset the object graph in-memory.

asset get_balance(account_id_type owner, asset_id_type asset_id) const

Retrieve a particular account’s balance in a given asset.

Return

owner’s balance in asset

Parameters
  • owner: Account whose balance should be retrieved

  • asset_id: ID of the asset to get balance in

asset get_balance(const account_object &owner, const asset_object &asset_obj) const

This is an overloaded method.

void adjust_balance(account_id_type account, asset delta)

Adjust a particular account’s balance in a given asset by a delta.

Parameters
  • account: ID of account whose balance should be adjusted

  • delta: Asset ID and amount to adjust balance by

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.

Return

owner’s balance in asset

Parameters
  • owner: Account whose balance should be retrieved

  • asset_id: ID of the asset to get balance in

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.

If the given optional VBID is not valid(), or it does not have a CDD vesting policy, or the owner / vesting_seconds of the policy does not match the parameter, then credit amount to newly created VBID and return it.

Otherwise, credit amount to ovbid.

Return

ID of newly created VBO, but only if VBO was created.

void debug_dump()

This method dumps the state of the blockchain in a semi-human readable form for the purpose of tracking down funds and mismatches in currency allocation

asset match(const call_order_object &call, const force_settlement_object &settle, const price &match_price, asset max_settlement, const price &fill_price)

Matches the two orders, the first parameter is taker, the second is maker.

Return

the amount of asset settled

bool fill_limit_order(const limit_order_object &order, const asset &pays, const asset &receives, bool cull_if_small, const price &fill_price, const bool is_maker)

Return

true if the order was completely filled and thus freed.

bool check_call_orders(const asset_object &mia, bool enable_black_swan = true, bool for_new_limit_order = false, const asset_bitasset_data_object *bitasset_ptr = nullptr)

Starting with the least collateralized orders, fill them if their call price is above the max(lowest bid,call_limit).

This method will return true if it filled a short or limit

Return

true if a margin call was executed.

Parameters
  • mia: - the market issued asset that should be called.

  • enable_black_swan: - when adjusting collateral, triggering a black swan is invalid and will throw if enable_black_swan is not set to true.

  • for_new_limit_order: - true if this function is called when matching call orders with a new limit order

  • bitasset_ptr: - an optional pointer to the bitasset_data object of the asset

void enable_standby_votes_tracking(bool enable)

Enable or disable tracking of votes of standby witnesses and committee members.

fc::future<void> precompute_parallel(const signed_block &block, const uint32_t skip = skip_nothing) const

Precomputes digests, signatures and operation validations depending on skip flags. “Expensive” computations may be done in a parallel thread.

Return

a future that will resolve to the input block with precomputations applied

Parameters
  • block: the block to preprocess

  • skip: indicates which computations can be skipped

fc::future<void> precompute_parallel(const precomputable_transaction &trx) const

Precomputes digests, signatures and operation validations. “Expensive” computations may be done in a parallel thread.

Return

a future that will resolve to the input transaction with precomputations applied

Parameters
  • trx: the transaction to preprocess

Public Members

fc::signal<void(const signed_block&)> applied_block

This signal is emitted after all operations and virtual operation for a block have been applied but before the get_applied_operations() are cleared.

You may not yield from this callback because the blockchain is holding the write lock and may be in an “inconstant state” until after it is released.

fc::signal<void(const signed_transaction&)> on_pending_transaction

This signal is emitted any time a new transaction is added to the pending block state.

fc::signal<void(const vector<object_id_type>&, const flat_set<account_id_type>&)> new_objects

Emitted After a block has been applied and committed. The callback should not yield and should execute quickly.

fc::signal<void(const vector<object_id_type>&, const flat_set<account_id_type>&)> changed_objects

Emitted After a block has been applied and committed. The callback should not yield and should execute quickly.

fc::signal<void(const vector<object_id_type>&, const vector<const object *>&, const flat_set<account_id_type>&)> removed_objects

this signal is emitted any time an object is removed and contains a pointer to the last value of every object that was removed.

class dynamic_global_property_object : public graphene::db::abstract_object<dynamic_global_property_object>
#include <global_property_object.hpp>

Maintains global state information (committee_member list, current fees)

This is an implementation detail. The values here are calculated during normal chain operations and reflect the current values of global blockchain properties.

Public Members

uint32_t recently_missed_count = 0

Every time a block is missed this increases by RECENTLY_MISSED_COUNT_INCREMENT, every time a block is found it decreases by RECENTLY_MISSED_COUNT_DECREMENT. It is never less than 0.

If the recently_missed_count hits 2*UNDO_HISTORY then no new blocks may be pushed.

uint64_t current_aslot = 0

The current absolute slot number. Equal to the total number of slots since genesis. Also equal to the total number of missed slots plus head_block_number.

fc::uint128_t recent_slots_filled

used to compute witness participation.

uint32_t dynamic_flags = 0

dynamic_flags specifies chain state properties that can be expressed in one bit.

template<typename DerivedEvaluator>
class evaluator : public graphene::chain::generic_evaluator
#include <evaluator.hpp>

Public Functions

virtual operation_result evaluate(const operation &op)

Note

derived classes should ASSUME that the default validation that is indepenent of chain state should be performed by op.validate() and should not perform these extra checks.

class fba_accumulator_object : public graphene::db::abstract_object<fba_accumulator_object>
#include <fba_object.hpp>

fba_accumulator_object accumulates fees to be paid out via buyback or other FBA mechanism.

class force_settlement_object : public graphene::db::abstract_object<force_settlement_object>
#include <market_object.hpp>

tracks bitassets scheduled for force settlement at some point in the future.

On the settlement_date the balance will be converted to the collateral asset and paid to owner and then this object will be deleted.

class fork_database
#include <fork_database.hpp>

As long as blocks are pushed in order the fork database will maintain a linked tree of all blocks that branch from the start_block. The tree will have a maximum depth of 1024 blocks after which the database will start lopping off forks.

Every time a block is pushed into the fork DB the block with the highest block_num will be returned.

Public Functions

shared_ptr<fork_item> push_block(const signed_block &b)

Pushes the block into the fork database

Return

the new head block ( the longest fork )

pair<fork_database::branch_type, fork_database::branch_type> fetch_branch_from(block_id_type first, block_id_type second) const

Given two head blocks, return two branches of the fork graph that end with a common ancestor (same prior block)

Public Static Attributes

const int MAX_BLOCK_REORDERING = 1024

The maximum number of blocks that may be skipped in an out-of-order push.

class generic_evaluator
#include <evaluator.hpp>

Subclassed by graphene::chain::evaluator< account_create_evaluator >, graphene::chain::evaluator< account_update_evaluator >, graphene::chain::evaluator< account_upgrade_evaluator >, graphene::chain::evaluator< account_whitelist_evaluator >, graphene::chain::evaluator< assert_evaluator >, graphene::chain::evaluator< asset_claim_fees_evaluator >, graphene::chain::evaluator< asset_claim_pool_evaluator >, graphene::chain::evaluator< asset_create_evaluator >, graphene::chain::evaluator< asset_fund_fee_pool_evaluator >, graphene::chain::evaluator< asset_global_settle_evaluator >, graphene::chain::evaluator< asset_issue_evaluator >, graphene::chain::evaluator< asset_publish_feeds_evaluator >, graphene::chain::evaluator< asset_reserve_evaluator >, graphene::chain::evaluator< asset_settle_evaluator >, graphene::chain::evaluator< asset_update_bitasset_evaluator >, graphene::chain::evaluator< asset_update_evaluator >, graphene::chain::evaluator< asset_update_feed_producers_evaluator >, graphene::chain::evaluator< asset_update_issuer_evaluator >, graphene::chain::evaluator< balance_claim_evaluator >, graphene::chain::evaluator< bid_collateral_evaluator >, graphene::chain::evaluator< blind_transfer_evaluator >, graphene::chain::evaluator< call_order_update_evaluator >, graphene::chain::evaluator< committee_member_create_evaluator >, graphene::chain::evaluator< committee_member_update_evaluator >, graphene::chain::evaluator< committee_member_update_global_parameters_evaluator >, graphene::chain::evaluator< custom_evaluator >, graphene::chain::evaluator< htlc_create_evaluator >, graphene::chain::evaluator< htlc_extend_evaluator >, graphene::chain::evaluator< htlc_redeem_evaluator >, graphene::chain::evaluator< limit_order_cancel_evaluator >, graphene::chain::evaluator< limit_order_create_evaluator >, graphene::chain::evaluator< override_transfer_evaluator >, graphene::chain::evaluator< proposal_create_evaluator >, graphene::chain::evaluator< proposal_delete_evaluator >, graphene::chain::evaluator< proposal_update_evaluator >, graphene::chain::evaluator< transfer_evaluator >, graphene::chain::evaluator< transfer_from_blind_evaluator >, graphene::chain::evaluator< transfer_to_blind_evaluator >, graphene::chain::evaluator< vesting_balance_create_evaluator >, graphene::chain::evaluator< vesting_balance_withdraw_evaluator >, graphene::chain::evaluator< withdraw_permission_claim_evaluator >, graphene::chain::evaluator< withdraw_permission_create_evaluator >, graphene::chain::evaluator< withdraw_permission_delete_evaluator >, graphene::chain::evaluator< withdraw_permission_update_evaluator >, graphene::chain::evaluator< witness_create_evaluator >, graphene::chain::evaluator< witness_update_evaluator >, graphene::chain::evaluator< worker_create_evaluator >, graphene::chain::evaluator< DerivedEvaluator >

Public Functions

virtual operation_result evaluate(const operation &op) = 0

Note

derived classes should ASSUME that the default validation that is indepenent of chain state should be performed by op.validate() and should not perform these extra checks.

void pay_fee()

Routes the fee to where it needs to go. The default implementation routes the fee to the account_statistics_object of the fee_paying_account.

Before pay_fee() is called, the fee is computed by prepare_fee() and has been moved out of the fee_paying_account and (if paid in a non-CORE asset) converted by the asset’s fee pool.

Therefore, when pay_fee() is called, the fee only exists in this->core_fee_paid. So pay_fee() need only increment the receiving balance.

The default implementation simply calls account_statistics_object->pay_fee() to increment pending_fees or pending_vested_fees.

struct genesis_state_type
#include <genesis_state.hpp>

Public Functions

chain_id_type compute_chain_id() const

Get the chain_id corresponding to this genesis state.

This is the SHA256 serialization of the genesis_state.

Public Members

chain_id_type initial_chain_id

Temporary, will be moved elsewhere.

struct initial_committee_member_type
#include <genesis_state.hpp>

Public Members

string owner_name

Must correspond to one of the initial accounts.

struct initial_witness_type
#include <genesis_state.hpp>

Public Members

string owner_name

Must correspond to one of the initial accounts.

struct initial_worker_type
#include <genesis_state.hpp>

Public Members

string owner_name

Must correspond to one of the initial accounts.

class global_property_object : public graphene::db::abstract_object<global_property_object>
#include <global_property_object.hpp>

Maintains global state information (committee_member list, current fees)

This is an implementation detail. The values here are set by committee_members to tune the blockchain parameters.

class htlc_object : public graphene::db::abstract_object<htlc_object>
#include <htlc_object.hpp>

database object to store HTLCs

This object is stored in the database while an HTLC is active. The HTLC will become inactive at expiration or when unlocked via the preimage.

struct instant_vesting_policy
#include <vesting_balance_object.hpp>

instant vesting policy

This policy allows to withdraw everything that is on a balance immediately

class limit_order_create_evaluator : public graphene::chain::evaluator<limit_order_create_evaluator>
#include <market_evaluator.hpp>

Public Functions

void convert_fee()

override the default behavior defined by generic_evalautor

void pay_fee()

override the default behavior defined by generic_evalautor which is to post the fee to fee_paying_account_stats.pending_fees

class limit_order_object : public graphene::db::abstract_object<limit_order_object>
#include <market_object.hpp>

an offer to sell a amount of a asset at a specified exchange rate by a certain time

This limit_order_objects are indexed by expiration and is automatically deleted on the first block after expiration.

Public Members

share_type for_sale

asset id is sell_price.base.asset_id

share_type deferred_fee

fee converted to CORE

asset deferred_paid_fee

originally paid fee

struct linear_vesting_policy
#include <vesting_balance_object.hpp>

Linear vesting balance with cliff.

This vesting balance type is used to mimic traditional stock vesting contracts where each day a certain amount vests until it is fully matured.

Note

New funds may not be added to a linear vesting balance.

Public Members

fc::time_point_sec begin_timestamp

This is the time at which funds begin vesting.

uint32_t vesting_cliff_seconds = 0

No amount may be withdrawn before this many seconds of the vesting period have elapsed.

uint32_t vesting_duration_seconds = 0

Duration of the vesting period, in seconds. Must be greater than 0 and greater than vesting_cliff_seconds.

share_type begin_balance

The total amount of asset to vest.

class node_property_object
#include <node_property_object.hpp>

Contains per-node database configuration.

Transactions are evaluated differently based on per-node state. Settings here may change based on whether the node is syncing or up-to-date. Or whether the node is a witness node. Or if we’re processing a transaction in a witness-signed block vs. a fresh transaction from the p2p network. Or configuration-specified tradeoffs of performance/hardfork resilience vs. paranoia.

class op_evaluator
#include <evaluator.hpp>

Subclassed by graphene::chain::op_evaluator_impl< T >

class operation_history_object : public graphene::db::abstract_object<operation_history_object>
#include <operation_history_object.hpp>

tracks the history of all logical operations on blockchain state

All operations and virtual operations result in the creation of an operation_history_object that is maintained on disk as a stack. Each real or virtual operation is assigned a unique ID / sequence number that it can be referenced by.

Note

by default these objects are not tracked, the account_history_plugin must be loaded fore these objects to be maintained.

Note

this object is READ ONLY it can never be modified

Public Members

uint32_t block_num = 0

the block that caused this operation

uint16_t trx_in_block = 0

the transaction in the block

uint16_t op_in_trx = 0

the operation within the transaction

uint32_t virtual_op = 0

any virtual operations implied by operation in block

class proposal_object : public graphene::db::abstract_object<proposal_object>
#include <proposal_object.hpp>

tracks the approval of a partially approved transaction

struct refund_worker_type
#include <worker_object.hpp>

A worker who returns all of his pay to the reserve.

This worker type pays everything he receives back to the network’s reserve funds pool.

Public Members

share_type total_burned

Record of how much this worker has burned in his lifetime.

class required_approval_index : public secondary_index
#include <proposal_object.hpp>

tracks all of the proposal objects that requrie approval of an individual account.

This is a secondary index on the proposal_index

Note

the set of required approvals is constant

class special_authority_object : public graphene::db::abstract_object<special_authority_object>
#include <special_authority_object.hpp>

special_authority_object only exists to help with a specific indexing problem. We want to be able to iterate over all accounts that contain a special authority. However, accounts which have a special_authority are very rare. So rather than indexing account_object by the special_authority fields (requiring additional bookkeeping for every account), we instead maintain a special_authority_object pointing to each account which has special_authority (requiring additional bookkeeping only for every account which has special_authority).

This class is an implementation detail.

class transaction_evaluation_state
#include <transaction_evaluation_state.hpp>

Place holder for state tracked while processing a transaction. This class provides helper methods that are common to many different operations and also tracks which keys have signed the transaction

class transaction_history_object : public graphene::db::abstract_object<transaction_history_object>
#include <transaction_history_object.hpp>

The purpose of this object is to enable the detection of duplicate transactions. When a transaction is included in a block a transaction_history_object is added. At the end of block processing all transaction_history_objects that have expired can be removed from the index.

class transfer_from_blind_evaluator : public graphene::chain::evaluator<transfer_from_blind_evaluator>
#include <confidential_evaluator.hpp>

Public Functions

void pay_fee()

Routes the fee to where it needs to go. The default implementation routes the fee to the account_statistics_object of the fee_paying_account.

Before pay_fee() is called, the fee is computed by prepare_fee() and has been moved out of the fee_paying_account and (if paid in a non-CORE asset) converted by the asset’s fee pool.

Therefore, when pay_fee() is called, the fee only exists in this->core_fee_paid. So pay_fee() need only increment the receiving balance.

The default implementation simply calls account_statistics_object->pay_fee() to increment pending_fees or pending_vested_fees.

class transfer_to_blind_evaluator : public graphene::chain::evaluator<transfer_to_blind_evaluator>
#include <confidential_evaluator.hpp>

Public Functions

void pay_fee()

Routes the fee to where it needs to go. The default implementation routes the fee to the account_statistics_object of the fee_paying_account.

Before pay_fee() is called, the fee is computed by prepare_fee() and has been moved out of the fee_paying_account and (if paid in a non-CORE asset) converted by the asset’s fee pool.

Therefore, when pay_fee() is called, the fee only exists in this->core_fee_paid. So pay_fee() need only increment the receiving balance.

The default implementation simply calls account_statistics_object->pay_fee() to increment pending_fees or pending_vested_fees.

class vesting_balance_object : public graphene::db::abstract_object<vesting_balance_object>
#include <vesting_balance_object.hpp>

Vesting balance object is a balance that is locked by the blockchain for a period of time.

Subclassed by graphene::wallet::vesting_balance_object_with_info

Public Functions

void deposit(const fc::time_point_sec &now, const asset &amount)

Deposit amount into vesting balance, requiring it to vest before withdrawal.

void deposit_vested(const fc::time_point_sec &now, const asset &amount)

Deposit amount into vesting balance, making the new funds vest immediately.

void withdraw(const fc::time_point_sec &now, const asset &amount)

Used to remove a vesting balance from the VBO. As well as the balance field, coin_seconds_earned and coin_seconds_earned_last_update fields are updated.

The money doesn’t “go” anywhere; the caller is responsible for crediting it to the proper account.

asset get_allowed_withdraw(const time_point_sec &now) const

Get amount of allowed withdrawal.

Public Members

account_id_type owner

Account which owns and may withdraw from this vesting balance.

asset balance

Total amount remaining in this vesting balance Includes the unvested funds, and the vested funds which have not yet been withdrawn

vesting_policy policy

The vesting policy stores details on when funds vest, and controls when they may be withdrawn.

vesting_balance_type balance_type = vesting_balance_type::unspecified

type of the vesting balance

struct vesting_balance_worker_type
#include <worker_object.hpp>

A worker who sends his pay to a vesting balance.

This worker type takes all of his pay and places it into a vesting balance

Public Members

vesting_balance_id_type balance

The balance this worker pays into.

struct vote_counter
#include <vote_count.hpp>

Keep track of vote totals in internal authority object. See #533.

Public Functions

void finish(authority &out_auth)

Write into out_auth, but only if we have at least one member.

class withdraw_permission_object : public graphene::db::abstract_object<withdraw_permission_object>
#include <withdraw_permission_object.hpp>

Grants another account authority to withdraw a limited amount of funds per interval.

The primary purpose of this object is to enable recurring payments on the blockchain. An account which wishes to process a recurring payment may use a withdraw_permission_claim_operation to reference an object of this type and withdraw up to withdrawal_limit from withdraw_from_account. Only authorized_account may do this. Any number of withdrawals may be made so long as the total amount withdrawn per period does not exceed the limit for any given period.

Public Members

account_id_type withdraw_from_account

The account authorizing authorized_account to withdraw from it.

account_id_type authorized_account

The account authorized to make withdrawals from withdraw_from_account.

asset withdrawal_limit

The maximum amount which may be withdrawn per period. All withdrawals must be of this asset type.

uint32_t withdrawal_period_sec = 0

The duration of a withdrawal period in seconds.

time_point_sec expiration

The time at which this withdraw permission expires.

class worker_object : public graphene::db::abstract_object<worker_object>
#include <worker_object.hpp>

Worker object contains the details of a blockchain worker. See The Blockchain Worker System for details.

Public Members

account_id_type worker_account

ID of the account which owns this worker.

time_point_sec work_begin_date

Time at which this worker begins receiving pay, if elected.

time_point_sec work_end_date

Time at which this worker will cease to receive pay. Worker will be deleted at this time.

share_type daily_pay

Amount in CORE this worker will be paid each day.

worker_type worker

ID of this worker’s pay balance.

string name

Human-readable name for the worker.

string url

URL to a web page representing this worker.

vote_id_type vote_for

Voting ID which represents approval of this worker.

vote_id_type vote_against

Voting ID which represents disapproval of this worker.

struct worker_pay_visitor

A visitor for worker_type which calls pay_worker on the worker within.

namespace detail

Functions

void check_asset_options_hf_1268(const fc::time_point_sec &block_time, const asset_options &options)
share_type calculate_percent(const share_type &value, uint16_t percent)
template<typename T, int... Is>
void for_each(T &&t, const account_object &a, seq<Is...>)
template<typename Lambda>
void with_skip_flags(database &db, uint32_t skip_flags, Lambda callback)

Set the skip_flags to the given value, call callback, then reset skip_flags to their previous value after callback is done.

template<typename Lambda>
void without_pending_transactions(database &db, std::vector<processed_transaction> &&pending_transactions, Lambda callback)

Empty pending_transactions, call callback, then reset pending_transactions after callback is done.

Pending transactions which no longer validate will be culled.

bool _is_authorized_asset(const database &d, const account_object &acct, const asset_object &asset_obj)
uint64_t vbo_mfs_hash(const account_id_type &account_id, const asset_id_type &asset_id)

Calculate a hash for account_id_type and asset_id. Use 48 bit value (see object_id.hpp) for account_id and XOR it with 24 bit for asset_id

void check_vesting_balance_policy_hf_1268(const fc::time_point_sec &block_time, const vesting_policy_initializer &policy)
struct pending_transactions_restorer
#include <db_with.hpp>

Class used to help the without_pending_transactions implementation.

TODO: Change the name of this class to better reflect the fact that it restores popped transactions as well as pending transactions.

struct skip_flags_restorer
#include <db_with.hpp>

Class used to help the with_skip_flags implementation. It must be defined in this header because it must be available to the with_skip_flags implementation, which is a template and therefore must also be defined in this header.

struct vbo_mfs_key

Used as a key to search vesting_balance_object in the index

struct vesting_balance_object_equal
#include <vesting_balance_object.hpp>

Used as CompatiblePred Compares two vesting_balance_objects if vesting_balance_object.balance_type is a market_fee_sharing compare owners’ ids and assets’ ids otherwise: vesting_balance_object.id

struct vesting_balance_object_hash
#include <vesting_balance_object.hpp>

Used as CompatibleHash Calculate a hash vesting_balance_object if vesting_balance_object.balance_type is market_fee_sharing calculate has as vbo_mfs_hash(vesting_balance_object.owner, hash(vbo.balance.asset_id) (see vbo_mfs_hash) otherwise: hash_value(vesting_balance_object.id);