31 #include <graphene/chain/hardfork.hpp>
40 namespace graphene {
namespace chain {
46 a.
num_auths() <= chain_params.maximum_authority_membership,
47 internal_verify_auth_max_auth_exceeded,
48 "Maximum authority membership exceeded" );
52 internal_verify_auth_account_not_found,
53 "Account ${a} specified in authority does not exist",
68 "Voted for more witnesses than currently allowed (${c})", (
"c", chain_params.maximum_witness_count) );
70 "Voted for more committee members than currently allowed (${c})", (
"c", chain_params.maximum_committee_count) );
74 uint32_t max_vote_id = gpo.next_available_vote_id;
75 bool has_worker_votes =
false;
76 for(
auto id : options.
votes )
78 FC_ASSERT(
id < max_vote_id,
"Can not vote for ${id} which does not exist.", (
"id",
id) );
80 has_worker_votes =
true;
86 for(
auto id : options.
votes )
90 FC_ASSERT( against_worker_idx.find(
id ) == against_worker_idx.end(),
91 "Can no longer vote against a worker." );
99 for (
auto id : options.
votes ) {
100 switch (
id.type() ) {
102 FC_ASSERT( committee_idx.find(
id) != committee_idx.end(),
103 "Can not vote for ${id} which does not exist.", (
"id",
id) );
106 FC_ASSERT( witness_idx.find(
id) != witness_idx.end(),
107 "Can not vote for ${id} which does not exist.", (
"id",
id) );
110 FC_ASSERT( approve_worker_idx.find(
id ) != approve_worker_idx.end(),
111 "Can not vote for ${id} which does not exist.", (
"id",
id) );
114 FC_THROW(
"Invalid Vote Type: ${id}", (
"id",
id) );
133 GRAPHENE_RECODE_EXC( internal_verify_auth_max_auth_exceeded, account_create_max_auth_exceeded )
134 GRAPHENE_RECODE_EXC( internal_verify_auth_account_not_found, account_create_auth_account_not_found )
136 if( op.
extensions.value.owner_special_authority.valid() )
138 if( op.
extensions.value.active_special_authority.valid() )
140 if( op.
extensions.value.buyback_options.valid() )
147 auto current_account_itr = acnt_indx.
indices().get<by_name>().find( op.
name );
148 FC_ASSERT( current_account_itr == acnt_indx.indices().get<by_name>().end(),
149 "Account '${a}' already exists.", (
"a",op.
name) );
160 bool has_small_percent = (
167 if( has_small_percent )
169 if( referrer_percent >= 100 )
171 wlog(
"between 100% and 0x100%: ${o}", (
"o", o) );
173 referrer_percent = referrer_percent*100;
180 const auto& new_acnt_object = d.
create<
account_object>( [&o,&d,&global_properties,referrer_percent]
185 obj.lifetime_referrer = o.
referrer(d).lifetime_referrer;
187 const auto& params = global_properties.parameters;
189 obj.lifetime_referrer_fee_percentage = params.lifetime_referrer_percent_of_fee;
190 obj.referrer_rewards_percentage = referrer_percent;
200 s.is_voting = obj.options.is_voting();
207 if( o.extensions.value.buyback_options.valid() )
209 obj.allowed_assets = o.extensions.value.buyback_options->markets;
210 obj.
allowed_assets->emplace( o.extensions.value.buyback_options->asset_to_buy );
213 obj.creation_block_num = d._current_block_num;
217 const auto& dynamic_properties = d.get_dynamic_global_properties();
222 if( dynamic_properties.accounts_registered_this_interval % global_properties.parameters.accounts_per_fee_scale == 0
223 && global_properties.parameters.account_fee_scale_bitshifts != 0 )
235 sa.account = new_acnt_object.id;
239 if( o.extensions.value.buyback_options.valid() )
241 asset_id_type asset_to_buy = o.extensions.value.buyback_options->asset_to_buy;
245 bo.asset_to_buy = asset_to_buy;
250 a.buyback_account = new_acnt_object.id;
254 return new_acnt_object.
id;
267 GRAPHENE_RECODE_EXC( internal_verify_auth_max_auth_exceeded, account_update_max_auth_exceeded )
268 GRAPHENE_RECODE_EXC( internal_verify_auth_account_not_found, account_update_auth_account_not_found )
270 if( o.
extensions.value.owner_special_authority.valid() )
272 if( o.
extensions.value.active_special_authority.valid() )
297 aso.is_voting = o.new_options->is_voting();
298 aso.last_vote_time = d.head_block_time();
308 a.top_n_control_flags = 0;
312 a.active = *o.active;
313 a.top_n_control_flags = 0;
317 a.options = *o.new_options;
318 a.num_committee_voted = a.options.num_committee_voted();
320 if( o.
extensions.value.owner_special_authority.valid() )
322 a.owner_special_authority = *(o.extensions.value.owner_special_authority);
323 a.top_n_control_flags = 0;
325 if( o.
extensions.value.active_special_authority.valid() )
327 a.active_special_authority = *(o.extensions.value.active_special_authority);
328 a.top_n_control_flags = 0;
334 if( sa_before && (!sa_after) )
337 auto sa_it = sa_idx.find( o.
account );
338 assert( sa_it != sa_idx.end() );
341 else if( (!sa_before) && sa_after )
381 if( o.new_listing & o.white_listed )
382 a.whitelisted_accounts.insert( o.account_to_list );
384 a.whitelisted_accounts.erase( o.account_to_list );
386 if( o.new_listing & o.black_listed )
387 a.blacklisted_accounts.insert( o.account_to_list );
389 a.blacklisted_accounts.erase( o.account_to_list );
414 a.statistics(d).process_fees(a, d);
415 a.membership_expiration_date = time_point_sec::maximum();
416 a.referrer = a.registrar = a.lifetime_referrer = a.get_id();
417 a.lifetime_referrer_fee_percentage = GRAPHENE_100_PERCENT - a.network_fee_percentage;
420 FC_ASSERT( d.head_block_time() <= HARDFORK_613_TIME );
421 FC_ASSERT(a.membership_expiration_date - d.head_block_time() < fc::days(3650),
422 "May not extend annual membership more than a decade into the future.");
423 a.membership_expiration_date += fc::days(365);
426 FC_ASSERT( d.head_block_time() <= HARDFORK_613_TIME );
427 a.statistics(d).process_fees(a, d);
428 assert(a.is_basic_account(d.head_block_time()));
429 a.referrer = a.get_id();
430 a.membership_expiration_date = d.head_block_time() + fc::days(365);