BitShares-Core  7.0.2
BitShares blockchain node software and command-line wallet 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
FC_CAPTURE_AND_RETHROW
#define FC_CAPTURE_AND_RETHROW(...)
Definition: exception.hpp:479
graphene::db::object::id
object_id_type id
Definition: object.hpp:69
graphene::chain::committee_member_update_evaluator::do_evaluate
void_result do_evaluate(const committee_member_update_operation &o)
Definition: committee_member_evaluator.cpp:56
graphene::chain::database
tracks the blockchain state in an extensible manner
Definition: database.hpp:70
graphene::db::object_database::get
const T & get(const object_id_type &id) const
Definition: object_database.hpp:119
database.hpp
graphene::chain::committee_member_update_evaluator::do_apply
void_result do_apply(const committee_member_update_operation &o)
Definition: committee_member_evaluator.cpp:62
graphene::protocol::committee_member_create_operation::committee_member_account
account_id_type committee_member_account
The account which owns the committee_member. This account pays the fee for this operation.
Definition: committee_member.hpp:44
fee_schedule.hpp
graphene::protocol::committee_member_create_operation
Create a committee_member object, as a bid to hold a committee_member seat on the network.
Definition: committee_member.hpp:38
graphene::db::object_database::create
const T & create(F &&constructor)
Definition: object_database.hpp:63
graphene::chain::committee_member_update_global_parameters_evaluator::do_apply
void_result do_apply(const committee_member_update_global_parameters_operation &o)
Definition: committee_member_evaluator.cpp:83
graphene::protocol::committee_member_update_operation
Update a committee_member object.
Definition: committee_member.hpp:58
graphene::protocol::vote_id_type
An ID for some votable object.
Definition: vote.hpp:51
graphene::protocol::committee_member_update_operation::committee_member_account
account_id_type committee_member_account
The account which owns the committee_member. This account pays the fee for this operation.
Definition: committee_member.hpp:66
committee_member_evaluator.hpp
graphene::protocol::vote_id_type::committee
@ committee
Definition: vote.hpp:60
graphene::chain::transaction_evaluation_state::_is_proposed_trx
bool _is_proposed_trx
Definition: transaction_evaluation_state.hpp:49
graphene::chain::committee_member_create_evaluator::do_evaluate
void_result do_evaluate(const committee_member_create_operation &o)
Definition: committee_member_evaluator.cpp:35
account_object.hpp
graphene::protocol::committee_member_update_global_parameters_operation::new_parameters
chain_parameters new_parameters
Definition: committee_member.hpp:89
graphene::protocol::committee_member_create_operation::url
string url
Definition: committee_member.hpp:45
committee_member_object.hpp
vote.hpp
graphene::chain::generic_evaluator::db
database & db() const
Definition: evaluator.cpp:39
graphene::protocol::committee_member_update_global_parameters_operation
Used by committee_members to update the global parameters of the blockchain.
Definition: committee_member.hpp:84
FC_ASSERT
#define FC_ASSERT(TEST,...)
Checks a condition and throws an assert_exception if the test is FALSE.
Definition: exception.hpp:345
graphene::db::object_id_type
Definition: object_id.hpp:30
graphene::chain::global_property_object::next_available_vote_id
uint32_t next_available_vote_id
Definition: global_property_object.hpp:47
graphene::chain::committee_member_update_global_parameters_evaluator::do_evaluate
void_result do_evaluate(const committee_member_update_global_parameters_operation &o)
Definition: committee_member_evaluator.cpp:75
graphene::chain::global_property_object
Maintains global state information (committee_member list, current fees)
Definition: global_property_object.hpp:40
graphene::chain::committee_member_create_evaluator::do_apply
object_id_type do_apply(const committee_member_create_operation &o)
Definition: committee_member_evaluator.cpp:41
graphene::protocol::committee_member_update_operation::committee_member
committee_member_id_type committee_member
The committee member to update.
Definition: committee_member.hpp:64
transaction_evaluation_state.hpp
graphene::chain::global_property_object::pending_parameters
optional< chain_parameters > pending_parameters
Definition: global_property_object.hpp:45
graphene::protocol::void_result
Definition: base.hpp:86
graphene
Definition: api.cpp:48
graphene::db::object_database::modify
void modify(const T &obj, const Lambda &m)
Definition: object_database.hpp:99
graphene::chain::generic_evaluator::trx_state
transaction_evaluation_state * trx_state
Definition: evaluator.hpp:120
graphene::chain::committee_member_object
tracks information about a committee_member account.
Definition: committee_member_object.hpp:43