Graphene Updates and DApp Support #643

Closed
nathanielhourt wants to merge 84 commits from dapp-support into develop
357 changed files with 3985 additions and 3480 deletions
Showing only changes of commit 2da369453e - Show all commits

4
.gitignore vendored
View file

@ -1,6 +1,10 @@
*.a
*.sw*
/build
/build-*
CMakeLists.txt.user
*.cmake
CMakeCache.txt
CMakeFiles

2
.gitmodules vendored
View file

@ -4,6 +4,6 @@
ignore = dirty
[submodule "libraries/fc"]
path = libraries/fc
url = https://github.com/peerplays-network/peerplays-fc.git
url = https://github.com/nathanhourt/peerplays-fc
branch = latest-fc
ignore = dirty

View file

@ -8,6 +8,15 @@ set( CLI_CLIENT_EXECUTABLE_NAME graphene_client )
set( GUI_CLIENT_EXECUTABLE_NAME Peerplays )
set( CUSTOM_URL_SCHEME "gcs" )
set( INSTALLER_APP_ID "68ad7005-8eee-49c9-95ce-9eed97e5b347" )
set( CMAKE_CXX_STANDARD 14 )
set( GRAPHENE_BUILD_DYNAMIC_LIBRARIES OFF CACHE BOOL
"Whether to build dynamic libraries instead of static. Applies only to chain, db, protocol, net, and utilities" )
if( GRAPHENE_BUILD_DYNAMIC_LIBRARIES )
set( CMAKE_POSITION_INDEPENDENT_CODE ON )
set( CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" )
endif()
set( FC_BUILD_DYNAMIC_LIBRARIES ${GRAPHENE_BUILD_DYNAMIC_LIBRARIES} CACHE BOOL "Whether FC should build as a dynamic library rather than static" )
# http://stackoverflow.com/a/18369825
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
@ -83,13 +92,17 @@ LIST(APPEND BOOST_COMPONENTS thread
system
filesystem
program_options
signals
serialization
chrono
unit_test_framework
context
locale)
SET( Boost_USE_STATIC_LIBS ON CACHE STRING "ON or OFF" )
IF( ${GRAPHENE_BUILD_DYNAMIC_LIBRARIES} )
SET( Boost_USE_STATIC_LIBS OFF CACHE STRING "ON or OFF" )
ELSE()
SET( Boost_USE_STATIC_LIBS ON CACHE STRING "ON or OFF" )
ENDIF()
IF( WIN32 )
SET(BOOST_ROOT $ENV{BOOST_ROOT})
@ -143,11 +156,11 @@ else( WIN32 ) # Apple AND Linux
if( APPLE )
# Apple Specific Options Here
message( STATUS "Configuring Peerplays on OS X" )
set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -std=c++11 -stdlib=libc++ -Wall" )
set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -stdlib=libc++ -Wall" )
else( APPLE )
# Linux Specific Options Here
message( STATUS "Configuring Peerplays on Linux" )
set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -std=c++11 -Wall" )
set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wall" )
set( rt_library rt )
#set( pthread_library pthread)
set(CMAKE_LINKER_FLAGS "-pthread" CACHE STRING "Linker Flags" FORCE)

View file

@ -5,6 +5,6 @@ add_subdirectory( egenesis )
add_subdirectory( fc )
add_subdirectory( net )
add_subdirectory( plugins )
add_subdirectory( time )
add_subdirectory( utilities )
add_subdirectory( wallet )
add_subdirectory( protocol )

View file

@ -12,10 +12,11 @@ add_library( graphene_app
)
# need to link graphene_debug_witness because plugins aren't sufficiently isolated #246
#target_link_libraries( graphene_app graphene_market_history graphene_account_history graphene_chain fc graphene_db graphene_net graphene_utilities graphene_debug_witness )
target_link_libraries( graphene_app
PUBLIC graphene_net graphene_utilities
graphene_account_history graphene_accounts_list graphene_affiliate_stats graphene_bookie graphene_debug_witness graphene_elasticsearch graphene_es_objects graphene_generate_genesis graphene_market_history )
PUBLIC graphene_chain graphene_net graphene_utilities
fc graphene_db peerplays_sidechain
graphene_account_history graphene_accounts_list graphene_affiliate_stats graphene_bookie graphene_debug_witness graphene_elasticsearch
graphene_es_objects graphene_generate_genesis graphene_market_history )
target_include_directories( graphene_app
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include"
@ -43,7 +44,7 @@ add_library( graphene_plugin
)
target_link_libraries( graphene_plugin
PUBLIC graphene_net graphene_utilities )
PUBLIC graphene_chain graphene_net graphene_utilities )
target_include_directories( graphene_plugin
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" )

View file

@ -29,14 +29,16 @@
#include <graphene/chain/confidential_object.hpp>
#include <graphene/chain/database.hpp>
#include <graphene/chain/get_config.hpp>
#include <graphene/utilities/key_conversion.hpp>
#include <graphene/protocol/fee_schedule.hpp>
#include <graphene/chain/confidential_object.hpp>
#include <graphene/chain/market_object.hpp>
#include <graphene/chain/protocol/fee_schedule.hpp>
#include <graphene/chain/tournament_object.hpp>
#include <graphene/chain/transaction_object.hpp>
#include <graphene/chain/transaction_history_object.hpp>
#include <graphene/chain/withdraw_permission_object.hpp>
#include <graphene/chain/worker_object.hpp>
#include <graphene/utilities/key_conversion.hpp>
#include <fc/crypto/base64.hpp>
#include <fc/crypto/hex.hpp>
#include <fc/rpc/api_connection.hpp>
#include <fc/thread/future.hpp>
@ -144,7 +146,7 @@ void network_broadcast_api::on_applied_block(const signed_block &b) {
if (itr != _callbacks.end()) {
auto block_num = b.block_num();
auto &callback = _callbacks.find(id)->second;
fc::async([capture_this, this, id, block_num, trx_num, trx, callback]() {
fc::async([capture_this, id, block_num, trx_num, trx, callback]() {
callback(fc::variant(transaction_confirmation{id, block_num, trx_num, trx},
GRAPHENE_MAX_NESTED_OBJECTS));
});
@ -164,7 +166,7 @@ void network_broadcast_api::broadcast_transaction(const signed_transaction &trx)
fc::variant network_broadcast_api::broadcast_transaction_synchronous(const signed_transaction &trx) {
_app.chain_database()->check_transaction_for_duplicated_operations(trx);
fc::promise<fc::variant>::ptr prom(new fc::promise<fc::variant>());
fc::promise<fc::variant>::ptr prom(fc::promise<fc::variant>::create());
broadcast_transaction_with_callback([=](const fc::variant &v) {
prom->set_value(v);
},

View file

@ -26,8 +26,10 @@
#include <graphene/app/application.hpp>
#include <graphene/app/plugin.hpp>
#include <graphene/chain/protocol/fee_schedule.hpp>
#include <graphene/chain/protocol/types.hpp>
#include <graphene/chain/db_with.hpp>
#include <graphene/chain/genesis_state.hpp>
#include <graphene/protocol/fee_schedule.hpp>
#include <graphene/protocol/types.hpp>
#include <graphene/egenesis/egenesis.hpp>
@ -306,10 +308,10 @@ public:
auto initial_state = [this] {
ilog("Initializing database...");
if (_options->count("genesis-json")) {
std::string genesis_str;
fc::read_file_contents(_options->at("genesis-json").as<boost::filesystem::path>(), genesis_str);
genesis_state_type genesis = fc::json::from_string(genesis_str).as<genesis_state_type>(20);
if( _options->count("genesis-json") )
{
genesis_state_type genesis = fc::json::from_file( _options->at("genesis-json").as<boost::filesystem::path>()).as<genesis_state_type>( 20 );
std::string genesis_str = fc::json::to_string(genesis) + "\n";
bool modified_genesis = false;
if (_options->count("genesis-timestamp")) {
genesis.initial_timestamp = fc::time_point_sec(fc::time_point::now()) + genesis.initial_parameters.block_interval + _options->at("genesis-timestamp").as<uint32_t>();
@ -359,7 +361,7 @@ public:
if (_options->count("enable-standby-votes-tracking")) {
_chain_db->enable_standby_votes_tracking(_options->at("enable-standby-votes-tracking").as<bool>());
}
std::string replay_reason = "reason not provided";
if (_options->count("replay-blockchain"))

View file

@ -198,7 +198,7 @@ static void load_config_file(const fc::path &config_ini_path, const bpo::options
bpo::variables_map &options) {
deduplicator dedup;
bpo::options_description unique_options("Graphene Witness Node");
for (const boost::shared_ptr<bpo::option_description> opt : cfg_options.options()) {
for( const boost::shared_ptr<bpo::option_description>& opt : cfg_options.options() ) {
const boost::shared_ptr<bpo::option_description> od = dedup.next(opt);
if (!od)
continue;
@ -241,8 +241,8 @@ static void create_new_config_file(const fc::path &config_ini_path, const fc::pa
};
deduplicator dedup(modify_option_defaults);
std::ofstream out_cfg(config_ini_path.preferred_string());
std::string plugin_header_surrounding(78, '=');
for (const boost::shared_ptr<bpo::option_description> opt : cfg_options.options()) {
std::string plugin_header_surrounding( 78, '=' );
for( const boost::shared_ptr<bpo::option_description>& opt : cfg_options.options() ) {
const boost::shared_ptr<bpo::option_description> od = dedup.next(opt);
if (!od)
continue;

View file

@ -23,11 +23,14 @@
*/
#include <graphene/app/database_api.hpp>
#include <graphene/chain/account_object.hpp>
#include <graphene/chain/get_config.hpp>
#include <graphene/chain/protocol/address.hpp>
#include <graphene/chain/pts_address.hpp>
#include <graphene/chain/hardfork.hpp>
#include <graphene/chain/tournament_object.hpp>
#include <graphene/chain/get_config.hpp>
#include <graphene/protocol/address.hpp>
#include <graphene/protocol/pts_address.hpp>
#include <fc/bloom_filter.hpp>
@ -2362,10 +2365,9 @@ graphene::app::gpos_info database_api_impl::get_gpos_info(const account_id_type
}
vector<vesting_balance_object> account_vbos;
const time_point_sec now = _db.head_block_time();
auto vesting_range = _db.get_index_type<vesting_balance_index>().indices().get<by_account>().equal_range(account);
std::for_each(vesting_range.first, vesting_range.second,
[&account_vbos, now](const vesting_balance_object &balance) {
[&account_vbos](const vesting_balance_object &balance) {
if (balance.balance.amount > 0 && balance.balance_type == vesting_balance_type::gpos && balance.balance.asset_id == asset_id_type())
account_vbos.emplace_back(balance);
});

View file

@ -25,8 +25,8 @@
#include <graphene/app/database_api.hpp>
#include <graphene/chain/protocol/confidential.hpp>
#include <graphene/chain/protocol/types.hpp>
#include <graphene/protocol/types.hpp>
#include <graphene/protocol/confidential.hpp>
#include <graphene/accounts_list/accounts_list_plugin.hpp>
#include <graphene/market_history/market_history_plugin.hpp>

View file

@ -25,7 +25,7 @@
#include <graphene/app/full_account.hpp>
#include <graphene/chain/protocol/types.hpp>
#include <graphene/protocol/types.hpp>
#include <graphene/chain/database.hpp>

View file

@ -24,9 +24,11 @@
#pragma once
#include <graphene/chain/account_object.hpp>
#include <graphene/chain/market_object.hpp>
#include <graphene/chain/market_evaluator.hpp>
#include <graphene/chain/vesting_balance_object.hpp>
#include <graphene/chain/withdraw_permission_object.hpp>
#include <graphene/chain/proposal_object.hpp>
namespace graphene { namespace app {
using namespace graphene::chain;

View file

@ -23,7 +23,7 @@
*/
#include <graphene/app/plugin.hpp>
#include <graphene/chain/protocol/fee_schedule.hpp>
#include <graphene/protocol/fee_schedule.hpp>
namespace graphene { namespace app {

View file

@ -6,31 +6,33 @@ set_source_files_properties( "${CMAKE_CURRENT_BINARY_DIR}/include/graphene/chain
add_dependencies( build_hardfork_hpp cat-parts )
file(GLOB HEADERS "include/graphene/chain/*.hpp")
file(GLOB PROTOCOL_HEADERS "include/graphene/chain/protocol/*.hpp")
list(APPEND HEADERS "${CMAKE_CURRENT_BINARY_DIR}/include/graphene/chain/hardfork.hpp")
file(GLOB CPP_FILES "*.cpp")
file(GLOB PROTOCOL_CPP_FILES "protocol/*.cpp")
#if( GRAPHENE_DISABLE_UNITY_BUILD )
list(FILTER CPP_FILES EXCLUDE REGEX "[/]database[.]cpp$")
#message ("--- ${CPP_FILES}")
message( STATUS "Graphene database unity build disabled" )
#else( GRAPHENE_DISABLE_UNITY_BUILD )
# list(FILTER CPP_FILES EXCLUDE REGEX ".*db_.*[.]cpp$")
# #message ("--- ${CPP_FILES}")
# set( GRAPHENE_DB_FILES
# database.cpp )
# message( STATUS "Graphene database unity build enabled" )
#endif( GRAPHENE_DISABLE_UNITY_BUILD )
add_library( graphene_chain
${CPP_FILES}
${PROTOCOL_CPP_FILES}
${HEADERS}
${PROTOCOL_HEADERS}
"${CMAKE_CURRENT_BINARY_DIR}/include/graphene/chain/hardfork.hpp"
)
set( GRAPHENE_CHAIN_FILES
${CPP_FILES}
${HEADERS}
"${CMAKE_CURRENT_BINARY_DIR}/include/graphene/chain/hardfork.hpp"
)
if (NOT ${GRAPHENE_BUILD_DYNAMIC_LIBRARIES})
add_library( graphene_chain ${GRAPHENE_CHAIN_FILES} )
else()
add_library( graphene_chain SHARED ${GRAPHENE_CHAIN_FILES} )
endif()
add_dependencies( graphene_chain build_hardfork_hpp )
target_link_libraries( graphene_chain graphene_db )
target_link_libraries( graphene_chain fc graphene_db graphene_protocol )
target_include_directories( graphene_chain
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_BINARY_DIR}/include" )
@ -46,4 +48,3 @@ INSTALL( TARGETS
ARCHIVE DESTINATION lib
)
INSTALL( FILES ${HEADERS} DESTINATION "include/graphene/chain" )
INSTALL( FILES ${PROTOCOL_HEADERS} DESTINATION "include/graphene/chain/protocol" )

View file

@ -214,7 +214,7 @@ object_id_type account_create_evaluator::do_apply( const account_create_operatio
if( dynamic_properties.accounts_registered_this_interval % global_properties.parameters.accounts_per_fee_scale == 0
&& global_properties.parameters.account_fee_scale_bitshifts != 0 )
{
d.modify(global_properties, [&dynamic_properties](global_property_object& p) {
d.modify(global_properties, [](global_property_object& p) {
p.parameters.current_fees->get<account_create_operation>().basic_fee <<= p.parameters.account_fee_scale_bitshifts;
});
}

View file

@ -36,10 +36,10 @@ share_type cut_fee(share_type a, uint16_t p)
if( p == GRAPHENE_100_PERCENT )
return a;
fc::uint128 r(a.value);
fc::uint128_t r = a.value;
r *= p;
r /= GRAPHENE_100_PERCENT;
return r.to_uint64();
return r;
}
void account_balance_object::adjust_balance(const asset& delta)
@ -142,7 +142,12 @@ set<address> account_member_index::get_address_members(const account_object& a)c
return result;
}
void account_member_index::object_inserted(const object& obj)
void account_member_index::object_loaded(const object& obj)
{
object_created(obj);
}
void account_member_index::object_created(const object& obj)
{
assert( dynamic_cast<const account_object*>(&obj) ); // for debug only
const account_object& a = static_cast<const account_object&>(obj);
@ -256,7 +261,10 @@ void account_member_index::object_modified(const object& after)
}
void account_referrer_index::object_inserted( const object& obj )
void account_referrer_index::object_loaded( const object& obj )
{
}
void account_referrer_index::object_created( const object& obj )
{
}
void account_referrer_index::object_removed( const object& obj )
@ -272,7 +280,12 @@ void account_referrer_index::object_modified( const object& after )
const uint8_t balances_by_account_index::bits = 20;
const uint64_t balances_by_account_index::mask = (1ULL << balances_by_account_index::bits) - 1;
void balances_by_account_index::object_inserted( const object& obj )
void balances_by_account_index::object_loaded( const object& obj )
{
object_created(obj);
}
void balances_by_account_index::object_created( const object& obj )
{
const auto& abo = dynamic_cast< const account_balance_object& >( obj );
while( balances.size() < (abo.owner.instance.value >> bits) + 1 )

View file

@ -62,15 +62,15 @@ namespace graphene { namespace chain {
//ilog("Paying ${p} of ${P} for ${s} of ${r}", ("p",payout.to_uint64())("P",to_pay.value)("s",share)("r",remaining) );
remaining -= share;
}
FC_ASSERT( payout.to_uint64() <= to_pay );
FC_ASSERT( payout <= to_pay );
if( payout > 0 )
{
if ( accumulator.find(affiliate) == accumulator.end() )
accumulator[affiliate] = payout.to_uint64();
accumulator[affiliate] = payout;
else
accumulator[affiliate] += payout.to_uint64();
to_pay -= payout.to_uint64();
paid += payout.to_uint64();
accumulator[affiliate] += payout;
to_pay -= payout;
paid += payout;
}
}
FC_ASSERT( to_pay == 0 );

View file

@ -38,10 +38,11 @@ share_type asset_bitasset_data_object::max_force_settlement_volume(share_type cu
if( options.maximum_force_settlement_volume == GRAPHENE_100_PERCENT )
return current_supply + force_settled_volume;
fc::uint128 volume = current_supply.value + force_settled_volume.value;
fc::uint128_t volume = current_supply.value;
volume += force_settled_volume.value;
volume *= options.maximum_force_settlement_volume;
volume /= GRAPHENE_100_PERCENT;
return volume.to_uint64();
return volume;
}
void asset_bitasset_data_object::update_median_feeds(time_point_sec current_time)

View file

@ -22,7 +22,7 @@
* THE SOFTWARE.
*/
#include <graphene/chain/balance_evaluator.hpp>
#include <graphene/chain/pts_address.hpp>
#include <graphene/protocol/pts_address.hpp>
namespace graphene { namespace chain {

View file

@ -75,7 +75,7 @@ namespace mpl = boost::mpl;
amount_to_match_128 += backer_multiplier - GRAPHENE_BETTING_ODDS_PRECISION - 1;
amount_to_match_128 /= backer_multiplier - GRAPHENE_BETTING_ODDS_PRECISION;
}
return amount_to_match_128.to_uint64();
return amount_to_match_128;
}
share_type bet_object::get_approximate_matching_amount(bool round_up /* = false */) const

View file

@ -22,7 +22,7 @@
* THE SOFTWARE.
*/
#include <graphene/chain/block_database.hpp>
#include <graphene/chain/protocol/fee_schedule.hpp>
#include <graphene/protocol/fee_schedule.hpp>
#include <fc/io/raw.hpp>
namespace graphene { namespace chain {

View file

@ -22,7 +22,7 @@
* THE SOFTWARE.
*/
#include <graphene/chain/protocol/buyback.hpp>
#include <graphene/protocol/buyback.hpp>
#include <graphene/chain/database.hpp>
#include <graphene/chain/exceptions.hpp>
#include <graphene/chain/hardfork.hpp>

View file

@ -25,9 +25,8 @@
#include <graphene/chain/committee_member_object.hpp>
#include <graphene/chain/database.hpp>
#include <graphene/chain/account_object.hpp>
#include <graphene/chain/hardfork.hpp>
#include <graphene/chain/protocol/fee_schedule.hpp>
#include <graphene/chain/protocol/vote.hpp>
#include <graphene/protocol/fee_schedule.hpp>
#include <graphene/protocol/vote.hpp>
#include <graphene/chain/transaction_evaluation_state.hpp>
namespace graphene { namespace chain {
@ -42,7 +41,7 @@ object_id_type committee_member_create_evaluator::do_apply( const committee_memb
{ 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::committee);
vote_id = vote_id_type(vote_id_type::committee, p.next_available_vote_id++);
});
const auto& new_del_object = db().create<committee_member_object>( [&]( committee_member_object& obj ){

View file

@ -22,7 +22,7 @@
* THE SOFTWARE.
*/
#include <graphene/chain/exceptions.hpp>
#include <graphene/chain/protocol/confidential.hpp>
#include <graphene/protocol/confidential.hpp>
#include <graphene/chain/confidential_evaluator.hpp>
#include <graphene/chain/confidential_object.hpp>
#include <graphene/chain/database.hpp>

View file

@ -126,3 +126,4 @@ void_result delete_custom_account_authority_evaluator::do_apply(const custom_acc
} // namespace chain
} // namespace graphene

View file

@ -29,6 +29,8 @@
#include <graphene/chain/betting_market_object.hpp>
#include <graphene/chain/event_object.hpp>
#include <fc/log/logger.hpp>
#include <boost/range/iterator_range.hpp>
#include <boost/range/combine.hpp>
#include <boost/range/join.hpp>
@ -132,7 +134,7 @@ void database::resolve_betting_market_group(const betting_market_group_object& b
bool group_was_canceled = resolutions.begin()->second == betting_market_resolution_type::cancel;
if (group_was_canceled)
modify(betting_market_group, [group_was_canceled,this](betting_market_group_object& betting_market_group_obj) {
modify(betting_market_group, [this](betting_market_group_object& betting_market_group_obj) {
betting_market_group_obj.on_canceled_event(*this, false); // this cancels the betting markets
});
else {
@ -149,7 +151,7 @@ void database::resolve_betting_market_group(const betting_market_group_object& b
});
}
modify(betting_market_group, [group_was_canceled,this](betting_market_group_object& betting_market_group_obj) {
modify(betting_market_group, [this](betting_market_group_object& betting_market_group_obj) {
betting_market_group_obj.on_graded_event(*this);
});
}
@ -263,7 +265,7 @@ void database::settle_betting_market_group(const betting_market_group_object& be
share_type rake_amount;
if (net_profits.value > 0 && rake_account_id)
{
rake_amount = ((fc::uint128_t(net_profits.value) * rake_fee_percentage + GRAPHENE_100_PERCENT - 1) / GRAPHENE_100_PERCENT).to_uint64();
rake_amount = ((fc::uint128_t(net_profits.value) * rake_fee_percentage + GRAPHENE_100_PERCENT - 1) / GRAPHENE_100_PERCENT);
share_type affiliates_share;
if (rake_amount.value)
affiliates_share = payout_helper.payout( bettor_id, rake_amount );
@ -490,7 +492,7 @@ int match_bet(database& db, const bet_object& taker_bet, const bet_object& maker
payout_128 += taker_amount_to_match.value;
payout_128 *= GRAPHENE_BETTING_ODDS_PRECISION;
payout_128 /= maker_bet.back_or_lay == bet_type::back ? maker_amount_to_match.value : taker_amount_to_match.value;
assert(payout_128.to_uint64() == maker_bet.backer_multiplier);
assert(payout_128 == maker_bet.backer_multiplier);
}
#endif

View file

@ -26,22 +26,22 @@
#include <graphene/chain/db_with.hpp>
#include <graphene/chain/hardfork.hpp>
#include <graphene/chain/protocol/operations.hpp>
#include <graphene/chain/protocol/betting_market.hpp>
#include <graphene/chain/block_summary_object.hpp>
#include <graphene/chain/global_property_object.hpp>
#include <graphene/chain/operation_history_object.hpp>
#include <graphene/chain/proposal_object.hpp>
#include <graphene/chain/transaction_object.hpp>
#include <graphene/chain/transaction_history_object.hpp>
#include <graphene/chain/witness_object.hpp>
#include <graphene/chain/protocol/fee_schedule.hpp>
#include <graphene/chain/exceptions.hpp>
#include <graphene/chain/evaluator.hpp>
#include <graphene/chain/witness_schedule_object.hpp>
#include <fc/crypto/digest.hpp>
#include <graphene/protocol/fee_schedule.hpp>
#include <graphene/protocol/operations.hpp>
#include <graphene/protocol/betting_market.hpp>
#include <fc/crypto/digest.hpp>
namespace {
@ -819,7 +819,7 @@ processed_transaction database::_apply_transaction(const signed_transaction& trx
const auto& tapos_block_summary = block_summary_id_type( trx.ref_block_num )(*this);
//Verify TaPoS block summary has correct ID prefix, and that this block's time is not past the expiration
FC_ASSERT( trx.ref_block_prefix == tapos_block_summary.block_id._hash[1] );
FC_ASSERT( trx.ref_block_prefix == tapos_block_summary.block_id._hash[1].value() );
}
fc::time_point_sec now = head_block_time();
@ -832,8 +832,8 @@ processed_transaction database::_apply_transaction(const signed_transaction& trx
//Insert transaction into unique transactions database.
if( !(skip & skip_transaction_dupe_check) )
{
create<transaction_object>([&trx_id,&trx](transaction_object& transaction) {
transaction.trx_id = trx_id;
create<transaction_history_object>([&trx](transaction_history_object& transaction) {
transaction.trx_id = trx.id();
transaction.trx = trx;
});
}

View file

@ -113,13 +113,15 @@ std::vector<uint32_t> database::get_seeds( asset_id_type for_asset, uint8_t coun
{
FC_ASSERT( count_winners <= 64 );
std::string salted_string = std::string(_random_number_generator._seed) + std::to_string(for_asset.instance.value);
uint32_t* seeds = (uint32_t*)(fc::sha256::hash(salted_string)._hash);
auto seeds_hash = fc::sha256::hash(salted_string);
uint32_t* seeds = (uint32_t*)(seeds_hash._hash);
std::vector<uint32_t> result;
result.reserve(64);
for( int s = 0; s < 8; ++s ) {
uint32_t* sub_seeds = ( uint32_t* ) fc::sha256::hash( std::to_string( seeds[s] ) + std::to_string( for_asset.instance.value ) )._hash;
auto sub_seeds_hash = fc::sha256::hash(std::to_string(seeds[s]) + std::to_string(for_asset.instance.value));
uint32_t* sub_seeds = (uint32_t*) sub_seeds_hash._hash;
for( int ss = 0; ss < 8; ++ss ) {
result.push_back(sub_seeds[ss]);
}
@ -224,7 +226,8 @@ std::set<son_id_type> database::get_sons_to_be_deregistered()
{
if(son.status == son_status::in_maintenance)
{
auto stats = son.statistics(*this);
auto& stats = son.statistics(*this);
// TODO : We need to add a function that returns if we can deregister SON
// i.e. with introduction of PW code, we have to make a decision if the SON
// is needed for release of funds from the PW

View file

@ -40,7 +40,7 @@
#include <graphene/chain/operation_history_object.hpp>
#include <graphene/chain/proposal_object.hpp>
#include <graphene/chain/special_authority_object.hpp>
#include <graphene/chain/transaction_object.hpp>
#include <graphene/chain/transaction_history_object.hpp>
#include <graphene/chain/vesting_balance_object.hpp>
#include <graphene/chain/withdraw_permission_object.hpp>
#include <graphene/chain/witness_object.hpp>
@ -104,7 +104,7 @@
#include <graphene/chain/sidechain_transaction_evaluator.hpp>
#include <graphene/chain/random_number_evaluator.hpp>
#include <graphene/chain/protocol/fee_schedule.hpp>
#include <graphene/protocol/fee_schedule.hpp>
#include <fc/uint128.hpp>
#include <fc/crypto/digest.hpp>
@ -152,8 +152,8 @@ const uint8_t operation_history_object::type_id;
const uint8_t proposal_object::space_id;
const uint8_t proposal_object::type_id;
const uint8_t transaction_object::space_id;
const uint8_t transaction_object::type_id;
const uint8_t transaction_history_object::space_id;
const uint8_t transaction_history_object::type_id;
const uint8_t vesting_balance_object::space_id;
const uint8_t vesting_balance_object::type_id;
@ -680,7 +680,7 @@ void database::init_genesis(const genesis_state_type& genesis_state)
p.time = genesis_state.initial_timestamp;
p.dynamic_flags = 0;
p.witness_budget = 0;
p.recent_slots_filled = fc::uint128::max_value();
p.recent_slots_filled = std::numeric_limits<fc::uint128_t>::max();
});
create<global_betting_statistics_object>([&](global_betting_statistics_object& betting_statistics) {
betting_statistics.number_of_active_events = 0;
@ -903,7 +903,7 @@ void database::init_genesis(const genesis_state_type& genesis_state)
for( const auto& handout : genesis_state.initial_balances )
{
const auto asset_id = get_asset_id(handout.asset_symbol);
create<balance_object>([&handout,&get_asset_id,total_allocation,asset_id](balance_object& b) {
create<balance_object>([&handout,total_allocation,asset_id](balance_object& b) {
b.balance = asset(handout.amount, asset_id);
b.owner = handout.owner;
});
@ -1049,7 +1049,7 @@ void database::init_genesis(const genesis_state_type& genesis_state)
_wso.last_scheduling_block = 0;
_wso.recent_slots_filled = fc::uint128::max_value();
_wso.recent_slots_filled = std::numeric_limits<fc::uint128_t>::max();
// for shuffled
for( const witness_id_type& wid : get_global_properties().active_witnesses )
@ -1076,7 +1076,7 @@ void database::init_genesis(const genesis_state_type& genesis_state)
_sso.last_scheduling_block = 0;
_sso.recent_slots_filled = fc::uint128::max_value();
_sso.recent_slots_filled = std::numeric_limits<fc::uint128_t>::max();
});
assert( sso.id == son_schedule_id_type() );

View file

@ -22,10 +22,6 @@
* THE SOFTWARE.
*/
#include <boost/multiprecision/integer.hpp>
#include <fc/uint128.hpp>
#include <graphene/chain/database.hpp>
#include <graphene/chain/fba_accumulator_id.hpp>
#include <graphene/chain/hardfork.hpp>
@ -51,6 +47,8 @@
#include <graphene/chain/witness_schedule_object.hpp>
#include <graphene/chain/worker_object.hpp>
#include <numeric>
namespace graphene { namespace chain {
template<class Index>
@ -427,7 +425,7 @@ void database::pay_workers( share_type& budget )
// worker with more votes is preferred
// if two workers exactly tie for votes, worker with lower ID is preferred
std::sort(active_workers.begin(), active_workers.end(), [this](const worker_object& wa, const worker_object& wb) {
std::sort(active_workers.begin(), active_workers.end(), [](const worker_object& wa, const worker_object& wb) {
share_type wa_vote = wa.approving_stake();
share_type wb_vote = wb.approving_stake();
if( wa_vote != wb_vote )
@ -447,10 +445,10 @@ void database::pay_workers( share_type& budget )
// Note: if there is a good chance that passed_time_count == day_count,
// for better performance, can avoid the 128 bit calculation by adding a check.
// Since it's not the case on BitShares mainnet, we're not using a check here.
fc::uint128 pay(requested_pay.value);
fc::uint128_t pay = requested_pay.value;
pay *= passed_time_count;
pay /= day_count;
requested_pay = pay.to_uint64();
requested_pay = pay;
share_type actual_pay = std::min(budget, requested_pay);
//ilog(" ==> Paying ${a} to worker ${w}", ("w", active_worker.id)("a", actual_pay));
@ -839,7 +837,7 @@ void database::initialize_budget_record( fc::time_point_sec now, budget_record&
budget_u128 >>= GRAPHENE_CORE_ASSET_CYCLE_RATE_BITS;
share_type budget;
if( budget_u128 < reserve.value )
rec.total_budget = share_type(budget_u128.to_uint64());
rec.total_budget = share_type(budget_u128);
else
rec.total_budget = reserve;
@ -905,7 +903,7 @@ void database::process_budget()
if( worker_budget_u128 >= available_funds.value )
worker_budget = available_funds;
else
worker_budget = worker_budget_u128.to_uint64();
worker_budget = worker_budget_u128;
rec.worker_budget = worker_budget;
available_funds -= worker_budget;
@ -1050,12 +1048,12 @@ void split_fba_balance(
fc::uint128_t buyback_amount_128 = fba.accumulated_fba_fees.value;
buyback_amount_128 *= designated_asset_buyback_pct;
buyback_amount_128 /= GRAPHENE_100_PERCENT;
share_type buyback_amount = buyback_amount_128.to_uint64();
share_type buyback_amount = buyback_amount_128;
fc::uint128_t issuer_amount_128 = fba.accumulated_fba_fees.value;
issuer_amount_128 *= designated_asset_issuer_pct;
issuer_amount_128 /= GRAPHENE_100_PERCENT;
share_type issuer_amount = issuer_amount_128.to_uint64();
share_type issuer_amount = issuer_amount_128;
// this assert should never fail
FC_ASSERT( buyback_amount + issuer_amount <= fba.accumulated_fba_fees );
@ -1532,7 +1530,7 @@ void schedule_pending_dividend_balances(database& db,
minimum_amount_to_distribute *= 100 * GRAPHENE_1_PERCENT;
minimum_amount_to_distribute /= dividend_data.options.minimum_fee_percentage;
wdump((total_fee_per_asset_in_payout_asset)(dividend_data.options));
minimum_shares_to_distribute = minimum_amount_to_distribute.to_uint64();
minimum_shares_to_distribute = minimum_amount_to_distribute;
}
dlog("Processing dividend payments of asset type ${payout_asset_type}, delta balance is ${delta_balance}", ("payout_asset_type", payout_asset_type(db).symbol)("delta_balance", delta_balance));
@ -1594,7 +1592,7 @@ void schedule_pending_dividend_balances(database& db,
fc::uint128_t amount_to_credit(delta_balance.value);
amount_to_credit *= holder_balance.amount.value;
amount_to_credit /= total_balance_of_dividend_asset.value;
share_type full_shares_to_credit((int64_t) amount_to_credit.to_uint64());
share_type full_shares_to_credit((int64_t) amount_to_credit);
share_type shares_to_credit = (uint64_t) floor(full_shares_to_credit.value * vesting_factor);
if (shares_to_credit < full_shares_to_credit) {
@ -1631,7 +1629,7 @@ void schedule_pending_dividend_balances(database& db,
fc::uint128_t amount_to_credit(delta_balance.value);
amount_to_credit *= holder_balance.value;
amount_to_credit /= total_balance_of_dividend_asset.value;
share_type shares_to_credit((int64_t) amount_to_credit.to_uint64());
share_type shares_to_credit((int64_t) amount_to_credit);
remaining_amount_to_distribute = credit_account(db,
holder_balance_object.owner,
@ -1691,7 +1689,7 @@ void schedule_pending_dividend_balances(database& db,
fc::uint128_t amount_to_debit(remaining_amount_to_recover.value);
amount_to_debit *= pending_balance_object.pending_balance.value;
amount_to_debit /= remaining_pending_balances.value;
share_type shares_to_debit((int64_t)amount_to_debit.to_uint64());
share_type shares_to_debit((int64_t)amount_to_debit);
remaining_amount_to_recover -= shares_to_debit;
remaining_pending_balances -= pending_balance_object.pending_balance;

View file

@ -29,7 +29,8 @@
#include <graphene/chain/special_authority_object.hpp>
#include <graphene/chain/operation_history_object.hpp>
#include <graphene/chain/nft_object.hpp>
#include <graphene/chain/protocol/fee_schedule.hpp>
#include <graphene/protocol/fee_schedule.hpp>
#include <fc/io/fstream.hpp>

View file

@ -575,10 +575,10 @@ asset database::calculate_market_fee( const asset_object& trade_asset, const ass
if( trade_asset.options.market_fee_percent == 0 )
return trade_asset.amount(0);
fc::uint128 a(trade_amount.amount.value);
fc::uint128_t a(trade_amount.amount.value);
a *= trade_asset.options.market_fee_percent;
a /= GRAPHENE_100_PERCENT;
asset percent_fee = trade_asset.amount(a.to_uint64());
asset percent_fee = trade_asset.amount(a);
if( percent_fee.amount > trade_asset.options.max_market_fee )
percent_fee.amount = trade_asset.options.max_market_fee;

View file

@ -24,11 +24,11 @@
#include <fc/container/flat.hpp>
#include <graphene/protocol/authority.hpp>
#include <graphene/protocol/operations.hpp>
#include <graphene/protocol/transaction.hpp>
#include <graphene/chain/database.hpp>
#include <graphene/chain/protocol/authority.hpp>
#include <graphene/chain/protocol/operations.hpp>
#include <graphene/chain/protocol/transaction.hpp>
#include <graphene/chain/protocol/types.hpp>
#include <graphene/chain/withdraw_permission_object.hpp>
#include <graphene/chain/worker_object.hpp>
#include <graphene/chain/confidential_object.hpp>
@ -39,14 +39,17 @@
#include <graphene/chain/proposal_object.hpp>
#include <graphene/chain/operation_history_object.hpp>
#include <graphene/chain/vesting_balance_object.hpp>
#include <graphene/chain/transaction_object.hpp>
#include <graphene/chain/transaction_history_object.hpp>
#include <graphene/chain/impacted.hpp>
#include <graphene/chain/hardfork.hpp>
#include <graphene/chain/account_object.hpp>
#include <graphene/chain/account_role_object.hpp>
#include <graphene/chain/son_object.hpp>
#include <graphene/chain/sidechain_address_object.hpp>
#include <graphene/chain/tournament_object.hpp>
#include <graphene/chain/custom_permission_object.hpp>
#include <graphene/chain/offer_object.hpp>
#include <graphene/chain/nft_object.hpp>
using namespace fc;
using namespace graphene::chain;
@ -450,7 +453,6 @@ void get_relevant_accounts( const object* obj, flat_set<account_id_type>& accoun
{
case null_object_type:
case base_object_type:
case OBJECT_TYPE_COUNT:
return;
case account_object_type:{
accounts.insert( obj->id );
@ -518,7 +520,85 @@ void get_relevant_accounts( const object* obj, flat_set<account_id_type>& accoun
} case balance_object_type:{
/** these are free from any accounts */
break;
} case account_role_type:{
} case tournament_object_type:{
auto aobj = dynamic_cast<const tournament_object*>(obj);
assert(aobj != nullptr);
accounts.insert(aobj->creator);
accounts.insert(aobj->options.whitelist.begin(), aobj->options.whitelist.end());
break;
} case tournament_details_object_type:{
auto aobj = dynamic_cast<const tournament_details_object*>(obj);
assert(aobj != nullptr);
accounts.insert(aobj->registered_players.begin(), aobj->registered_players.end());
std::transform(aobj->payers.begin(), aobj->payers.end(), std::inserter(accounts, accounts.end()),
[](const auto& pair) { return pair.first; });
std::for_each(aobj->players_payers.begin(), aobj->players_payers.end(),
[&accounts](const auto& pair) {
accounts.insert(pair.first);
accounts.insert(pair.second);
});
break;
} case match_object_type:{
auto aobj = dynamic_cast<const match_object*>(obj);
assert(aobj != nullptr);
accounts.insert(aobj->players.begin(), aobj->players.end());
std::for_each(aobj->game_winners.begin(), aobj->game_winners.end(),
[&accounts](const auto& set) { accounts.insert(set.begin(), set.end()); });
accounts.insert(aobj->match_winners.begin(), aobj->match_winners.end());
break;
} case game_object_type:{
auto aobj = dynamic_cast<const game_object*>(obj);
assert(aobj != nullptr);
accounts.insert(aobj->players.begin(), aobj->players.end());
accounts.insert(aobj->winners.begin(), aobj->winners.end());
break;
} case sport_object_type:
break;
case event_group_object_type:
break;
case event_object_type:
break;
case betting_market_rules_object_type:
break;
case betting_market_group_object_type:
break;
case betting_market_object_type:
break;
case bet_object_type:{
auto aobj = dynamic_cast<const bet_object*>(obj);
assert(aobj != nullptr);
accounts.insert(aobj->bettor_id);
break;
} case custom_permission_object_type:{
auto aobj = dynamic_cast<const custom_permission_object*>(obj);
assert(aobj != nullptr);
accounts.insert(aobj->account);
add_authority_accounts(accounts, aobj->auth);
break;
} case custom_account_authority_object_type:
break;
case offer_object_type:{
auto aobj = dynamic_cast<const offer_object*>(obj);
assert(aobj != nullptr);
accounts.insert(aobj->issuer);
if (aobj->bidder.valid())
accounts.insert(*aobj->bidder);
break;
} case nft_metadata_object_type:{
auto aobj = dynamic_cast<const nft_metadata_object*>(obj);
assert(aobj != nullptr);
accounts.insert(aobj->owner);
if (aobj->revenue_partner.valid())
accounts.insert(*aobj->revenue_partner);
break;
} case nft_object_type:{
auto aobj = dynamic_cast<const nft_object*>(obj);
assert(aobj != nullptr);
accounts.insert(aobj->owner);
accounts.insert(aobj->approved);
accounts.insert(aobj->approved_operators.begin(), aobj->approved_operators.end());
break;
} case account_role_object_type:{
const auto& aobj = dynamic_cast<const account_role_object*>(obj);
assert( aobj != nullptr );
accounts.insert( aobj->owner );
@ -529,6 +609,8 @@ void get_relevant_accounts( const object* obj, flat_set<account_id_type>& accoun
assert( aobj != nullptr );
accounts.insert( aobj->son_account );
break;
} case son_proposal_object_type:{
break;
} case son_wallet_object_type:{
break;
} case son_wallet_deposit_object_type:{
@ -558,9 +640,9 @@ void get_relevant_accounts( const object* obj, flat_set<account_id_type>& accoun
break;
case impl_reserved0_object_type:
break;
case impl_asset_dynamic_data_type:
case impl_asset_dynamic_data_object_type:
break;
case impl_asset_bitasset_data_type:
case impl_asset_bitasset_data_object_type:
break;
case impl_account_balance_object_type:{
const auto& aobj = dynamic_cast<const account_balance_object*>(obj);
@ -572,11 +654,11 @@ void get_relevant_accounts( const object* obj, flat_set<account_id_type>& accoun
assert( aobj != nullptr );
accounts.insert( aobj->owner );
break;
} case impl_transaction_object_type:{
const auto& aobj = dynamic_cast<const transaction_object*>(obj);
assert( aobj != nullptr );
} case impl_transaction_history_object_type:{
const auto& aobj = dynamic_cast<const transaction_history_object*>(obj);
FC_ASSERT( aobj != nullptr );
transaction_get_impacted_accounts( aobj->trx, accounts,
ignore_custom_operation_required_auths);
ignore_custom_operation_required_auths );
break;
} case impl_blinded_balance_object_type:{
const auto& aobj = dynamic_cast<const blinded_balance_object*>(obj);
@ -600,6 +682,44 @@ void get_relevant_accounts( const object* obj, flat_set<account_id_type>& accoun
break;
case impl_fba_accumulator_object_type:
break;
case impl_asset_dividend_data_object_type:{
const auto& aobj = dynamic_cast<const asset_dividend_data_object*>(obj);
assert( aobj != nullptr );
accounts.insert(aobj->dividend_distribution_account);
break;
} case impl_pending_dividend_payout_balance_for_holder_object_type:{
const auto& aobj = dynamic_cast<const pending_dividend_payout_balance_for_holder_object*>(obj);
assert( aobj != nullptr );
accounts.insert(aobj->owner);
break;
} case impl_total_distributed_dividend_balance_object_type:
break;
case impl_betting_market_position_object_type:{
const auto& aobj = dynamic_cast<const betting_market_position_object*>(obj);
assert( aobj != nullptr );
accounts.insert(aobj->bettor_id);
break;
} case impl_global_betting_statistics_object_type:
break;
case impl_lottery_balance_object_type:
break;
case impl_sweeps_vesting_balance_object_type:{
const auto& aobj = dynamic_cast<const sweeps_vesting_balance_object*>(obj);
assert( aobj != nullptr );
accounts.insert(aobj->owner);
break;
} case impl_offer_history_object_type:{
const auto& aobj = dynamic_cast<const offer_history_object*>(obj);
assert( aobj != nullptr );
accounts.insert(aobj->issuer);
if (aobj->bidder.valid())
accounts.insert(*aobj->bidder);
break;
} case impl_son_statistics_object_type: {
break;
} case impl_son_schedule_object_type: {
break;
}
case impl_nft_lottery_balance_object_type:
break;
default:

View file

@ -35,13 +35,11 @@
#include <graphene/chain/proposal_object.hpp>
#include <graphene/chain/son_proposal_object.hpp>
#include <graphene/chain/tournament_object.hpp>
#include <graphene/chain/transaction_object.hpp>
#include <graphene/chain/transaction_history_object.hpp>
#include <graphene/chain/withdraw_permission_object.hpp>
#include <graphene/chain/witness_object.hpp>
#include <graphene/chain/protocol/fee_schedule.hpp>
#include <fc/uint128.hpp>
#include <graphene/protocol/fee_schedule.hpp>
namespace graphene { namespace chain {
@ -156,7 +154,8 @@ void database::clear_expired_transactions()
{ try {
//Look for expired transactions in the deduplication list, and remove them.
//Transactions must have expired by at least two forking windows in order to be removed.
auto& transaction_idx = static_cast<transaction_index&>(get_mutable_index(implementation_ids, impl_transaction_object_type));
auto& transaction_idx = static_cast<transaction_index&>(get_mutable_index(implementation_ids,
impl_transaction_history_object_type));
const auto& dedupe_index = transaction_idx.indices().get<by_expiration>();
while( (!dedupe_index.empty()) && (head_block_time() > dedupe_index.begin()->trx.expiration) )
transaction_idx.remove(*dedupe_index.begin());
@ -427,7 +426,7 @@ void database::clear_expired_orders()
auto& pays = order.balance;
auto receives = (order.balance * mia.current_feed.settlement_price);
receives.amount = (fc::uint128_t(receives.amount.value) *
(GRAPHENE_100_PERCENT - mia.options.force_settlement_offset_percent) / GRAPHENE_100_PERCENT).to_uint64();
(GRAPHENE_100_PERCENT - mia.options.force_settlement_offset_percent) / GRAPHENE_100_PERCENT);
assert(receives <= order.balance * mia.current_feed.settlement_price);
price settlement_price = pays / receives;

View file

@ -22,12 +22,14 @@
* THE SOFTWARE.
*/
#include <graphene/protocol/son_info.hpp>
#include <graphene/chain/database.hpp>
#include <graphene/chain/global_property_object.hpp>
#include <graphene/chain/witness_object.hpp>
#include <graphene/chain/witness_schedule_object.hpp>
#include <graphene/chain/son_object.hpp>
#include <graphene/chain/son_info.hpp>
#include <fc/popcount.hpp>
namespace graphene { namespace chain {
@ -267,7 +269,7 @@ void database::update_witness_schedule(const signed_block& next_block)
modify(wso, [&](witness_schedule_object& _wso)
{
_wso.slots_since_genesis += schedule_slot;
witness_scheduler_rng rng(wso.rng_seed.data, _wso.slots_since_genesis);
witness_scheduler_rng rng(wso.rng_seed.data(), _wso.slots_since_genesis);
_wso.scheduler._min_token_count = std::max(int(gpo.active_witnesses.size()) / 2, 1);
@ -332,7 +334,7 @@ void database::update_son_schedule(const signed_block& next_block)
modify(sso, [&](son_schedule_object& _sso)
{
_sso.slots_since_genesis += schedule_slot;
witness_scheduler_rng rng(sso.rng_seed.data, _sso.slots_since_genesis);
witness_scheduler_rng rng(sso.rng_seed.data(), _sso.slots_since_genesis);
_sso.scheduler._min_token_count = std::max(int(gpo.active_sons.size()) / 2, 1);
@ -391,12 +393,12 @@ uint32_t database::witness_participation_rate()const
if (gpo.parameters.witness_schedule_algorithm == GRAPHENE_WITNESS_SHUFFLED_ALGORITHM)
{
const dynamic_global_property_object& dpo = get_dynamic_global_properties();
return uint64_t(GRAPHENE_100_PERCENT) * dpo.recent_slots_filled.popcount() / 128;
return uint64_t(GRAPHENE_100_PERCENT) * fc::popcount(dpo.recent_slots_filled) / 128;
}
if (gpo.parameters.witness_schedule_algorithm == GRAPHENE_WITNESS_SCHEDULED_ALGORITHM)
{
const witness_schedule_object& wso = get_witness_schedule_object();
return uint64_t(GRAPHENE_100_PERCENT) * wso.recent_slots_filled.popcount() / 128;
return uint64_t(GRAPHENE_100_PERCENT) * fc::popcount(wso.recent_slots_filled) / 128;
}
return 0;
}

View file

@ -33,9 +33,7 @@
#include <graphene/chain/fba_object.hpp>
#include <graphene/chain/committee_member_object.hpp>
#include <graphene/chain/market_evaluator.hpp>
#include <graphene/chain/protocol/fee_schedule.hpp>
#include <fc/uint128.hpp>
#include <graphene/protocol/fee_schedule.hpp>
namespace graphene { namespace chain {
database& generic_evaluator::db()const { return trx_state->db(); }

View file

@ -29,6 +29,7 @@
#include <graphene/chain/hardfork.hpp>
#include <graphene/chain/is_authorized_asset.hpp>
#include <graphene/chain/global_betting_statistics_object.hpp>
#include <graphene/chain/betting_market_object.hpp>
namespace graphene { namespace chain {

View file

@ -0,0 +1,135 @@
/*
* Copyright (c) 2019 BitShares Blockchain Foundation, and contributors.
*
* The MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <graphene/chain/exceptions.hpp>
#include <graphene/chain/internal_exceptions.hpp>
namespace graphene { namespace chain {
// Internal exceptions
FC_IMPLEMENT_DERIVED_EXCEPTION( internal_exception, graphene::chain::chain_exception, 3990000, "internal exception" )
GRAPHENE_IMPLEMENT_INTERNAL_EXCEPTION( verify_auth_max_auth_exceeded, 1, "Exceeds max authority fan-out" )
GRAPHENE_IMPLEMENT_INTERNAL_EXCEPTION( verify_auth_account_not_found, 2, "Auth account not found" )
// Public exceptions
FC_IMPLEMENT_EXCEPTION( chain_exception, 3000000, "blockchain exception" )
FC_IMPLEMENT_DERIVED_EXCEPTION( database_query_exception, chain_exception, 3010000, "database query exception" )
FC_IMPLEMENT_DERIVED_EXCEPTION( block_validate_exception, chain_exception, 3020000, "block validation exception" )
FC_IMPLEMENT_DERIVED_EXCEPTION( operation_validate_exception, chain_exception, 3040000, "operation validation exception" )
FC_IMPLEMENT_DERIVED_EXCEPTION( operation_evaluate_exception, chain_exception, 3050000, "operation evaluation exception" )
FC_IMPLEMENT_DERIVED_EXCEPTION( utility_exception, chain_exception, 3060000, "utility method exception" )
FC_IMPLEMENT_DERIVED_EXCEPTION( undo_database_exception, chain_exception, 3070000, "undo database exception" )
FC_IMPLEMENT_DERIVED_EXCEPTION( unlinkable_block_exception, chain_exception, 3080000, "unlinkable block" )
FC_IMPLEMENT_DERIVED_EXCEPTION( black_swan_exception, chain_exception, 3090000, "black swan" )
FC_IMPLEMENT_DERIVED_EXCEPTION( plugin_exception, chain_exception, 3100000, "plugin exception" )
FC_IMPLEMENT_DERIVED_EXCEPTION( insufficient_feeds, chain_exception, 37006, "insufficient feeds" )
FC_IMPLEMENT_DERIVED_EXCEPTION( pop_empty_chain, undo_database_exception, 3070001, "there are no blocks to pop" )
GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( transfer );
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( from_account_not_whitelisted, transfer, 1, "owner mismatch" )
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( to_account_not_whitelisted, transfer, 2, "owner mismatch" )
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( restricted_transfer_asset, transfer, 3, "restricted transfer asset" )
//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( limit_order_create );
//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( limit_order_cancel );
GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( call_order_update );
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( unfilled_margin_call, call_order_update, 1, "Updating call order would trigger a margin call that cannot be fully filled" )
GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( account_create );
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( max_auth_exceeded, account_create, 1, "Exceeds max authority fan-out" )
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( auth_account_not_found, account_create, 2, "Auth account not found" )
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( buyback_incorrect_issuer, account_create, 3, "Incorrect issuer specified for account" )
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( buyback_already_exists, account_create, 4, "Cannot create buyback for asset which already has buyback" )
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( buyback_too_many_markets, account_create, 5, "Too many buyback markets" )
GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( account_update );
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( max_auth_exceeded, account_update, 1, "Exceeds max authority fan-out" )
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( auth_account_not_found, account_update, 2, "Auth account not found" )
//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( account_whitelist );
//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( account_upgrade );
//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( account_transfer );
//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( asset_create );
//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( asset_update );
//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( asset_update_bitasset );
//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( asset_update_feed_producers );
//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( asset_issue );
GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( asset_reserve );
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( invalid_on_mia, asset_reserve, 1, "invalid on mia" )
//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( asset_fund_fee_pool );
//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( asset_settle );
//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( asset_global_settle );
//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( asset_publish_feed );
//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( committee_member_create );
//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( witness_create );
GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( proposal_create );
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( review_period_required, proposal_create, 1, "review_period required" )
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( review_period_insufficient, proposal_create, 2, "review_period insufficient" )
//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( proposal_update );
//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( proposal_delete );
//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( withdraw_permission_create );
//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( withdraw_permission_update );
//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( withdraw_permission_claim );
//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( withdraw_permission_delete );
//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( fill_order );
//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( global_parameters_update );
//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( vesting_balance_create );
//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( vesting_balance_withdraw );
//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( worker_create );
//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( custom );
//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( assert );
GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( balance_claim );
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( claimed_too_often, balance_claim, 1, "balance claimed too often" )
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( invalid_claim_amount, balance_claim, 2, "invalid claim amount" )
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( owner_mismatch, balance_claim, 3, "owner mismatch" )
GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( override_transfer );
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( not_permitted, override_transfer, 1, "not permitted" )
GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( blind_transfer );
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( unknown_commitment, blind_transfer, 1, "Attempting to claim an unknown prior commitment" );
//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( transfer_from_blind_operation )
//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( asset_claim_fees_operation )
//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( bid_collateral_operation )
//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( asset_claim_pool_operation )
//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( asset_update_issuer_operation )
#define GRAPHENE_RECODE_EXC( cause_type, effect_type ) \
catch( const cause_type& e ) \
{ throw( effect_type( e.what(), e.get_log() ) ); }
} } // graphene::chain

View file

@ -23,7 +23,7 @@
*/
#include <graphene/chain/fork_database.hpp>
#include <graphene/chain/exceptions.hpp>
#include <graphene/chain/protocol/fee_schedule.hpp>
#include <graphene/protocol/fee_schedule.hpp>
namespace graphene { namespace chain {
fork_database::fork_database()

View file

@ -24,8 +24,8 @@
#include <graphene/chain/genesis_state.hpp>
// these are required to serialize a genesis_state
#include <graphene/chain/protocol/fee_schedule.hpp>
// this is required to serialize a genesis_state
#include <graphene/protocol/fee_schedule.hpp>
namespace graphene { namespace chain {

View file

@ -24,7 +24,7 @@
#include <graphene/chain/get_config.hpp>
#include <graphene/chain/config.hpp>
#include <graphene/chain/protocol/types.hpp>
#include <graphene/protocol/types.hpp>
namespace graphene { namespace chain {
@ -74,7 +74,6 @@ fc::variant_object get_config()
result[ "GRAPHENE_MAX_COLLATERAL_RATIO" ] = GRAPHENE_MAX_COLLATERAL_RATIO;
result[ "GRAPHENE_DEFAULT_MAINTENANCE_COLLATERAL_RATIO" ] = GRAPHENE_DEFAULT_MAINTENANCE_COLLATERAL_RATIO;
result[ "GRAPHENE_DEFAULT_MAX_SHORT_SQUEEZE_RATIO" ] = GRAPHENE_DEFAULT_MAX_SHORT_SQUEEZE_RATIO;
result[ "GRAPHENE_DEFAULT_MARGIN_PERIOD_SEC" ] = GRAPHENE_DEFAULT_MARGIN_PERIOD_SEC;
result[ "GRAPHENE_DEFAULT_MAX_WITNESSES" ] = GRAPHENE_DEFAULT_MAX_WITNESSES;
result[ "GRAPHENE_DEFAULT_MAX_COMMITTEE" ] = GRAPHENE_DEFAULT_MAX_COMMITTEE;
result[ "GRAPHENE_DEFAULT_MAX_PROPOSAL_LIFETIME_SEC" ] = GRAPHENE_DEFAULT_MAX_PROPOSAL_LIFETIME_SEC;

View file

@ -1,7 +1,7 @@
// #210 Check authorities on custom_operation
#ifndef HARDFORK_CORE_210_TIME
#ifdef BUILD_PEERPLAYS_TESTNET
#define HARDFORK_CORE_210_TIME (fc::time_point_sec::from_iso_string("2030-01-01T00:00:00")) // (Not yet scheduled)
#define HARDFORK_CORE_210_TIME (fc::time_point_sec::from_iso_string("2021-01-01T00:00:00"))
#else
#define HARDFORK_CORE_210_TIME (fc::time_point_sec::from_iso_string("2030-01-01T00:00:00")) // (Not yet scheduled)
#endif

View file

@ -1,3 +1,4 @@
// The value should be harmonized with the protcol constant named GPOS_PERIOD_START
#ifndef HARDFORK_GPOS_TIME
#ifdef BUILD_PEERPLAYS_TESTNET
#define HARDFORK_GPOS_TIME (fc::time_point_sec::from_iso_string("2020-01-06T01:00:00"))

View file

@ -22,13 +22,15 @@
* THE SOFTWARE.
*/
#pragma once
#include <graphene/chain/protocol/types.hpp>
#include <graphene/protocol/operations.hpp>
#include <graphene/db/generic_index.hpp>
#include <graphene/chain/protocol/account.hpp>
#include <graphene/chain/types.hpp>
#include <boost/multi_index/composite_key.hpp>
namespace graphene { namespace chain {
class database;
class account_object;
class vesting_balance_object;
/**
* @class account_statistics_object
@ -321,7 +323,8 @@ namespace graphene { namespace chain {
};
public:
virtual void object_inserted( const object& obj ) override;
virtual void object_loaded( const object& obj ) override;
virtual void object_created( const object& obj ) override;
virtual void object_removed( const object& obj ) override;
virtual void about_to_modify( const object& before ) override;
virtual void object_modified( const object& after ) override;
@ -352,7 +355,8 @@ namespace graphene { namespace chain {
class account_referrer_index : public secondary_index
{
public:
virtual void object_inserted( const object& obj ) override;
virtual void object_loaded( const object& obj ) override;
virtual void object_created( const object& obj ) override;
virtual void object_removed( const object& obj ) override;
virtual void about_to_modify( const object& before ) override;
virtual void object_modified( const object& after ) override;
@ -393,7 +397,8 @@ namespace graphene { namespace chain {
class balances_by_account_index : public secondary_index
{
public:
virtual void object_inserted( const object& obj ) override;
virtual void object_loaded( const object& obj ) override;
virtual void object_created( const object& obj ) override;
virtual void object_removed( const object& obj ) override;
virtual void about_to_modify( const object& before ) override;
virtual void object_modified( const object& after ) override;
@ -541,6 +546,10 @@ namespace graphene { namespace chain {
}}
MAP_OBJECT_ID_TO_TYPE(graphene::chain::account_object)
MAP_OBJECT_ID_TO_TYPE(graphene::chain::account_balance_object)
MAP_OBJECT_ID_TO_TYPE(graphene::chain::account_statistics_object)
FC_REFLECT_DERIVED( graphene::chain::account_object,
(graphene::db::object),
(membership_expiration_date)(registrar)(referrer)(lifetime_referrer)

View file

@ -2,8 +2,8 @@
#include <graphene/chain/database.hpp>
#include <graphene/chain/evaluator.hpp>
#include <graphene/chain/protocol/operations.hpp>
#include <graphene/chain/protocol/types.hpp>
#include <graphene/protocol/operations.hpp>
#include <graphene/protocol/types.hpp>
namespace graphene { namespace chain {

View file

@ -1,5 +1,5 @@
#pragma once
#include <graphene/chain/protocol/types.hpp>
#include <graphene/protocol/types.hpp>
#include <graphene/db/object.hpp>
#include <graphene/db/generic_index.hpp>
@ -13,7 +13,7 @@ namespace graphene
{
public:
static const uint8_t space_id = protocol_ids;
static const uint8_t type_id = account_role_type;
static const uint8_t type_id = account_role_object_type;
account_id_type owner;
std::string name;
@ -45,5 +45,7 @@ namespace graphene
} // namespace chain
} // namespace graphene
MAP_OBJECT_ID_TO_TYPE(graphene::chain::account_role_object)
FC_REFLECT_DERIVED(graphene::chain::account_role_object, (graphene::db::object),
(owner)(name)(metadata)(allowed_operations)(whitelisted_accounts)(valid_to))

View file

@ -23,8 +23,8 @@
*/
#pragma once
#include <graphene/chain/protocol/asset.hpp>
#include <graphene/chain/protocol/affiliate.hpp>
#include <graphene/protocol/asset.hpp>
#include <graphene/protocol/affiliate.hpp>
#include <graphene/chain/betting_market_object.hpp>
#include <graphene/chain/tournament_object.hpp>

View file

@ -22,7 +22,7 @@
* THE SOFTWARE.
*/
#pragma once
#include <graphene/chain/protocol/operations.hpp>
#include <graphene/protocol/operations.hpp>
#include <graphene/chain/evaluator.hpp>
#include <graphene/chain/database.hpp>

View file

@ -22,7 +22,7 @@
* THE SOFTWARE.
*/
#pragma once
#include <graphene/chain/protocol/operations.hpp>
#include <graphene/protocol/operations.hpp>
#include <graphene/chain/evaluator.hpp>
#include <graphene/chain/database.hpp>

View file

@ -22,11 +22,10 @@
* THE SOFTWARE.
*/
#pragma once
#include <graphene/chain/protocol/types.hpp>
#include <graphene/db/generic_index.hpp>
#include <graphene/db/flat_index.hpp>
#include <graphene/chain/protocol/asset_ops.hpp>
#include <graphene/protocol/asset_ops.hpp>
#include <boost/multi_index/composite_key.hpp>
#include <graphene/db/generic_index.hpp>
#include <graphene/chain/types.hpp>
/**
* @defgroup prediction_market Prediction Market
@ -39,6 +38,9 @@
*/
namespace graphene { namespace chain {
class account_object;
class asset_bitasset_data_object;
class asset_dividend_data_object;
class database;
class transaction_evaluation_state;
using namespace graphene::db;
@ -59,7 +61,7 @@ namespace graphene { namespace chain {
{
public:
static const uint8_t space_id = implementation_ids;
static const uint8_t type_id = impl_asset_dynamic_data_type;
static const uint8_t type_id = impl_asset_dynamic_data_object_type;
/// The number of shares currently in existence
share_type current_supply;
@ -111,13 +113,13 @@ namespace graphene { namespace chain {
string amount_to_string(share_type amount)const;
/// Convert an asset to a textual representation, i.e. "123.45"
string amount_to_string(const asset& amount)const
{ FC_ASSERT(amount.asset_id == id); return amount_to_string(amount.amount); }
{ FC_ASSERT(amount.asset_id == get_id()); return amount_to_string(amount.amount); }
/// Convert an asset to a textual representation with symbol, i.e. "123.45 USD"
string amount_to_pretty_string(share_type amount)const
{ return amount_to_string(amount) + " " + symbol; }
/// Convert an asset to a textual representation with symbol, i.e. "123.45 USD"
string amount_to_pretty_string(const asset &amount)const
{ FC_ASSERT(amount.asset_id == id); return amount_to_pretty_string(amount.amount); }
{ FC_ASSERT(amount.asset_id == get_id()); return amount_to_pretty_string(amount.amount); }
uint32_t get_issuer_num()const
{ return issuer.instance.value; }
@ -197,7 +199,7 @@ namespace graphene { namespace chain {
{
public:
static const uint8_t space_id = implementation_ids;
static const uint8_t type_id = impl_asset_bitasset_data_type;
static const uint8_t type_id = impl_asset_bitasset_data_object_type;
/// The asset this object belong to
asset_id_type asset_id;
@ -375,7 +377,7 @@ namespace graphene { namespace chain {
{
public:
static const uint8_t space_id = implementation_ids;
static const uint8_t type_id = impl_asset_dividend_data_type;
static const uint8_t type_id = impl_asset_dividend_data_object_type;
/// The tunable options for Dividend-paying assets are stored in this field.
dividend_asset_options options;
@ -419,7 +421,7 @@ namespace graphene { namespace chain {
{
public:
static const uint8_t space_id = implementation_ids;
static const uint8_t type_id = impl_distributed_dividend_balance_data_type;
static const uint8_t type_id = impl_total_distributed_dividend_balance_object_type;
asset_id_type dividend_holder_asset_type;
asset_id_type dividend_payout_asset_type;
@ -518,6 +520,14 @@ namespace graphene { namespace chain {
} } // graphene::chain
MAP_OBJECT_ID_TO_TYPE(graphene::chain::asset_object)
MAP_OBJECT_ID_TO_TYPE(graphene::chain::asset_dynamic_data_object)
MAP_OBJECT_ID_TO_TYPE(graphene::chain::asset_bitasset_data_object)
MAP_OBJECT_ID_TO_TYPE(graphene::chain::asset_dividend_data_object)
MAP_OBJECT_ID_TO_TYPE(graphene::chain::total_distributed_dividend_balance_object)
MAP_OBJECT_ID_TO_TYPE(graphene::chain::lottery_balance_object)
MAP_OBJECT_ID_TO_TYPE(graphene::chain::sweeps_vesting_balance_object)
FC_REFLECT_DERIVED( graphene::chain::asset_dynamic_data_object, (graphene::db::object),
(current_supply)(sweeps_tickets_sold)(confidential_supply)(accumulated_fees)(fee_pool) )

View file

@ -23,7 +23,7 @@
*/
#pragma once
#include <graphene/chain/protocol/transaction.hpp>
#include <graphene/protocol/transaction.hpp>
#include <graphene/chain/database.hpp>
#include <graphene/chain/balance_object.hpp>
#include <graphene/chain/evaluator.hpp>

View file

@ -71,6 +71,8 @@ namespace graphene { namespace chain {
using balance_index = generic_index<balance_object, balance_multi_index_type>;
} }
MAP_OBJECT_ID_TO_TYPE(graphene::chain::balance_object)
FC_REFLECT_DERIVED( graphene::chain::balance_object, (graphene::db::object),
(owner)(balance)(vesting_policy)(last_claim_date) )

View file

@ -23,7 +23,7 @@
*/
#pragma once
#include <graphene/chain/protocol/operations.hpp>
#include <graphene/protocol/operations.hpp>
#include <graphene/chain/evaluator.hpp>
#include <graphene/chain/database.hpp>

View file

@ -23,14 +23,17 @@
*/
#pragma once
#include <graphene/chain/protocol/types.hpp>
#include <graphene/chain/types.hpp>
#include <graphene/protocol/betting_market.hpp>
#include <graphene/db/object.hpp>
#include <graphene/db/generic_index.hpp>
#include <graphene/chain/protocol/betting_market.hpp>
#include <sstream>
#include <boost/multi_index/composite_key.hpp>
#include <sstream>
namespace graphene { namespace chain {
class betting_market_object;
class betting_market_group_object;
@ -45,7 +48,7 @@ namespace fc {
namespace graphene { namespace chain {
FC_DECLARE_EXCEPTION(no_transition, 100000, "Invalid state transition");
FC_DECLARE_EXCEPTION(no_transition, 100000);
class database;
struct by_event_id;
@ -717,9 +720,16 @@ inline Stream& operator>>( Stream& s, betting_market_group_object& betting_marke
} } // graphene::chain
MAP_OBJECT_ID_TO_TYPE(graphene::chain::betting_market_rules_object)
MAP_OBJECT_ID_TO_TYPE(graphene::chain::betting_market_group_object)
MAP_OBJECT_ID_TO_TYPE(graphene::chain::betting_market_object)
MAP_OBJECT_ID_TO_TYPE(graphene::chain::bet_object)
MAP_OBJECT_ID_TO_TYPE(graphene::chain::betting_market_position_object)
FC_REFLECT_DERIVED( graphene::chain::betting_market_rules_object, (graphene::db::object), (name)(description) )
FC_REFLECT_DERIVED( graphene::chain::betting_market_group_object, (graphene::db::object), (description)(event_id)(rules_id)(asset_id)(total_matched_bets_amount)(never_in_play)(delay_before_settling)(settling_time) )
FC_REFLECT_DERIVED( graphene::chain::betting_market_object, (graphene::db::object), (group_id)(description)(payout_condition)(resolution) )
FC_REFLECT_DERIVED( graphene::chain::bet_object, (graphene::db::object), (bettor_id)(betting_market_id)(amount_to_bet)(backer_multiplier)(back_or_lay)(end_of_delay) )
FC_REFLECT_DERIVED( graphene::chain::betting_market_position_object, (graphene::db::object), (bettor_id)(betting_market_id)(pay_if_payout_condition)(pay_if_not_payout_condition)(pay_if_canceled)(pay_if_not_canceled)(fees_collected) )

View file

@ -23,12 +23,13 @@
*/
#pragma once
#include <fstream>
#include <graphene/chain/protocol/block.hpp>
#include <graphene/protocol/block.hpp>
#include <fc/filesystem.hpp>
namespace graphene { namespace chain {
class index_entry;
struct index_entry;
using namespace graphene::protocol;
class block_database
{

View file

@ -22,7 +22,8 @@
* THE SOFTWARE.
*/
#pragma once
#include <graphene/chain/protocol/types.hpp>
#include <graphene/chain/types.hpp>
#include <graphene/db/object.hpp>
namespace graphene { namespace chain {
@ -48,6 +49,7 @@ namespace graphene { namespace chain {
} }
MAP_OBJECT_ID_TO_TYPE(graphene::chain::block_summary_object)
FC_REFLECT_DERIVED( graphene::chain::block_summary_object, (graphene::db::object), (block_id) )

View file

@ -22,7 +22,9 @@
* THE SOFTWARE.
*/
#pragma once
#include <graphene/chain/protocol/types.hpp>
#include <graphene/chain/types.hpp>
#include <graphene/db/object.hpp>
#include <graphene/db/generic_index.hpp>
namespace graphene { namespace chain {
@ -67,6 +69,8 @@ class budget_record_object : public graphene::db::abstract_object<budget_record_
} }
MAP_OBJECT_ID_TO_TYPE(graphene::chain::budget_record_object)
FC_REFLECT(graphene::chain::budget_record,
(time_since_last_budget)
(from_initial_reserve)

View file

@ -23,7 +23,7 @@
*/
#pragma once
#include <graphene/chain/protocol/buyback.hpp>
#include <graphene/protocol/buyback.hpp>
namespace graphene { namespace chain {

View file

@ -23,7 +23,8 @@
*/
#pragma once
#include <graphene/chain/protocol/types.hpp>
#include <graphene/chain/types.hpp>
#include <graphene/db/object.hpp>
#include <graphene/db/generic_index.hpp>
@ -64,6 +65,8 @@ typedef generic_index< buyback_object, buyback_multi_index_type > buyback_index;
} } // graphene::chain
MAP_OBJECT_ID_TO_TYPE(graphene::chain::buyback_object)
FC_REFLECT_DERIVED( graphene::chain::buyback_object, (graphene::db::object), (asset_to_buy) )
GRAPHENE_EXTERNAL_SERIALIZATION( extern, graphene::chain::buyback_object )

View file

@ -24,6 +24,7 @@
#pragma once
#include <graphene/chain/immutable_chain_parameters.hpp>
#include <graphene/chain/types.hpp>
namespace graphene { namespace chain {
@ -42,6 +43,8 @@ class chain_property_object : public abstract_object<chain_property_object>
} }
MAP_OBJECT_ID_TO_TYPE(graphene::chain::chain_property_object)
FC_REFLECT_DERIVED( graphene::chain::chain_property_object, (graphene::db::object),
(chain_id)
(immutable_parameters)

View file

@ -24,6 +24,7 @@
#pragma once
#include <graphene/chain/evaluator.hpp>
#include <graphene/chain/committee_member_object.hpp>
#include <graphene/chain/global_property_object.hpp>
namespace graphene { namespace chain {

View file

@ -22,9 +22,10 @@
* THE SOFTWARE.
*/
#pragma once
#include <graphene/chain/protocol/types.hpp>
#include <graphene/db/object.hpp>
#include <graphene/db/generic_index.hpp>
#include <graphene/protocol/vote.hpp>
#include <graphene/chain/types.hpp>
namespace graphene { namespace chain {
using namespace graphene::db;
@ -71,6 +72,7 @@ namespace graphene { namespace chain {
using committee_member_index = generic_index<committee_member_object, committee_member_multi_index_type>;
} } // graphene::chain
MAP_OBJECT_ID_TO_TYPE(graphene::chain::committee_member_object)
FC_REFLECT_DERIVED( graphene::chain::committee_member_object, (graphene::db::object),
(committee_member_account)(vote_id)(total_votes)(url) )

View file

@ -23,13 +23,10 @@
*/
#pragma once
#include <graphene/chain/evaluator.hpp>
#include <graphene/chain/types.hpp>
namespace graphene { namespace chain {
struct transfer_to_blind_operation;
struct transfer_from_blind_operation;
struct blind_transfer_operation;
class transfer_to_blind_evaluator : public evaluator<transfer_to_blind_evaluator>
{
public:

View file

@ -23,8 +23,8 @@
*/
#pragma once
#include <graphene/chain/protocol/authority.hpp>
#include <graphene/chain/protocol/types.hpp>
#include <graphene/protocol/authority.hpp>
#include <graphene/protocol/types.hpp>
#include <graphene/db/generic_index.hpp>
@ -65,6 +65,7 @@ typedef generic_index<blinded_balance_object, blinded_balance_object_multi_index
} } // graphene::chain
MAP_OBJECT_ID_TO_TYPE(graphene::chain::blinded_balance_object)
FC_REFLECT_DERIVED( graphene::chain::blinded_balance_object, (graphene::db::object),
(commitment)(asset_id)(owner) )

View file

@ -23,242 +23,16 @@
*/
#pragma once
#ifdef BUILD_PEERPLAYS_TESTNET
#define GRAPHENE_SYMBOL "TEST"
#define GRAPHENE_ADDRESS_PREFIX "TEST"
#else
#define GRAPHENE_SYMBOL "PPY"
#define GRAPHENE_ADDRESS_PREFIX "PPY"
#endif
#define GRAPHENE_MIN_ACCOUNT_NAME_LENGTH 1
#define GRAPHENE_MAX_ACCOUNT_NAME_LENGTH 63
#define GRAPHENE_MIN_ASSET_SYMBOL_LENGTH 3
#define GRAPHENE_MAX_ASSET_SYMBOL_LENGTH 16
#define GRAPHENE_MAX_SHARE_SUPPLY int64_t(1000000000000000ll)
#define GRAPHENE_MAX_PAY_RATE 10000 /* 100% */
#define GRAPHENE_MAX_SIG_CHECK_DEPTH 2
/**
* Don't allow the committee_members to publish a limit that would
* make the network unable to operate.
*/
#define GRAPHENE_MIN_TRANSACTION_SIZE_LIMIT 1024
#define GRAPHENE_MIN_BLOCK_INTERVAL 1 /* seconds */
#define GRAPHENE_MAX_BLOCK_INTERVAL 30 /* seconds */
#define GRAPHENE_DEFAULT_BLOCK_INTERVAL 3 /* seconds */
#define GRAPHENE_DEFAULT_MAX_TRANSACTION_SIZE 2048
#define GRAPHENE_DEFAULT_MAX_BLOCK_SIZE (GRAPHENE_DEFAULT_MAX_TRANSACTION_SIZE*GRAPHENE_DEFAULT_BLOCK_INTERVAL*200000)
#define GRAPHENE_DEFAULT_MAX_TIME_UNTIL_EXPIRATION (60*60*24) // seconds, aka: 1 day
#define GRAPHENE_DEFAULT_MAINTENANCE_INTERVAL (60*60*24) // seconds, aka: 1 day
#define GRAPHENE_DEFAULT_MAINTENANCE_SKIP_SLOTS 3 // number of slots to skip for maintenance interval
#include <graphene/protocol/config.hpp>
#define GRAPHENE_MIN_UNDO_HISTORY 10
#define GRAPHENE_MAX_UNDO_HISTORY 10000
#define GRAPHENE_MIN_BLOCK_SIZE_LIMIT (GRAPHENE_MIN_TRANSACTION_SIZE_LIMIT*5) // 5 transactions per block
#define GRAPHENE_MIN_TRANSACTION_EXPIRATION_LIMIT (GRAPHENE_MAX_BLOCK_INTERVAL * 5) // 5 transactions per block
#define GRAPHENE_BLOCKCHAIN_PRECISION uint64_t( 100000 )
#define GRAPHENE_MAX_NESTED_OBJECTS (200)
#define GRAPHENE_BLOCKCHAIN_PRECISION_DIGITS 5
#define GRAPHENE_DEFAULT_TRANSFER_FEE (1*GRAPHENE_BLOCKCHAIN_PRECISION)
#define GRAPHENE_MAX_INSTANCE_ID (uint64_t(-1)>>16)
/** percentage fields are fixed point with a denominator of 10,000 */
#define GRAPHENE_100_PERCENT 10000
#define GRAPHENE_1_PERCENT (GRAPHENE_100_PERCENT/100)
/** NOTE: making this a power of 2 (say 2^15) would greatly accelerate fee calcs */
#define GRAPHENE_MAX_MARKET_FEE_PERCENT GRAPHENE_100_PERCENT
#define GRAPHENE_DEFAULT_FORCE_SETTLEMENT_DELAY (60*60*24) ///< 1 day
#define GRAPHENE_DEFAULT_FORCE_SETTLEMENT_OFFSET 0 ///< 1%
#define GRAPHENE_DEFAULT_FORCE_SETTLEMENT_MAX_VOLUME (20* GRAPHENE_1_PERCENT) ///< 20%
#define GRAPHENE_DEFAULT_PRICE_FEED_LIFETIME (60*60*24) ///< 1 day
#define GRAPHENE_MAX_FEED_PRODUCERS 200
#define GRAPHENE_DEFAULT_MAX_AUTHORITY_MEMBERSHIP 10
#define GRAPHENE_DEFAULT_MAX_ASSET_WHITELIST_AUTHORITIES 10
#define GRAPHENE_DEFAULT_MAX_ASSET_FEED_PUBLISHERS 10
/**
* These ratios are fixed point numbers with a denominator of GRAPHENE_COLLATERAL_RATIO_DENOM, the
* minimum maitenance collateral is therefore 1.001x and the default
* maintenance ratio is 1.75x
*/
///@{
#define GRAPHENE_COLLATERAL_RATIO_DENOM 1000
#define GRAPHENE_MIN_COLLATERAL_RATIO 1001 ///< lower than this could result in divide by 0
#define GRAPHENE_MAX_COLLATERAL_RATIO 32000 ///< higher than this is unnecessary and may exceed int16 storage
#define GRAPHENE_DEFAULT_MAINTENANCE_COLLATERAL_RATIO 1750 ///< Call when collateral only pays off 175% the debt
#define GRAPHENE_DEFAULT_MAX_SHORT_SQUEEZE_RATIO 1500 ///< Stop calling when collateral only pays off 150% of the debt
///@}
#define GRAPHENE_DEFAULT_MARGIN_PERIOD_SEC (30*60*60*24)
#define GRAPHENE_DEFAULT_MIN_WITNESS_COUNT (11)
#define GRAPHENE_DEFAULT_MIN_COMMITTEE_MEMBER_COUNT (11)
#define GRAPHENE_DEFAULT_MIN_SON_COUNT (5)
#define GRAPHENE_DEFAULT_MAX_WITNESSES (1001) // SHOULD BE ODD
#define GRAPHENE_DEFAULT_MAX_COMMITTEE (1001) // SHOULD BE ODD
#define GRAPHENE_DEFAULT_MAX_SONS (15)
#define GRAPHENE_DEFAULT_MAX_PROPOSAL_LIFETIME_SEC (60*60*24*7*4) // Four weeks
#define GRAPHENE_DEFAULT_COMMITTEE_PROPOSAL_REVIEW_PERIOD_SEC (60*60*24*7*2) // Two weeks
#define GRAPHENE_DEFAULT_NETWORK_PERCENT_OF_FEE (20*GRAPHENE_1_PERCENT)
#define GRAPHENE_DEFAULT_LIFETIME_REFERRER_PERCENT_OF_FEE (30*GRAPHENE_1_PERCENT)
#define GRAPHENE_DEFAULT_MAX_BULK_DISCOUNT_PERCENT (50*GRAPHENE_1_PERCENT)
#define GRAPHENE_DEFAULT_BULK_DISCOUNT_THRESHOLD_MIN ( GRAPHENE_BLOCKCHAIN_PRECISION*int64_t(1000) )
#define GRAPHENE_DEFAULT_BULK_DISCOUNT_THRESHOLD_MAX ( GRAPHENE_DEFAULT_BULK_DISCOUNT_THRESHOLD_MIN*int64_t(100) )
#define GRAPHENE_DEFAULT_CASHBACK_VESTING_PERIOD_SEC (60*60*24*365) ///< 1 year
#define GRAPHENE_DEFAULT_CASHBACK_VESTING_THRESHOLD (GRAPHENE_BLOCKCHAIN_PRECISION*int64_t(100))
#define GRAPHENE_DEFAULT_BURN_PERCENT_OF_FEE (20*GRAPHENE_1_PERCENT)
#define GRAPHENE_WITNESS_PAY_PERCENT_PRECISION (1000000000)
#define GRAPHENE_DEFAULT_MAX_ASSERT_OPCODE 1
#define GRAPHENE_DEFAULT_FEE_LIQUIDATION_THRESHOLD GRAPHENE_BLOCKCHAIN_PRECISION * 100;
#define GRAPHENE_DEFAULT_ACCOUNTS_PER_FEE_SCALE 1000
#define GRAPHENE_DEFAULT_ACCOUNT_FEE_SCALE_BITSHIFTS 4
#define GRAPHENE_DEFAULT_MAX_BUYBACK_MARKETS 4
#define GRAPHENE_MAX_WORKER_NAME_LENGTH 63
#define GRAPHENE_MAX_URL_LENGTH 127
#define GRAPHENE_WITNESS_SHUFFLED_ALGORITHM 0
#define GRAPHENE_WITNESS_SCHEDULED_ALGORITHM 1
// counter initialization values used to derive near and far future seeds for shuffling witnesses
// we use the fractional bits of sqrt(2) in hex
#define GRAPHENE_NEAR_SCHEDULE_CTR_IV ( (uint64_t( 0x6a09 ) << 0x30) \
| (uint64_t( 0xe667 ) << 0x20) \
| (uint64_t( 0xf3bc ) << 0x10) \
| (uint64_t( 0xc908 ) ) )
// and the fractional bits of sqrt(3) in hex
#define GRAPHENE_FAR_SCHEDULE_CTR_IV ( (uint64_t( 0xbb67 ) << 0x30) \
| (uint64_t( 0xae85 ) << 0x20) \
| (uint64_t( 0x84ca ) << 0x10) \
| (uint64_t( 0xa73b ) ) )
// counter used to determine bits of entropy
// must be less than or equal to secret_hash_type::data_length()
#define GRAPHENE_RNG_SEED_LENGTH (160 / 8)
/**
* every second, the fraction of burned core asset which cycles is
* GRAPHENE_CORE_ASSET_CYCLE_RATE / (1 << GRAPHENE_CORE_ASSET_CYCLE_RATE_BITS)
*/
#define GRAPHENE_CORE_ASSET_CYCLE_RATE 17
#define GRAPHENE_CORE_ASSET_CYCLE_RATE_BITS 32
#define GRAPHENE_DEFAULT_WITNESS_PAY_PER_BLOCK (GRAPHENE_BLOCKCHAIN_PRECISION * int64_t( 10) )
#define GRAPHENE_DEFAULT_WITNESS_PAY_VESTING_SECONDS (60*60*24)
#define GRAPHENE_DEFAULT_WORKER_BUDGET_PER_DAY (GRAPHENE_BLOCKCHAIN_PRECISION * int64_t(500) * 1000 )
#define GRAPHENE_DEFAULT_MINIMUM_FEEDS 7
#define GRAPHENE_MAX_INTEREST_APR uint16_t( 10000 )
#define GRAPHENE_CURRENT_DB_VERSION "PPY2.5"
#define GRAPHENE_DEFAULT_MIN_SON_COUNT (5)
#define GRAPHENE_RECENTLY_MISSED_COUNT_INCREMENT 4
#define GRAPHENE_RECENTLY_MISSED_COUNT_DECREMENT 3
#define GRAPHENE_CURRENT_DB_VERSION "PPY2.4"
#define GRAPHENE_IRREVERSIBLE_THRESHOLD (70 * GRAPHENE_1_PERCENT)
/**
* Reserved Account IDs with special meaning
*/
///@{
/// Represents the current committee members, two-week review period
#define GRAPHENE_COMMITTEE_ACCOUNT (graphene::chain::account_id_type(0))
/// Represents the current witnesses
#define GRAPHENE_WITNESS_ACCOUNT (graphene::chain::account_id_type(1))
/// Represents the current committee members
#define GRAPHENE_RELAXED_COMMITTEE_ACCOUNT (graphene::chain::account_id_type(2))
/// Represents the canonical account with NO authority (nobody can access funds in null account)
#define GRAPHENE_NULL_ACCOUNT (graphene::chain::account_id_type(3))
/// Represents the canonical account with WILDCARD authority (anybody can access funds in temp account)
#define GRAPHENE_TEMP_ACCOUNT (graphene::chain::account_id_type(4))
/// Represents the canonical account for specifying you will vote directly (as opposed to a proxy)
#define GRAPHENE_PROXY_TO_SELF_ACCOUNT (graphene::chain::account_id_type(5))
///
#define GRAPHENE_RAKE_FEE_ACCOUNT_ID (graphene::chain::account_id_type(6))
/// Sentinel value used in the scheduler.
#define GRAPHENE_NULL_WITNESS (graphene::chain::witness_id_type(0))
///@}
#define GRAPHENE_FBA_STEALTH_DESIGNATED_ASSET (asset_id_type(743))
#define GRAPHENE_DEFAULT_RAKE_FEE_PERCENTAGE (3*GRAPHENE_1_PERCENT)
/**
* Betting-related constants.
*
* We store bet multipliers as fixed-precision uint32_t. These values are
* the maximum power-of-ten bet we can have on a "symmetric" market:
* (decimal) 1.0001 - 10001
* (fractional) 1:10000 - 10000:1
*/
///@{
/// betting odds (multipliers) are stored as fixed-precision, divide by this to get the actual multiplier
#define GRAPHENE_BETTING_ODDS_PRECISION 10000
/// the smallest bet multiplier we will accept
#define GRAPHENE_BETTING_MIN_MULTIPLIER 10001
/// the largest bet multiplier we will accept
#define GRAPHENE_BETTING_MAX_MULTIPLIER 100010000
///@}
#define GRAPHENE_DEFAULT_MIN_BET_MULTIPLIER 10100
#define GRAPHENE_DEFAULT_MAX_BET_MULTIPLIER 10000000
#define GRAPHENE_DEFAULT_PERMITTED_BETTING_ODDS_INCREMENTS { { 20000, 100}, /* <= 2: 0.01 */ \
{ 30000, 200}, /* <= 3: 0.02 */ \
{ 40000, 500}, /* <= 4: 0.05 */ \
{ 60000, 1000}, /* <= 6: 0.10 */ \
{ 100000, 2000}, /* <= 10: 0.20 */ \
{ 200000, 5000}, /* <= 20: 0.50 */ \
{ 300000, 10000}, /* <= 30: 1.00 */ \
{ 500000, 20000}, /* <= 50: 2.00 */ \
{ 1000000, 50000}, /* <= 100: 5.00 */ \
{ 10000000, 100000} } /* <= 1000: 10.00 */
#define GRAPHENE_DEFAULT_BETTING_PERCENT_FEE (2 * GRAPHENE_1_PERCENT)
#define GRAPHENE_DEFAULT_LIVE_BETTING_DELAY_TIME 5 // seconds
#define GRAPHENE_MAX_NESTED_OBJECTS (200)
#define TOURNAMENT_MIN_ROUND_DELAY 0
#define TOURNAMENT_MAX_ROUND_DELAY 600
#define TOURNAMENT_MIN_TIME_PER_COMMIT_MOVE 0
#define TOURNAMENT_MAN_TIME_PER_COMMIT_MOVE 600
#define TOURNAMENT_MIN_TIME_PER_REVEAL_MOVE 0
#define TOURNAMENT_MAX_TIME_PER_REVEAL_MOVE 600
#define TOURNAMENT_DEFAULT_RAKE_FEE_PERCENTAGE (3*GRAPHENE_1_PERCENT)
#define TOURNAMENT_MINIMAL_RAKE_FEE_PERCENTAGE (1*GRAPHENE_1_PERCENT)
#define TOURNAMENT_MAXIMAL_RAKE_FEE_PERCENTAGE (20*GRAPHENE_1_PERCENT)
#define TOURNAMENT_MAXIMAL_REGISTRATION_DEADLINE (60*60*24*30) // seconds, 30 days
#define TOURNAMENT_MAX_NUMBER_OF_WINS 100
#define TOURNAMENT_MAX_PLAYERS_NUMBER 256
#define TOURNAMENT_MAX_WHITELIST_LENGTH 1000
#define TOURNAMENT_MAX_START_TIME_IN_FUTURE (60*60*24*7*4) // 1 month
#define TOURNAMENT_MAX_START_DELAY (60*60*24*7) // 1 week
#define SON_VESTING_AMOUNT (50*GRAPHENE_BLOCKCHAIN_PRECISION) // 50 PPY
#define SON_VESTING_PERIOD (60*60*24*2) // 2 days
#define SON_DEREGISTER_TIME (60*60*12) // 12 Hours in seconds
#define SON_HEARTBEAT_FREQUENCY (60*3) // 3 minutes in seconds
#define SON_DOWN_TIME (60*3*2) // 2 Heartbeats in seconds
#define SON_BITCOIN_MIN_TX_CONFIRMATIONS (1)
#define SON_PAY_TIME (60*60*24) // 1 day
#define SON_PAY_MAX (GRAPHENE_BLOCKCHAIN_PRECISION * int64_t(200))
#define SWEEPS_DEFAULT_DISTRIBUTION_PERCENTAGE (2*GRAPHENE_1_PERCENT)
#define SWEEPS_DEFAULT_DISTRIBUTION_ASSET (graphene::chain::asset_id_type(0))
#define SWEEPS_VESTING_BALANCE_MULTIPLIER 100000000
#define SWEEPS_ACCUMULATOR_ACCOUNT (graphene::chain::account_id_type(0))
#define GPOS_PERIOD (60*60*24*30*6) // 6 months
#define GPOS_SUBPERIOD (60*60*24*30) // 1 month
#define GPOS_VESTING_LOCKIN_PERIOD (60*60*24*30) // 1 month
#define RBAC_MIN_PERMISSION_NAME_LENGTH 3
#define RBAC_MAX_PERMISSION_NAME_LENGTH 10
#define RBAC_MAX_PERMISSIONS_PER_ACCOUNT 5 // 5 per account
#define RBAC_MAX_ACCOUNT_AUTHORITY_LIFETIME 180*24*60*60 // 6 months
#define RBAC_MAX_AUTHS_PER_PERMISSION 15 // 15 ops linked per permission
#define NFT_TOKEN_MIN_LENGTH 3
#define NFT_TOKEN_MAX_LENGTH 15
#define NFT_URI_MAX_LENGTH GRAPHENE_MAX_URL_LENGTH
#define ACCOUNT_ROLES_MAX_PER_ACCOUNT 20 // Max 20 roles can be created by a resource owner
#define ACCOUNT_ROLES_MAX_LIFETIME 365*24*60*60 // 1 Year

View file

@ -1,6 +1,7 @@
#pragma once
#include <graphene/chain/evaluator.hpp>
#include <graphene/chain/protocol/custom_account_authority.hpp>
#include <graphene/protocol/custom_account_authority.hpp>
namespace graphene
{
@ -35,4 +36,5 @@ public:
};
} // namespace chain
} // namespace graphene
} // namespace graphene

View file

@ -1,5 +1,6 @@
#pragma once
#include <graphene/chain/protocol/types.hpp>
#include <graphene/chain/types.hpp>
#include <graphene/db/object.hpp>
#include <graphene/db/generic_index.hpp>
@ -23,7 +24,6 @@ namespace graphene { namespace chain {
time_point_sec valid_to;
};
struct by_id;
struct by_permission_and_op;
struct by_expiration;
using custom_account_authority_multi_index_type = multi_index_container<
@ -51,5 +51,8 @@ namespace graphene { namespace chain {
} } // graphene::chain
MAP_OBJECT_ID_TO_TYPE(graphene::chain::custom_account_authority_object)
FC_REFLECT_DERIVED( graphene::chain::custom_account_authority_object, (graphene::db::object),
(permission_id)(operation_type)(valid_from)(valid_to) )
(permission_id)(operation_type)(valid_from)(valid_to) )

View file

@ -22,7 +22,7 @@
* THE SOFTWARE.
*/
#pragma once
#include <graphene/chain/protocol/operations.hpp>
#include <graphene/protocol/operations.hpp>
#include <graphene/chain/evaluator.hpp>
#include <graphene/chain/database.hpp>

View file

@ -1,6 +1,8 @@
#pragma once
#include <graphene/chain/evaluator.hpp>
#include <graphene/chain/protocol/custom_permission.hpp>
#include <graphene/protocol/custom_permission.hpp>
namespace graphene
{
@ -35,4 +37,5 @@ public:
};
} // namespace chain
} // namespace graphene
} // namespace graphene

View file

@ -1,5 +1,9 @@
#pragma once
#include <graphene/chain/protocol/types.hpp>
#include <graphene/chain/types.hpp>
#include <graphene/protocol/authority.hpp>
#include <graphene/db/object.hpp>
#include <graphene/db/generic_index.hpp>
@ -25,7 +29,6 @@ namespace graphene { namespace chain {
authority auth;
};
struct by_id;
struct by_account_and_permission;
using custom_permission_multi_index_type = multi_index_container<
custom_permission_object,
@ -45,5 +48,8 @@ namespace graphene { namespace chain {
} } // graphene::chain
MAP_OBJECT_ID_TO_TYPE(graphene::chain::custom_permission_object)
FC_REFLECT_DERIVED( graphene::chain::custom_permission_object, (graphene::db::object),
(account)(permission_name)(auth) )
(account)(permission_name)(auth) )

View file

@ -22,6 +22,7 @@
* THE SOFTWARE.
*/
#pragma once
#include <graphene/chain/global_property_object.hpp>
#include <graphene/chain/node_property_object.hpp>
#include <graphene/chain/account_object.hpp>
@ -30,18 +31,20 @@
#include <graphene/chain/block_database.hpp>
#include <graphene/chain/genesis_state.hpp>
#include <graphene/chain/evaluator.hpp>
#include <graphene/chain/betting_market_object.hpp>
#include <graphene/db/object_database.hpp>
#include <graphene/db/object.hpp>
#include <graphene/db/simple_index.hpp>
#include <graphene/protocol/fee_schedule.hpp>
#include <graphene/protocol/protocol.hpp>
#include <graphene/protocol/sidechain_defs.hpp>
#include <fc/signals.hpp>
#include <fc/crypto/hash_ctr_rng.hpp>
#include <graphene/chain/protocol/protocol.hpp>
#include <graphene/chain/sidechain_defs.hpp>
#include <fc/log/logger.hpp>
#include <map>
@ -51,6 +54,15 @@ namespace graphene { namespace chain {
using graphene::db::object;
class op_evaluator;
class transaction_evaluation_state;
class proposal_object;
class operation_history_object;
class chain_property_object;
class witness_schedule_object;
class witness_object;
class force_settlement_object;
class limit_order_object;
class call_order_object;
class account_role_object;
struct budget_record;
@ -334,11 +346,53 @@ namespace graphene { namespace chain {
void initialize_indexes();
void init_genesis(const genesis_state_type& genesis_state = genesis_state_type());
/**
* @brief Register a new evaluator to the evaluator chain for its operation type
* @tparam EvaluatorType An evaluator type which will be used to evaluate its declared operation type
* @return If registering an evaluator for an operation that already has an evaluator, returns a handle for
* the newly added evaluator which can be used to delete it later.
*
* This method registers a new evaluator type with tthe database. The evaluator specifies an operation type
* which it should be used to evaluate. The evaluator will be instantiated each time an operaton of the
* appropriate type is processed and used to evaluate the operation.
*
* This method may be called more than once with multiple evaluator types for a given operation type. When
* multiple evaluator types are registered for a given operation type, they will all execute in the order of
* registration; however, only the return value of the first registered evaluator will be returned; return
* values of subsequently registered evaluators will be silently dropped.
*
* The first evaluator registered for a given operation type is permanent, and is the only evaluator which
* can return a value. Subsequent (auxiliary) evaluators for that operation type can be deleted at runtime
* by calling @ref delete_evaluator() with the evaluator_handle obtained when registering the evaluator.
*/
template<typename EvaluatorType>
void register_evaluator()
optional<op_evaluator::evaluator_handle> register_evaluator()
{
_operation_evaluators[
operation::tag<typename EvaluatorType::operation_type>::value].reset( new op_evaluator_impl<EvaluatorType>() );
auto& eval_ptr = _operation_evaluators[operation::tag<typename EvaluatorType::operation_type>::value];
if (eval_ptr == nullptr)
eval_ptr = std::make_unique<op_evaluator_impl<EvaluatorType>>();
else
return eval_ptr->append_evaluator(std::make_unique<op_evaluator_impl<EvaluatorType>>());
return {};
}
/**
* @brief Delete an auxiliary evaluator
* @param handle The evaluator handle for the evaluator to delete, as returned by @ref register_evaluator
*
* Auxiliary evaluators, or the second and subsequent evaluators registered for a given operation type,
* can be deleted so that they no longer execute when operations of the relevant type are processed.
*
* If it may be desired to delete an auxiliary evaluator, retain the evaluator handle obtained when the
* evaluator was initially registered and when it is necessary to delete the evaluator, pass the handle
* to this function.
*
* The evaluator will have been deleted by the time this function returns.
*/
void delete_evaluator(op_evaluator::evaluator_handle&& handle)
{
if ((uint64_t)handle.get_operation_type() < _operation_evaluators.size())
_operation_evaluators[handle.get_operation_type()]->delete_evaluator(std::move(handle));
}
//////////////////// db_balance.cpp ////////////////////

View file

@ -24,14 +24,17 @@
#pragma once
#include <graphene/chain/exceptions.hpp>
#include <graphene/chain/transaction_evaluation_state.hpp>
#include <graphene/chain/protocol/operations.hpp>
#include <graphene/protocol/operations.hpp>
namespace graphene { namespace chain {
class database;
struct signed_transaction;
class generic_evaluator;
class transaction_evaluation_state;
class account_object;
class account_statistics_object;
class asset_object;
class asset_dynamic_data_object;
class generic_evaluator
{
@ -119,8 +122,41 @@ namespace graphene { namespace chain {
class op_evaluator
{
protected:
unique_ptr<op_evaluator> next_evaluator;
public:
class evaluator_handle {
// Move-only semantics, and only friends can construct
evaluator_handle(const op_evaluator* pointer, operation::tag_type type)
: pointer(pointer), operation_type(type) {}
evaluator_handle(const evaluator_handle&) = delete;
evaluator_handle& operator=(const evaluator_handle&) = delete;
friend class op_evaluator;
template<typename>
friend class op_evaluator_impl;
// Pointer to the handled evaluator
const op_evaluator* pointer;
// Tag of the handled evaluator
operation::tag_type operation_type;
public:
evaluator_handle(evaluator_handle&&) = default;
evaluator_handle& operator=(evaluator_handle&&) = default;
operation::tag_type get_operation_type() const { return operation_type; }
};
virtual ~op_evaluator(){}
virtual evaluator_handle append_evaluator(unique_ptr<op_evaluator> next_evaluator) = 0;
virtual void delete_evaluator(evaluator_handle&& handle) {
if (next_evaluator.get() == handle.pointer)
// Next evaluator in chain is the one to delete. Move its next pointer into ours, and unique_ptr will delete the one that's going away.
next_evaluator = std::move(next_evaluator->next_evaluator);
else
next_evaluator->delete_evaluator(std::move(handle));
}
virtual operation_result evaluate(transaction_evaluation_state& eval_state, const operation& op, bool apply) = 0;
};
@ -128,10 +164,21 @@ namespace graphene { namespace chain {
class op_evaluator_impl : public op_evaluator
{
public:
virtual evaluator_handle append_evaluator(unique_ptr<op_evaluator> next_evaluator) override {
if (this->next_evaluator == nullptr) {
this->next_evaluator = std::move(next_evaluator);
return evaluator_handle(this->next_evaluator.get(), operation::tag<typename T::operation_type>::value);
} else {
return this->next_evaluator->append_evaluator(std::move(next_evaluator));
}
}
virtual operation_result evaluate(transaction_evaluation_state& eval_state, const operation& op, bool apply = true) override
{
T eval;
return eval.start_evaluate(eval_state, op, apply);
auto result = eval.start_evaluate(eval_state, op, apply);
if (this->next_evaluator != nullptr)
this->next_evaluator->evaluate(eval_state, op, apply);
return result;
}
};

View file

@ -23,9 +23,11 @@
*/
#pragma once
#include <graphene/chain/protocol/operations.hpp>
#include <graphene/chain/evaluator.hpp>
#include <graphene/chain/database.hpp>
#include <graphene/chain/event_object.hpp>
#include <graphene/protocol/operations.hpp>
namespace graphene { namespace chain {

View file

@ -23,7 +23,7 @@
*/
#pragma once
#include <graphene/chain/protocol/operations.hpp>
#include <graphene/protocol/operations.hpp>
#include <graphene/chain/evaluator.hpp>
#include <graphene/chain/database.hpp>

View file

@ -23,9 +23,11 @@
*/
#pragma once
#include <graphene/chain/protocol/types.hpp>
#include <graphene/chain/types.hpp>
#include <graphene/db/object.hpp>
#include <graphene/db/generic_index.hpp>
#include <boost/multi_index/composite_key.hpp>
namespace graphene { namespace chain {
@ -58,4 +60,6 @@ typedef multi_index_container<
typedef generic_index<event_group_object, event_group_object_multi_index_type> event_group_object_index;
} } // graphene::chain
MAP_OBJECT_ID_TO_TYPE(graphene::chain::event_group_object)
FC_REFLECT_DERIVED( graphene::chain::event_group_object, (graphene::db::object), (name)(sport_id) )

View file

@ -23,14 +23,17 @@
*/
#pragma once
#include <graphene/chain/protocol/types.hpp>
#include <graphene/chain/types.hpp>
#include <graphene/protocol/event.hpp>
#include <graphene/db/object.hpp>
#include <graphene/db/generic_index.hpp>
#include <graphene/chain/protocol/event.hpp>
#include <sstream>
#include <boost/multi_index/composite_key.hpp>
#include <sstream>
namespace graphene { namespace chain {
class event_object;
} }
@ -158,6 +161,9 @@ typedef generic_index<event_object, event_object_multi_index_type> event_object_
return s;
}
} } // graphene::chain
FC_REFLECT(graphene::chain::event_object, (name)(season)(start_time)(event_group_id)(at_least_one_betting_market_group_settled)(scores))
MAP_OBJECT_ID_TO_TYPE(graphene::chain::event_object)
FC_REFLECT_DERIVED(graphene::chain::event_object, (graphene::db::object),
(name)(season)(start_time)(event_group_id)(at_least_one_betting_market_group_settled)(scores))

View file

@ -25,7 +25,10 @@
#include <boost/exception/diagnostic_information.hpp>
#include <fc/exception/exception.hpp>
#include <graphene/chain/protocol/protocol.hpp>
#include <graphene/protocol/exceptions.hpp>
#include <graphene/protocol/fee_schedule.hpp>
#include <graphene/protocol/operations.hpp>
#include <graphene/chain/types.hpp>
#define GRAPHENE_ASSERT( expr, exc_type, FORMAT, ... ) \
FC_MULTILINE_MACRO_BEGIN \
@ -33,15 +36,26 @@
FC_THROW_EXCEPTION( exc_type, FORMAT, __VA_ARGS__ ); \
FC_MULTILINE_MACRO_END
#define GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( op_name ) \
FC_DECLARE_DERIVED_EXCEPTION( \
op_name ## _validate_exception, \
graphene::chain::operation_validate_exception, \
3040000 + 100 * operation::tag< op_name ## _operation >::value \
) \
FC_DECLARE_DERIVED_EXCEPTION( \
op_name ## _evaluate_exception, \
graphene::chain::operation_evaluate_exception, \
3050000 + 100 * operation::tag< op_name ## _operation >::value \
)
#define GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( op_name ) \
FC_IMPLEMENT_DERIVED_EXCEPTION( \
op_name ## _validate_exception, \
graphene::chain::operation_validate_exception, \
3040000 + 100 * operation::tag< op_name ## _operation >::value, \
#op_name "_operation validation exception" \
) \
FC_DECLARE_DERIVED_EXCEPTION( \
FC_IMPLEMENT_DERIVED_EXCEPTION( \
op_name ## _evaluate_exception, \
graphene::chain::operation_evaluate_exception, \
3050000 + 100 * operation::tag< op_name ## _operation >::value, \
@ -50,6 +64,14 @@
#define GRAPHENE_DECLARE_OP_VALIDATE_EXCEPTION( exc_name, op_name, seqnum, msg ) \
FC_DECLARE_DERIVED_EXCEPTION( \
op_name ## _ ## exc_name, \
graphene::chain::op_name ## _validate_exception, \
3040000 + 100 * operation::tag< op_name ## _operation >::value \
+ seqnum \
)
#define GRAPHENE_IMPLEMENT_OP_VALIDATE_EXCEPTION( exc_name, op_name, seqnum, msg ) \
FC_IMPLEMENT_DERIVED_EXCEPTION( \
op_name ## _ ## exc_name, \
graphene::chain::op_name ## _validate_exception, \
3040000 + 100 * operation::tag< op_name ## _operation >::value \
@ -59,6 +81,14 @@
#define GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( exc_name, op_name, seqnum, msg ) \
FC_DECLARE_DERIVED_EXCEPTION( \
op_name ## _ ## exc_name, \
graphene::chain::op_name ## _evaluate_exception, \
3050000 + 100 * operation::tag< op_name ## _operation >::value \
+ seqnum \
)
#define GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( exc_name, op_name, seqnum, msg ) \
FC_IMPLEMENT_DERIVED_EXCEPTION( \
op_name ## _ ## exc_name, \
graphene::chain::op_name ## _evaluate_exception, \
3050000 + 100 * operation::tag< op_name ## _operation >::value \
@ -91,30 +121,21 @@
namespace graphene { namespace chain {
FC_DECLARE_EXCEPTION( chain_exception, 3000000, "blockchain exception" )
FC_DECLARE_DERIVED_EXCEPTION( database_query_exception, graphene::chain::chain_exception, 3010000, "database query exception" )
FC_DECLARE_DERIVED_EXCEPTION( block_validate_exception, graphene::chain::chain_exception, 3020000, "block validation exception" )
FC_DECLARE_DERIVED_EXCEPTION( transaction_exception, graphene::chain::chain_exception, 3030000, "transaction validation exception" )
FC_DECLARE_DERIVED_EXCEPTION( operation_validate_exception, graphene::chain::chain_exception, 3040000, "operation validation exception" )
FC_DECLARE_DERIVED_EXCEPTION( operation_evaluate_exception, graphene::chain::chain_exception, 3050000, "operation evaluation exception" )
FC_DECLARE_DERIVED_EXCEPTION( utility_exception, graphene::chain::chain_exception, 3060000, "utility method exception" )
FC_DECLARE_DERIVED_EXCEPTION( undo_database_exception, graphene::chain::chain_exception, 3070000, "undo database exception" )
FC_DECLARE_DERIVED_EXCEPTION( unlinkable_block_exception, graphene::chain::chain_exception, 3080000, "unlinkable block" )
FC_DECLARE_DERIVED_EXCEPTION( black_swan_exception, graphene::chain::chain_exception, 3090000, "black swan" )
FC_DECLARE_DERIVED_EXCEPTION( plugin_exception, graphene::chain::chain_exception, 3100000, "plugin exception" )
FC_DECLARE_EXCEPTION( chain_exception, 3000000 )
FC_DECLARE_DERIVED_EXCEPTION( database_query_exception, chain_exception, 3010000 )
FC_DECLARE_DERIVED_EXCEPTION( block_validate_exception, chain_exception, 3020000 )
FC_DECLARE_DERIVED_EXCEPTION( transaction_exception, chain_exception, 3030000 )
FC_DECLARE_DERIVED_EXCEPTION( operation_validate_exception, chain_exception, 3040000 )
FC_DECLARE_DERIVED_EXCEPTION( operation_evaluate_exception, chain_exception, 3050000 )
FC_DECLARE_DERIVED_EXCEPTION( utility_exception, chain_exception, 3060000 )
FC_DECLARE_DERIVED_EXCEPTION( undo_database_exception, chain_exception, 3070000 )
FC_DECLARE_DERIVED_EXCEPTION( unlinkable_block_exception, chain_exception, 3080000 )
FC_DECLARE_DERIVED_EXCEPTION( black_swan_exception, chain_exception, 3090000 )
FC_DECLARE_DERIVED_EXCEPTION( plugin_exception, chain_exception, 3100000 )
FC_DECLARE_DERIVED_EXCEPTION( tx_missing_active_auth, graphene::chain::transaction_exception, 3030001, "missing required active authority" )
FC_DECLARE_DERIVED_EXCEPTION( tx_missing_owner_auth, graphene::chain::transaction_exception, 3030002, "missing required owner authority" )
FC_DECLARE_DERIVED_EXCEPTION( tx_missing_other_auth, graphene::chain::transaction_exception, 3030003, "missing required other authority" )
FC_DECLARE_DERIVED_EXCEPTION( tx_irrelevant_sig, graphene::chain::transaction_exception, 3030004, "irrelevant signature included" )
FC_DECLARE_DERIVED_EXCEPTION( tx_duplicate_sig, graphene::chain::transaction_exception, 3030005, "duplicate signature included" )
FC_DECLARE_DERIVED_EXCEPTION( invalid_committee_approval, graphene::chain::transaction_exception, 3030006, "committee account cannot directly approve transaction" )
FC_DECLARE_DERIVED_EXCEPTION( insufficient_fee, graphene::chain::transaction_exception, 3030007, "insufficient fee" )
FC_DECLARE_DERIVED_EXCEPTION( insufficient_feeds, chain_exception, 37006 )
FC_DECLARE_DERIVED_EXCEPTION( invalid_pts_address, graphene::chain::utility_exception, 3060001, "invalid pts address" )
FC_DECLARE_DERIVED_EXCEPTION( insufficient_feeds, graphene::chain::chain_exception, 37006, "insufficient feeds" )
FC_DECLARE_DERIVED_EXCEPTION( pop_empty_chain, graphene::chain::undo_database_exception, 3070001, "there are no blocks to pop" )
FC_DECLARE_DERIVED_EXCEPTION( pop_empty_chain, undo_database_exception, 3070001 )
GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( transfer );
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( from_account_not_whitelisted, transfer, 1, "owner mismatch" )
@ -185,93 +206,11 @@ namespace graphene { namespace chain {
GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( blind_transfer );
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( unknown_commitment, blind_transfer, 1, "Attempting to claim an unknown prior commitment" );
/*
FC_DECLARE_DERIVED_EXCEPTION( addition_overflow, graphene::chain::chain_exception, 30002, "addition overflow" )
FC_DECLARE_DERIVED_EXCEPTION( subtraction_overflow, graphene::chain::chain_exception, 30003, "subtraction overflow" )
FC_DECLARE_DERIVED_EXCEPTION( asset_type_mismatch, graphene::chain::chain_exception, 30004, "asset/price mismatch" )
FC_DECLARE_DERIVED_EXCEPTION( unsupported_chain_operation, graphene::chain::chain_exception, 30005, "unsupported chain operation" )
FC_DECLARE_DERIVED_EXCEPTION( unknown_transaction, graphene::chain::chain_exception, 30006, "unknown transaction" )
FC_DECLARE_DERIVED_EXCEPTION( duplicate_transaction, graphene::chain::chain_exception, 30007, "duplicate transaction" )
FC_DECLARE_DERIVED_EXCEPTION( zero_amount, graphene::chain::chain_exception, 30008, "zero amount" )
FC_DECLARE_DERIVED_EXCEPTION( zero_price, graphene::chain::chain_exception, 30009, "zero price" )
FC_DECLARE_DERIVED_EXCEPTION( asset_divide_by_self, graphene::chain::chain_exception, 30010, "asset divide by self" )
FC_DECLARE_DERIVED_EXCEPTION( asset_divide_by_zero, graphene::chain::chain_exception, 30011, "asset divide by zero" )
FC_DECLARE_DERIVED_EXCEPTION( new_database_version, graphene::chain::chain_exception, 30012, "new database version" )
FC_DECLARE_DERIVED_EXCEPTION( unlinkable_block, graphene::chain::chain_exception, 30013, "unlinkable block" )
FC_DECLARE_DERIVED_EXCEPTION( price_out_of_range, graphene::chain::chain_exception, 30014, "price out of range" )
FC_DECLARE_DERIVED_EXCEPTION( block_numbers_not_sequential, graphene::chain::chain_exception, 30015, "block numbers not sequential" )
FC_DECLARE_DERIVED_EXCEPTION( invalid_previous_block_id, graphene::chain::chain_exception, 30016, "invalid previous block" )
FC_DECLARE_DERIVED_EXCEPTION( invalid_block_time, graphene::chain::chain_exception, 30017, "invalid block time" )
FC_DECLARE_DERIVED_EXCEPTION( time_in_past, graphene::chain::chain_exception, 30018, "time is in the past" )
FC_DECLARE_DERIVED_EXCEPTION( time_in_future, graphene::chain::chain_exception, 30019, "time is in the future" )
FC_DECLARE_DERIVED_EXCEPTION( invalid_block_digest, graphene::chain::chain_exception, 30020, "invalid block digest" )
FC_DECLARE_DERIVED_EXCEPTION( invalid_committee_member_signee, graphene::chain::chain_exception, 30021, "invalid committee_member signee" )
FC_DECLARE_DERIVED_EXCEPTION( failed_checkpoint_verification, graphene::chain::chain_exception, 30022, "failed checkpoint verification" )
FC_DECLARE_DERIVED_EXCEPTION( wrong_chain_id, graphene::chain::chain_exception, 30023, "wrong chain id" )
FC_DECLARE_DERIVED_EXCEPTION( unknown_block, graphene::chain::chain_exception, 30024, "unknown block" )
FC_DECLARE_DERIVED_EXCEPTION( block_older_than_undo_history, graphene::chain::chain_exception, 30025, "block is older than our undo history allows us to process" )
FC_DECLARE_EXCEPTION( evaluation_error, 31000, "Evaluation Error" )
FC_DECLARE_DERIVED_EXCEPTION( negative_deposit, graphene::chain::evaluation_error, 31001, "negative deposit" )
FC_DECLARE_DERIVED_EXCEPTION( not_a_committee_member, graphene::chain::evaluation_error, 31002, "not a committee_member" )
FC_DECLARE_DERIVED_EXCEPTION( unknown_balance_record, graphene::chain::evaluation_error, 31003, "unknown balance record" )
FC_DECLARE_DERIVED_EXCEPTION( insufficient_funds, graphene::chain::evaluation_error, 31004, "insufficient funds" )
FC_DECLARE_DERIVED_EXCEPTION( missing_signature, graphene::chain::evaluation_error, 31005, "missing signature" )
FC_DECLARE_DERIVED_EXCEPTION( invalid_claim_password, graphene::chain::evaluation_error, 31006, "invalid claim password" )
FC_DECLARE_DERIVED_EXCEPTION( invalid_withdraw_condition, graphene::chain::evaluation_error, 31007, "invalid withdraw condition" )
FC_DECLARE_DERIVED_EXCEPTION( negative_withdraw, graphene::chain::evaluation_error, 31008, "negative withdraw" )
FC_DECLARE_DERIVED_EXCEPTION( not_an_active_committee_member, graphene::chain::evaluation_error, 31009, "not an active committee_member" )
FC_DECLARE_DERIVED_EXCEPTION( expired_transaction, graphene::chain::evaluation_error, 31010, "expired transaction" )
FC_DECLARE_DERIVED_EXCEPTION( invalid_transaction_expiration, graphene::chain::evaluation_error, 31011, "invalid transaction expiration" )
FC_DECLARE_DERIVED_EXCEPTION( oversized_transaction, graphene::chain::evaluation_error, 31012, "transaction exceeded the maximum transaction size" )
FC_DECLARE_DERIVED_EXCEPTION( invalid_account_name, graphene::chain::evaluation_error, 32001, "invalid account name" )
FC_DECLARE_DERIVED_EXCEPTION( unknown_account_id, graphene::chain::evaluation_error, 32002, "unknown account id" )
FC_DECLARE_DERIVED_EXCEPTION( unknown_account_name, graphene::chain::evaluation_error, 32003, "unknown account name" )
FC_DECLARE_DERIVED_EXCEPTION( missing_parent_account_signature, graphene::chain::evaluation_error, 32004, "missing parent account signature" )
FC_DECLARE_DERIVED_EXCEPTION( parent_account_retracted, graphene::chain::evaluation_error, 32005, "parent account retracted" )
FC_DECLARE_DERIVED_EXCEPTION( account_expired, graphene::chain::evaluation_error, 32006, "account expired" )
FC_DECLARE_DERIVED_EXCEPTION( account_already_registered, graphene::chain::evaluation_error, 32007, "account already registered" )
FC_DECLARE_DERIVED_EXCEPTION( account_key_in_use, graphene::chain::evaluation_error, 32008, "account key already in use" )
FC_DECLARE_DERIVED_EXCEPTION( account_retracted, graphene::chain::evaluation_error, 32009, "account retracted" )
FC_DECLARE_DERIVED_EXCEPTION( unknown_parent_account_name, graphene::chain::evaluation_error, 32010, "unknown parent account name" )
FC_DECLARE_DERIVED_EXCEPTION( unknown_committee_member_slate, graphene::chain::evaluation_error, 32011, "unknown committee_member slate" )
FC_DECLARE_DERIVED_EXCEPTION( too_may_committee_members_in_slate, graphene::chain::evaluation_error, 32012, "too many committee_members in slate" )
FC_DECLARE_DERIVED_EXCEPTION( pay_balance_remaining, graphene::chain::evaluation_error, 32013, "pay balance remaining" )
FC_DECLARE_DERIVED_EXCEPTION( not_a_committee_member_signature, graphene::chain::evaluation_error, 33002, "not committee_members signature" )
FC_DECLARE_DERIVED_EXCEPTION( invalid_precision, graphene::chain::evaluation_error, 35001, "invalid precision" )
FC_DECLARE_DERIVED_EXCEPTION( invalid_asset_symbol, graphene::chain::evaluation_error, 35002, "invalid asset symbol" )
FC_DECLARE_DERIVED_EXCEPTION( unknown_asset_id, graphene::chain::evaluation_error, 35003, "unknown asset id" )
FC_DECLARE_DERIVED_EXCEPTION( asset_symbol_in_use, graphene::chain::evaluation_error, 35004, "asset symbol in use" )
FC_DECLARE_DERIVED_EXCEPTION( invalid_asset_amount, graphene::chain::evaluation_error, 35005, "invalid asset amount" )
FC_DECLARE_DERIVED_EXCEPTION( negative_issue, graphene::chain::evaluation_error, 35006, "negative issue" )
FC_DECLARE_DERIVED_EXCEPTION( over_issue, graphene::chain::evaluation_error, 35007, "over issue" )
FC_DECLARE_DERIVED_EXCEPTION( unknown_asset_symbol, graphene::chain::evaluation_error, 35008, "unknown asset symbol" )
FC_DECLARE_DERIVED_EXCEPTION( asset_id_in_use, graphene::chain::evaluation_error, 35009, "asset id in use" )
FC_DECLARE_DERIVED_EXCEPTION( not_user_issued, graphene::chain::evaluation_error, 35010, "not user issued" )
FC_DECLARE_DERIVED_EXCEPTION( invalid_asset_name, graphene::chain::evaluation_error, 35011, "invalid asset name" )
FC_DECLARE_DERIVED_EXCEPTION( committee_member_vote_limit, graphene::chain::evaluation_error, 36001, "committee_member_vote_limit" )
FC_DECLARE_DERIVED_EXCEPTION( insufficient_fee, graphene::chain::evaluation_error, 36002, "insufficient fee" )
FC_DECLARE_DERIVED_EXCEPTION( negative_fee, graphene::chain::evaluation_error, 36003, "negative fee" )
FC_DECLARE_DERIVED_EXCEPTION( missing_deposit, graphene::chain::evaluation_error, 36004, "missing deposit" )
FC_DECLARE_DERIVED_EXCEPTION( insufficient_relay_fee, graphene::chain::evaluation_error, 36005, "insufficient relay fee" )
FC_DECLARE_DERIVED_EXCEPTION( invalid_market, graphene::chain::evaluation_error, 37001, "invalid market" )
FC_DECLARE_DERIVED_EXCEPTION( unknown_market_order, graphene::chain::evaluation_error, 37002, "unknown market order" )
FC_DECLARE_DERIVED_EXCEPTION( shorting_base_shares, graphene::chain::evaluation_error, 37003, "shorting base shares" )
FC_DECLARE_DERIVED_EXCEPTION( insufficient_collateral, graphene::chain::evaluation_error, 37004, "insufficient collateral" )
FC_DECLARE_DERIVED_EXCEPTION( insufficient_depth, graphene::chain::evaluation_error, 37005, "insufficient depth" )
FC_DECLARE_DERIVED_EXCEPTION( insufficient_feeds, graphene::chain::evaluation_error, 37006, "insufficient feeds" )
FC_DECLARE_DERIVED_EXCEPTION( invalid_feed_price, graphene::chain::evaluation_error, 37007, "invalid feed price" )
FC_DECLARE_DERIVED_EXCEPTION( price_multiplication_overflow, graphene::chain::evaluation_error, 38001, "price multiplication overflow" )
FC_DECLARE_DERIVED_EXCEPTION( price_multiplication_underflow, graphene::chain::evaluation_error, 38002, "price multiplication underflow" )
FC_DECLARE_DERIVED_EXCEPTION( price_multiplication_undefined, graphene::chain::evaluation_error, 38003, "price multiplication undefined product 0*inf" )
*/
//GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( transfer_from_blind_operation )
//GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( asset_claim_fees_operation )
//GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( bid_collateral_operation )
//GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( asset_claim_pool_operation )
//GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( asset_update_issuer_operation )
#define GRAPHENE_RECODE_EXC( cause_type, effect_type ) \
catch( const cause_type& e ) \

View file

@ -23,7 +23,7 @@
*/
#pragma once
#include <graphene/chain/protocol/types.hpp>
#include <graphene/protocol/types.hpp>
namespace graphene { namespace chain {

View file

@ -23,7 +23,7 @@
*/
#pragma once
#include <graphene/chain/protocol/types.hpp>
#include <graphene/chain/types.hpp>
#include <graphene/db/object.hpp>
#include <graphene/db/generic_index.hpp>
@ -49,6 +49,8 @@ class fba_accumulator_object : public graphene::db::abstract_object< fba_accumul
} } // graphene::chain
MAP_OBJECT_ID_TO_TYPE(graphene::chain::fba_accumulator_object)
FC_REFLECT_DERIVED( graphene::chain::fba_accumulator_object, (graphene::db::object),
(accumulated_fba_fees)(designated_asset) )

View file

@ -22,7 +22,9 @@
* THE SOFTWARE.
*/
#pragma once
#include <graphene/chain/protocol/block.hpp>
#include <graphene/protocol/block.hpp>
#include <graphene/chain/types.hpp>
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/member.hpp>

View file

@ -23,12 +23,17 @@
*/
#pragma once
#include <graphene/chain/match_object.hpp>
#include <graphene/chain/rock_paper_scissors.hpp>
#include <boost/multi_index/composite_key.hpp>
#include <graphene/protocol/tournament.hpp>
#include <graphene/db/flat_index.hpp>
#include <graphene/db/generic_index.hpp>
#include <fc/crypto/hex.hpp>
#include <boost/multi_index/composite_key.hpp>
#include <sstream>
namespace graphene { namespace chain {
@ -159,6 +164,8 @@ namespace graphene { namespace chain {
} }
MAP_OBJECT_ID_TO_TYPE(graphene::chain::game_object)
FC_REFLECT_ENUM(graphene::chain::game_state,
(game_in_progress)
(expecting_commit_moves)
@ -166,6 +173,6 @@ FC_REFLECT_ENUM(graphene::chain::game_state,
(game_complete))
//FC_REFLECT_TYPENAME(graphene::chain::game_object) // manually serialized
FC_REFLECT(graphene::chain::game_object, (players))
FC_REFLECT_DERIVED(graphene::chain::game_object, (graphene::db::object), (players))

View file

@ -23,9 +23,9 @@
*/
#pragma once
#include <graphene/chain/protocol/address.hpp>
#include <graphene/chain/protocol/chain_parameters.hpp>
#include <graphene/chain/protocol/types.hpp>
#include <graphene/protocol/address.hpp>
#include <graphene/protocol/chain_parameters.hpp>
#include <graphene/chain/types.hpp>
#include <graphene/chain/immutable_chain_parameters.hpp>
#include <fc/crypto/sha256.hpp>

View file

@ -30,3 +30,4 @@ namespace graphene { namespace chain {
fc::variant_object get_config();
} } // graphene::chain

View file

@ -23,7 +23,8 @@
*/
#pragma once
#include <graphene/chain/protocol/types.hpp>
#include <graphene/chain/types.hpp>
#include <graphene/db/object.hpp>
#include <graphene/db/generic_index.hpp>
@ -49,4 +50,6 @@ typedef generic_index<global_betting_statistics_object, global_betting_statistic
} } // graphene::chain
MAP_OBJECT_ID_TO_TYPE(graphene::chain::global_betting_statistics_object)
FC_REFLECT_DERIVED( graphene::chain::global_betting_statistics_object, (graphene::db::object), (number_of_active_events)(total_amount_staked) )

View file

@ -24,10 +24,12 @@
#pragma once
#include <fc/uint128.hpp>
#include <graphene/chain/protocol/chain_parameters.hpp>
#include <graphene/chain/protocol/types.hpp>
#include <graphene/chain/database.hpp>
#include <graphene/chain/son_info.hpp>
#include <graphene/protocol/chain_parameters.hpp>
#include <graphene/protocol/son_info.hpp>
#include <graphene/chain/types.hpp>
#include <graphene/chain/hardfork.hpp>
#include <graphene/db/object.hpp>
namespace graphene { namespace chain {
@ -89,8 +91,6 @@ namespace graphene { namespace chain {
* every time a block is found it decreases by
* RECENTLY_MISSED_COUNT_DECREMENT. It is
* never less than 0.
*
* If the recently_missed_count hits 2*UNDO_HISTORY then no new blocks may be pushed.
*/
uint32_t recently_missed_count = 0;
@ -130,6 +130,9 @@ namespace graphene { namespace chain {
};
}}
MAP_OBJECT_ID_TO_TYPE(graphene::chain::dynamic_global_property_object)
MAP_OBJECT_ID_TO_TYPE(graphene::chain::global_property_object)
FC_REFLECT_DERIVED( graphene::chain::dynamic_global_property_object, (graphene::db::object),
(head_block_number)
(head_block_id)

View file

@ -24,7 +24,7 @@
#pragma once
#include <graphene/chain/config.hpp>
#include <graphene/chain/protocol/types.hpp>
#include <graphene/protocol/types.hpp>
namespace graphene { namespace chain {

View file

@ -24,9 +24,9 @@
#pragma once
#include <fc/container/flat.hpp>
#include <graphene/chain/protocol/operations.hpp>
#include <graphene/chain/protocol/transaction.hpp>
#include <graphene/chain/protocol/types.hpp>
#include <graphene/protocol/operations.hpp>
#include <graphene/protocol/transaction.hpp>
#include <graphene/protocol/types.hpp>
namespace graphene { namespace chain {

View file

@ -23,11 +23,17 @@
*/
#pragma once
#include <fc/exception/exception.hpp>
#include <graphene/chain/exceptions.hpp>
#define GRAPHENE_DECLARE_INTERNAL_EXCEPTION( exc_name, seqnum, msg ) \
FC_DECLARE_DERIVED_EXCEPTION( \
internal_ ## exc_name, \
graphene::chain::internal_exception, \
3990000 + seqnum \
)
#define GRAPHENE_IMPLEMENT_INTERNAL_EXCEPTION( exc_name, seqnum, msg ) \
FC_IMPLEMENT_DERIVED_EXCEPTION( \
internal_ ## exc_name, \
graphene::chain::internal_exception, \
3990000 + seqnum, \
@ -36,7 +42,7 @@
namespace graphene { namespace chain {
FC_DECLARE_DERIVED_EXCEPTION( internal_exception, graphene::chain::chain_exception, 3990000, "internal exception" )
FC_DECLARE_DERIVED_EXCEPTION( internal_exception, graphene::chain::chain_exception, 3990000 )
GRAPHENE_DECLARE_INTERNAL_EXCEPTION( verify_auth_max_auth_exceeded, 1, "Exceeds max authority fan-out" )
GRAPHENE_DECLARE_INTERNAL_EXCEPTION( verify_auth_account_not_found, 2, "Auth account not found" )

View file

@ -22,7 +22,7 @@
* THE SOFTWARE.
*/
#pragma once
#include <graphene/chain/protocol/operations.hpp>
#include <graphene/protocol/operations.hpp>
#include <graphene/chain/evaluator.hpp>
#include <graphene/chain/database.hpp>

View file

@ -23,7 +23,7 @@
*/
#pragma once
#include <graphene/chain/evaluator.hpp>
#include <graphene/chain/protocol/types.hpp>
#include <graphene/chain/types.hpp>
namespace graphene { namespace chain {
@ -31,9 +31,7 @@ namespace graphene { namespace chain {
class asset_object;
class asset_bitasset_data_object;
class call_order_object;
struct call_order_update_operation;
struct limit_order_cancel_operation;
struct limit_order_create_operation;
class limit_order_object;
class limit_order_create_evaluator : public evaluator<limit_order_create_evaluator>
{

View file

@ -23,10 +23,10 @@
*/
#pragma once
#include <graphene/chain/protocol/asset.hpp>
#include <graphene/chain/protocol/types.hpp>
#include <graphene/db/generic_index.hpp>
#include <graphene/db/object.hpp>
#include <graphene/protocol/asset.hpp>
#include <graphene/chain/types.hpp>
#include <boost/multi_index/composite_key.hpp>
@ -65,7 +65,6 @@ class limit_order_object : public abstract_object<limit_order_object>
asset amount_to_receive()const { return amount_for_sale() * sell_price; }
};
struct by_id;
struct by_price;
struct by_expiration;
struct by_account;
@ -205,6 +204,10 @@ typedef generic_index<force_settlement_object, force_settlement_object_multi_ind
} } // graphene::chain
MAP_OBJECT_ID_TO_TYPE(graphene::chain::limit_order_object)
MAP_OBJECT_ID_TO_TYPE(graphene::chain::call_order_object)
MAP_OBJECT_ID_TO_TYPE(graphene::chain::force_settlement_object)
FC_REFLECT_DERIVED( graphene::chain::limit_order_object,
(graphene::db::object),
(expiration)(seller)(for_sale)(sell_price)(deferred_fee)

View file

@ -1,10 +1,17 @@
#pragma once
#include <graphene/chain/protocol/tournament.hpp>
#include <graphene/chain/rock_paper_scissors.hpp>
#include <boost/multi_index/composite_key.hpp>
#include <graphene/chain/game_object.hpp>
#include <graphene/protocol/tournament.hpp>
#include <graphene/db/flat_index.hpp>
#include <graphene/db/generic_index.hpp>
#include <fc/crypto/hex.hpp>
#include <boost/multi_index/composite_key.hpp>
#include <sstream>
namespace graphene { namespace chain {
@ -157,11 +164,13 @@ namespace graphene { namespace chain {
} }
MAP_OBJECT_ID_TO_TYPE(graphene::chain::match_object)
FC_REFLECT_ENUM(graphene::chain::match_state,
(waiting_on_previous_matches)
(match_in_progress)
(match_complete))
//FC_REFLECT_TYPENAME(graphene::chain::match_object) // manually serialized
FC_REFLECT(graphene::chain::match_object, (players))
FC_REFLECT_DERIVED(graphene::chain::match_object, (graphene::db::object), (players))

View file

@ -2,8 +2,9 @@
#include <graphene/chain/database.hpp>
#include <graphene/chain/evaluator.hpp>
#include <graphene/chain/protocol/operations.hpp>
#include <graphene/chain/protocol/types.hpp>
#include <graphene/protocol/operations.hpp>
#include <graphene/protocol/types.hpp>
namespace graphene { namespace chain {

View file

@ -1,8 +1,10 @@
#pragma once
#include <graphene/chain/protocol/operations.hpp>
#include <graphene/chain/evaluator.hpp>
#include <graphene/chain/database.hpp>
#include <graphene/protocol/operations.hpp>
namespace graphene
{
namespace chain

View file

@ -1,5 +1,7 @@
#pragma once
#include <graphene/chain/protocol/types.hpp>
#include <graphene/protocol/types.hpp>
#include <graphene/db/object.hpp>
#include <graphene/db/generic_index.hpp>
@ -33,7 +35,7 @@ namespace graphene { namespace chain {
{
public:
static const uint8_t space_id = protocol_ids;
static const uint8_t type_id = nft_metadata_type;
static const uint8_t type_id = nft_metadata_object_type;
account_id_type owner;
std::string name;
@ -177,6 +179,10 @@ namespace graphene { namespace chain {
} } // graphene::chain
MAP_OBJECT_ID_TO_TYPE(graphene::chain::nft_lottery_balance_object)
MAP_OBJECT_ID_TO_TYPE(graphene::chain::nft_metadata_object)
MAP_OBJECT_ID_TO_TYPE(graphene::chain::nft_object)
FC_REFLECT_DERIVED( graphene::chain::nft_lottery_balance_object, (graphene::db::object),
(total_progressive_jackpot)
(jackpot)

View file

@ -1,7 +1,8 @@
#include <graphene/chain/protocol/operations.hpp>
#include <graphene/chain/evaluator.hpp>
#include <graphene/chain/database.hpp>
#include <graphene/protocol/operations.hpp>
namespace graphene
{
namespace chain

View file

@ -1,5 +1,9 @@
#pragma once
#include <graphene/chain/protocol/operations.hpp>
#include <graphene/chain/types.hpp>
#include <graphene/protocol/operations.hpp>
#include <graphene/db/generic_index.hpp>
namespace graphene
@ -56,7 +60,8 @@ namespace graphene
class offer_item_index : public secondary_index
{
public:
virtual void object_inserted(const object &obj) override;
virtual void object_loaded(const object &obj) override;
virtual void object_created(const object &obj) override;
virtual void object_removed(const object &obj) override;
virtual void about_to_modify(const object &before) override{};
virtual void object_modified(const object &after) override;
@ -99,6 +104,9 @@ namespace graphene
} // namespace chain
} // namespace graphene
MAP_OBJECT_ID_TO_TYPE(graphene::chain::offer_object)
MAP_OBJECT_ID_TO_TYPE(graphene::chain::offer_history_object)
FC_REFLECT_DERIVED(graphene::chain::offer_object, (graphene::db::object),
(issuer)(item_ids)(bidder)(bid_price)(minimum_price)(
maximum_price)(buying_item)(offer_expiration_date))

View file

@ -23,82 +23,84 @@
*/
#pragma once
#include <graphene/chain/protocol/operations.hpp>
#include <graphene/chain/types.hpp>
#include <graphene/protocol/operations.hpp>
#include <graphene/db/object.hpp>
#include <boost/multi_index/composite_key.hpp>
namespace graphene { namespace chain {
/**
* @brief tracks the history of all logical operations on blockchain state
* @ingroup object
* @ingroup implementation
*
* All operations and virtual operations result in the creation of an
* operation_history_object that is maintained on disk as a stack. Each
* real or virtual operation is assigned a unique ID / sequence number that
* it can be referenced by.
*
* @note by default these objects are not tracked, the account_history_plugin must
* be loaded fore these objects to be maintained.
*
* @note this object is READ ONLY it can never be modified
*/
class operation_history_object : public abstract_object<operation_history_object>
{
public:
static const uint8_t space_id = protocol_ids;
static const uint8_t type_id = operation_history_object_type;
/**
* @brief tracks the history of all logical operations on blockchain state
* @ingroup object
* @ingroup implementation
*
* All operations and virtual operations result in the creation of an
* operation_history_object that is maintained on disk as a stack. Each
* real or virtual operation is assigned a unique ID / sequence number that
* it can be referenced by.
*
* @note by default these objects are not tracked, the account_history_plugin must
* be loaded fore these objects to be maintained.
*
* @note this object is READ ONLY it can never be modified
*/
class operation_history_object : public abstract_object<operation_history_object>
{
public:
static const uint8_t space_id = protocol_ids;
static const uint8_t type_id = operation_history_object_type;
operation_history_object( const operation& o ):op(o){}
operation_history_object(){}
operation_history_object( const operation& o ):op(o){}
operation_history_object(){}
operation op;
operation_result result;
/** the block that caused this operation */
uint32_t block_num = 0;
/** the transaction in the block */
uint16_t trx_in_block = 0;
/** the operation within the transaction */
uint16_t op_in_trx = 0;
/** any virtual operations implied by operation in block */
uint32_t virtual_op = 0;
};
operation op;
operation_result result;
/** the block that caused this operation */
uint32_t block_num = 0;
/** the transaction in the block */
uint16_t trx_in_block = 0;
/** the operation within the transaction */
uint16_t op_in_trx = 0;
/** any virtual operations implied by operation in block */
uint32_t virtual_op = 0;
};
/**
* @brief a node in a linked list of operation_history_objects
* @ingroup implementation
* @ingroup object
*
* Account history is important for users and wallets even though it is
* not part of "core validation". Account history is maintained as
* a linked list stored on disk in a stack. Each account will point to the
* most recent account history object by ID. When a new operation relativent
* to that account is processed a new account history object is allcoated at
* the end of the stack and intialized to point to the prior object.
*
* This data is never accessed as part of chain validation and therefore
* can be kept on disk as a memory mapped file. Using a memory mapped file
* will help the operating system better manage / cache / page files and
* also accelerates load time.
*
* When the transaction history for a particular account is requested the
* linked list can be traversed with relatively effecient disk access because
* of the use of a memory mapped stack.
*/
class account_transaction_history_object : public abstract_object<account_transaction_history_object>
{
public:
static const uint8_t space_id = implementation_ids;
static const uint8_t type_id = impl_account_transaction_history_object_type;
account_id_type account; /// the account this operation applies to
operation_history_id_type operation_id;
uint32_t sequence = 0; /// the operation position within the given account
account_transaction_history_id_type next;
};
/**
* @brief a node in a linked list of operation_history_objects
* @ingroup implementation
* @ingroup object
*
* Account history is important for users and wallets even though it is
* not part of "core validation". Account history is maintained as
* a linked list stored on disk in a stack. Each account will point to the
* most recent account history object by ID. When a new operation relativent
* to that account is processed a new account history object is allcoated at
* the end of the stack and intialized to point to the prior object.
*
* This data is never accessed as part of chain validation and therefore
* can be kept on disk as a memory mapped file. Using a memory mapped file
* will help the operating system better manage / cache / page files and
* also accelerates load time.
*
* When the transaction history for a particular account is requested the
* linked list can be traversed with relatively effecient disk access because
* of the use of a memory mapped stack.
*/
class account_transaction_history_object : public abstract_object<account_transaction_history_object>
{
public:
static const uint8_t space_id = implementation_ids;
static const uint8_t type_id = impl_account_transaction_history_object_type;
account_id_type account; /// the account this operation applies to
operation_history_id_type operation_id;
uint32_t sequence = 0; /// the operation position within the given account
account_transaction_history_id_type next;
};
struct by_id;
struct by_seq;
struct by_op;
struct by_opid;
@ -136,9 +138,11 @@ typedef multi_index_container<
typedef generic_index<account_transaction_history_object, account_transaction_history_multi_index_type> account_transaction_history_index;
} } // graphene::chain
MAP_OBJECT_ID_TO_TYPE(graphene::chain::operation_history_object)
MAP_OBJECT_ID_TO_TYPE(graphene::chain::account_transaction_history_object)
FC_REFLECT_DERIVED( graphene::chain::operation_history_object, (graphene::chain::object),
(op)(result)(block_num)(trx_in_block)(op_in_trx)(virtual_op) )
FC_REFLECT_DERIVED( graphene::chain::account_transaction_history_object, (graphene::chain::object),

View file

@ -23,7 +23,7 @@
*/
#pragma once
#include <graphene/chain/protocol/operations.hpp>
#include <graphene/protocol/operations.hpp>
#include <graphene/chain/evaluator.hpp>
#include <graphene/chain/database.hpp>
#include <graphene/chain/transaction_evaluation_state.hpp>

View file

@ -23,13 +23,16 @@
*/
#pragma once
#include <graphene/chain/protocol/transaction.hpp>
#include <graphene/protocol/transaction.hpp>
#include <graphene/chain/transaction_evaluation_state.hpp>
#include <graphene/db/generic_index.hpp>
#include <boost/multi_index/composite_key.hpp>
namespace graphene { namespace chain {
using namespace graphene::protocol;
using namespace graphene::db;
class database;
/**
@ -59,7 +62,7 @@ class proposal_object : public abstract_object<proposal_object>
};
/**
* @brief tracks all of the proposal objects that requrie approval of
* @brief tracks all of the proposal objects that require approval of
* an individual account.
*
* @ingroup object
@ -72,7 +75,8 @@ class proposal_object : public abstract_object<proposal_object>
class required_approval_index : public secondary_index
{
public:
virtual void object_inserted( const object& obj ) override;
virtual void object_loaded( const object& obj ) override;
virtual void object_created( const object& obj ) override;
virtual void object_removed( const object& obj ) override;
virtual void about_to_modify( const object& before ) override{};
virtual void object_modified( const object& after ) override{};
@ -94,6 +98,8 @@ typedef generic_index<proposal_object, proposal_multi_index_container> proposal_
} } // graphene::chain
MAP_OBJECT_ID_TO_TYPE(graphene::chain::proposal_object)
FC_REFLECT_DERIVED( graphene::chain::proposal_object, (graphene::chain::object),
(expiration_time)(review_period_time)(proposed_transaction)(required_active_approvals)
(available_active_approvals)(required_owner_approvals)(available_owner_approvals)

Some files were not shown because too many files have changed in this diff Show more