Graphene Updates and DApp Support #643
118 changed files with 686 additions and 730 deletions
|
|
@ -170,7 +170,7 @@ namespace graphene { namespace app {
|
|||
{
|
||||
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 ) );
|
||||
} );
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ namespace detail {
|
|||
|
||||
void new_connection( const fc::http::websocket_connection_ptr& c )
|
||||
{
|
||||
auto wsc = std::make_shared<fc::rpc::websocket_api_connection>(*c, GRAPHENE_MAX_NESTED_OBJECTS);
|
||||
auto wsc = std::make_shared<fc::rpc::websocket_api_connection>(c, GRAPHENE_MAX_NESTED_OBJECTS);
|
||||
auto login = std::make_shared<graphene::app::login_api>( std::ref(*_self) );
|
||||
login->enable_api("database_api");
|
||||
|
||||
|
|
@ -380,7 +380,6 @@ namespace detail {
|
|||
_chain_db->enable_standby_votes_tracking( _options->at("enable-standby-votes-tracking").as<bool>() );
|
||||
}
|
||||
|
||||
bool replay = false;
|
||||
std::string replay_reason = "reason not provided";
|
||||
|
||||
if( _options->count("replay-blockchain") )
|
||||
|
|
@ -554,7 +553,7 @@ namespace detail {
|
|||
_chain_db->push_transaction( transaction_message.trx );
|
||||
} FC_CAPTURE_AND_RETHROW( (transaction_message) ) }
|
||||
|
||||
virtual void handle_message(const message& message_to_process) override
|
||||
virtual void handle_message(const message&) override
|
||||
{
|
||||
// not a transaction, not a block
|
||||
FC_THROW( "Invalid Message Type" );
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ static void load_config_file(const fc::path& config_ini_path, const bpo::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;
|
||||
|
|
@ -259,7 +259,7 @@ 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() )
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@
|
|||
#include <graphene/chain/get_config.hpp>
|
||||
#include <graphene/chain/tournament_object.hpp>
|
||||
#include <graphene/chain/account_object.hpp>
|
||||
#include <graphene/chain/hardfork.hpp>
|
||||
|
||||
#include <graphene/protocol/address.hpp>
|
||||
#include <graphene/protocol/pts_address.hpp>
|
||||
|
||||
|
|
@ -2330,10 +2332,9 @@ graphene::app::gpos_info database_api_impl::get_gpos_info(const account_id_type
|
|||
#endif
|
||||
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@
|
|||
#include <graphene/chain/market_object.hpp>
|
||||
#include <graphene/chain/proposal_object.hpp>
|
||||
#include <graphene/chain/withdraw_permission_object.hpp>
|
||||
#include <graphene/chain/htlc_object.hpp>
|
||||
|
||||
namespace graphene { namespace app {
|
||||
using namespace graphene::chain;
|
||||
|
|
|
|||
|
|
@ -212,7 +212,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;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ share_type cut_fee(share_type a, uint16_t p)
|
|||
fc::uint128_t r = a.value;
|
||||
r *= p;
|
||||
r /= GRAPHENE_100_PERCENT;
|
||||
return r.convert_to<uint64_t>();
|
||||
return r;
|
||||
}
|
||||
|
||||
void account_balance_object::adjust_balance(const asset& delta)
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
|
|
|||
|
|
@ -593,7 +593,6 @@ void_result asset_update_dividend_evaluator::do_apply( const asset_update_divide
|
|||
obj.referrer = op.issuer;
|
||||
obj.lifetime_referrer = op.issuer(db()).lifetime_referrer;
|
||||
|
||||
auto& params = db().get_global_properties().parameters;
|
||||
obj.network_fee_percentage = GRAPHENE_DEFAULT_NETWORK_PERCENT_OF_FEE;
|
||||
obj.lifetime_referrer_fee_percentage = GRAPHENE_DEFAULT_LIFETIME_REFERRER_PERCENT_OF_FEE;
|
||||
obj.referrer_rewards_percentage = GRAPHENE_DEFAULT_LIFETIME_REFERRER_PERCENT_OF_FEE;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ share_type asset_bitasset_data_object::max_force_settlement_volume(share_type cu
|
|||
volume += force_settled_volume.value;
|
||||
volume *= options.maximum_force_settlement_volume;
|
||||
volume /= GRAPHENE_100_PERCENT;
|
||||
return volume.convert_to<uint64_t>();
|
||||
return volume;
|
||||
}
|
||||
|
||||
void asset_bitasset_data_object::update_median_feeds(time_point_sec current_time)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
|
@ -303,7 +305,8 @@ void database::settle_betting_market_group(const betting_market_group_object& be
|
|||
remove(betting_market);
|
||||
}
|
||||
|
||||
const event_object& event = betting_market_group.event_id(*this);
|
||||
// Fetch to check for existence
|
||||
betting_market_group.event_id(*this);
|
||||
|
||||
fc_dlog(fc::logger::get("betting"), "removing betting market group ${id}", ("id", betting_market_group.id));
|
||||
remove(betting_market_group);
|
||||
|
|
@ -537,7 +540,6 @@ int match_bet(database& db, const bet_object& taker_bet, const bet_object& maker
|
|||
// because we matched at the maker's odds and not the taker's odds, the remaining amount to match
|
||||
// may not be an even multiple of the taker's odds; round it down.
|
||||
share_type taker_remaining_factor = unrounded_taker_remaining_amount_to_match / takers_odds_maker_odds_ratio;
|
||||
share_type taker_remaining_maker_amount_to_match = taker_remaining_factor * takers_odds_maker_odds_ratio;
|
||||
share_type taker_remaining_bet_amount = taker_remaining_factor * takers_odds_taker_odds_ratio;
|
||||
|
||||
taker_refund_amount = taker_bet.amount_to_bet.amount - taker_amount_to_match - taker_remaining_bet_amount;
|
||||
|
|
|
|||
|
|
@ -26,9 +26,6 @@
|
|||
#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>
|
||||
|
|
@ -38,8 +35,11 @@
|
|||
#include <graphene/chain/witness_object.hpp>
|
||||
#include <graphene/chain/exceptions.hpp>
|
||||
#include <graphene/chain/evaluator.hpp>
|
||||
#include <graphene/chain/witness_schedule_object.hpp>
|
||||
|
||||
#include <graphene/protocol/fee_schedule.hpp>
|
||||
#include <graphene/protocol/operations.hpp>
|
||||
#include <graphene/protocol/betting_market.hpp>
|
||||
|
||||
namespace {
|
||||
|
||||
|
|
|
|||
|
|
@ -110,13 +110,15 @@ std::vector<uint32_t> database::get_seeds(asset_id_type for_asset, uint8_t count
|
|||
{
|
||||
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]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -834,7 +834,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;
|
||||
});
|
||||
|
|
@ -986,7 +986,7 @@ void database::init_genesis(const genesis_state_type& genesis_state)
|
|||
|
||||
_wso.last_scheduling_block = 0;
|
||||
|
||||
_wso.recent_slots_filled = fc::uint128_t::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 )
|
||||
|
|
|
|||
|
|
@ -22,10 +22,6 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <fc/uint128.hpp>
|
||||
|
||||
#include <graphene/protocol/market.hpp>
|
||||
|
||||
#include <graphene/chain/database.hpp>
|
||||
#include <graphene/chain/fba_accumulator_id.hpp>
|
||||
#include <graphene/chain/hardfork.hpp>
|
||||
|
|
@ -48,6 +44,12 @@
|
|||
#include <graphene/chain/worker_object.hpp>
|
||||
#include <graphene/chain/custom_account_authority_object.hpp>
|
||||
|
||||
#include <graphene/protocol/market.hpp>
|
||||
|
||||
#include <fc/uint128.hpp>
|
||||
|
||||
#include <numeric>
|
||||
|
||||
#define USE_VESTING_OBJECT_BY_ASSET_BALANCE_INDEX // vesting_balance_object by_asset_balance index needed
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
|
|
@ -163,7 +165,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 )
|
||||
|
|
@ -186,7 +188,7 @@ void database::pay_workers( share_type& budget )
|
|||
fc::uint128_t pay = requested_pay.value;
|
||||
pay *= passed_time_count;
|
||||
pay /= day_count;
|
||||
requested_pay = pay.convert_to<uint64_t>();
|
||||
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));
|
||||
|
|
@ -435,7 +437,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.convert_to<uint64_t>());
|
||||
rec.total_budget = share_type(budget_u128);
|
||||
else
|
||||
rec.total_budget = reserve;
|
||||
|
||||
|
|
@ -490,7 +492,7 @@ void database::process_budget()
|
|||
if( worker_budget_u128 >= available_funds.value )
|
||||
worker_budget = available_funds;
|
||||
else
|
||||
worker_budget = worker_budget_u128.convert_to<uint64_t>();
|
||||
worker_budget = worker_budget_u128;
|
||||
rec.worker_budget = worker_budget;
|
||||
available_funds -= worker_budget;
|
||||
|
||||
|
|
@ -630,12 +632,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.convert_to<uint64_t>();
|
||||
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.convert_to<uint64_t>();
|
||||
share_type issuer_amount = issuer_amount_128;
|
||||
|
||||
// this assert should never fail
|
||||
FC_ASSERT( buyback_amount + issuer_amount <= fba.accumulated_fba_fees );
|
||||
|
|
@ -1121,7 +1123,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));
|
||||
|
|
@ -1183,7 +1185,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) {
|
||||
|
|
@ -1220,7 +1222,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,
|
||||
|
|
@ -1280,7 +1282,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;
|
||||
|
|
@ -1466,7 +1468,6 @@ void process_dividend_assets(database& db)
|
|||
{
|
||||
// if there was a previous payout, make our next payment one interval
|
||||
uint32_t current_time_sec = current_head_block_time.sec_since_epoch();
|
||||
fc::time_point_sec reference_time = *dividend_data_obj.last_scheduled_payout_time;
|
||||
uint32_t next_possible_time_sec = dividend_data_obj.last_scheduled_payout_time->sec_since_epoch();
|
||||
do
|
||||
next_possible_time_sec += *dividend_data_obj.options.payout_interval;
|
||||
|
|
|
|||
|
|
@ -578,7 +578,7 @@ asset database::calculate_market_fee( const asset_object& trade_asset, const ass
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ namespace graphene { namespace chain {
|
|||
void database::update_global_dynamic_data( const signed_block& b, const uint32_t missed_blocks )
|
||||
{
|
||||
const dynamic_global_property_object& _dgp = get_dynamic_global_properties();
|
||||
const global_property_object& gpo = get_global_properties();
|
||||
|
||||
// dynamic global properties updating
|
||||
modify( _dgp, [&b,this,missed_blocks]( dynamic_global_property_object& dgp ){
|
||||
|
|
@ -424,7 +423,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;
|
||||
|
|
|
|||
|
|
@ -191,7 +191,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);
|
||||
|
||||
|
|
@ -250,12 +250,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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
||||
|
|
|
|||
|
|
@ -127,9 +127,6 @@ namespace graphene { namespace chain {
|
|||
//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 )
|
||||
//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( htlc_create_operation )
|
||||
//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( htlc_redeem_operation )
|
||||
//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( htlc_extend_operation )
|
||||
|
||||
#define GRAPHENE_RECODE_EXC( cause_type, effect_type ) \
|
||||
catch( const cause_type& e ) \
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
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;
|
||||
|
|
@ -371,7 +372,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;
|
||||
|
|
@ -415,7 +416,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;
|
||||
|
|
@ -517,6 +518,10 @@ namespace graphene { namespace 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) )
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
||||
|
|
|
|||
|
|
@ -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,6 +720,12 @@ 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) )
|
||||
FC_REFLECT_DERIVED( graphene::chain::betting_market_object, (graphene::db::object), (group_id) )
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,8 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
#pragma once
|
||||
#include <graphene/protocol/types.hpp>
|
||||
#include <graphene/chain/types.hpp>
|
||||
|
||||
#include <graphene/db/object.hpp>
|
||||
#include <graphene/db/generic_index.hpp>
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include <graphene/protocol/types.hpp>
|
||||
#include <graphene/chain/types.hpp>
|
||||
|
||||
#include <graphene/db/object.hpp>
|
||||
#include <graphene/db/generic_index.hpp>
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <graphene/chain/immutable_chain_parameters.hpp>
|
||||
#include <graphene/chain/types.hpp>
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
||||
|
|
|
|||
|
|
@ -25,224 +25,13 @@
|
|||
|
||||
#include <graphene/protocol/config.hpp>
|
||||
|
||||
#define GRAPHENE_SYMBOL "TEST"
|
||||
#define GRAPHENE_ADDRESS_PREFIX "TEST"
|
||||
|
||||
#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
|
||||
|
||||
#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_MAX_WITNESSES (1001) // SHOULD BE ODD
|
||||
#define GRAPHENE_DEFAULT_MAX_COMMITTEE (1001) // SHOULD BE ODD
|
||||
#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_RECENTLY_MISSED_COUNT_INCREMENT 4
|
||||
#define GRAPHENE_RECENTLY_MISSED_COUNT_DECREMENT 3
|
||||
|
||||
#define GRAPHENE_CURRENT_DB_VERSION "PPY2.5"
|
||||
|
||||
#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 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
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
#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>
|
||||
|
|
@ -41,7 +42,7 @@
|
|||
|
||||
#include <fc/crypto/hash_ctr_rng.hpp>
|
||||
|
||||
#include <graphene/chain/protocol/protocol.hpp>
|
||||
#include <graphene/protocol/protocol.hpp>
|
||||
|
||||
#include <fc/log/logger.hpp>
|
||||
|
||||
|
|
@ -59,7 +60,6 @@ namespace graphene { namespace chain {
|
|||
class witness_object;
|
||||
class force_settlement_object;
|
||||
class limit_order_object;
|
||||
class collateral_bid_object;
|
||||
class call_order_object;
|
||||
|
||||
struct budget_record;
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
||||
|
|
|
|||
|
|
@ -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) )
|
||||
|
|
|
|||
|
|
@ -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,5 +161,7 @@ typedef generic_index<event_object, event_object_multi_index_type> event_object_
|
|||
return s;
|
||||
}
|
||||
} } // graphene::chain
|
||||
FC_REFLECT(graphene::chain::event_object, (name))
|
||||
|
||||
MAP_OBJECT_ID_TO_TYPE(graphene::chain::event_object)
|
||||
|
||||
FC_REFLECT(graphene::chain::event_object, (name)(season)(start_time)(event_group_id)(at_least_one_betting_market_group_settled)(scores))
|
||||
|
|
|
|||
|
|
@ -202,9 +202,6 @@ namespace graphene { namespace chain {
|
|||
//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 )
|
||||
//GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( htlc_create_operation )
|
||||
//GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( htlc_redeem_operation )
|
||||
//GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( htlc_extend_operation )
|
||||
|
||||
#define GRAPHENE_RECODE_EXC( cause_type, effect_type ) \
|
||||
catch( const cause_type& e ) \
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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) )
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@
|
|||
|
||||
#include <graphene/protocol/chain_parameters.hpp>
|
||||
#include <graphene/chain/types.hpp>
|
||||
#include <graphene/chain/database.hpp>
|
||||
#include <graphene/db/object.hpp>
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
||||
|
|
|
|||
|
|
@ -207,7 +207,6 @@ typedef generic_index<force_settlement_object, force_settlement_object_multi_ind
|
|||
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)
|
||||
MAP_OBJECT_ID_TO_TYPE(graphene::chain::collateral_bid_object)
|
||||
|
||||
FC_REFLECT_DERIVED( graphene::chain::limit_order_object,
|
||||
(graphene::db::object),
|
||||
|
|
|
|||
|
|
@ -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,6 +164,8 @@ 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)
|
||||
|
|
|
|||
|
|
@ -22,82 +22,85 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#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;
|
||||
|
|
@ -135,7 +138,6 @@ 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)
|
||||
|
|
|
|||
|
|
@ -26,11 +26,14 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
#include <graphene/chain/types.hpp>
|
||||
|
||||
#include <graphene/protocol/rock_paper_scissors.hpp>
|
||||
|
||||
#include <fc/crypto/sha256.hpp>
|
||||
#include <fc/reflect/reflect.hpp>
|
||||
#include <fc/optional.hpp>
|
||||
#include <fc/static_variant.hpp>
|
||||
#include <fc/array.hpp>
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
struct rock_paper_scissors_game_details
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
||||
|
|
@ -48,4 +49,6 @@ typedef multi_index_container<
|
|||
typedef generic_index<sport_object, sport_object_multi_index_type> sport_object_index;
|
||||
} } // graphene::chain
|
||||
|
||||
MAP_OBJECT_ID_TO_TYPE(graphene::chain::sport_object)
|
||||
|
||||
FC_REFLECT_DERIVED( graphene::chain::sport_object, (graphene::db::object), (name) )
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#pragma once
|
||||
#include <graphene/chain/protocol/operations.hpp>
|
||||
#include <graphene/protocol/operations.hpp>
|
||||
#include <graphene/chain/evaluator.hpp>
|
||||
#include <graphene/chain/database.hpp>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,19 @@
|
|||
#pragma once
|
||||
#include <graphene/chain/protocol/tournament.hpp>
|
||||
|
||||
#include <graphene/chain/types.hpp>
|
||||
#include <graphene/chain/rock_paper_scissors.hpp>
|
||||
#include <boost/multi_index/composite_key.hpp>
|
||||
#include <graphene/chain/match_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 <sstream>
|
||||
|
||||
#include <boost/multi_index/composite_key.hpp>
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
class tournament_object;
|
||||
} }
|
||||
|
|
@ -234,6 +241,9 @@ namespace graphene { namespace chain {
|
|||
|
||||
} }
|
||||
|
||||
MAP_OBJECT_ID_TO_TYPE(graphene::chain::tournament_details_object)
|
||||
MAP_OBJECT_ID_TO_TYPE(graphene::chain::tournament_object)
|
||||
|
||||
FC_REFLECT_DERIVED(graphene::chain::tournament_details_object, (graphene::db::object),
|
||||
(tournament_id)
|
||||
(registered_players)
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
#include <graphene/protocol/operations.hpp>
|
||||
|
||||
namespace graphene {
|
||||
namespace protocol { class signed_transaction; }
|
||||
namespace protocol { struct signed_transaction; }
|
||||
namespace chain {
|
||||
class database;
|
||||
using protocol::signed_transaction;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,10 @@
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include <graphene/chain/types.hpp>
|
||||
|
||||
#include <graphene/protocol/transaction.hpp>
|
||||
|
||||
#include <graphene/db/index.hpp>
|
||||
#include <graphene/db/generic_index.hpp>
|
||||
|
||||
|
|
|
|||
|
|
@ -46,10 +46,10 @@ GRAPHENE_DEFINE_IDS(chain, implementation_ids, impl_,
|
|||
(buyback)
|
||||
(fba_accumulator)
|
||||
(asset_dividend_data)
|
||||
(pending_dividend_payout_balance_for_holder_object)
|
||||
(distributed_dividend_balance_data)
|
||||
(betting_market_position_object)
|
||||
(global_betting_statistics_object)
|
||||
(lottery_balance_object)
|
||||
(sweeps_vesting_balance_object)
|
||||
(offer_history_object))
|
||||
(pending_dividend_payout_balance_for_holder)
|
||||
(total_distributed_dividend_balance)
|
||||
(betting_market_position)
|
||||
(global_betting_statistics)
|
||||
(lottery_balance)
|
||||
(sweeps_vesting_balance)
|
||||
(offer_history))
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include <graphene/protocol/vesting.hpp>
|
||||
|
||||
#include <graphene/protocol/asset.hpp>
|
||||
#include <graphene/db/object.hpp>
|
||||
#include <graphene/db/generic_index.hpp>
|
||||
|
|
|
|||
|
|
@ -22,11 +22,16 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
#pragma once
|
||||
#include <graphene/protocol/types.hpp>
|
||||
#include <graphene/db/object.hpp>
|
||||
#include <graphene/db/generic_index.hpp>
|
||||
#include <graphene/chain/witness_scheduler.hpp>
|
||||
#include <graphene/chain/witness_scheduler_rng.hpp>
|
||||
#include <graphene/chain/types.hpp>
|
||||
|
||||
#include <graphene/protocol/chain_parameters.hpp>
|
||||
|
||||
#include <graphene/db/object.hpp>
|
||||
#include <graphene/db/generic_index.hpp>
|
||||
|
||||
#include <fc/uint128.hpp>
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
|
||||
|
|
@ -62,13 +67,13 @@ class witness_schedule_object : public graphene::db::abstract_object<witness_sch
|
|||
witness_scheduler scheduler;
|
||||
uint32_t last_scheduling_block;
|
||||
uint64_t slots_since_genesis = 0;
|
||||
fc::array< char, sizeof(secret_hash_type) > rng_seed;
|
||||
std::array< char, sizeof(secret_hash_type) > rng_seed = {};
|
||||
|
||||
/**
|
||||
* Not necessary for consensus, but used for figuring out the participation rate.
|
||||
* The nth bit is 0 if the nth slot was unfilled, else it is 1.
|
||||
*/
|
||||
fc::uint128 recent_slots_filled;
|
||||
fc::uint128_t recent_slots_filled;
|
||||
};
|
||||
|
||||
} }
|
||||
|
|
|
|||
|
|
@ -25,9 +25,9 @@
|
|||
#include <graphene/chain/proposal_evaluator.hpp>
|
||||
#include <graphene/chain/proposal_object.hpp>
|
||||
#include <graphene/chain/account_object.hpp>
|
||||
#include <graphene/chain/protocol/account.hpp>
|
||||
#include <graphene/chain/protocol/fee_schedule.hpp>
|
||||
#include <graphene/chain/protocol/tournament.hpp>
|
||||
#include <graphene/protocol/account.hpp>
|
||||
#include <graphene/protocol/fee_schedule.hpp>
|
||||
#include <graphene/protocol/tournament.hpp>
|
||||
#include <graphene/chain/exceptions.hpp>
|
||||
#include <graphene/chain/hardfork.hpp>
|
||||
|
||||
|
|
@ -314,7 +314,7 @@ void_result proposal_update_evaluator::do_apply(const proposal_update_operation&
|
|||
// Potential optimization: if _executed_proposal is true, we can skip the modify step and make push_proposal skip
|
||||
// signature checks. This isn't done now because I just wrote all the proposals code, and I'm not yet 100% sure the
|
||||
// required approvals are sufficient to authorize the transaction.
|
||||
d.modify(*_proposal, [&o, &d](proposal_object& p) {
|
||||
d.modify(*_proposal, [&o](proposal_object& p) {
|
||||
p.available_active_approvals.insert(o.active_approvals_to_add.begin(), o.active_approvals_to_add.end());
|
||||
p.available_owner_approvals.insert(o.owner_approvals_to_add.begin(), o.owner_approvals_to_add.end());
|
||||
for( account_id_type id : o.active_approvals_to_remove )
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <graphene/chain/protocol/fee_schedule.hpp>
|
||||
#include <graphene/protocol/fee_schedule.hpp>
|
||||
|
||||
#include <graphene/chain/balance_object.hpp>
|
||||
#include <graphene/chain/block_summary_object.hpp>
|
||||
|
|
@ -36,15 +36,20 @@
|
|||
#include <graphene/chain/market_object.hpp>
|
||||
#include <graphene/chain/operation_history_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/withdraw_permission_object.hpp>
|
||||
#include <graphene/chain/witness_object.hpp>
|
||||
#include <graphene/chain/witness_schedule_object.hpp>
|
||||
#include <graphene/chain/witness_scheduler.hpp>
|
||||
#include <graphene/chain/worker_object.hpp>
|
||||
#include <graphene/chain/betting_market_object.hpp>
|
||||
|
||||
#include <fc/io/raw.hpp>
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
FC_IMPLEMENT_EXCEPTION(no_transition, 100000, "Invalid state transition");
|
||||
} }
|
||||
|
||||
GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::balance_object )
|
||||
GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::block_summary_object )
|
||||
GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::budget_record )
|
||||
|
|
@ -63,7 +68,7 @@ GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::global_propert
|
|||
GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::operation_history_object )
|
||||
GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::account_transaction_history_object )
|
||||
GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::special_authority_object )
|
||||
GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::transaction_object )
|
||||
GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::transaction_history_object )
|
||||
GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::withdraw_permission_object )
|
||||
GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::witness_object )
|
||||
GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::witness_scheduler )
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#include <graphene/chain/protocol/tournament.hpp>
|
||||
#include <graphene/protocol/tournament.hpp>
|
||||
#include <graphene/chain/tournament_object.hpp>
|
||||
#include <graphene/chain/game_object.hpp>
|
||||
#include <graphene/chain/tournament_evaluator.hpp>
|
||||
|
|
@ -106,8 +106,7 @@ namespace graphene { namespace chain {
|
|||
object_id_type tournament_create_evaluator::do_apply( const tournament_create_operation& op )
|
||||
{ try {
|
||||
const tournament_details_object& tournament_details =
|
||||
db().create<tournament_details_object>( [&]( tournament_details_object& a ) {
|
||||
});
|
||||
db().create<tournament_details_object>( [&]( tournament_details_object& ) { });
|
||||
|
||||
const tournament_object& new_tournament =
|
||||
db().create<tournament_object>( [&]( tournament_object& t ) {
|
||||
|
|
|
|||
|
|
@ -317,7 +317,7 @@ namespace graphene { namespace chain {
|
|||
|
||||
share_type rake_amount = 0;
|
||||
if (dividend_id)
|
||||
rake_amount = (fc::uint128_t(tournament_obj.prize_pool.value) * rake_fee_percentage / GRAPHENE_1_PERCENT / 100).to_uint64();
|
||||
rake_amount = (fc::uint128_t(tournament_obj.prize_pool.value) * rake_fee_percentage / GRAPHENE_1_PERCENT / 100);
|
||||
asset won_prize(tournament_obj.prize_pool - rake_amount, tournament_obj.options.buy_in.asset_id);
|
||||
tournament_payout_operation op;
|
||||
|
||||
|
|
@ -645,13 +645,6 @@ namespace graphene { namespace chain {
|
|||
}
|
||||
}
|
||||
|
||||
fc::sha256 rock_paper_scissors_throw::calculate_hash() const
|
||||
{
|
||||
std::vector<char> full_throw_packed(fc::raw::pack(*this));
|
||||
return fc::sha256::hash(full_throw_packed.data(), full_throw_packed.size());
|
||||
}
|
||||
|
||||
|
||||
vector<tournament_id_type> tournament_players_index::get_registered_tournaments_for_account( const account_id_type& a )const
|
||||
{
|
||||
auto iter = account_to_joined_tournaments.find(a);
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include <graphene/chain/database.hpp>
|
||||
#include <graphene/chain/vesting_balance_evaluator.hpp>
|
||||
#include <graphene/chain/vesting_balance_object.hpp>
|
||||
#include <graphene/chain/hardfork.hpp>
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ asset linear_vesting_policy::get_allowed_withdraw( const vesting_policy_context&
|
|||
share_type total_vested = 0;
|
||||
if( elapsed_seconds < vesting_duration_seconds )
|
||||
{
|
||||
total_vested = (fc::uint128_t( begin_balance.value ) * elapsed_seconds / vesting_duration_seconds).to_uint64();
|
||||
total_vested = (fc::uint128_t( begin_balance.value ) * elapsed_seconds / vesting_duration_seconds);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ namespace graphene { namespace net {
|
|||
{
|
||||
public:
|
||||
node(const std::string& user_agent);
|
||||
~node();
|
||||
virtual ~node();
|
||||
|
||||
void close();
|
||||
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@
|
|||
#include <fc/api.hpp>
|
||||
#include <fc/variant_object.hpp>
|
||||
|
||||
#include <graphene/chain/protocol/types.hpp>
|
||||
#include <graphene/chain/protocol/asset.hpp>
|
||||
#include <graphene/protocol/types.hpp>
|
||||
#include <graphene/protocol/asset.hpp>
|
||||
#include <graphene/chain/event_object.hpp>
|
||||
#include <graphene/chain/operation_history_object.hpp>
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public:
|
|||
inline asset_id_type get_asset_id()const { return total_payout.asset_id; }
|
||||
};
|
||||
|
||||
typedef object_id<AFFILIATE_STATS_SPACE_ID, app_reward_object_type, app_reward_object> app_reward_id_type;
|
||||
typedef object_id<AFFILIATE_STATS_SPACE_ID, app_reward_object_type> app_reward_id_type;
|
||||
|
||||
struct by_asset;
|
||||
struct by_app_asset;
|
||||
|
|
@ -86,7 +86,7 @@ public:
|
|||
inline asset_id_type get_asset_id()const { return total_payout.asset_id; }
|
||||
};
|
||||
|
||||
typedef object_id<AFFILIATE_STATS_SPACE_ID, referral_reward_object_type, referral_reward_object> referral_reward_id_type;
|
||||
typedef object_id<AFFILIATE_STATS_SPACE_ID, referral_reward_object_type> referral_reward_id_type;
|
||||
|
||||
struct by_referral_asset;
|
||||
typedef multi_index_container<
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ fc::variants bookie_api_impl::get_objects(const vector<object_id_type>& ids) con
|
|||
result.reserve(ids.size());
|
||||
|
||||
std::transform(ids.begin(), ids.end(), std::back_inserter(result),
|
||||
[this, &db](object_id_type id) -> fc::variant {
|
||||
[&db](object_id_type id) -> fc::variant {
|
||||
switch (id.type())
|
||||
{
|
||||
case event_id_type::type_id:
|
||||
|
|
|
|||
|
|
@ -519,7 +519,8 @@ asset bookie_plugin::get_total_matched_bet_amount_for_betting_market_group(betti
|
|||
}
|
||||
std::vector<event_object> bookie_plugin::get_events_containing_sub_string(const std::string& sub_string, const std::string& language)
|
||||
{
|
||||
ilog("bookie plugin: get_events_containing_sub_string(${sub_string}, ${language})", (sub_string)(language));
|
||||
ilog("bookie plugin: get_events_containing_sub_string(${sub_string}, ${language})",
|
||||
("sub_string", sub_string)("language", language));
|
||||
return my->get_events_containing_sub_string(sub_string, language);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@
|
|||
#include <fc/api.hpp>
|
||||
#include <fc/variant_object.hpp>
|
||||
|
||||
#include <graphene/chain/protocol/types.hpp>
|
||||
#include <graphene/chain/protocol/asset.hpp>
|
||||
#include <graphene/protocol/types.hpp>
|
||||
#include <graphene/protocol/asset.hpp>
|
||||
#include <graphene/chain/event_object.hpp>
|
||||
|
||||
using namespace graphene::chain;
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class persistent_event_object : public graphene::db::abstract_object<persistent_
|
|||
event_id_type get_event_id() const { return ephemeral_event_object.id; }
|
||||
};
|
||||
|
||||
typedef object_id<bookie_objects, persistent_event_object_type, persistent_event_object> persistent_event_id_type;
|
||||
typedef object_id<bookie_objects, persistent_event_object_type> persistent_event_id_type;
|
||||
|
||||
struct by_event_id;
|
||||
typedef multi_index_container<
|
||||
|
|
|
|||
|
|
@ -23,8 +23,10 @@
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include <graphene/app/plugin.hpp>
|
||||
#include <graphene/chain/database.hpp>
|
||||
#include <graphene/chain/event_object.hpp>
|
||||
|
||||
#include <graphene/app/plugin.hpp>
|
||||
|
||||
#include <fc/thread/future.hpp>
|
||||
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ void delayed_node_plugin::plugin_set_program_options(bpo::options_description& c
|
|||
|
||||
void delayed_node_plugin::connect()
|
||||
{
|
||||
my->client_connection = std::make_shared<fc::rpc::websocket_api_connection>(*my->client.connect(my->remote_endpoint), GRAPHENE_MAX_NESTED_OBJECTS);
|
||||
my->client_connection = std::make_shared<fc::rpc::websocket_api_connection>(my->client.connect(my->remote_endpoint), GRAPHENE_MAX_NESTED_OBJECTS);
|
||||
my->database_api = my->client_connection->get_remote_api<graphene::app::database_api>(0);
|
||||
my->client_connection_closed = my->client_connection->closed.connect([this] {
|
||||
connection_failed();
|
||||
|
|
|
|||
|
|
@ -296,12 +296,12 @@ void generate_genesis_plugin::generate_snapshot()
|
|||
auto balance_iter = by_effective_balance_index.begin();
|
||||
for (; balance_iter != by_effective_balance_index.end(); ++balance_iter)
|
||||
{
|
||||
fc::uint128 share_drop_amount = total_amount_to_distribute.value;
|
||||
fc::uint128_t share_drop_amount = total_amount_to_distribute.value;
|
||||
share_drop_amount *= balance_iter->get_effective_balance().value;
|
||||
share_drop_amount /= total_bts_balance.value;
|
||||
if (!share_drop_amount.to_uint64())
|
||||
if (!share_drop_amount)
|
||||
break; // balances are decreasing, so every balance after will also round to zero
|
||||
total_shares_dropped += share_drop_amount.to_uint64();
|
||||
total_shares_dropped += share_drop_amount;
|
||||
effective_total_bts_balance += balance_iter->get_effective_balance();
|
||||
}
|
||||
|
||||
|
|
@ -312,10 +312,10 @@ void generate_genesis_plugin::generate_snapshot()
|
|||
|
||||
do {
|
||||
--balance_iter;
|
||||
fc::uint128 share_drop_amount = remaining_amount_to_distribute.value;
|
||||
fc::uint128_t share_drop_amount = remaining_amount_to_distribute.value;
|
||||
share_drop_amount *= balance_iter->get_effective_balance().value;
|
||||
share_drop_amount /= bts_balance_remaining.value;
|
||||
graphene::chain::share_type amount_distributed = share_drop_amount.to_uint64();
|
||||
graphene::chain::share_type amount_distributed = share_drop_amount;
|
||||
|
||||
by_effective_balance_index.modify(balance_iter, [&](my_account_balance_object& balance_object) {
|
||||
balance_object.sharedrop += amount_distributed;
|
||||
|
|
|
|||
|
|
@ -79,7 +79,6 @@ private:
|
|||
|
||||
boost::program_options::variables_map _options;
|
||||
bool _production_enabled = false;
|
||||
bool _consecutive_production_enabled = false;
|
||||
uint32_t _required_witness_participation = 33 * GRAPHENE_1_PERCENT;
|
||||
uint32_t _production_skip_flags = graphene::chain::database::skip_nothing;
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@
|
|||
*/
|
||||
#include <graphene/protocol/account.hpp>
|
||||
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
|
||||
namespace graphene { namespace protocol {
|
||||
|
||||
/**
|
||||
|
|
@ -59,13 +61,6 @@ bool is_valid_name( const string& name )
|
|||
{ try {
|
||||
const size_t len = name.size();
|
||||
|
||||
/** this condition will prevent witnesses from including new names before this time, but
|
||||
* allow them after this time. This check can be removed from the code after HARDFORK_385_TIME
|
||||
* has passed.
|
||||
*/
|
||||
if( fc::time_point::now() < fc::time_point(HARDFORK_385_TIME) )
|
||||
FC_ASSERT( len >= 3 );
|
||||
|
||||
if( len < GRAPHENE_MIN_ACCOUNT_NAME_LENGTH )
|
||||
{
|
||||
ilog( ".");
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ namespace graphene { namespace protocol {
|
|||
address::operator std::string()const
|
||||
{
|
||||
std::array<char,24> bin_addr;
|
||||
static_assert( bin_addr.size() >= sizeof(addr) + 4 );
|
||||
static_assert( bin_addr.size() >= sizeof(addr) + 4, "" );
|
||||
memcpy( bin_addr.data(), addr.data(), sizeof(addr) );
|
||||
auto checksum = fc::ripemd160::hash( addr.data(), sizeof(addr) );
|
||||
memcpy( bin_addr.data() + 20, (char*)&checksum._hash[0], 4 );
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#include <graphene/chain/protocol/betting_market.hpp>
|
||||
#include <graphene/protocol/betting_market.hpp>
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
namespace graphene { namespace protocol {
|
||||
|
||||
void betting_market_rules_create_operation::validate() const
|
||||
{
|
||||
|
|
@ -77,5 +77,5 @@ void bet_cancel_operation::validate() const
|
|||
|
||||
|
||||
|
||||
} } // graphene::chain
|
||||
} } // graphene::protocol
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@
|
|||
*/
|
||||
#include <graphene/protocol/block.hpp>
|
||||
#include <fc/io/raw.hpp>
|
||||
#include <fc/bitutil.hpp>
|
||||
#include <algorithm>
|
||||
|
||||
namespace graphene { namespace protocol {
|
||||
|
|
@ -91,6 +90,6 @@ namespace graphene { namespace protocol {
|
|||
|
||||
} }
|
||||
|
||||
GRAPHENE_EXTERNAL_SERIALIZATION(/*not extern*/, graphene::chain::block_header)
|
||||
GRAPHENE_EXTERNAL_SERIALIZATION(/*not extern*/, graphene::chain::signed_block_header)
|
||||
GRAPHENE_EXTERNAL_SERIALIZATION(/*not extern*/, graphene::chain::signed_block)
|
||||
GRAPHENE_EXTERNAL_SERIALIZATION(/*not extern*/, graphene::protocol::block_header)
|
||||
GRAPHENE_EXTERNAL_SERIALIZATION(/*not extern*/, graphene::protocol::signed_block_header)
|
||||
GRAPHENE_EXTERNAL_SERIALIZATION(/*not extern*/, graphene::protocol::signed_block)
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#include <graphene/chain/protocol/event.hpp>
|
||||
#include <graphene/protocol/event.hpp>
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
namespace graphene { namespace protocol {
|
||||
|
||||
void event_create_operation::validate() const
|
||||
{
|
||||
|
|
@ -40,5 +40,5 @@ void event_update_status_operation::validate() const
|
|||
FC_ASSERT( fee.amount >= 0 );
|
||||
}
|
||||
|
||||
} } // graphene::chain
|
||||
} } // graphene::protocol
|
||||
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#include <graphene/chain/protocol/event_group.hpp>
|
||||
#include <graphene/protocol/event_group.hpp>
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
namespace graphene { namespace protocol {
|
||||
|
||||
void event_group_create_operation::validate() const
|
||||
{
|
||||
|
|
@ -40,5 +40,5 @@ void event_group_delete_operation::validate() const
|
|||
FC_ASSERT( fee.amount >= 0 );
|
||||
}
|
||||
|
||||
} } // graphene::chain
|
||||
} } // graphene::protocol
|
||||
|
||||
|
|
|
|||
|
|
@ -121,10 +121,10 @@ namespace graphene { namespace protocol {
|
|||
scaled /= GRAPHENE_100_PERCENT;
|
||||
FC_ASSERT( scaled <= GRAPHENE_MAX_SHARE_SUPPLY );
|
||||
//idump( (base_value)(scaled)(core_exchange_rate) );
|
||||
auto result = asset( scaled.to_uint64(), asset_id_type(0) ) * core_exchange_rate;
|
||||
auto result = asset( scaled, asset_id_type(0) ) * core_exchange_rate;
|
||||
//FC_ASSERT( result * core_exchange_rate >= asset( scaled.to_uint64()) );
|
||||
|
||||
while( result * core_exchange_rate < asset( scaled.to_uint64()) )
|
||||
while( result * core_exchange_rate < asset(scaled) )
|
||||
result.amount++;
|
||||
|
||||
FC_ASSERT( result.amount <= GRAPHENE_MAX_SHARE_SUPPLY );
|
||||
|
|
|
|||
|
|
@ -22,11 +22,13 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
#pragma once
|
||||
#include <graphene/chain/protocol/account.hpp>
|
||||
#include <graphene/chain/protocol/base.hpp>
|
||||
#include <graphene/chain/protocol/memo.hpp>
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
#include <graphene/protocol/types.hpp>
|
||||
#include <graphene/protocol/account.hpp>
|
||||
#include <graphene/protocol/base.hpp>
|
||||
#include <graphene/protocol/memo.hpp>
|
||||
|
||||
namespace graphene { namespace protocol {
|
||||
|
||||
/**
|
||||
* Virtual op generated when an affiliate receives payout.
|
||||
|
|
@ -83,10 +85,10 @@ namespace graphene { namespace chain {
|
|||
{ return 0; }
|
||||
};
|
||||
|
||||
} } // graphene::chain
|
||||
} } // graphene::protocol
|
||||
|
||||
FC_REFLECT( graphene::chain::affiliate_payout_operation::fee_parameters_type, )
|
||||
FC_REFLECT( graphene::chain::affiliate_referral_payout_operation::fee_parameters_type, )
|
||||
FC_REFLECT( graphene::protocol::affiliate_payout_operation::fee_parameters_type, )
|
||||
FC_REFLECT( graphene::protocol::affiliate_referral_payout_operation::fee_parameters_type, )
|
||||
|
||||
FC_REFLECT( graphene::chain::affiliate_payout_operation, (fee)(affiliate)(tag)(payout) )
|
||||
FC_REFLECT( graphene::chain::affiliate_referral_payout_operation, (fee)(player)(payout) )
|
||||
FC_REFLECT( graphene::protocol::affiliate_payout_operation, (fee)(affiliate)(tag)(payout) )
|
||||
FC_REFLECT( graphene::protocol::affiliate_referral_payout_operation, (fee)(player)(payout) )
|
||||
|
|
|
|||
|
|
@ -23,11 +23,10 @@
|
|||
*/
|
||||
#pragma once
|
||||
#include <graphene/protocol/base.hpp>
|
||||
#include <graphene/protocol/asset.hpp>
|
||||
#include <graphene/protocol/memo.hpp>
|
||||
#include <graphene/protocol/asset.hpp>
|
||||
|
||||
namespace graphene { namespace protocol {
|
||||
|
||||
namespace graphene { namespace protocol {
|
||||
bool is_valid_symbol( const string& symbol );
|
||||
|
||||
struct benefactor {
|
||||
|
|
@ -152,13 +151,13 @@ namespace graphene { namespace protocol {
|
|||
/// the options are updated again.
|
||||
fc::optional<uint32_t> payout_interval;
|
||||
/// Each dividend distribution incurs a fee that is based on the number of accounts
|
||||
/// that hold the dividend asset, not as a percentage of the amount paid out.
|
||||
/// that hold the dividend asset, not as a percentage of the amount paid out.
|
||||
/// This parameter prevents assets from being distributed unless the fee is less than
|
||||
/// the percentage here, to prevent a slow trickle of deposits to the account from being
|
||||
/// completely consumed.
|
||||
/// In other words, if you set this parameter to 10% and the fees work out to 100 BTS
|
||||
/// to share out, balances in the dividend distribution accounts will not be shared out
|
||||
/// if the balance is less than 10000 BTS.
|
||||
/// if the balance is less than 10000 BTS.
|
||||
uint64_t minimum_fee_percentage;
|
||||
|
||||
/// Normally, pending dividend payments are calculated each maintenance interval in
|
||||
|
|
@ -171,7 +170,7 @@ namespace graphene { namespace protocol {
|
|||
///
|
||||
/// Payouts will always occur at the next payout time whether or not it falls on a
|
||||
/// multiple of the distribution interval, and the timer on the distribution interval
|
||||
/// are reset at payout time. So if you have the distribution interval at three days
|
||||
/// are reset at payout time. So if you have the distribution interval at three days
|
||||
/// and the payout interval at one week, payouts will occur at days 3, 6, 7, 10, 13, 14...
|
||||
fc::optional<uint32_t> minimum_distribution_interval;
|
||||
|
||||
|
|
@ -188,7 +187,7 @@ namespace graphene { namespace protocol {
|
|||
*/
|
||||
struct asset_create_operation : public base_operation
|
||||
{
|
||||
struct fee_parameters_type {
|
||||
struct fee_parameters_type {
|
||||
uint64_t symbol3 = 500000 * GRAPHENE_BLOCKCHAIN_PRECISION;
|
||||
uint64_t symbol4 = 300000 * GRAPHENE_BLOCKCHAIN_PRECISION;
|
||||
uint64_t long_symbol = 5000 * GRAPHENE_BLOCKCHAIN_PRECISION;
|
||||
|
|
@ -225,7 +224,7 @@ namespace graphene { namespace protocol {
|
|||
///Operation for creation of lottery
|
||||
struct lottery_asset_create_operation : public base_operation
|
||||
{
|
||||
struct fee_parameters_type {
|
||||
struct fee_parameters_type {
|
||||
uint64_t lottery_asset = 20 * GRAPHENE_BLOCKCHAIN_PRECISION;
|
||||
uint32_t price_per_kbyte = 10; /// only required for large lottery names.
|
||||
};
|
||||
|
|
@ -296,9 +295,9 @@ namespace graphene { namespace protocol {
|
|||
*/
|
||||
struct asset_settle_operation : public base_operation
|
||||
{
|
||||
struct fee_parameters_type {
|
||||
struct fee_parameters_type {
|
||||
/** this fee should be high to encourage small settlement requests to
|
||||
* be performed on the market rather than via forced settlement.
|
||||
* be performed on the market rather than via forced settlement.
|
||||
*
|
||||
* Note that in the event of a black swan or prediction market close out
|
||||
* everyone will have to pay this fee.
|
||||
|
|
@ -367,7 +366,7 @@ namespace graphene { namespace protocol {
|
|||
* payments.
|
||||
*/
|
||||
uint64_t distribution_base_fee;
|
||||
/** This fee is charged (in addition to the distribution_base_fee) for each
|
||||
/** This fee is charged (in addition to the distribution_base_fee) for each
|
||||
* user the dividend payment is shared out amongst
|
||||
*/
|
||||
uint32_t distribution_fee_per_holder;
|
||||
|
|
@ -429,7 +428,7 @@ namespace graphene { namespace protocol {
|
|||
*/
|
||||
struct asset_update_operation : public base_operation
|
||||
{
|
||||
struct fee_parameters_type {
|
||||
struct fee_parameters_type {
|
||||
uint64_t fee = 500 * GRAPHENE_BLOCKCHAIN_PRECISION;
|
||||
uint32_t price_per_kbyte = 10;
|
||||
};
|
||||
|
|
@ -482,9 +481,9 @@ namespace graphene { namespace protocol {
|
|||
* @brief Update options specific to dividend-paying assets
|
||||
* @ingroup operations
|
||||
*
|
||||
* Dividend-paying assets have some options which are not relevant to other asset types.
|
||||
* Dividend-paying assets have some options which are not relevant to other asset types.
|
||||
* This operation is used to update those options an an existing dividend-paying asset.
|
||||
* This can also be used to convert a non-dividend-paying asset into a dividend-paying
|
||||
* This can also be used to convert a non-dividend-paying asset into a dividend-paying
|
||||
* asset.
|
||||
*
|
||||
* @pre @ref issuer MUST be an existing account and MUST match asset_object::issuer on @ref asset_to_update
|
||||
|
|
@ -573,8 +572,8 @@ namespace graphene { namespace protocol {
|
|||
*/
|
||||
struct asset_issue_operation : public base_operation
|
||||
{
|
||||
struct fee_parameters_type {
|
||||
uint64_t fee = 20 * GRAPHENE_BLOCKCHAIN_PRECISION;
|
||||
struct fee_parameters_type {
|
||||
uint64_t fee = 20 * GRAPHENE_BLOCKCHAIN_PRECISION;
|
||||
uint32_t price_per_kbyte = GRAPHENE_BLOCKCHAIN_PRECISION;
|
||||
};
|
||||
|
||||
|
|
@ -629,19 +628,19 @@ namespace graphene { namespace protocol {
|
|||
account_id_type fee_payer()const { return issuer; }
|
||||
void validate()const;
|
||||
};
|
||||
|
||||
|
||||
struct sweeps_vesting_claim_operation : public base_operation
|
||||
{
|
||||
struct fee_parameters_type {
|
||||
uint64_t fee = 20 * GRAPHENE_BLOCKCHAIN_PRECISION;
|
||||
};
|
||||
|
||||
|
||||
asset fee;
|
||||
account_id_type account;
|
||||
asset amount_to_claim;
|
||||
extensions_type extensions;
|
||||
|
||||
|
||||
|
||||
|
||||
account_id_type fee_payer()const { return account; }
|
||||
void validate()const {};
|
||||
};
|
||||
|
|
@ -691,6 +690,7 @@ FC_REFLECT( graphene::protocol::benefactor, (id)(share) )
|
|||
|
||||
FC_REFLECT( graphene::protocol::lottery_asset_options, (benefactors)(owner)(winning_tickets)(ticket_price)(end_date)(ending_on_soldout)(is_active) )
|
||||
|
||||
|
||||
FC_REFLECT( graphene::protocol::asset_create_operation::fee_parameters_type, (symbol3)(symbol4)(long_symbol)(price_per_kbyte) )
|
||||
FC_REFLECT( graphene::protocol::lottery_asset_create_operation::fee_parameters_type, (lottery_asset)(price_per_kbyte) )
|
||||
FC_REFLECT( graphene::protocol::asset_global_settle_operation::fee_parameters_type, (fee) )
|
||||
|
|
@ -734,20 +734,6 @@ FC_REFLECT( graphene::protocol::asset_update_operation,
|
|||
(new_options)
|
||||
(extensions)
|
||||
)
|
||||
FC_REFLECT( graphene::protocol::asset_update_issuer_operation,
|
||||
(fee)
|
||||
(issuer)
|
||||
(asset_to_update)
|
||||
(new_options)
|
||||
(extensions)
|
||||
)
|
||||
FC_REFLECT( graphene::chain::asset_update_dividend_operation,
|
||||
(fee)
|
||||
(issuer)
|
||||
(asset_to_update)
|
||||
(new_options)
|
||||
(extensions)
|
||||
)
|
||||
FC_REFLECT( graphene::protocol::asset_update_bitasset_operation,
|
||||
(fee)
|
||||
(issuer)
|
||||
|
|
@ -755,6 +741,13 @@ FC_REFLECT( graphene::protocol::asset_update_bitasset_operation,
|
|||
(new_options)
|
||||
(extensions)
|
||||
)
|
||||
FC_REFLECT( graphene::protocol::asset_update_dividend_operation,
|
||||
(fee)
|
||||
(issuer)
|
||||
(asset_to_update)
|
||||
(new_options)
|
||||
(extensions)
|
||||
)
|
||||
FC_REFLECT( graphene::protocol::asset_update_feed_producers_operation,
|
||||
(fee)(issuer)(asset_to_update)(new_feed_producers)(extensions)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -23,10 +23,11 @@
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include <graphene/chain/protocol/types.hpp>
|
||||
#include <graphene/chain/protocol/base.hpp>
|
||||
#include <graphene/protocol/types.hpp>
|
||||
#include <graphene/protocol/base.hpp>
|
||||
#include <graphene/protocol/asset.hpp>
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
namespace graphene { namespace protocol {
|
||||
|
||||
struct betting_market_rules_create_operation : public base_operation
|
||||
{
|
||||
|
|
@ -417,22 +418,22 @@ struct bet_adjusted_operation : public base_operation
|
|||
|
||||
} }
|
||||
|
||||
FC_REFLECT( graphene::chain::betting_market_rules_create_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::chain::betting_market_rules_create_operation,
|
||||
FC_REFLECT( graphene::protocol::betting_market_rules_create_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::protocol::betting_market_rules_create_operation,
|
||||
(fee)(name)(description)(extensions) )
|
||||
|
||||
FC_REFLECT( graphene::chain::betting_market_rules_update_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::chain::betting_market_rules_update_operation,
|
||||
FC_REFLECT( graphene::protocol::betting_market_rules_update_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::protocol::betting_market_rules_update_operation,
|
||||
(fee)(new_name)(new_description)(extensions)(betting_market_rules_id) )
|
||||
|
||||
FC_REFLECT_ENUM( graphene::chain::betting_market_status,
|
||||
FC_REFLECT_ENUM( graphene::protocol::betting_market_status,
|
||||
(unresolved)
|
||||
(frozen)
|
||||
(graded)
|
||||
(canceled)
|
||||
(settled)
|
||||
(BETTING_MARKET_STATUS_COUNT) )
|
||||
FC_REFLECT_ENUM( graphene::chain::betting_market_group_status,
|
||||
FC_REFLECT_ENUM( graphene::protocol::betting_market_group_status,
|
||||
(upcoming)
|
||||
(in_play)
|
||||
(closed)
|
||||
|
|
@ -443,51 +444,51 @@ FC_REFLECT_ENUM( graphene::chain::betting_market_group_status,
|
|||
(canceled)
|
||||
(BETTING_MARKET_GROUP_STATUS_COUNT) )
|
||||
|
||||
FC_REFLECT( graphene::chain::betting_market_group_create_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::chain::betting_market_group_create_operation,
|
||||
FC_REFLECT( graphene::protocol::betting_market_group_create_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::protocol::betting_market_group_create_operation,
|
||||
(fee)(description)(event_id)(rules_id)(asset_id)
|
||||
(never_in_play)(delay_before_settling)
|
||||
(extensions) )
|
||||
|
||||
FC_REFLECT( graphene::chain::betting_market_group_update_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::chain::betting_market_group_update_operation,
|
||||
FC_REFLECT( graphene::protocol::betting_market_group_update_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::protocol::betting_market_group_update_operation,
|
||||
(fee)(betting_market_group_id)(new_description)(new_rules_id)(status)(extensions) )
|
||||
|
||||
FC_REFLECT( graphene::chain::betting_market_create_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::chain::betting_market_create_operation,
|
||||
FC_REFLECT( graphene::protocol::betting_market_create_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::protocol::betting_market_create_operation,
|
||||
(fee)(group_id)(description)(payout_condition)(extensions) )
|
||||
|
||||
FC_REFLECT( graphene::chain::betting_market_update_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::chain::betting_market_update_operation,
|
||||
FC_REFLECT( graphene::protocol::betting_market_update_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::protocol::betting_market_update_operation,
|
||||
(fee)(betting_market_id)(new_group_id)(new_description)(new_payout_condition)(extensions) )
|
||||
|
||||
FC_REFLECT_ENUM( graphene::chain::betting_market_resolution_type, (win)(not_win)(cancel)(BETTING_MARKET_RESOLUTION_COUNT) )
|
||||
FC_REFLECT_ENUM( graphene::protocol::betting_market_resolution_type, (win)(not_win)(cancel)(BETTING_MARKET_RESOLUTION_COUNT) )
|
||||
|
||||
FC_REFLECT( graphene::chain::betting_market_group_resolve_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::chain::betting_market_group_resolve_operation,
|
||||
FC_REFLECT( graphene::protocol::betting_market_group_resolve_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::protocol::betting_market_group_resolve_operation,
|
||||
(fee)(betting_market_group_id)(resolutions)(extensions) )
|
||||
|
||||
FC_REFLECT( graphene::chain::betting_market_group_resolved_operation::fee_parameters_type, )
|
||||
FC_REFLECT( graphene::chain::betting_market_group_resolved_operation,
|
||||
FC_REFLECT( graphene::protocol::betting_market_group_resolved_operation::fee_parameters_type, )
|
||||
FC_REFLECT( graphene::protocol::betting_market_group_resolved_operation,
|
||||
(bettor_id)(betting_market_group_id)(resolutions)(winnings)(fees_paid)(fee) )
|
||||
|
||||
FC_REFLECT( graphene::chain::betting_market_group_cancel_unmatched_bets_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::chain::betting_market_group_cancel_unmatched_bets_operation,
|
||||
FC_REFLECT( graphene::protocol::betting_market_group_cancel_unmatched_bets_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::protocol::betting_market_group_cancel_unmatched_bets_operation,
|
||||
(fee)(betting_market_group_id)(extensions) )
|
||||
|
||||
FC_REFLECT_ENUM( graphene::chain::bet_type, (back)(lay) )
|
||||
FC_REFLECT( graphene::chain::bet_place_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::chain::bet_place_operation,
|
||||
FC_REFLECT_ENUM( graphene::protocol::bet_type, (back)(lay) )
|
||||
FC_REFLECT( graphene::protocol::bet_place_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::protocol::bet_place_operation,
|
||||
(fee)(bettor_id)(betting_market_id)(amount_to_bet)(backer_multiplier)(back_or_lay)(extensions) )
|
||||
|
||||
FC_REFLECT( graphene::chain::bet_matched_operation::fee_parameters_type, )
|
||||
FC_REFLECT( graphene::chain::bet_matched_operation, (bettor_id)(bet_id)(amount_bet)(backer_multiplier)(guaranteed_winnings_returned) )
|
||||
FC_REFLECT( graphene::protocol::bet_matched_operation::fee_parameters_type, )
|
||||
FC_REFLECT( graphene::protocol::bet_matched_operation, (fee)(bettor_id)(bet_id)(amount_bet)(backer_multiplier)(guaranteed_winnings_returned) )
|
||||
|
||||
FC_REFLECT( graphene::chain::bet_cancel_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::chain::bet_cancel_operation, (fee) (bettor_id) (bet_to_cancel) (extensions) )
|
||||
FC_REFLECT( graphene::protocol::bet_cancel_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::protocol::bet_cancel_operation, (fee) (bettor_id) (bet_to_cancel) (extensions) )
|
||||
|
||||
FC_REFLECT( graphene::chain::bet_canceled_operation::fee_parameters_type, )
|
||||
FC_REFLECT( graphene::chain::bet_canceled_operation, (bettor_id)(bet_id)(stake_returned) )
|
||||
FC_REFLECT( graphene::protocol::bet_canceled_operation::fee_parameters_type, )
|
||||
FC_REFLECT( graphene::protocol::bet_canceled_operation, (fee)(bettor_id)(bet_id)(stake_returned) )
|
||||
|
||||
FC_REFLECT( graphene::chain::bet_adjusted_operation::fee_parameters_type, )
|
||||
FC_REFLECT( graphene::chain::bet_adjusted_operation, (bettor_id)(bet_id)(stake_returned) )
|
||||
FC_REFLECT( graphene::protocol::bet_adjusted_operation::fee_parameters_type, )
|
||||
FC_REFLECT( graphene::protocol::bet_adjusted_operation, (fee) (bettor_id)(bet_id)(stake_returned) )
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@
|
|||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <../hardfork.d/GPOS.hf>
|
||||
#include <memory>
|
||||
|
||||
#include <graphene/protocol/config.hpp>
|
||||
#include <graphene/protocol/base.hpp>
|
||||
|
||||
namespace graphene { namespace protocol {
|
||||
|
|
@ -44,7 +44,7 @@ namespace graphene { namespace protocol {
|
|||
/* gpos parameters */
|
||||
optional < uint32_t > gpos_period = GPOS_PERIOD;
|
||||
optional < uint32_t > gpos_subperiod = GPOS_SUBPERIOD;
|
||||
optional < uint32_t > gpos_period_start = HARDFORK_GPOS_TIME.sec_since_epoch();
|
||||
optional < uint32_t > gpos_period_start = GPOS_PERIOD_START.sec_since_epoch();
|
||||
optional < uint32_t > gpos_vesting_lockin_period = GPOS_VESTING_LOCKIN_PERIOD;
|
||||
/* rbac parameters */
|
||||
optional < uint16_t > rbac_max_permissions_per_account = RBAC_MAX_PERMISSIONS_PER_ACCOUNT;
|
||||
|
|
@ -101,6 +101,8 @@ namespace graphene { namespace protocol {
|
|||
|
||||
extension<parameter_extension> extensions;
|
||||
|
||||
chain_parameters();
|
||||
|
||||
/** defined in fee_schedule.cpp */
|
||||
void validate()const;
|
||||
inline bet_multiplier_type min_bet_multiplier()const {
|
||||
|
|
@ -135,7 +137,7 @@ namespace graphene { namespace protocol {
|
|||
return extensions.value.gpos_subperiod.valid() ? *extensions.value.gpos_subperiod : GPOS_SUBPERIOD; /// gpos_period % gpos_subperiod = 0
|
||||
}
|
||||
inline uint32_t gpos_period_start()const {
|
||||
return extensions.value.gpos_period_start.valid() ? *extensions.value.gpos_period_start : HARDFORK_GPOS_TIME.sec_since_epoch(); /// current period start date
|
||||
return extensions.value.gpos_period_start.valid() ? *extensions.value.gpos_period_start : GPOS_PERIOD_START.sec_since_epoch(); /// current period start date
|
||||
}
|
||||
inline uint32_t gpos_vesting_lockin_period()const {
|
||||
return extensions.value.gpos_vesting_lockin_period.valid() ? *extensions.value.gpos_vesting_lockin_period : GPOS_VESTING_LOCKIN_PERIOD; /// GPOS vesting lockin period
|
||||
|
|
|
|||
|
|
@ -23,11 +23,8 @@
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#define GRAPHENE_SYMBOL "BTS"
|
||||
#define GRAPHENE_ADDRESS_PREFIX "BTS"
|
||||
|
||||
#define GRAPHENE_BLOCKCHAIN_PRECISION uint64_t( 100000 )
|
||||
#define GRAPHENE_BLOCKCHAIN_PRECISION_DIGITS 5
|
||||
#define GRAPHENE_SYMBOL "TEST"
|
||||
#define GRAPHENE_ADDRESS_PREFIX "TEST"
|
||||
|
||||
#define GRAPHENE_MIN_ACCOUNT_NAME_LENGTH 1
|
||||
#define GRAPHENE_MAX_ACCOUNT_NAME_LENGTH 63
|
||||
|
|
@ -36,21 +33,8 @@
|
|||
#define GRAPHENE_MAX_ASSET_SYMBOL_LENGTH 16
|
||||
|
||||
#define GRAPHENE_MAX_SHARE_SUPPLY int64_t(1000000000000000ll)
|
||||
|
||||
#define GRAPHENE_MAX_WORKER_NAME_LENGTH 63
|
||||
#define GRAPHENE_MAX_URL_LENGTH 127
|
||||
|
||||
#define GRAPHENE_MAX_PAY_RATE 10000 /* 100% */
|
||||
#define GRAPHENE_MAX_SIG_CHECK_DEPTH 2
|
||||
|
||||
#define GRAPHENE_IRREVERSIBLE_THRESHOLD (70 * GRAPHENE_1_PERCENT)
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
||||
/**
|
||||
* Don't allow the committee_members to publish a limit that would
|
||||
* make the network unable to operate.
|
||||
|
|
@ -59,51 +43,34 @@
|
|||
#define GRAPHENE_MIN_BLOCK_INTERVAL 1 /* seconds */
|
||||
#define GRAPHENE_MAX_BLOCK_INTERVAL 30 /* seconds */
|
||||
|
||||
#define GRAPHENE_DEFAULT_BLOCK_INTERVAL 5 /* seconds */
|
||||
#define GRAPHENE_DEFAULT_BLOCK_INTERVAL 3 /* seconds */
|
||||
#define GRAPHENE_DEFAULT_MAX_TRANSACTION_SIZE 2048
|
||||
#define GRAPHENE_DEFAULT_MAX_BLOCK_SIZE (2*1000*1000) /* < 2 MiB (less than MAX_MESSAGE_SIZE in graphene/net/config.hpp) */
|
||||
#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
|
||||
|
||||
#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_DEFAULT_MAX_AUTHORITY_MEMBERSHIP 10
|
||||
#define GRAPHENE_DEFAULT_MAX_ASSET_WHITELIST_AUTHORITIES 10
|
||||
#define GRAPHENE_DEFAULT_MAX_ASSET_FEED_PUBLISHERS 10
|
||||
|
||||
#define GRAPHENE_DEFAULT_MIN_WITNESS_COUNT (11)
|
||||
#define GRAPHENE_DEFAULT_MIN_COMMITTEE_MEMBER_COUNT (11)
|
||||
#define GRAPHENE_DEFAULT_MAX_WITNESSES (1001) // SHOULD BE ODD
|
||||
#define GRAPHENE_DEFAULT_MAX_COMMITTEE (1001) // SHOULD BE ODD
|
||||
#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_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_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_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_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_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
|
||||
|
|
@ -116,25 +83,155 @@
|
|||
#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_MAX_WITNESSES (1001) // SHOULD BE ODD
|
||||
#define GRAPHENE_DEFAULT_MAX_COMMITTEE (1001) // SHOULD BE ODD
|
||||
#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_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::protocol::account_id_type(0))
|
||||
#define GRAPHENE_COMMITTEE_ACCOUNT (graphene::chain::account_id_type(0))
|
||||
/// Represents the current witnesses
|
||||
#define GRAPHENE_WITNESS_ACCOUNT (graphene::protocol::account_id_type(1))
|
||||
#define GRAPHENE_WITNESS_ACCOUNT (graphene::chain::account_id_type(1))
|
||||
/// Represents the current committee members
|
||||
#define GRAPHENE_RELAXED_COMMITTEE_ACCOUNT (graphene::protocol::account_id_type(2))
|
||||
#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::protocol::account_id_type(3))
|
||||
#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::protocol::account_id_type(4))
|
||||
#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::protocol::account_id_type(5))
|
||||
#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::protocol::witness_id_type(0))
|
||||
#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 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 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
|
||||
|
|
|
|||
|
|
@ -23,10 +23,11 @@
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include <graphene/chain/protocol/types.hpp>
|
||||
#include <graphene/chain/protocol/base.hpp>
|
||||
#include <graphene/protocol/types.hpp>
|
||||
#include <graphene/protocol/base.hpp>
|
||||
#include <graphene/protocol/asset.hpp>
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
namespace graphene { namespace protocol {
|
||||
|
||||
struct event_create_operation : public base_operation
|
||||
{
|
||||
|
|
@ -132,16 +133,16 @@ struct event_update_status_operation : public base_operation
|
|||
|
||||
} }
|
||||
|
||||
FC_REFLECT( graphene::chain::event_create_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::chain::event_create_operation,
|
||||
FC_REFLECT( graphene::protocol::event_create_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::protocol::event_create_operation,
|
||||
(fee)(name)(season)(start_time)(event_group_id)(extensions) )
|
||||
|
||||
FC_REFLECT( graphene::chain::event_update_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::chain::event_update_operation,
|
||||
FC_REFLECT( graphene::protocol::event_update_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::protocol::event_update_operation,
|
||||
(fee)(event_id)(new_event_group_id)(new_name)(new_season)(new_start_time)(new_status)(extensions) )
|
||||
|
||||
FC_REFLECT_ENUM( graphene::chain::event_status, (upcoming)(in_progress)(frozen)(finished)(canceled)(settled)(STATUS_COUNT) )
|
||||
FC_REFLECT( graphene::chain::event_update_status_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::chain::event_update_status_operation,
|
||||
FC_REFLECT_ENUM( graphene::protocol::event_status, (upcoming)(in_progress)(frozen)(finished)(canceled)(settled)(STATUS_COUNT) )
|
||||
FC_REFLECT( graphene::protocol::event_update_status_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::protocol::event_update_status_operation,
|
||||
(fee)(event_id)(status)(scores)(extensions) )
|
||||
|
||||
|
|
|
|||
|
|
@ -23,10 +23,11 @@
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include <graphene/chain/protocol/types.hpp>
|
||||
#include <graphene/chain/protocol/base.hpp>
|
||||
#include <graphene/protocol/types.hpp>
|
||||
#include <graphene/protocol/base.hpp>
|
||||
#include <graphene/protocol/asset.hpp>
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
namespace graphene { namespace protocol {
|
||||
|
||||
struct event_group_create_operation : public base_operation
|
||||
{
|
||||
|
|
@ -86,14 +87,14 @@ struct event_group_delete_operation : public base_operation
|
|||
|
||||
} }
|
||||
|
||||
FC_REFLECT( graphene::chain::event_group_create_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::chain::event_group_create_operation,
|
||||
FC_REFLECT( graphene::protocol::event_group_create_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::protocol::event_group_create_operation,
|
||||
(fee)(name)(sport_id)(extensions) )
|
||||
|
||||
FC_REFLECT( graphene::chain::event_group_update_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::chain::event_group_update_operation,
|
||||
FC_REFLECT( graphene::protocol::event_group_update_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::protocol::event_group_update_operation,
|
||||
(fee)(new_sport_id)(new_name)(event_group_id)(extensions) )
|
||||
|
||||
FC_REFLECT( graphene::chain::event_group_delete_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::chain::event_group_delete_operation,
|
||||
FC_REFLECT( graphene::protocol::event_group_delete_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::protocol::event_group_delete_operation,
|
||||
(fee)(event_group_id)(extensions) )
|
||||
|
|
|
|||
|
|
@ -33,16 +33,16 @@
|
|||
|
||||
namespace graphene { namespace protocol {
|
||||
|
||||
FC_DECLARE_EXCEPTION( protocol_exception, 4000000, "protocol exception" )
|
||||
FC_DECLARE_EXCEPTION( protocol_exception, 4000000 )
|
||||
|
||||
FC_DECLARE_DERIVED_EXCEPTION( transaction_exception, graphene::protocol::protocol_exception, 4010000, "transaction validation exception" )
|
||||
FC_DECLARE_DERIVED_EXCEPTION( transaction_exception, graphene::protocol::protocol_exception, 4010000 )
|
||||
|
||||
FC_DECLARE_DERIVED_EXCEPTION( tx_missing_active_auth, graphene::protocol::transaction_exception, 4010001, "missing required active authority" )
|
||||
FC_DECLARE_DERIVED_EXCEPTION( tx_missing_owner_auth, graphene::protocol::transaction_exception, 4010002, "missing required owner authority" )
|
||||
FC_DECLARE_DERIVED_EXCEPTION( tx_missing_other_auth, graphene::protocol::transaction_exception, 4010003, "missing required other authority" )
|
||||
FC_DECLARE_DERIVED_EXCEPTION( tx_irrelevant_sig, graphene::protocol::transaction_exception, 4010004, "irrelevant signature included" )
|
||||
FC_DECLARE_DERIVED_EXCEPTION( tx_duplicate_sig, graphene::protocol::transaction_exception, 4010005, "duplicate signature included" )
|
||||
FC_DECLARE_DERIVED_EXCEPTION( invalid_committee_approval, graphene::protocol::transaction_exception, 4010006, "committee account cannot directly approve transaction" )
|
||||
FC_DECLARE_DERIVED_EXCEPTION( insufficient_fee, graphene::protocol::transaction_exception, 4010007, "insufficient fee" )
|
||||
FC_DECLARE_DERIVED_EXCEPTION( tx_missing_active_auth, graphene::protocol::transaction_exception, 4010001 )
|
||||
FC_DECLARE_DERIVED_EXCEPTION( tx_missing_owner_auth, graphene::protocol::transaction_exception, 4010002 )
|
||||
FC_DECLARE_DERIVED_EXCEPTION( tx_missing_other_auth, graphene::protocol::transaction_exception, 4010003 )
|
||||
FC_DECLARE_DERIVED_EXCEPTION( tx_irrelevant_sig, graphene::protocol::transaction_exception, 4010004 )
|
||||
FC_DECLARE_DERIVED_EXCEPTION( tx_duplicate_sig, graphene::protocol::transaction_exception, 4010005 )
|
||||
FC_DECLARE_DERIVED_EXCEPTION( invalid_committee_approval, graphene::protocol::transaction_exception, 4010006 )
|
||||
FC_DECLARE_DERIVED_EXCEPTION( insufficient_fee, graphene::protocol::transaction_exception, 4010007 )
|
||||
|
||||
} } // graphene::protocol
|
||||
|
|
|
|||
|
|
@ -83,10 +83,6 @@ namespace graphene { namespace protocol {
|
|||
|
||||
} } // graphene::protocol
|
||||
|
||||
namespace fc {
|
||||
template<> struct get_typename<std::shared_ptr<graphene::protocol::fee_schedule>> { static const char* name() { return "shared_ptr<fee_schedule>"; } };
|
||||
}
|
||||
|
||||
FC_REFLECT_TYPENAME( graphene::protocol::fee_parameters )
|
||||
FC_REFLECT( graphene::protocol::fee_schedule, (parameters)(scale) )
|
||||
|
||||
|
|
|
|||
|
|
@ -22,10 +22,10 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
#pragma once
|
||||
#include <graphene/chain/protocol/base.hpp>
|
||||
#include <graphene/chain/asset_object.hpp>
|
||||
#include <graphene/protocol/base.hpp>
|
||||
#include <graphene/protocol/asset.hpp>
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
namespace graphene { namespace protocol {
|
||||
|
||||
/**
|
||||
* @ingroup operations
|
||||
|
|
@ -104,9 +104,9 @@ namespace graphene { namespace chain {
|
|||
share_type calculate_fee( const fee_parameters_type& k )const { return k.fee; }
|
||||
};
|
||||
|
||||
} } // graphene::chain
|
||||
} } // graphene::protocol
|
||||
|
||||
FC_REFLECT( graphene::chain::ticket_purchase_operation,
|
||||
FC_REFLECT( graphene::protocol::ticket_purchase_operation,
|
||||
(fee)
|
||||
(lottery)
|
||||
(buyer)
|
||||
|
|
@ -114,10 +114,10 @@ FC_REFLECT( graphene::chain::ticket_purchase_operation,
|
|||
(amount)
|
||||
(extensions)
|
||||
)
|
||||
FC_REFLECT( graphene::chain::ticket_purchase_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::protocol::ticket_purchase_operation::fee_parameters_type, (fee) )
|
||||
|
||||
FC_REFLECT_TYPENAME( graphene::chain::ticket_num )
|
||||
FC_REFLECT( graphene::chain::lottery_reward_operation,
|
||||
FC_REFLECT_TYPENAME( graphene::protocol::ticket_num )
|
||||
FC_REFLECT( graphene::protocol::lottery_reward_operation,
|
||||
(fee)
|
||||
(lottery)
|
||||
(winner)
|
||||
|
|
@ -126,13 +126,13 @@ FC_REFLECT( graphene::chain::lottery_reward_operation,
|
|||
(is_benefactor_reward)
|
||||
(winner_ticket_id)
|
||||
)
|
||||
FC_REFLECT( graphene::chain::lottery_reward_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::protocol::lottery_reward_operation::fee_parameters_type, (fee) )
|
||||
|
||||
|
||||
FC_REFLECT( graphene::chain::lottery_end_operation,
|
||||
FC_REFLECT( graphene::protocol::lottery_end_operation,
|
||||
(fee)
|
||||
(lottery)
|
||||
(participants)
|
||||
(extensions)
|
||||
)
|
||||
FC_REFLECT( graphene::chain::lottery_end_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::protocol::lottery_end_operation::fee_parameters_type, (fee) )
|
||||
|
|
|
|||
|
|
@ -167,8 +167,7 @@ FC_REFLECT( graphene::protocol::fill_order_operation::fee_parameters_type, ) //
|
|||
FC_REFLECT( graphene::protocol::limit_order_create_operation,(fee)(seller)(amount_to_sell)(min_to_receive)(expiration)(fill_or_kill)(extensions))
|
||||
FC_REFLECT( graphene::protocol::limit_order_cancel_operation,(fee)(fee_paying_account)(order)(extensions) )
|
||||
FC_REFLECT( graphene::protocol::call_order_update_operation, (fee)(funding_account)(delta_collateral)(delta_debt)(extensions) )
|
||||
FC_REFLECT( graphene::protocol::fill_order_operation, (fee)(order_id)(account_id)(pays)(receives)(fill_price)(is_maker) )
|
||||
FC_REFLECT( graphene::chain::fill_order_operation, (fee)(order_id)(account_id)(pays)(receives) )
|
||||
FC_REFLECT( graphene::protocol::fill_order_operation, (fee)(order_id)(account_id)(pays)(receives) )
|
||||
|
||||
GRAPHENE_EXTERNAL_SERIALIZATION( extern, graphene::protocol::limit_order_create_operation::fee_parameters_type )
|
||||
GRAPHENE_EXTERNAL_SERIALIZATION( extern, graphene::protocol::limit_order_cancel_operation::fee_parameters_type )
|
||||
|
|
|
|||
|
|
@ -22,5 +22,5 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
#pragma once
|
||||
#include <graphene/chain/protocol/fee_schedule.hpp>
|
||||
#include <graphene/chain/protocol/block.hpp>
|
||||
#include <graphene/protocol/fee_schedule.hpp>
|
||||
#include <graphene/protocol/block.hpp>
|
||||
|
|
|
|||
|
|
@ -30,8 +30,9 @@
|
|||
|
||||
#include <fc/container/flat.hpp>
|
||||
#include <fc/reflect/reflect.hpp>
|
||||
#include <fc/crypto/sha256.hpp>
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
namespace graphene { namespace protocol {
|
||||
|
||||
struct rock_paper_scissors_game_options
|
||||
{
|
||||
|
|
@ -69,14 +70,17 @@ namespace graphene { namespace chain {
|
|||
uint64_t nonce1;
|
||||
uint64_t nonce2;
|
||||
rock_paper_scissors_gesture gesture;
|
||||
fc::sha256 calculate_hash() const;
|
||||
fc::sha256 calculate_hash() const {
|
||||
std::vector<char> full_throw_packed(fc::raw::pack(*this));
|
||||
return fc::sha256::hash(full_throw_packed.data(), full_throw_packed.size());
|
||||
}
|
||||
};
|
||||
|
||||
struct rock_paper_scissors_throw_commit
|
||||
{
|
||||
uint64_t nonce1;
|
||||
fc::sha256 throw_hash;
|
||||
bool operator<(const graphene::chain::rock_paper_scissors_throw_commit& rhs) const
|
||||
bool operator<(const graphene::protocol::rock_paper_scissors_throw_commit& rhs) const
|
||||
{
|
||||
return std::tie(nonce1, throw_hash) < std::tie(rhs.nonce1, rhs.throw_hash);
|
||||
}
|
||||
|
|
@ -92,25 +96,25 @@ namespace graphene { namespace chain {
|
|||
|
||||
} }
|
||||
|
||||
FC_REFLECT( graphene::chain::rock_paper_scissors_game_options, (insurance_enabled)(time_per_commit_move)(time_per_reveal_move)(number_of_gestures) )
|
||||
FC_REFLECT( graphene::protocol::rock_paper_scissors_game_options, (insurance_enabled)(time_per_commit_move)(time_per_reveal_move)(number_of_gestures) )
|
||||
|
||||
// FC_REFLECT_TYPENAME( graphene::chain::rock_paper_scissors_gesture)
|
||||
FC_REFLECT_ENUM( graphene::chain::rock_paper_scissors_gesture,
|
||||
// FC_REFLECT_TYPENAME( graphene::protocol::rock_paper_scissors_gesture)
|
||||
FC_REFLECT_ENUM( graphene::protocol::rock_paper_scissors_gesture,
|
||||
(rock)
|
||||
(paper)
|
||||
(scissors)
|
||||
(spock)
|
||||
(lizard))
|
||||
|
||||
FC_REFLECT( graphene::chain::rock_paper_scissors_throw,
|
||||
FC_REFLECT( graphene::protocol::rock_paper_scissors_throw,
|
||||
(nonce1)
|
||||
(nonce2)
|
||||
(gesture) )
|
||||
|
||||
FC_REFLECT( graphene::chain::rock_paper_scissors_throw_commit,
|
||||
FC_REFLECT( graphene::protocol::rock_paper_scissors_throw_commit,
|
||||
(nonce1)
|
||||
(throw_hash) )
|
||||
|
||||
FC_REFLECT( graphene::chain::rock_paper_scissors_throw_reveal,
|
||||
FC_REFLECT( graphene::protocol::rock_paper_scissors_throw_reveal,
|
||||
(nonce2)(gesture) )
|
||||
|
||||
|
|
|
|||
|
|
@ -23,10 +23,11 @@
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include <graphene/chain/protocol/types.hpp>
|
||||
#include <graphene/chain/protocol/base.hpp>
|
||||
#include <graphene/protocol/types.hpp>
|
||||
#include <graphene/protocol/base.hpp>
|
||||
#include <graphene/protocol/asset.hpp>
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
namespace graphene { namespace protocol {
|
||||
|
||||
struct sport_create_operation : public base_operation
|
||||
{
|
||||
|
|
@ -74,14 +75,14 @@ struct sport_delete_operation : public base_operation
|
|||
|
||||
} }
|
||||
|
||||
FC_REFLECT( graphene::chain::sport_create_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::chain::sport_create_operation,
|
||||
FC_REFLECT( graphene::protocol::sport_create_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::protocol::sport_create_operation,
|
||||
(fee)(name)(extensions) )
|
||||
|
||||
FC_REFLECT( graphene::chain::sport_update_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::chain::sport_update_operation,
|
||||
FC_REFLECT( graphene::protocol::sport_update_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::protocol::sport_update_operation,
|
||||
(fee)(sport_id)(new_name)(extensions) )
|
||||
|
||||
FC_REFLECT( graphene::chain::sport_delete_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::chain::sport_delete_operation,
|
||||
FC_REFLECT( graphene::protocol::sport_delete_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::protocol::sport_delete_operation,
|
||||
(fee)(sport_id)(extensions) )
|
||||
|
|
|
|||
|
|
@ -30,11 +30,11 @@
|
|||
|
||||
#include <fc/container/flat.hpp>
|
||||
#include <fc/reflect/reflect.hpp>
|
||||
#include <graphene/chain/protocol/asset.hpp>
|
||||
#include <graphene/chain/protocol/rock_paper_scissors.hpp>
|
||||
#include <graphene/chain/protocol/base.hpp>
|
||||
#include <graphene/protocol/asset.hpp>
|
||||
#include <graphene/protocol/rock_paper_scissors.hpp>
|
||||
#include <graphene/protocol/base.hpp>
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
namespace graphene { namespace protocol {
|
||||
|
||||
enum class payout_type
|
||||
{
|
||||
|
|
@ -220,15 +220,15 @@ namespace graphene { namespace chain {
|
|||
|
||||
} }
|
||||
|
||||
FC_REFLECT_ENUM(graphene::chain::payout_type,
|
||||
FC_REFLECT_ENUM(graphene::protocol::payout_type,
|
||||
(prize_award)
|
||||
(buyin_refund)
|
||||
(rake_fee)
|
||||
)
|
||||
|
||||
FC_REFLECT_TYPENAME( graphene::chain::game_specific_options )
|
||||
FC_REFLECT_TYPENAME( graphene::chain::game_specific_moves )
|
||||
FC_REFLECT( graphene::chain::tournament_options,
|
||||
FC_REFLECT_TYPENAME( graphene::protocol::game_specific_options )
|
||||
FC_REFLECT_TYPENAME( graphene::protocol::game_specific_moves )
|
||||
FC_REFLECT( graphene::protocol::tournament_options,
|
||||
(registration_deadline)
|
||||
(number_of_players)
|
||||
(buy_in)
|
||||
|
|
@ -239,31 +239,31 @@ FC_REFLECT( graphene::chain::tournament_options,
|
|||
(number_of_wins)
|
||||
(meta)
|
||||
(game_options))
|
||||
FC_REFLECT( graphene::chain::tournament_create_operation,
|
||||
FC_REFLECT( graphene::protocol::tournament_create_operation,
|
||||
(fee)
|
||||
(creator)
|
||||
(options)
|
||||
(extensions))
|
||||
FC_REFLECT( graphene::chain::tournament_join_operation,
|
||||
FC_REFLECT( graphene::protocol::tournament_join_operation,
|
||||
(fee)
|
||||
(payer_account_id)
|
||||
(player_account_id)
|
||||
(tournament_id)
|
||||
(buy_in)
|
||||
(extensions))
|
||||
FC_REFLECT( graphene::chain::tournament_leave_operation,
|
||||
FC_REFLECT( graphene::protocol::tournament_leave_operation,
|
||||
(fee)
|
||||
(canceling_account_id)
|
||||
(player_account_id)
|
||||
(tournament_id)
|
||||
(extensions))
|
||||
FC_REFLECT( graphene::chain::game_move_operation,
|
||||
FC_REFLECT( graphene::protocol::game_move_operation,
|
||||
(fee)
|
||||
(game_id)
|
||||
(player_account_id)
|
||||
(move)
|
||||
(extensions))
|
||||
FC_REFLECT( graphene::chain::tournament_payout_operation,
|
||||
FC_REFLECT( graphene::protocol::tournament_payout_operation,
|
||||
(fee)
|
||||
(payout_account_id)
|
||||
(tournament_id)
|
||||
|
|
@ -271,9 +271,9 @@ FC_REFLECT( graphene::chain::tournament_payout_operation,
|
|||
(type)
|
||||
(extensions))
|
||||
|
||||
FC_REFLECT( graphene::chain::tournament_create_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::chain::tournament_join_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::chain::tournament_leave_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::chain::game_move_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::chain::tournament_payout_operation::fee_parameters_type, )
|
||||
FC_REFLECT( graphene::protocol::tournament_create_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::protocol::tournament_join_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::protocol::tournament_leave_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::protocol::game_move_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::protocol::tournament_payout_operation::fee_parameters_type, )
|
||||
|
||||
|
|
|
|||
|
|
@ -230,7 +230,8 @@ namespace graphene { namespace protocol {
|
|||
FC_REFLECT( graphene::protocol::transaction, (ref_block_num)(ref_block_prefix)(expiration)(operations)(extensions) )
|
||||
// Note: not reflecting signees field for backward compatibility; in addition, it should not be in p2p messages
|
||||
FC_REFLECT_DERIVED( graphene::protocol::signed_transaction, (graphene::protocol::transaction), (signatures) )
|
||||
FC_REFLECT_DERIVED( graphene::protocol::processed_transaction, (graphene::protocol::precomputable_transaction), (operation_results) )
|
||||
FC_REFLECT_DERIVED( graphene::protocol::processed_transaction, (graphene::protocol::signed_transaction),
|
||||
(operation_results) )
|
||||
|
||||
|
||||
GRAPHENE_EXTERNAL_SERIALIZATION(extern, graphene::protocol::transaction)
|
||||
|
|
|
|||
|
|
@ -177,6 +177,9 @@ using digest_type = fc::sha256;
|
|||
using signature_type = fc::ecc::compact_signature;
|
||||
using share_type = safe<int64_t>;
|
||||
using weight_type = uint16_t;
|
||||
using secret_hash_type = fc::ripemd160;
|
||||
using bet_multiplier_type = uint32_t;
|
||||
using internationalized_string_type = flat_map<std::string, std::string>;
|
||||
|
||||
struct public_key_type {
|
||||
struct binary_key {
|
||||
|
|
@ -195,6 +198,9 @@ struct public_key_type {
|
|||
friend bool operator == (const public_key_type& p1, const fc::ecc::public_key& p2);
|
||||
friend bool operator == (const public_key_type& p1, const public_key_type& p2);
|
||||
friend bool operator != (const public_key_type& p1, const public_key_type& p2);
|
||||
// TODO: This is temporary for testing
|
||||
bool is_valid_v1( const std::string& base58str );
|
||||
bool is_valid_muse( const std::string& base58str );
|
||||
};
|
||||
|
||||
class pubkey_comparator {
|
||||
|
|
@ -242,22 +248,22 @@ GRAPHENE_DEFINE_IDS(protocol, protocol_ids, /*protocol objects are not prefixed*
|
|||
(vesting_balance)
|
||||
(worker)
|
||||
(balance)
|
||||
(tournament_object_type)
|
||||
(tournament_details_object_type)
|
||||
(match_object_type)
|
||||
(game_object_type)
|
||||
(sport_object_type)
|
||||
(event_group_object_type)
|
||||
(event_object_type)
|
||||
(betting_market_rules_object_type)
|
||||
(betting_market_group_object_type)
|
||||
(betting_market_object_type)
|
||||
(bet_object_type)
|
||||
(custom_permission_object_type)
|
||||
(custom_account_authority_object_type)
|
||||
(offer_object_type)
|
||||
(tournament)
|
||||
(tournament_details)
|
||||
(match)
|
||||
(game)
|
||||
(sport)
|
||||
(event_group)
|
||||
(event)
|
||||
(betting_market_rules)
|
||||
(betting_market_group)
|
||||
(betting_market)
|
||||
(bet)
|
||||
(custom_permission)
|
||||
(custom_account_authority)
|
||||
(offer)
|
||||
(nft_metadata_type)
|
||||
(nft_object_type))
|
||||
(nft))
|
||||
|
||||
FC_REFLECT(graphene::protocol::public_key_type, (key_data))
|
||||
FC_REFLECT(graphene::protocol::public_key_type::binary_key, (data)(check))
|
||||
|
|
|
|||
|
|
@ -132,7 +132,6 @@ FC_REFLECT( graphene::protocol::vesting_balance_withdraw_operation, (fee)(vestin
|
|||
|
||||
FC_REFLECT(graphene::protocol::linear_vesting_policy_initializer, (begin_timestamp)(vesting_cliff_seconds)(vesting_duration_seconds) )
|
||||
FC_REFLECT(graphene::protocol::cdd_vesting_policy_initializer, (start_claim)(vesting_seconds) )
|
||||
FC_REFLECT_EMPTY( graphene::protocol::instant_vesting_policy_initializer )
|
||||
FC_REFLECT_TYPENAME( graphene::protocol::vesting_policy_initializer )
|
||||
|
||||
FC_REFLECT_ENUM( graphene::protocol::vesting_balance_type, (normal)(gpos) )
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#include <graphene/chain/protocol/lottery_ops.hpp>
|
||||
#include <graphene/protocol/lottery_ops.hpp>
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
namespace graphene { namespace protocol {
|
||||
|
||||
void ticket_purchase_operation::validate() const
|
||||
{
|
||||
|
|
@ -36,4 +36,4 @@ share_type ticket_purchase_operation::calculate_fee( const fee_parameters_type&
|
|||
return k.fee;
|
||||
}
|
||||
|
||||
} } // namespace graphene::chain
|
||||
} } // namespace graphene::protocol
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ uint64_t base_operation::calculate_data_fee( uint64_t bytes, uint64_t price_per_
|
|||
{
|
||||
auto result = (fc::uint128_t(bytes) * price_per_kbyte) / 1024;
|
||||
FC_ASSERT( result <= GRAPHENE_MAX_SHARE_SUPPLY );
|
||||
return result.convert_to<uint64_t>();
|
||||
return result;
|
||||
}
|
||||
|
||||
void balance_claim_operation::validate()const
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue