Declare, but not yet implement, account_upgrade_operation which can upgrade accounts to members. Resolve #21 by removing all the sketchy pointer arithmetic stuff
This commit is contained in:
parent
7d96e0c124
commit
7f0d1ebbed
7 changed files with 197 additions and 215 deletions
|
|
@ -412,6 +412,7 @@ namespace graphene { namespace chain {
|
|||
void for_each(T&& t, const account_object& a, seq<Is...>)
|
||||
{
|
||||
auto l = { (std::get<Is>(t)(a), 0)... };
|
||||
(void)l;
|
||||
}
|
||||
}
|
||||
template<class... Types>
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ namespace graphene { namespace chain {
|
|||
|
||||
account_id_type fee_payer()const { return fee_paying_account; }
|
||||
void get_required_auth(flat_set<account_id_type>& active_auth_set , flat_set<account_id_type>&)const;
|
||||
share_type calculate_fee( const fee_schedule_type& k )const{ return k.at( key_create_fee_type ); }
|
||||
share_type calculate_fee( const fee_schedule_type& k )const{ return k.key_create_fee; }
|
||||
void validate()const;
|
||||
|
||||
void get_balance_delta( balance_accumulator& acc, const operation_result& result = asset())const { acc.adjust( fee_payer(), -fee ); }
|
||||
|
|
@ -193,7 +193,7 @@ namespace graphene { namespace chain {
|
|||
account_id_type fee_payer()const { return authorizing_account; }
|
||||
void get_required_auth(flat_set<account_id_type>& active_auth_set, flat_set<account_id_type>&)const;
|
||||
void validate()const { FC_ASSERT( fee.amount >= 0 ); FC_ASSERT(new_listing < 0x4); }
|
||||
share_type calculate_fee(const fee_schedule_type& k)const { return k.at(account_whitelist_fee_type); }
|
||||
share_type calculate_fee(const fee_schedule_type& k)const { return k.account_whitelist_fee; }
|
||||
|
||||
void get_balance_delta( balance_accumulator& acc, const operation_result& result = asset())const { acc.adjust( fee_payer(), -fee ); }
|
||||
};
|
||||
|
|
@ -220,6 +220,62 @@ namespace graphene { namespace chain {
|
|||
void get_balance_delta( balance_accumulator& acc, const operation_result& result = asset())const { acc.adjust( fee_payer(), -fee ); }
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Manage an account's membership status
|
||||
* @ingroup operations
|
||||
*
|
||||
* This operation is used to upgrade an account to a member, or renew its subscription. If an account which is an
|
||||
* unexpired annual subscription member publishes this operation with @ref upgrade_to_lifetime_member set to false,
|
||||
* the account's membership expiration date will be pushed backward one year. If a basic account publishes it with
|
||||
* @ref upgrade_to_lifetime_member set to false, the account will be upgraded to a subscription member with an
|
||||
* expiration date one year after the processing time of this operation.
|
||||
*
|
||||
* Any account may use this operation to become a lifetime member by setting @ref upgrade_to_lifetime_member to
|
||||
* true. Once an account has become a lifetime member, it may not use this operation anymore.
|
||||
*/
|
||||
struct account_upgrade_operation
|
||||
{
|
||||
asset fee;
|
||||
/// The account to upgrade; must not already be a lifetime member
|
||||
account_id_type account_to_upgrade;
|
||||
/// If true, the account will be upgraded to a lifetime member; otherwise, it will add a year to the subscription
|
||||
bool upgrade_to_lifetime_member = false;
|
||||
|
||||
account_id_type fee_payer()const { return account_to_upgrade; }
|
||||
void get_required_auth(flat_set<account_id_type>& active_auth_set , flat_set<account_id_type>&)const
|
||||
{ active_auth_set.insert(account_to_upgrade); }
|
||||
void validate()const;
|
||||
share_type calculate_fee( const fee_schedule_type& k )const;
|
||||
void get_balance_delta( balance_accumulator& acc, const operation_result& = asset())const { acc.adjust( fee_payer(), -fee ); }
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief transfers the account to another account while clearing the white list
|
||||
* @ingroup operations
|
||||
*
|
||||
* In theory an account can be transferred by simply updating the authorities, but that kind
|
||||
* of transfer lacks semantic meaning and is more often done to rotate keys without transferring
|
||||
* ownership. This operation is used to indicate the legal transfer of title to this account and
|
||||
* a break in the operation history.
|
||||
*
|
||||
* The account_id's owner/active/voting/memo authority should be set to new_owner
|
||||
*
|
||||
* This operation will clear the account's whitelist statuses, but not the blacklist statuses.
|
||||
*/
|
||||
struct account_transfer_operation
|
||||
{
|
||||
asset fee;
|
||||
account_id_type account_id;
|
||||
account_id_type new_owner;
|
||||
|
||||
account_id_type fee_payer()const { return account_id; }
|
||||
void get_required_auth(flat_set<account_id_type>& active_auth_set, flat_set<account_id_type>&)const;
|
||||
void validate()const;
|
||||
share_type calculate_fee( const fee_schedule_type& k )const;
|
||||
|
||||
void get_balance_delta( balance_accumulator& acc, const operation_result& result = asset())const { acc.adjust( fee_payer(), -fee ); }
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Create a delegate object, as a bid to hold a delegate seat on the network.
|
||||
* @ingroup operations
|
||||
|
|
@ -240,34 +296,6 @@ namespace graphene { namespace chain {
|
|||
void get_balance_delta( balance_accumulator& acc, const operation_result& result = asset())const { acc.adjust( fee_payer(), -fee ); }
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief transfers the account to another account while clearing the white list
|
||||
* @ingroup operations
|
||||
*
|
||||
* In theory an account can be transferred by simply updating the authorities, but that kind
|
||||
* of transfer lacks semantic meaning and is more often done to rotate keys without transferring
|
||||
* ownership. This operation is used to indicate the legal transfer of title to this account and
|
||||
* a break in the operation history.
|
||||
*
|
||||
* The account_id's owner/active/voting/memo authority should be set to new_owner
|
||||
*
|
||||
* This operation will clear the account's whitelist statuses, but not the blacklist statuses.
|
||||
*/
|
||||
struct account_transfer_operation
|
||||
{
|
||||
asset fee;
|
||||
account_id_type account_id;
|
||||
account_id_type new_owner;
|
||||
|
||||
account_id_type fee_payer()const { return account_id; }
|
||||
void get_required_auth(flat_set<account_id_type>& active_auth_set, flat_set<account_id_type>&)const;
|
||||
void validate()const;
|
||||
share_type calculate_fee( const fee_schedule_type& k )const;
|
||||
|
||||
void get_balance_delta( balance_accumulator& acc, const operation_result& result = asset())const { acc.adjust( fee_payer(), -fee ); }
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Create a witness object, as a bid to hold a witness position on the network.
|
||||
* @ingroup operations
|
||||
|
|
@ -640,7 +668,7 @@ namespace graphene { namespace chain {
|
|||
{ active_auth_set.insert(fee_payer()); }
|
||||
void validate()const;
|
||||
share_type calculate_fee( const fee_schedule_type& k )const
|
||||
{ return k.at(asset_update_fee_type); }
|
||||
{ return k.asset_update_fee; }
|
||||
void get_balance_delta( balance_accumulator& acc, const operation_result& result = asset())const
|
||||
{ acc.adjust( fee_payer(), -fee ); }
|
||||
};
|
||||
|
|
@ -1565,6 +1593,7 @@ namespace graphene { namespace chain {
|
|||
account_create_operation,
|
||||
account_update_operation,
|
||||
account_whitelist_operation,
|
||||
account_upgrade_operation,
|
||||
account_transfer_operation,
|
||||
asset_create_operation,
|
||||
asset_update_operation,
|
||||
|
|
@ -1739,10 +1768,10 @@ FC_REFLECT( graphene::chain::account_create_operation,
|
|||
(num_witness)(num_committee)(vote)
|
||||
)
|
||||
|
||||
FC_REFLECT_TYPENAME( fc::flat_set<graphene::chain::vote_id_type> )
|
||||
FC_REFLECT( graphene::chain::account_update_operation,
|
||||
(fee)(account)(owner)(active)(voting_account)(memo_key)(num_witness)(num_committee)(vote)
|
||||
)
|
||||
FC_REFLECT( graphene::chain::account_upgrade_operation, (fee)(account_to_upgrade)(upgrade_to_lifetime_member) )
|
||||
|
||||
FC_REFLECT_TYPENAME( graphene::chain::account_whitelist_operation::account_listing)
|
||||
FC_REFLECT_ENUM( graphene::chain::account_whitelist_operation::account_listing,
|
||||
|
|
@ -1840,3 +1869,4 @@ FC_REFLECT( graphene::chain::custom_operation, (fee)(payer)(required_auths)(id)(
|
|||
FC_REFLECT( graphene::chain::void_result, )
|
||||
|
||||
FC_REFLECT_TYPENAME( graphene::chain::operation )
|
||||
FC_REFLECT_TYPENAME( fc::flat_set<graphene::chain::vote_id_type> )
|
||||
|
|
|
|||
|
|
@ -86,53 +86,6 @@ namespace graphene { namespace chain {
|
|||
};
|
||||
|
||||
inline bool is_relative( object_id_type o ){ return o.space() == 0; }
|
||||
/**
|
||||
* There are many types of fees charged by the network
|
||||
* for different operations. These fees are published by
|
||||
* the delegates and can change over time.
|
||||
*/
|
||||
enum fee_type
|
||||
{
|
||||
key_create_fee_type, ///< the cost to register a public key with the blockchain
|
||||
account_create_fee_type, ///< the cost to register the cheapest non-free account
|
||||
account_len8_fee_type,
|
||||
account_len7_fee_type,
|
||||
account_len6_fee_type,
|
||||
account_len5_fee_type,
|
||||
account_len4_fee_type,
|
||||
account_len3_fee_type,
|
||||
account_premium_fee_type, ///< accounts on the reserved list of top 100K domains
|
||||
account_whitelist_fee_type, ///< the fee to whitelist an account
|
||||
delegate_create_fee_type, ///< fixed fee for registering as a delegate, used to discourage frivioulous delegates
|
||||
witness_withdraw_pay_fee_type, ///< fee for withdrawing witness pay
|
||||
transfer_fee_type, ///< fee for transferring some asset
|
||||
limit_order_fee_type, ///< fee for placing a limit order in the markets
|
||||
short_order_fee_type, ///< fee for placing a short order in the markets
|
||||
publish_feed_fee_type, ///< fee for publishing a price feed
|
||||
asset_create_fee_type, ///< the cost to register the cheapest asset
|
||||
asset_update_fee_type, ///< the cost to modify a registered asset
|
||||
asset_issue_fee_type, ///< the cost to modify a registered asset
|
||||
asset_fund_fee_pool_fee_type, ///< the cost to add funds to an asset's fee pool
|
||||
asset_settle_fee_type, ///< the cost to trigger a forced settlement of a market-issued asset
|
||||
market_fee_type, ///< a percentage charged on market orders
|
||||
transaction_fee_type, ///< a base price for every transaction
|
||||
data_fee_type, ///< a price per 1024 bytes of user data
|
||||
signature_fee_type, ///< a surcharge on transactions with more than 2 signatures.
|
||||
global_parameters_update_fee_type, ///< the cost to update the global parameters
|
||||
prime_upgrade_fee_type, ///< the cost to upgrade an account to prime
|
||||
withdraw_permission_update_fee_type, ///< the cost to create/update a withdraw permission
|
||||
create_bond_offer_fee_type,
|
||||
cancel_bond_offer_fee_type,
|
||||
accept_bond_offer_fee_type,
|
||||
claim_bond_collateral_fee_type,
|
||||
file_storage_fee_per_day_type, ///< the cost of leasing a file with 2^16 bytes for 1 day
|
||||
vesting_balance_create_fee_type,
|
||||
vesting_balance_withdraw_fee_type,
|
||||
global_settle_fee_type,
|
||||
worker_create_fee_type, ///< the cost to create a new worker
|
||||
worker_delete_fee_type, ///< the cost to delete a worker
|
||||
FEE_TYPE_COUNT ///< Sentry value which contains the number of different fee types
|
||||
};
|
||||
|
||||
/**
|
||||
* List all object types from all namespaces here so they can
|
||||
|
|
@ -370,53 +323,71 @@ namespace graphene { namespace chain {
|
|||
|
||||
struct fee_schedule_type
|
||||
{
|
||||
fee_schedule_type()
|
||||
{
|
||||
memset( (char*)this, 0, sizeof(*this) );
|
||||
}
|
||||
void set( uint32_t f, share_type v ){ FC_ASSERT( f < FEE_TYPE_COUNT && v.value <= uint32_t(-1) ); *(&key_create_fee + f) = v.value; }
|
||||
const share_type at( uint32_t f )const { FC_ASSERT( f < FEE_TYPE_COUNT ); return *(&key_create_fee + f); }
|
||||
size_t size()const{ return FEE_TYPE_COUNT; }
|
||||
/**
|
||||
* @brief The fee_set_visitor struct sets all fees to a particular value in one fell swoop
|
||||
*
|
||||
* Example:
|
||||
* @code
|
||||
* fee_schedule_type sch;
|
||||
* // Set all fees to 50
|
||||
* fc::reflector<fee_schedule_type>::visit(fee_schedule_type::fee_set_visitor{sch, 50});
|
||||
* @endcode
|
||||
*/
|
||||
struct fee_set_visitor {
|
||||
fee_schedule_type& f;
|
||||
uint32_t fee;
|
||||
|
||||
template<typename Member, typename Class, Member (Class::*member)>
|
||||
void operator()(const char*)const
|
||||
{
|
||||
f.*member = fee;
|
||||
}
|
||||
};
|
||||
|
||||
uint32_t key_create_fee; ///< the cost to register a public key with the blockchain
|
||||
uint32_t account_create_fee; ///< the cost to register the cheapest non-free account
|
||||
uint32_t account_len8_fee;
|
||||
uint32_t account_len7_fee;
|
||||
uint32_t account_len6_fee;
|
||||
uint32_t account_len5_fee;
|
||||
uint32_t account_len4_fee;
|
||||
uint32_t account_len3_fee;
|
||||
uint32_t account_premium_fee; ///< accounts on the reserved list of top 100K domains
|
||||
uint32_t account_whitelist_fee; ///< the fee to whitelist an account
|
||||
uint32_t delegate_create_fee; ///< fixed fee for registering as a delegate; used to discourage frivioulous delegates
|
||||
uint32_t witness_withdraw_pay_fee; ///< fee for withdrawing witness pay
|
||||
uint32_t transfer_fee; ///< fee for transferring some asset
|
||||
uint32_t limit_order_fee; ///< fee for placing a limit order in the markets
|
||||
uint32_t short_order_fee; ///< fee for placing a short order in the markets
|
||||
uint32_t publish_feed_fee; ///< fee for publishing a price feed
|
||||
uint32_t asset_create_fee; ///< the cost to register the cheapest asset
|
||||
uint32_t asset_update_fee; ///< the cost to modify a registered asset
|
||||
uint32_t asset_issue_fee; ///< the cost to modify a registered asset
|
||||
uint32_t asset_fund_fee_pool_fee; ///< the cost to add funds to an asset's fee pool
|
||||
uint32_t asset_settle_fee; ///< the cost to trigger a forced settlement of a market-issued asset
|
||||
uint32_t market_fee; ///< a percentage charged on market orders
|
||||
uint32_t transaction_fee; ///< a base price for every transaction
|
||||
uint32_t data_fee; ///< a price per 1024 bytes of user data
|
||||
uint32_t signature_fee; ///< a surcharge on transactions with more than 2 signatures.
|
||||
uint32_t global_parameters_update_fee; ///< the cost to update the global parameters
|
||||
uint32_t prime_upgrade_fee; ///< the cost to upgrade an account to prime
|
||||
uint32_t withdraw_permission_update_fee; ///< the cost to create/update a withdraw permission
|
||||
uint32_t create_bond_offer_fee;
|
||||
uint32_t cancel_bond_offer_fee;
|
||||
uint32_t accept_bond_offer_fee;
|
||||
uint32_t claim_bond_collateral_fee;
|
||||
uint32_t file_storage_fee_per_day; ///< the cost of leasing a file with 2^16 bytes for 1 day
|
||||
uint32_t vesting_balance_create_fee;
|
||||
uint32_t vesting_balance_withdraw_fee;
|
||||
uint32_t global_settle_fee;
|
||||
uint32_t worker_create_fee; ///< the cost to create a new worker
|
||||
uint32_t worker_delete_fee; ///< the cost to delete a worker
|
||||
fee_schedule_type()
|
||||
{
|
||||
memset( (char*)this, 0, sizeof(*this) );
|
||||
}
|
||||
|
||||
uint32_t key_create_fee; ///< the cost to register a public key with the blockchain
|
||||
uint32_t account_create_fee; ///< the cost to register the cheapest non-free account
|
||||
uint32_t account_len8_fee;
|
||||
uint32_t account_len7_fee;
|
||||
uint32_t account_len6_fee;
|
||||
uint32_t account_len5_fee;
|
||||
uint32_t account_len4_fee;
|
||||
uint32_t account_len3_fee;
|
||||
uint32_t account_premium_fee; ///< accounts with premium names; i.e. @ref is_cheap_name returns false
|
||||
uint32_t account_whitelist_fee; ///< the fee to whitelist an account
|
||||
uint32_t delegate_create_fee; ///< fixed fee for registering as a delegate; used to discourage frivioulous delegates
|
||||
uint32_t witness_withdraw_pay_fee; ///< fee for withdrawing witness pay
|
||||
uint32_t transfer_fee; ///< fee for transferring some asset
|
||||
uint32_t limit_order_fee; ///< fee for placing a limit order in the markets
|
||||
uint32_t short_order_fee; ///< fee for placing a short order in the markets
|
||||
uint32_t publish_feed_fee; ///< fee for publishing a price feed
|
||||
uint32_t asset_create_fee; ///< the cost to register the cheapest asset
|
||||
uint32_t asset_update_fee; ///< the cost to modify a registered asset
|
||||
uint32_t asset_issue_fee; ///< the cost to modify a registered asset
|
||||
uint32_t asset_fund_fee_pool_fee; ///< the cost to add funds to an asset's fee pool
|
||||
uint32_t asset_settle_fee; ///< the cost to trigger a forced settlement of a market-issued asset
|
||||
uint32_t market_fee; ///< a percentage charged on market orders
|
||||
uint32_t transaction_fee; ///< a base price for every transaction
|
||||
uint32_t data_fee; ///< a price per 1024 bytes of user data
|
||||
uint32_t signature_fee; ///< a surcharge on transactions with more than 2 signatures.
|
||||
uint32_t global_parameters_update_fee; ///< the cost to update the global parameters
|
||||
uint32_t membership_annual_fee; ///< the annual cost of a membership subscription
|
||||
uint32_t membership_lifetime_fee; ///< the cost to upgrade to a lifetime member
|
||||
uint32_t withdraw_permission_update_fee; ///< the cost to create/update a withdraw permission
|
||||
uint32_t create_bond_offer_fee;
|
||||
uint32_t cancel_bond_offer_fee;
|
||||
uint32_t accept_bond_offer_fee;
|
||||
uint32_t claim_bond_collateral_fee;
|
||||
uint32_t file_storage_fee_per_day; ///< the cost of leasing a file with 2^16 bytes for 1 day
|
||||
uint32_t vesting_balance_create_fee;
|
||||
uint32_t vesting_balance_withdraw_fee;
|
||||
uint32_t global_settle_fee;
|
||||
uint32_t worker_create_fee; ///< the cost to create a new worker
|
||||
uint32_t worker_delete_fee; ///< the cost to delete a worker
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -498,7 +469,6 @@ namespace graphene { namespace chain {
|
|||
"Maximum transaction expiration time must be greater than a block interval" );
|
||||
FC_ASSERT( maximum_proposal_lifetime - genesis_proposal_review_period > block_interval,
|
||||
"Genesis proposal review period must be less than the maximum proposal lifetime" );
|
||||
for( uint32_t i = 0; i < FEE_TYPE_COUNT; ++i ) { FC_ASSERT( current_fees.at(i) >= 0 ); }
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -588,7 +558,8 @@ FC_REFLECT( graphene::chain::fee_schedule_type,
|
|||
(data_fee)
|
||||
(signature_fee)
|
||||
(global_parameters_update_fee)
|
||||
(prime_upgrade_fee)
|
||||
(membership_annual_fee)
|
||||
(membership_lifetime_fee)
|
||||
(withdraw_permission_update_fee)
|
||||
(create_bond_offer_fee)
|
||||
(cancel_bond_offer_fee)
|
||||
|
|
@ -602,49 +573,6 @@ FC_REFLECT( graphene::chain::fee_schedule_type,
|
|||
(worker_delete_fee)
|
||||
)
|
||||
|
||||
|
||||
FC_REFLECT_ENUM( graphene::chain::fee_type,
|
||||
(key_create_fee_type)
|
||||
(account_create_fee_type)
|
||||
(account_len8_fee_type)
|
||||
(account_len7_fee_type)
|
||||
(account_len6_fee_type)
|
||||
(account_len5_fee_type)
|
||||
(account_len4_fee_type)
|
||||
(account_len3_fee_type)
|
||||
(account_premium_fee_type)
|
||||
(account_whitelist_fee_type)
|
||||
(delegate_create_fee_type)
|
||||
(witness_withdraw_pay_fee_type)
|
||||
(transfer_fee_type)
|
||||
(limit_order_fee_type)
|
||||
(short_order_fee_type)
|
||||
(publish_feed_fee_type)
|
||||
(asset_create_fee_type)
|
||||
(asset_update_fee_type)
|
||||
(asset_issue_fee_type)
|
||||
(asset_fund_fee_pool_fee_type)
|
||||
(asset_settle_fee_type)
|
||||
(market_fee_type)
|
||||
(transaction_fee_type)
|
||||
(data_fee_type)
|
||||
(signature_fee_type)
|
||||
(global_parameters_update_fee_type)
|
||||
(prime_upgrade_fee_type)
|
||||
(withdraw_permission_update_fee_type)
|
||||
(create_bond_offer_fee_type)
|
||||
(cancel_bond_offer_fee_type)
|
||||
(accept_bond_offer_fee_type)
|
||||
(claim_bond_collateral_fee_type)
|
||||
(file_storage_fee_per_day_type)
|
||||
(vesting_balance_create_fee_type)
|
||||
(vesting_balance_withdraw_fee_type)
|
||||
(global_settle_fee_type)
|
||||
(worker_create_fee_type)
|
||||
(worker_delete_fee_type)
|
||||
(FEE_TYPE_COUNT)
|
||||
)
|
||||
|
||||
FC_REFLECT( graphene::chain::chain_parameters,
|
||||
(current_fees)
|
||||
(witness_pay_percent_of_accumulated)
|
||||
|
|
|
|||
|
|
@ -108,21 +108,31 @@ bool is_cheap_name( const string& n )
|
|||
|
||||
share_type account_create_operation::calculate_fee( const fee_schedule_type& schedule )const
|
||||
{
|
||||
auto core_fee_required = schedule.at(account_create_fee_type);
|
||||
auto core_fee_required = schedule.account_create_fee;
|
||||
|
||||
uint32_t s = name.size();
|
||||
if( is_cheap_name( name ) ) s = 63;
|
||||
|
||||
FC_ASSERT( s >= 2 );
|
||||
|
||||
if( s <= 8 )
|
||||
core_fee_required = schedule.at(account_create_fee_type+9-s);
|
||||
if( s == 8 )
|
||||
core_fee_required = schedule.account_len8_fee;
|
||||
else if( s == 7 )
|
||||
core_fee_required = schedule.account_len7_fee;
|
||||
else if( s == 6 )
|
||||
core_fee_required = schedule.account_len6_fee;
|
||||
else if( s == 5 )
|
||||
core_fee_required = schedule.account_len5_fee;
|
||||
else if( s == 4 )
|
||||
core_fee_required = schedule.account_len4_fee;
|
||||
else if( s == 3 )
|
||||
core_fee_required = schedule.account_len3_fee;
|
||||
|
||||
return core_fee_required;
|
||||
}
|
||||
share_type account_update_operation::calculate_fee( const fee_schedule_type& schedule )const
|
||||
{
|
||||
return schedule.at(account_create_fee_type);
|
||||
return schedule.account_create_fee;
|
||||
}
|
||||
void account_update_operation::get_required_auth(flat_set<account_id_type>& active_auth_set,
|
||||
flat_set<account_id_type>& owner_auth_set) const
|
||||
|
|
@ -143,7 +153,7 @@ void account_update_operation::validate()const
|
|||
|
||||
share_type asset_create_operation::calculate_fee( const fee_schedule_type& schedule )const
|
||||
{
|
||||
auto core_fee_required = schedule.at(asset_create_fee_type);
|
||||
auto core_fee_required = schedule.asset_create_fee;
|
||||
|
||||
uint32_t s = symbol.size();
|
||||
while( s <= 6 ) { core_fee_required *= 30; ++s; }
|
||||
|
|
@ -153,10 +163,10 @@ share_type asset_create_operation::calculate_fee( const fee_schedule_type& sched
|
|||
|
||||
share_type transfer_operation::calculate_fee( const fee_schedule_type& schedule )const
|
||||
{
|
||||
auto core_fee_required = schedule.at( transfer_fee_type );
|
||||
share_type core_fee_required = schedule.transfer_fee;
|
||||
if( memo )
|
||||
{
|
||||
core_fee_required += share_type((memo->message.size() * schedule.at( data_fee_type ).value)/1024);
|
||||
core_fee_required += share_type((memo->message.size() * schedule.data_fee)/1024);
|
||||
}
|
||||
return core_fee_required;
|
||||
}
|
||||
|
|
@ -207,7 +217,7 @@ void account_create_operation::validate()const
|
|||
|
||||
share_type asset_publish_feed_operation::calculate_fee( const fee_schedule_type& schedule )const
|
||||
{
|
||||
return schedule.at( publish_feed_fee_type );
|
||||
return schedule.publish_feed_fee;
|
||||
}
|
||||
|
||||
void asset_publish_feed_operation::validate()const
|
||||
|
|
@ -278,7 +288,7 @@ void asset_update_operation::validate()const
|
|||
|
||||
share_type asset_update_operation::calculate_fee( const fee_schedule_type& k )const
|
||||
{
|
||||
return k.at( asset_update_fee_type );
|
||||
return k.asset_update_fee;
|
||||
}
|
||||
|
||||
void asset_burn_operation::get_required_auth(flat_set<account_id_type>& active_auth_set, flat_set<account_id_type>&) const
|
||||
|
|
@ -295,7 +305,7 @@ void asset_burn_operation::validate()const
|
|||
|
||||
share_type asset_burn_operation::calculate_fee( const fee_schedule_type& k )const
|
||||
{
|
||||
return k.at( asset_issue_fee_type );
|
||||
return k.asset_issue_fee;
|
||||
}
|
||||
|
||||
void asset_issue_operation::get_required_auth(flat_set<account_id_type>& active_auth_set, flat_set<account_id_type>&) const
|
||||
|
|
@ -313,12 +323,12 @@ void asset_issue_operation::validate()const
|
|||
|
||||
share_type asset_issue_operation::calculate_fee( const fee_schedule_type& k )const
|
||||
{
|
||||
return k.at( asset_issue_fee_type );
|
||||
return k.asset_issue_fee;
|
||||
}
|
||||
|
||||
share_type delegate_create_operation::calculate_fee( const fee_schedule_type& k )const
|
||||
{
|
||||
return k.at( delegate_create_fee_type ) ;
|
||||
return k.delegate_create_fee ;
|
||||
}
|
||||
|
||||
void delegate_create_operation::get_required_auth(flat_set<account_id_type>& active_auth_set, flat_set<account_id_type>&) const
|
||||
|
|
@ -345,7 +355,7 @@ void asset_fund_fee_pool_operation::validate() const
|
|||
|
||||
share_type asset_fund_fee_pool_operation::calculate_fee(const fee_schedule_type& k) const
|
||||
{
|
||||
return k.at( asset_fund_fee_pool_fee_type );
|
||||
return k.asset_fund_fee_pool_fee;
|
||||
}
|
||||
|
||||
void limit_order_create_operation::get_required_auth(flat_set<account_id_type>& active_auth_set, flat_set<account_id_type>&) const
|
||||
|
|
@ -363,7 +373,7 @@ void limit_order_create_operation::validate()const
|
|||
|
||||
share_type limit_order_create_operation::calculate_fee(const fee_schedule_type& k) const
|
||||
{
|
||||
return k.at( limit_order_fee_type );
|
||||
return k.limit_order_fee;
|
||||
}
|
||||
|
||||
void limit_order_cancel_operation::get_required_auth(flat_set<account_id_type>& active_auth_set, flat_set<account_id_type>&) const
|
||||
|
|
@ -378,7 +388,7 @@ void limit_order_cancel_operation::validate()const
|
|||
|
||||
share_type limit_order_cancel_operation::calculate_fee(const fee_schedule_type& k) const
|
||||
{
|
||||
return k.at( limit_order_fee_type );
|
||||
return k.limit_order_fee;
|
||||
}
|
||||
|
||||
void short_order_create_operation::get_required_auth(flat_set<account_id_type>& active_auth_set, flat_set<account_id_type>&) const
|
||||
|
|
@ -396,7 +406,7 @@ void short_order_create_operation::validate()const
|
|||
|
||||
share_type short_order_create_operation::calculate_fee(const fee_schedule_type& k) const
|
||||
{
|
||||
return k.at( short_order_fee_type );
|
||||
return k.short_order_fee;
|
||||
}
|
||||
void short_order_cancel_operation::get_required_auth(flat_set<account_id_type>& active_auth_set, flat_set<account_id_type>&) const
|
||||
{
|
||||
|
|
@ -410,7 +420,7 @@ void short_order_cancel_operation::validate()const
|
|||
|
||||
share_type short_order_cancel_operation::calculate_fee(const fee_schedule_type& k) const
|
||||
{
|
||||
return k.at( short_order_fee_type );
|
||||
return k.short_order_fee;
|
||||
}
|
||||
|
||||
void call_order_update_operation::get_required_auth(flat_set<account_id_type>& active_auth_set, flat_set<account_id_type>&) const
|
||||
|
|
@ -432,7 +442,7 @@ void call_order_update_operation::validate()const
|
|||
|
||||
share_type call_order_update_operation::calculate_fee(const fee_schedule_type& k) const
|
||||
{
|
||||
return k.at( short_order_fee_type );
|
||||
return k.short_order_fee;
|
||||
}
|
||||
|
||||
proposal_create_operation proposal_create_operation::genesis_proposal(const database& db)
|
||||
|
|
@ -514,7 +524,7 @@ void account_transfer_operation::get_required_auth(flat_set<account_id_type>& ac
|
|||
|
||||
share_type account_transfer_operation::calculate_fee( const fee_schedule_type& k )const
|
||||
{
|
||||
return k.at(transfer_fee_type);
|
||||
return k.transfer_fee;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -536,7 +546,7 @@ void witness_withdraw_pay_operation::validate() const
|
|||
|
||||
share_type witness_withdraw_pay_operation::calculate_fee(const fee_schedule_type& k) const
|
||||
{
|
||||
return k.at(witness_withdraw_pay_fee_type);
|
||||
return k.witness_withdraw_pay_fee;
|
||||
}
|
||||
|
||||
void account_whitelist_operation::get_required_auth(flat_set<account_id_type>& active_auth_set, flat_set<account_id_type>&) const
|
||||
|
|
@ -552,7 +562,7 @@ void global_parameters_update_operation::validate() const
|
|||
|
||||
share_type global_parameters_update_operation::calculate_fee(const fee_schedule_type& k) const
|
||||
{
|
||||
return k.at(global_parameters_update_fee_type);
|
||||
return k.global_parameters_update_fee;
|
||||
}
|
||||
|
||||
void witness_create_operation::get_required_auth(flat_set<graphene::chain::account_id_type>& active_auth_set, flat_set<graphene::chain::account_id_type>&) const
|
||||
|
|
@ -567,7 +577,7 @@ void witness_create_operation::validate() const
|
|||
|
||||
share_type witness_create_operation::calculate_fee(const fee_schedule_type& k) const
|
||||
{
|
||||
return k.at(delegate_create_fee_type);
|
||||
return k.delegate_create_fee;
|
||||
}
|
||||
|
||||
void withdraw_permission_update_operation::get_required_auth(flat_set<account_id_type>& active_auth_set, flat_set<account_id_type>&)const
|
||||
|
|
@ -586,7 +596,7 @@ void withdraw_permission_update_operation::validate()const
|
|||
|
||||
share_type withdraw_permission_update_operation::calculate_fee( const fee_schedule_type& schedule )const
|
||||
{
|
||||
return schedule.at( withdraw_permission_update_fee_type );
|
||||
return schedule.withdraw_permission_update_fee;
|
||||
}
|
||||
|
||||
void withdraw_permission_claim_operation::get_required_auth(flat_set<account_id_type>& active_auth_set, flat_set<account_id_type>&)const
|
||||
|
|
@ -603,9 +613,9 @@ void withdraw_permission_claim_operation::validate()const
|
|||
|
||||
share_type withdraw_permission_claim_operation::calculate_fee( const fee_schedule_type& schedule )const
|
||||
{
|
||||
auto core_fee_required = schedule.at( transfer_fee_type );
|
||||
share_type core_fee_required = schedule.transfer_fee;
|
||||
if( memo )
|
||||
core_fee_required += share_type((memo->message.size() * schedule.at( data_fee_type ).value)/1024);
|
||||
core_fee_required += share_type((memo->message.size() * schedule.data_fee)/1024);
|
||||
return core_fee_required;
|
||||
}
|
||||
|
||||
|
|
@ -622,7 +632,7 @@ void withdraw_permission_delete_operation::validate() const
|
|||
|
||||
share_type withdraw_permission_delete_operation::calculate_fee(const fee_schedule_type& k) const
|
||||
{
|
||||
return k.at(withdraw_permission_update_fee_type);
|
||||
return k.withdraw_permission_update_fee;
|
||||
}
|
||||
|
||||
void withdraw_permission_create_operation::get_required_auth(flat_set<account_id_type>& active_auth_set, flat_set<account_id_type>&) const
|
||||
|
|
@ -642,7 +652,7 @@ void withdraw_permission_create_operation::validate() const
|
|||
|
||||
share_type withdraw_permission_create_operation::calculate_fee(const fee_schedule_type& k) const
|
||||
{
|
||||
return k.at(withdraw_permission_update_fee_type);
|
||||
return k.withdraw_permission_update_fee;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -660,7 +670,7 @@ void asset_global_settle_operation::validate()const
|
|||
|
||||
share_type asset_global_settle_operation::calculate_fee( const fee_schedule_type& k )const
|
||||
{
|
||||
return k.at(global_settle_fee_type);
|
||||
return k.global_settle_fee;
|
||||
}
|
||||
|
||||
void asset_settle_operation::get_required_auth(flat_set<account_id_type>& active_auth_set, flat_set<account_id_type>&) const
|
||||
|
|
@ -676,7 +686,7 @@ void asset_settle_operation::validate() const
|
|||
|
||||
share_type asset_settle_operation::calculate_fee(const fee_schedule_type& k) const
|
||||
{
|
||||
return k.at(asset_settle_fee_type);
|
||||
return k.asset_settle_fee;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -698,7 +708,7 @@ void asset_update_bitasset_operation::validate() const
|
|||
|
||||
share_type asset_update_bitasset_operation::calculate_fee(const fee_schedule_type& k) const
|
||||
{
|
||||
return k.at( asset_update_fee_type );
|
||||
return k.asset_update_fee;
|
||||
}
|
||||
|
||||
void asset_update_feed_producers_operation::validate() const
|
||||
|
|
@ -716,7 +726,7 @@ void file_write_operation::validate()const
|
|||
|
||||
share_type file_write_operation::calculate_fee( const fee_schedule_type& k )const
|
||||
{
|
||||
return ((((k.at( file_storage_fee_per_day_type ).value * lease_seconds)/(60*60*24))*file_size)/0xff) + ((data.size() * k.at( data_fee_type ).value)/1024);
|
||||
return ((((k.file_storage_fee_per_day * lease_seconds)/(60*60*24))*file_size)/0xff) + ((data.size() * k.data_fee)/1024);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -728,7 +738,7 @@ void vesting_balance_create_operation::get_required_auth(flat_set<account_id_typ
|
|||
|
||||
share_type vesting_balance_create_operation::calculate_fee( const fee_schedule_type& k )const
|
||||
{
|
||||
return k.at( vesting_balance_create_fee_type );
|
||||
return k.vesting_balance_create_fee;
|
||||
}
|
||||
|
||||
void vesting_balance_create_operation::validate()const
|
||||
|
|
@ -751,7 +761,7 @@ void vesting_balance_withdraw_operation::validate()const
|
|||
|
||||
share_type vesting_balance_withdraw_operation::calculate_fee( const fee_schedule_type& k )const
|
||||
{
|
||||
return k.at( vesting_balance_withdraw_fee_type );
|
||||
return k.vesting_balance_withdraw_fee;
|
||||
}
|
||||
|
||||
void memo_data::set_message( const fc::ecc::private_key& priv,
|
||||
|
|
@ -803,7 +813,7 @@ void custom_operation::validate()const
|
|||
}
|
||||
share_type custom_operation::calculate_fee( const fee_schedule_type& k )const
|
||||
{
|
||||
return (data.size() * k.at( data_fee_type ).value)/1024;
|
||||
return (data.size() * k.data_fee)/1024;
|
||||
}
|
||||
|
||||
void bond_create_offer_operation::get_required_auth( flat_set<account_id_type>& active_auth_set, flat_set<account_id_type>& )const
|
||||
|
|
@ -824,7 +834,7 @@ void bond_create_offer_operation::validate()const
|
|||
|
||||
share_type bond_create_offer_operation::calculate_fee( const fee_schedule_type& schedule )const
|
||||
{
|
||||
return schedule.at( create_bond_offer_fee_type );
|
||||
return schedule.create_bond_offer_fee;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -839,7 +849,7 @@ void bond_cancel_offer_operation::validate()const
|
|||
}
|
||||
share_type bond_cancel_offer_operation::calculate_fee( const fee_schedule_type& k )const
|
||||
{
|
||||
return k.at( cancel_bond_offer_fee_type );
|
||||
return k.cancel_bond_offer_fee;
|
||||
}
|
||||
|
||||
void bond_accept_offer_operation::get_required_auth(flat_set<account_id_type>& active_auth_set, flat_set<account_id_type>&)const
|
||||
|
|
@ -857,7 +867,7 @@ void bond_accept_offer_operation::validate()const
|
|||
|
||||
share_type bond_accept_offer_operation::calculate_fee( const fee_schedule_type& k )const
|
||||
{
|
||||
return k.at( accept_bond_offer_fee_type );
|
||||
return k.accept_bond_offer_fee;
|
||||
}
|
||||
void bond_claim_collateral_operation::get_required_auth(flat_set<account_id_type>& active_auth_set, flat_set<account_id_type>&)const
|
||||
{
|
||||
|
|
@ -874,7 +884,7 @@ void bond_claim_collateral_operation::validate()const
|
|||
|
||||
share_type bond_claim_collateral_operation::calculate_fee( const fee_schedule_type& k )const
|
||||
{
|
||||
return k.at( claim_bond_collateral_fee_type );
|
||||
return k.claim_bond_collateral_fee;
|
||||
}
|
||||
|
||||
void worker_create_operation::get_required_auth(flat_set<account_id_type>& active_auth_set, flat_set<account_id_type>&) const
|
||||
|
|
@ -892,7 +902,7 @@ void worker_create_operation::validate() const
|
|||
|
||||
share_type worker_create_operation::calculate_fee(const fee_schedule_type& k) const
|
||||
{
|
||||
return k.at( worker_create_fee_type );
|
||||
return k.worker_create_fee;
|
||||
}
|
||||
|
||||
string memo_message::serialize() const
|
||||
|
|
@ -911,4 +921,16 @@ memo_message memo_message::deserialize(const string& serial)
|
|||
return result;
|
||||
}
|
||||
|
||||
void account_upgrade_operation::validate() const
|
||||
{
|
||||
FC_ASSERT( fee.amount >= 0 );
|
||||
}
|
||||
|
||||
share_type account_upgrade_operation::calculate_fee(const fee_schedule_type& k) const
|
||||
{
|
||||
if( upgrade_to_lifetime_member )
|
||||
return k.membership_lifetime_fee;
|
||||
return k.membership_annual_fee;
|
||||
}
|
||||
|
||||
} } // namespace graphene::chain
|
||||
|
|
|
|||
|
|
@ -162,6 +162,7 @@ struct operation_get_impacted_accounts
|
|||
add_authority( *o.active );
|
||||
}
|
||||
}
|
||||
void operator()( const account_upgrade_operation& )const {}
|
||||
void operator()( const account_transfer_operation& o )const
|
||||
{
|
||||
_impacted.insert( o.new_owner );
|
||||
|
|
@ -236,12 +237,12 @@ struct operation_get_impacted_accounts
|
|||
|
||||
void operator()( const bond_create_offer_operation& o )const { }
|
||||
void operator()( const bond_cancel_offer_operation& o )const { }
|
||||
void operator()( const bond_accept_offer_operation& o )const {
|
||||
void operator()( const bond_accept_offer_operation& o )const {
|
||||
_impacted.insert( o.borrower );
|
||||
_impacted.insert( o.lender );
|
||||
}
|
||||
void operator()( const bond_claim_collateral_operation& o )const
|
||||
{
|
||||
void operator()( const bond_claim_collateral_operation& o )const
|
||||
{
|
||||
_impacted.insert( o.lender );
|
||||
_impacted.insert( o.claimer );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -670,9 +670,9 @@ void database_fixture::enable_fees(
|
|||
{
|
||||
db.modify(global_property_id_type()(db), [fee](global_property_object& gpo)
|
||||
{
|
||||
for( int i=0; i < FEE_TYPE_COUNT; ++i)
|
||||
gpo.parameters.current_fees.set(i, fee);
|
||||
gpo.parameters.current_fees.set( prime_upgrade_fee_type, 10*fee.value );
|
||||
fc::reflector<fee_schedule_type>::visit(fee_schedule_type::fee_set_visitor{gpo.parameters.current_fees,
|
||||
uint32_t(fee.value)});
|
||||
gpo.parameters.current_fees.membership_annual_fee = 10*fee.value;
|
||||
} );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1867,7 +1867,7 @@ BOOST_AUTO_TEST_CASE( witness_withdraw_pay_test )
|
|||
const asset_object* core = &asset_id_type()(db);
|
||||
const account_object* nathan = &get_account("nathan");
|
||||
enable_fees(100000000);
|
||||
BOOST_CHECK_GT(db.current_fee_schedule().at(prime_upgrade_fee_type).value, 0);
|
||||
BOOST_CHECK_GT(db.current_fee_schedule().membership_lifetime_fee, 0);
|
||||
|
||||
BOOST_CHECK_EQUAL(core->dynamic_asset_data_id(db).accumulated_fees.value, 0);
|
||||
account_update_operation uop;
|
||||
|
|
|
|||
Loading…
Reference in a new issue