BitShares-Core  7.0.2
BitShares blockchain node software and command-line wallet software
Classes
Implementations of the various worker types in the system

The system has various worker types, which do different things with the money they are paid. These worker types and their semantics are specified here. More...

Classes

struct  graphene::chain::refund_worker_type
 A worker who returns all of his pay to the reserve. More...
 
struct  graphene::chain::vesting_balance_worker_type
 A worker who sends his pay to a vesting balance. More...
 
struct  graphene::chain::burn_worker_type
 A worker who permanently destroys all of his pay. More...
 

Detailed Description

The system has various worker types, which do different things with the money they are paid. These worker types and their semantics are specified here.

All worker types exist as a struct containing the data this worker needs to evaluate, as well as a method pay_worker, which takes a pay amount and a non-const database reference, and applies the worker's specific pay semantics to the worker_type struct and/or the database. Furthermore, all worker types have an initializer, which is a struct containing the data needed to create that kind of worker.

Each initializer type has a method, init, which takes a non-const database reference, a const reference to the worker object being created, and a non-const reference to the specific *_worker_type object to initialize. The init method creates any further objects, and initializes the worker_type object as necessary according to the semantics of that particular worker type.

To create a new worker type, define a my_new_worker_type struct with a pay_worker method which updates the my_new_worker_type object and/or the database. Create a my_new_worker_type::initializer struct with an init method and any data members necessary to create a new worker of this type. Reflect my_new_worker_type and my_new_worker_type::initializer into FC's type system, and add them to worker_type and worker_initializer respectively. Make sure the order of types in worker_type and worker_initializer remains the same.