35 namespace graphene {
namespace chain {
43 const auto& db = *
this;
50 const auto& htlcs = db.get_index_type<
htlc_index>().indices();
51 map<asset_id_type,share_type> total_balances;
52 map<asset_id_type,share_type> total_debts;
59 total_balances[a.asset_type] += a.balance;
63 total_balances[s.balance.asset_id] += s.balance.amount;
66 total_balances[ vbo.balance.asset_id ] += vbo.balance.amount;
68 total_balances[ asset_id_type() ] += fba.accumulated_fba_fees;
72 reported_core_in_orders += s.total_core_in_orders;
75 total_balances[b.inv_swan_price.base.asset_id] += b.inv_swan_price.base.amount;
79 auto for_sale = o.amount_for_sale();
80 if( for_sale.asset_id == asset_id_type() ) core_in_orders += for_sale.amount;
81 total_balances[for_sale.asset_id] += for_sale.amount;
86 auto col = o.get_collateral();
87 if( col.asset_id == asset_id_type() ) core_in_orders += col.amount;
88 total_balances[col.asset_id] += col.amount;
89 total_debts[o.get_debt().asset_id] += o.get_debt().amount;
93 total_balances[asset_obj.get_id()] += asset_obj.dynamic_asset_data_id(db).accumulated_fees;
94 total_balances[asset_id_type()] += asset_obj.dynamic_asset_data_id(db).fee_pool;
97 for(
const auto& htlc : htlcs )
98 total_balances[htlc.transfer.asset_id] += htlc.transfer.amount;
102 FC_THROW(
"computed balance of CORE mismatch",
103 (
"computed value",total_balances[asset_id_type()].value)
119 constexpr uint8_t db_action_nil = 0;
120 constexpr uint8_t db_action_create = 1;
121 constexpr uint8_t db_action_write = 2;
122 constexpr uint8_t db_action_update = 3;
123 constexpr uint8_t db_action_delete = 4;
135 uint8_t action = db_action_nil;
136 auto it_id = vo.
find(
"id");
140 action = ( vo.
size() == 1 ) ? db_action_delete : db_action_write;
144 action = db_action_delete;
145 auto it_action = vo.
find(
"_action" );
146 if( it_action != vo.
end() )
148 const std::string& str_action = it_action->value().get_string();
149 if( str_action ==
"create" )
150 action = db_action_create;
151 else if( str_action ==
"write" )
152 action = db_action_write;
153 else if( str_action ==
"update" )
154 action = db_action_update;
155 else if( str_action ==
"delete" )
156 action = db_action_delete;
163 case db_action_create:
166 case db_action_write:
169 idx.object_default( obj );
173 case db_action_update:
179 case db_action_delete:
190 auto it = _node_property_object.
debug_updates.find( head_id );
200 auto it = _node_property_object.
debug_updates.find( head_id );
202 it = _node_property_object.
debug_updates.emplace( head_id, std::vector< fc::variant_object >() ).first;
203 it->second.emplace_back( update );
Tracks the balance of a single account/asset pairThis object is indexed on owner and asset_type so th...
void modify(const T &obj, const Lambda &m)
iterator find(const string &key) const
const index_type & indices() const
#define GRAPHENE_MAX_NESTED_OBJECTS
A simple index uses a vector<unique_ptr<T>> to store data.
tracks the blockchain state in an extensible manner
An order-perserving dictionary of variant's.
void debug_apply_update(database &db, const fc::variant_object &vo)
tracks debt and call price information
bool push_block(const signed_block &b, uint32_t skip=skip_nothing)
block_id_type head_block_id() const
provides stack-based nullable value similar to boost::optional
std::map< block_id_type, std::vector< fc::variant_object > > debug_updates
const object & get_object(const object_id_type &id) const
tracks bitassets scheduled for force settlement at some point in the future.
optional< signed_block > fetch_block_by_id(const block_id_type &id) const
#define FC_ASSERT(TEST,...)
Checks a condition and throws an assert_exception if the test is FALSE.
const index & get_index() const
tracks the asset information that changes frequentlyBecause the asset_object is very large it doesn't...
bids of collateral for debt after a black swan
tracks the parameters of an assetAll assets have a globally unique symbol name that controls how they...
void from_variant(const variant &var, flat_set< T, A... > &vo, uint32_t _max_depth)
void apply_debug_updates()
void remove(const object &obj)
share_type current_supply
The number of shares currently in existence.
void debug_update(const fc::variant_object &update)
an offer to sell an amount of an asset at a specified exchange rate by a certain timeThe objects are ...