forked from PBSA/peerplays
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
988a177
commit b3786b3
Showing
12 changed files
with
409 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#include <graphene/chain/btc-sidechain/son_operations_evaluator.hpp> | ||
|
||
#include <graphene/chain/database.hpp> | ||
#include <graphene/chain/btc-sidechain/son.hpp> | ||
|
||
namespace graphene { namespace chain { | ||
|
||
void_result create_son_evaluator::do_evaluate(const create_son_operation& op) | ||
{ try{ | ||
FC_ASSERT(db().get(op.owner_account).is_lifetime_member(), "Only Lifetime members may register a SON."); | ||
return void_result(); | ||
} FC_CAPTURE_AND_RETHROW( (op) ) } | ||
|
||
object_id_type create_son_evaluator::do_apply(const create_son_operation& op) | ||
{ try { | ||
vote_id_type vote_id; | ||
db().modify(db().get_global_properties(), [&vote_id](global_property_object& p) { | ||
vote_id = get_next_vote_id(p, vote_id_type::son); | ||
}); | ||
|
||
const auto& new_son_object = db().create<son_member_object>( [&]( son_member_object& obj ){ | ||
obj.son_member_account = op.owner_account; | ||
obj.vote_id = vote_id; | ||
obj.url = op.url; | ||
}); | ||
return new_son_object.id; | ||
} FC_CAPTURE_AND_RETHROW( (op) ) } | ||
|
||
void_result delete_son_evaluator::do_evaluate(const delete_son_operation& op) | ||
{ try { | ||
database& d = db(); | ||
const auto& idx = d.get_index_type<son_member_index>().indices().get<by_account>(); | ||
FC_ASSERT( idx.find(op.owner_account) != idx.end() ); | ||
return void_result(); | ||
} FC_CAPTURE_AND_RETHROW( (op) ) } | ||
|
||
void_result delete_son_evaluator::do_apply(const delete_son_operation& op) | ||
{ try { | ||
const auto& idx = db().get_index_type<son_member_index>().indices().get<by_account>(); | ||
db().remove(*idx.find(op.owner_account)); | ||
return void_result(); | ||
} FC_CAPTURE_AND_RETHROW( (op) ) } | ||
|
||
} } // namespace graphene::chain | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.