Resolve #67: Add name and/or URL to witness/worker/delegate objects

This commit is contained in:
Nathan Hourt 2015-06-29 10:01:42 -04:00
parent 6279515c54
commit f4342d98ae
6 changed files with 34 additions and 22 deletions

View file

@ -39,6 +39,7 @@ object_id_type delegate_create_evaluator::do_apply( const delegate_create_operat
const auto& new_del_object = db().create<delegate_object>( [&]( delegate_object& obj ){
obj.delegate_account = op.delegate_account;
obj.vote_id = vote_id;
obj.url = op.url;
});
return new_del_object.id;
} FC_CAPTURE_AND_RETHROW( (op) ) }

View file

@ -42,8 +42,9 @@ namespace graphene { namespace chain {
static const uint8_t space_id = protocol_ids;
static const uint8_t type_id = delegate_object_type;
account_id_type delegate_account;
vote_id_type vote_id;
account_id_type delegate_account;
vote_id_type vote_id;
string url;
};
struct by_account;
@ -62,5 +63,4 @@ namespace graphene { namespace chain {
} } // graphene::chain
FC_REFLECT_DERIVED( graphene::chain::delegate_object, (graphene::db::object),
(delegate_account)
(vote_id) )
(delegate_account)(vote_id)(url) )

View file

@ -31,12 +31,13 @@ namespace graphene { namespace chain {
static const uint8_t space_id = protocol_ids;
static const uint8_t type_id = witness_object_type;
account_id_type witness_account;
key_id_type signing_key;
secret_hash_type next_secret;
secret_hash_type last_secret;
share_type accumulated_income;
vote_id_type vote_id;
account_id_type witness_account;
key_id_type signing_key;
secret_hash_type next_secret;
secret_hash_type last_secret;
share_type accumulated_income;
vote_id_type vote_id;
string url;
witness_object() : vote_id(vote_id_type::witness) {}
};
@ -62,4 +63,5 @@ FC_REFLECT_DERIVED( graphene::chain::witness_object, (graphene::db::object),
(next_secret)
(last_secret)
(accumulated_income)
(vote_id) )
(vote_id)
(url) )

View file

@ -178,20 +178,24 @@ namespace graphene { namespace chain {
static const uint8_t type_id = worker_object_type;
/// ID of the account which owns this worker
account_id_type worker_account;
account_id_type worker_account;
/// Time at which this worker begins receiving pay, if elected
time_point_sec work_begin_date;
time_point_sec work_begin_date;
/// Time at which this worker will cease to receive pay. Worker will be deleted at this time
time_point_sec work_end_date;
time_point_sec work_end_date;
/// Amount in CORE this worker will be paid each day
share_type daily_pay;
share_type daily_pay;
/// ID of this worker's pay balance
worker_type worker;
worker_type worker;
/// Human-readable name for the worker
string name;
/// URL to a web page representing this worker
string url;
/// Voting ID which represents approval of this worker
vote_id_type vote_for;
vote_id_type vote_for;
/// Voting ID which represents disapproval of this worker
vote_id_type vote_against;
vote_id_type vote_against;
bool is_active(fc::time_point_sec now)const {
return now >= work_begin_date && now <= work_end_date;
@ -221,4 +225,6 @@ FC_REFLECT_DERIVED( graphene::chain::worker_object, (graphene::db::object),
(worker)
(vote_for)
(vote_against)
(name)
(url)
)

View file

@ -38,10 +38,11 @@ object_id_type witness_create_evaluator::do_apply( const witness_create_operatio
});
const auto& new_witness_object = db().create<witness_object>( [&]( witness_object& obj ){
obj.witness_account = op.witness_account;
obj.vote_id = vote_id;
obj.signing_key = op.block_signing_key;
obj.next_secret = op.initial_secret;
obj.witness_account = op.witness_account;
obj.vote_id = vote_id;
obj.signing_key = op.block_signing_key;
obj.next_secret = op.initial_secret;
obj.url = op.url;
});
return new_witness_object.id;
} FC_CAPTURE_AND_RETHROW( (op) ) }

View file

@ -46,6 +46,8 @@ object_id_type worker_create_evaluator::do_apply(const worker_create_evaluator::
w.daily_pay = o.daily_pay;
w.work_begin_date = o.work_begin_date;
w.work_end_date = o.work_end_date;
w.name = o.name;
w.url = o.url;
w.vote_for = for_id;
w.vote_against = against_id;
w.worker.set_which(o.initializer.which());