@@ -209,7 +209,7 @@ void database::initialize_indexes()
209
209
add_index< primary_index<asset_bitasset_data_index > >();
210
210
add_index< primary_index<simple_index<global_property_object >> >();
211
211
add_index< primary_index<simple_index<dynamic_global_property_object >> >();
212
- add_index< primary_index<simple_index<account_statistics_object > > >();
212
+ add_index< primary_index<account_stats_index > >();
213
213
add_index< primary_index<simple_index<asset_dynamic_data_object >> >();
214
214
add_index< primary_index<simple_index<block_summary_object >> >();
215
215
add_index< primary_index<simple_index<chain_property_object > > >();
@@ -258,12 +258,19 @@ void database::init_genesis(const genesis_state_type& genesis_state)
258
258
n.owner .weight_threshold = 1 ;
259
259
n.active .weight_threshold = 1 ;
260
260
n.name = " committee-account" ;
261
- n.statistics = create<account_statistics_object>( [&](account_statistics_object& s){ s.owner = n.id ; }).id ;
261
+ n.statistics = create<account_statistics_object>( [&n](account_statistics_object& s){
262
+ s.owner = n.id ;
263
+ s.name = n.name ;
264
+ s.core_in_balance = GRAPHENE_MAX_SHARE_SUPPLY;
265
+ }).id ;
262
266
});
263
267
FC_ASSERT (committee_account.get_id () == GRAPHENE_COMMITTEE_ACCOUNT);
264
268
FC_ASSERT (create<account_object>([this ](account_object& a) {
265
269
a.name = " witness-account" ;
266
- a.statistics = create<account_statistics_object>([&](account_statistics_object& s){s.owner = a.id ;}).id ;
270
+ a.statistics = create<account_statistics_object>([&a](account_statistics_object& s){
271
+ s.owner = a.id ;
272
+ s.name = a.name ;
273
+ }).id ;
267
274
a.owner .weight_threshold = 1 ;
268
275
a.active .weight_threshold = 1 ;
269
276
a.registrar = a.lifetime_referrer = a.referrer = GRAPHENE_WITNESS_ACCOUNT;
@@ -273,7 +280,10 @@ void database::init_genesis(const genesis_state_type& genesis_state)
273
280
}).get_id () == GRAPHENE_WITNESS_ACCOUNT);
274
281
FC_ASSERT (create<account_object>([this ](account_object& a) {
275
282
a.name = " relaxed-committee-account" ;
276
- a.statistics = create<account_statistics_object>([&](account_statistics_object& s){s.owner = a.id ;}).id ;
283
+ a.statistics = create<account_statistics_object>([&a](account_statistics_object& s){
284
+ s.owner = a.id ;
285
+ s.name = a.name ;
286
+ }).id ;
277
287
a.owner .weight_threshold = 1 ;
278
288
a.active .weight_threshold = 1 ;
279
289
a.registrar = a.lifetime_referrer = a.referrer = GRAPHENE_RELAXED_COMMITTEE_ACCOUNT;
@@ -283,7 +293,10 @@ void database::init_genesis(const genesis_state_type& genesis_state)
283
293
}).get_id () == GRAPHENE_RELAXED_COMMITTEE_ACCOUNT);
284
294
FC_ASSERT (create<account_object>([this ](account_object& a) {
285
295
a.name = " null-account" ;
286
- a.statistics = create<account_statistics_object>([&](account_statistics_object& s){s.owner = a.id ;}).id ;
296
+ a.statistics = create<account_statistics_object>([&a](account_statistics_object& s){
297
+ s.owner = a.id ;
298
+ s.name = a.name ;
299
+ }).id ;
287
300
a.owner .weight_threshold = 1 ;
288
301
a.active .weight_threshold = 1 ;
289
302
a.registrar = a.lifetime_referrer = a.referrer = GRAPHENE_NULL_ACCOUNT;
@@ -293,7 +306,10 @@ void database::init_genesis(const genesis_state_type& genesis_state)
293
306
}).get_id () == GRAPHENE_NULL_ACCOUNT);
294
307
FC_ASSERT (create<account_object>([this ](account_object& a) {
295
308
a.name = " temp-account" ;
296
- a.statistics = create<account_statistics_object>([&](account_statistics_object& s){s.owner = a.id ;}).id ;
309
+ a.statistics = create<account_statistics_object>([&a](account_statistics_object& s){
310
+ s.owner = a.id ;
311
+ s.name = a.name ;
312
+ }).id ;
297
313
a.owner .weight_threshold = 0 ;
298
314
a.active .weight_threshold = 0 ;
299
315
a.registrar = a.lifetime_referrer = a.referrer = GRAPHENE_TEMP_ACCOUNT;
@@ -303,7 +319,10 @@ void database::init_genesis(const genesis_state_type& genesis_state)
303
319
}).get_id () == GRAPHENE_TEMP_ACCOUNT);
304
320
FC_ASSERT (create<account_object>([this ](account_object& a) {
305
321
a.name = " proxy-to-self" ;
306
- a.statistics = create<account_statistics_object>([&](account_statistics_object& s){s.owner = a.id ;}).id ;
322
+ a.statistics = create<account_statistics_object>([&a](account_statistics_object& s){
323
+ s.owner = a.id ;
324
+ s.name = a.name ;
325
+ }).id ;
307
326
a.owner .weight_threshold = 1 ;
308
327
a.active .weight_threshold = 1 ;
309
328
a.registrar = a.lifetime_referrer = a.referrer = GRAPHENE_NULL_ACCOUNT;
@@ -318,9 +337,12 @@ void database::init_genesis(const genesis_state_type& genesis_state)
318
337
uint64_t id = get_index<account_object>().get_next_id ().instance ();
319
338
if ( id >= genesis_state.immutable_parameters .num_special_accounts )
320
339
break ;
321
- const account_object& acct = create<account_object>([& ](account_object& a) {
340
+ const account_object& acct = create<account_object>([this ,id ](account_object& a) {
322
341
a.name = " special-account-" + std::to_string (id);
323
- a.statistics = create<account_statistics_object>([&](account_statistics_object& s){s.owner = a.id ;}).id ;
342
+ a.statistics = create<account_statistics_object>([&a](account_statistics_object& s){
343
+ s.owner = a.id ;
344
+ s.name = a.name ;
345
+ }).id ;
324
346
a.owner .weight_threshold = 1 ;
325
347
a.active .weight_threshold = 1 ;
326
348
a.registrar = a.lifetime_referrer = a.referrer = account_id_type (id);
@@ -334,11 +356,11 @@ void database::init_genesis(const genesis_state_type& genesis_state)
334
356
335
357
// Create core asset
336
358
const asset_dynamic_data_object& dyn_asset =
337
- create<asset_dynamic_data_object>([& ](asset_dynamic_data_object& a) {
359
+ create<asset_dynamic_data_object>([](asset_dynamic_data_object& a) {
338
360
a.current_supply = GRAPHENE_MAX_SHARE_SUPPLY;
339
361
});
340
362
const asset_object& core_asset =
341
- create<asset_object>( [&]( asset_object& a ) {
363
+ create<asset_object>( [&genesis_state,&dyn_asset ]( asset_object& a ) {
342
364
a.symbol = GRAPHENE_SYMBOL;
343
365
a.options .max_supply = genesis_state.max_core_supply ;
344
366
a.precision = GRAPHENE_BLOCKCHAIN_PRECISION_DIGITS;
@@ -360,10 +382,10 @@ void database::init_genesis(const genesis_state_type& genesis_state)
360
382
if ( id >= genesis_state.immutable_parameters .num_special_assets )
361
383
break ;
362
384
const asset_dynamic_data_object& dyn_asset =
363
- create<asset_dynamic_data_object>([& ](asset_dynamic_data_object& a) {
385
+ create<asset_dynamic_data_object>([](asset_dynamic_data_object& a) {
364
386
a.current_supply = 0 ;
365
387
});
366
- const asset_object& asset_obj = create<asset_object>( [& ]( asset_object& a ) {
388
+ const asset_object& asset_obj = create<asset_object>( [id,&dyn_asset ]( asset_object& a ) {
367
389
a.symbol = " SPECIAL" + std::to_string ( id );
368
390
a.options .max_supply = 0 ;
369
391
a.precision = GRAPHENE_BLOCKCHAIN_PRECISION_DIGITS;
@@ -481,9 +503,9 @@ void database::init_genesis(const genesis_state_type& genesis_state)
481
503
cop.active = cop.owner ;
482
504
account_id_type owner_account_id = apply_operation (genesis_eval_state, cop).get <object_id_type>();
483
505
484
- modify ( owner_account_id (*this ).statistics (*this ), [&]( account_statistics_object& o ) {
485
- o.total_core_in_orders = collateral_rec.collateral ;
486
- });
506
+ modify ( owner_account_id (*this ).statistics (*this ), [&collateral_rec ]( account_statistics_object& o ) {
507
+ o.total_core_in_orders = collateral_rec.collateral ;
508
+ });
487
509
488
510
create<call_order_object>([&](call_order_object& c) {
489
511
c.borrower = owner_account_id;
0 commit comments