wip burn worker
This commit is contained in:
parent
08cba191c7
commit
548c760e46
3 changed files with 38 additions and 4 deletions
|
|
@ -130,9 +130,14 @@
|
||||||
* Reserved Account IDs with special meaning
|
* Reserved Account IDs with special meaning
|
||||||
*/
|
*/
|
||||||
///@{
|
///@{
|
||||||
|
/// Represents the current committee members, two-week review period (GRAPHENE_DEFAULT_GENESIS_PROPOSAL_REVIEW_PERIOD_SEC)
|
||||||
#define GRAPHENE_COMMITTEE_ACCOUNT (graphene::chain::account_id_type(0))
|
#define GRAPHENE_COMMITTEE_ACCOUNT (graphene::chain::account_id_type(0))
|
||||||
|
/// Represents the current witnesses
|
||||||
#define GRAPHENE_WITNESS_ACCOUNT (graphene::chain::account_id_type(1))
|
#define GRAPHENE_WITNESS_ACCOUNT (graphene::chain::account_id_type(1))
|
||||||
|
/// Represents the current committee members
|
||||||
#define GRAPHENE_RELAXED_COMMITTEE_ACCOUNT (graphene::chain::account_id_type(2))
|
#define GRAPHENE_RELAXED_COMMITTEE_ACCOUNT (graphene::chain::account_id_type(2))
|
||||||
|
/// Represents the canonical account with NO authority (nobody can access funds in null account)
|
||||||
#define GRAPHENE_NULL_ACCOUNT (graphene::chain::account_id_type(3))
|
#define GRAPHENE_NULL_ACCOUNT (graphene::chain::account_id_type(3))
|
||||||
|
/// Represents the canonical account with WILDCARD authority (anybody can access funds in temp account)
|
||||||
#define GRAPHENE_TEMP_ACCOUNT (graphene::chain::account_id_type(4))
|
#define GRAPHENE_TEMP_ACCOUNT (graphene::chain::account_id_type(4))
|
||||||
///@}
|
///@}
|
||||||
|
|
|
||||||
|
|
@ -52,9 +52,9 @@ namespace graphene { namespace chain {
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* @brief A worker who burns all of his pay
|
* @brief A worker who returns all of his pay to the reserve
|
||||||
*
|
*
|
||||||
* This worker type burns all pay he receives, paying it back to the network's reserve funds pool.
|
* This worker type pays everything he receives back to the network's reserve funds pool.
|
||||||
*/
|
*/
|
||||||
struct refund_worker_type
|
struct refund_worker_type
|
||||||
{
|
{
|
||||||
|
|
@ -92,16 +92,37 @@ namespace graphene { namespace chain {
|
||||||
uint16_t pay_vesting_period_days;
|
uint16_t pay_vesting_period_days;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief A worker who permanently destroys all of his pay
|
||||||
|
*
|
||||||
|
* This worker sends all pay he receives to the null account.
|
||||||
|
*/
|
||||||
|
struct burn_worker_type
|
||||||
|
{
|
||||||
|
/// Record of how much this worker has burned in his lifetime
|
||||||
|
share_type total_burned;
|
||||||
|
|
||||||
|
void pay_worker(share_type pay, database&);
|
||||||
|
|
||||||
|
struct initializer
|
||||||
|
{
|
||||||
|
void init(database&, const worker_object&, burn_worker_type& worker)const
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
};
|
||||||
///@}
|
///@}
|
||||||
|
|
||||||
// The ordering of types in these two static variants MUST be the same.
|
// The ordering of types in these two static variants MUST be the same.
|
||||||
typedef static_variant<
|
typedef static_variant<
|
||||||
refund_worker_type,
|
refund_worker_type,
|
||||||
vesting_balance_worker_type
|
vesting_balance_worker_type,
|
||||||
|
burn_worker_type
|
||||||
> worker_type;
|
> worker_type;
|
||||||
typedef static_variant<
|
typedef static_variant<
|
||||||
refund_worker_type::initializer,
|
refund_worker_type::initializer,
|
||||||
vesting_balance_worker_type::initializer
|
vesting_balance_worker_type::initializer,
|
||||||
|
burn_worker_type::initializer
|
||||||
> worker_initializer;
|
> worker_initializer;
|
||||||
|
|
||||||
/// @brief A visitor for @ref worker_type which initializes the worker within
|
/// @brief A visitor for @ref worker_type which initializes the worker within
|
||||||
|
|
@ -188,6 +209,8 @@ FC_REFLECT( graphene::chain::refund_worker_type, (total_burned) )
|
||||||
FC_REFLECT( graphene::chain::refund_worker_type::initializer, )
|
FC_REFLECT( graphene::chain::refund_worker_type::initializer, )
|
||||||
FC_REFLECT( graphene::chain::vesting_balance_worker_type, (balance) )
|
FC_REFLECT( graphene::chain::vesting_balance_worker_type, (balance) )
|
||||||
FC_REFLECT( graphene::chain::vesting_balance_worker_type::initializer, (pay_vesting_period_days) )
|
FC_REFLECT( graphene::chain::vesting_balance_worker_type::initializer, (pay_vesting_period_days) )
|
||||||
|
FC_REFLECT( graphene::chain::burn_worker_type, (total_burned) )
|
||||||
|
FC_REFLECT( graphene::chain::burn_worker_type::initializer, )
|
||||||
FC_REFLECT_TYPENAME( graphene::chain::worker_type )
|
FC_REFLECT_TYPENAME( graphene::chain::worker_type )
|
||||||
FC_REFLECT_TYPENAME( graphene::chain::worker_initializer )
|
FC_REFLECT_TYPENAME( graphene::chain::worker_initializer )
|
||||||
FC_REFLECT_DERIVED( graphene::chain::worker_object, (graphene::db::object),
|
FC_REFLECT_DERIVED( graphene::chain::worker_object, (graphene::db::object),
|
||||||
|
|
|
||||||
|
|
@ -50,4 +50,10 @@ void vesting_balance_worker_type::initializer::init(database& db, const worker_o
|
||||||
}).id;
|
}).id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void burn_worker_type::pay_worker(share_type pay, database& db)
|
||||||
|
{
|
||||||
|
total_burned += pay;
|
||||||
|
db.adjust_balance( GRAPHENE_NULL_ACCOUNT, pay );
|
||||||
|
}
|
||||||
|
|
||||||
} } // graphene::chain
|
} } // graphene::chain
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue