diff --git a/libraries/chain/include/graphene/chain/config.hpp b/libraries/chain/include/graphene/chain/config.hpp index b7ea145d..2aa1b1ab 100644 --- a/libraries/chain/include/graphene/chain/config.hpp +++ b/libraries/chain/include/graphene/chain/config.hpp @@ -130,9 +130,14 @@ * 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)) +/// Represents the current witnesses #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)) +/// Represents the canonical account with NO authority (nobody can access funds in null account) #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)) ///@} diff --git a/libraries/chain/include/graphene/chain/worker_object.hpp b/libraries/chain/include/graphene/chain/worker_object.hpp index fe9fe842..3204c8b3 100644 --- a/libraries/chain/include/graphene/chain/worker_object.hpp +++ b/libraries/chain/include/graphene/chain/worker_object.hpp @@ -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 { @@ -92,16 +92,37 @@ namespace graphene { namespace chain { 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. typedef static_variant< refund_worker_type, - vesting_balance_worker_type + vesting_balance_worker_type, + burn_worker_type > worker_type; typedef static_variant< refund_worker_type::initializer, - vesting_balance_worker_type::initializer + vesting_balance_worker_type::initializer, + burn_worker_type::initializer > worker_initializer; /// @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::vesting_balance_worker_type, (balance) ) 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_initializer ) FC_REFLECT_DERIVED( graphene::chain::worker_object, (graphene::db::object), diff --git a/libraries/chain/worker_object.cpp b/libraries/chain/worker_object.cpp index dcb8554b..4f7a6801 100644 --- a/libraries/chain/worker_object.cpp +++ b/libraries/chain/worker_object.cpp @@ -50,4 +50,10 @@ void vesting_balance_worker_type::initializer::init(database& db, const worker_o }).id; } +void burn_worker_type::pay_worker(share_type pay, database& db) +{ + total_burned += pay; + db.adjust_balance( GRAPHENE_NULL_ACCOUNT, pay ); +} + } } // graphene::chain