BitShares-Core  4.0.0
BitShares blockchain implementation and command-line interface software
committee_member_evaluator.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Cryptonomex, Inc., and contributors.
3  *
4  * The MIT License
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to deal
8  * in the Software without restriction, including without limitation the rights
9  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  * copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22  * THE SOFTWARE.
23  */
27 #include <graphene/chain/hardfork.hpp>
32 
33 namespace graphene { namespace chain {
34 
36 { try {
37  FC_ASSERT(db().get(op.committee_member_account).is_lifetime_member());
38  return void_result();
39 } FC_CAPTURE_AND_RETHROW( (op) ) }
40 
42 { try {
43  vote_id_type vote_id;
44  db().modify(db().get_global_properties(), [&vote_id](global_property_object& p) {
46  });
47 
48  const auto& new_del_object = db().create<committee_member_object>( [&]( committee_member_object& obj ){
49  obj.committee_member_account = op.committee_member_account;
50  obj.vote_id = vote_id;
51  obj.url = op.url;
52  });
53  return new_del_object.id;
54 } FC_CAPTURE_AND_RETHROW( (op) ) }
55 
57 { try {
58  FC_ASSERT(db().get(op.committee_member).committee_member_account == op.committee_member_account);
59  return void_result();
60 } FC_CAPTURE_AND_RETHROW( (op) ) }
61 
63 { try {
64  database& _db = db();
65  _db.modify(
66  _db.get(op.committee_member),
67  [&]( committee_member_object& com )
68  {
69  if( op.new_url.valid() )
70  com.url = *op.new_url;
71  });
72  return void_result();
73 } FC_CAPTURE_AND_RETHROW( (op) ) }
74 
77 { try {
79 
80  return void_result();
81 } FC_CAPTURE_AND_RETHROW( (o) ) }
82 
85 { try {
86  db().modify(db().get_global_properties(), [&o](global_property_object& p) {
88  });
89 
90  return void_result();
91 } FC_CAPTURE_AND_RETHROW( (o) ) }
92 
93 } } // graphene::chain
Create a committee_member object, as a bid to hold a committee_member seat on the network...
void modify(const T &obj, const Lambda &m)
void_result do_evaluate(const committee_member_update_operation &o)
Update a committee_member object.Currently the only field which can be updated is the url field...
void_result do_apply(const committee_member_update_operation &o)
tracks the blockchain state in an extensible manner
Definition: database.hpp:70
Definition: api.cpp:56
void_result do_evaluate(const committee_member_create_operation &o)
committee_member_id_type committee_member
The committee member to update.
object_id_type do_apply(const committee_member_create_operation &o)
bool valid() const
Definition: optional.hpp:186
const T & get(object_id_type id) const
account_id_type committee_member_account
The account which owns the committee_member. This account pays the fee for this operation.
object_id_type id
Definition: object.hpp:73
void_result do_evaluate(const committee_member_update_global_parameters_operation &o)
#define FC_CAPTURE_AND_RETHROW(...)
Definition: exception.hpp:478
#define FC_ASSERT(TEST,...)
Checks a condition and throws an assert_exception if the test is FALSE.
Definition: exception.hpp:345
An ID for some votable object.
Definition: vote.hpp:51
account_id_type committee_member_account
The account which owns the committee_member. This account pays the fee for this operation.
Maintains global state information (committee_member list, current fees)This is an implementation det...
void_result do_apply(const committee_member_update_global_parameters_operation &o)
Used by committee_members to update the global parameters of the blockchain.This operation allows the...
tracks information about a committee_member account.A committee_member is responsible for setting blo...
const T & create(F &&constructor)
optional< chain_parameters > pending_parameters
transaction_evaluation_state * trx_state
Definition: evaluator.hpp:120