Setting the core asset as test dividend asset inn genesis
This commit is contained in:
parent
0d8e3a31d5
commit
58f1fdc46d
1 changed files with 28 additions and 6 deletions
|
|
@ -328,7 +328,7 @@ void database::init_genesis(const genesis_state_type& genesis_state)
|
|||
a.lifetime_referrer_fee_percentage = GRAPHENE_100_PERCENT;
|
||||
}).get_id() == GRAPHENE_PROXY_TO_SELF_ACCOUNT);
|
||||
FC_ASSERT(create<account_object>([this](account_object& a) {
|
||||
a.name = "default-dividend-distribution";
|
||||
a.name = "test-dividend-distribution";
|
||||
a.statistics = create<account_statistics_object>([&](account_statistics_object& s){s.owner = a.id;}).id;
|
||||
a.owner.weight_threshold = 1;
|
||||
a.active.weight_threshold = 1;
|
||||
|
|
@ -337,7 +337,6 @@ void database::init_genesis(const genesis_state_type& genesis_state)
|
|||
a.network_fee_percentage = 0;
|
||||
a.lifetime_referrer_fee_percentage = GRAPHENE_100_PERCENT;
|
||||
}).get_id() == TOURNAMENT_RAKE_FEE_ACCOUNT_ID);
|
||||
|
||||
// Create more special accounts
|
||||
while( true )
|
||||
{
|
||||
|
|
@ -363,6 +362,22 @@ void database::init_genesis(const genesis_state_type& genesis_state)
|
|||
create<asset_dynamic_data_object>([&](asset_dynamic_data_object& a) {
|
||||
a.current_supply = GRAPHENE_MAX_SHARE_SUPPLY;
|
||||
});
|
||||
|
||||
const asset_dividend_data_object& div_asset =
|
||||
create<asset_dividend_data_object>([&](asset_dividend_data_object& a) {
|
||||
a.options.minimum_distribution_interval = 3*24*60*60;
|
||||
a.options.minimum_fee_percentage = 10*GRAPHENE_1_PERCENT;
|
||||
a.options.next_payout_time = genesis_state.initial_timestamp + fc::hours(1);
|
||||
a.options.payout_interval = 7*24*60*60;
|
||||
a.dividend_distribution_account = TOURNAMENT_RAKE_FEE_ACCOUNT_ID;
|
||||
});
|
||||
const asset_bitasset_data_object& bit_asset =
|
||||
create<asset_bitasset_data_object>([&](asset_bitasset_data_object& a) {
|
||||
a.current_feed.maintenance_collateral_ratio = 1750;
|
||||
a.current_feed.maximum_short_squeeze_ratio = 1500;
|
||||
a.current_feed_publication_time = genesis_state.initial_timestamp + fc::hours(1);
|
||||
});
|
||||
|
||||
const asset_object& core_asset =
|
||||
create<asset_object>( [&]( asset_object& a ) {
|
||||
a.symbol = GRAPHENE_SYMBOL;
|
||||
|
|
@ -370,16 +385,19 @@ void database::init_genesis(const genesis_state_type& genesis_state)
|
|||
a.precision = GRAPHENE_BLOCKCHAIN_PRECISION_DIGITS;
|
||||
a.options.flags = 0;
|
||||
a.options.issuer_permissions = 0;
|
||||
a.issuer = GRAPHENE_NULL_ACCOUNT;
|
||||
a.issuer = GRAPHENE_COMMITTEE_ACCOUNT ; // authority problems 1.2.0 ... 5
|
||||
a.options.core_exchange_rate.base.amount = 1;
|
||||
a.options.core_exchange_rate.base.asset_id = asset_id_type(0);
|
||||
a.options.core_exchange_rate.quote.amount = 1;
|
||||
a.options.core_exchange_rate.quote.asset_id = asset_id_type(0);
|
||||
a.dynamic_asset_data_id = dyn_asset.id;
|
||||
});
|
||||
a.dividend_data_id = div_asset.id;
|
||||
a.bitasset_data_id = bit_asset.id;
|
||||
});
|
||||
assert( asset_id_type(core_asset.id) == asset().asset_id );
|
||||
assert( get_balance(account_id_type(), asset_id_type()) == asset(dyn_asset.current_supply) );
|
||||
|
||||
#ifdef _DEFAULT_DIVIDEND_ASSET
|
||||
// Create default dividend asset
|
||||
const asset_dynamic_data_object& dyn_asset1 =
|
||||
create<asset_dynamic_data_object>([&](asset_dynamic_data_object& a) {
|
||||
|
|
@ -402,7 +420,7 @@ void database::init_genesis(const genesis_state_type& genesis_state)
|
|||
|
||||
const asset_object& default_asset =
|
||||
create<asset_object>( [&]( asset_object& a ) {
|
||||
a.symbol = "DEF";
|
||||
a.symbol = "DEFAULT";
|
||||
a.options.max_market_fee =
|
||||
a.options.max_supply = genesis_state.max_core_supply;
|
||||
a.precision = GRAPHENE_BLOCKCHAIN_PRECISION_DIGITS;
|
||||
|
|
@ -418,7 +436,7 @@ void database::init_genesis(const genesis_state_type& genesis_state)
|
|||
a.bitasset_data_id = bit_asset1.id;
|
||||
});
|
||||
assert( default_asset.id == asset_id_type(1) );
|
||||
|
||||
#endif
|
||||
// Create more special assets
|
||||
while( true )
|
||||
{
|
||||
|
|
@ -684,8 +702,12 @@ void database::init_genesis(const genesis_state_type& genesis_state)
|
|||
{
|
||||
total_supplies[ asset_id_type(0) ] = GRAPHENE_MAX_SHARE_SUPPLY;
|
||||
}
|
||||
#ifdef _DEFAULT_DIVIDEND_ASSET
|
||||
total_debts[ asset_id_type(1) ] =
|
||||
total_supplies[ asset_id_type(1) ] = 0;
|
||||
#endif
|
||||
// it is workaround, should be clarified
|
||||
total_debts[ asset_id_type() ] = total_supplies[ asset_id_type() ];
|
||||
|
||||
const auto& idx = get_index_type<asset_index>().indices().get<by_symbol>();
|
||||
auto it = idx.begin();
|
||||
|
|
|
|||
Loading…
Reference in a new issue