Graphene Updates and DApp Support #643

Closed
nathanielhourt wants to merge 84 commits from dapp-support into develop
94 changed files with 278 additions and 2729 deletions
Showing only changes of commit 4d836dacb9 - Show all commits

View file

@ -8,7 +8,7 @@ set( CLI_CLIENT_EXECUTABLE_NAME graphene_client )
set( GUI_CLIENT_EXECUTABLE_NAME BitShares )
set( CUSTOM_URL_SCHEME "gcs" )
set( INSTALLER_APP_ID "68ad7005-8eee-49c9-95ce-9eed97e5b347" )
set( CMAKE_CXX_VERSION 14 )
set( CMAKE_CXX_STANDARD 14 )
# http://stackoverflow.com/a/18369825
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")

View file

@ -12,7 +12,12 @@ add_library( graphene_app
)
# need to link graphene_debug_witness because plugins aren't sufficiently isolated #246
target_link_libraries( graphene_app graphene_market_history graphene_account_history graphene_accounts_list graphene_affiliate_stats graphene_chain fc graphene_db graphene_net graphene_utilities graphene_debug_witness graphene_bookie graphene_elasticsearch peerplays_sidechain )
target_link_libraries( graphene_app
PUBLIC graphene_chain graphene_net graphene_utilities
fc graphene_db peerplays_sidechain
graphene_account_history graphene_accounts_list graphene_affiliate_stats graphene_bookie graphene_debug_witness graphene_elasticsearch
graphene_es_objects graphene_generate_genesis graphene_market_history )
target_include_directories( graphene_app
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include"
"${CMAKE_CURRENT_SOURCE_DIR}/../egenesis/include" )
@ -29,3 +34,26 @@ INSTALL( TARGETS
ARCHIVE DESTINATION lib
)
INSTALL( FILES ${HEADERS} DESTINATION "include/graphene/app" )
add_library( graphene_plugin
plugin.cpp
include/graphene/app/plugin.hpp
)
target_link_libraries( graphene_plugin
PUBLIC graphene_chain graphene_net graphene_utilities )
target_include_directories( graphene_plugin
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" )
INSTALL( TARGETS
graphene_app
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)

View file

@ -1,76 +0,0 @@
#pragma once
#include <graphene/chain/protocol/base.hpp>
namespace graphene
{
namespace chain
{
struct custom_account_authority_create_operation : public base_operation
{
struct fee_parameters_type
{
uint64_t fee = GRAPHENE_BLOCKCHAIN_PRECISION;
uint32_t price_per_kbyte = GRAPHENE_BLOCKCHAIN_PRECISION;
};
asset fee;
custom_permission_id_type permission_id;
int operation_type;
time_point_sec valid_from;
time_point_sec valid_to;
account_id_type owner_account;
extensions_type extensions;
account_id_type fee_payer() const { return owner_account; }
void validate() const;
share_type calculate_fee(const fee_parameters_type &k) const;
};
struct custom_account_authority_update_operation : public base_operation
{
struct fee_parameters_type
{
uint64_t fee = GRAPHENE_BLOCKCHAIN_PRECISION;
};
asset fee;
custom_account_authority_id_type auth_id;
optional<time_point_sec> new_valid_from;
optional<time_point_sec> new_valid_to;
account_id_type owner_account;
extensions_type extensions;
account_id_type fee_payer() const { return owner_account; }
void validate() const;
share_type calculate_fee(const fee_parameters_type &k) const { return k.fee; }
};
struct custom_account_authority_delete_operation : public base_operation
{
struct fee_parameters_type
{
uint64_t fee = GRAPHENE_BLOCKCHAIN_PRECISION;
};
asset fee;
custom_account_authority_id_type auth_id;
account_id_type owner_account;
extensions_type extensions;
account_id_type fee_payer() const { return owner_account; }
void validate() const;
share_type calculate_fee(const fee_parameters_type &k) const { return k.fee; }
};
} // namespace chain
} // namespace graphene
FC_REFLECT(graphene::chain::custom_account_authority_create_operation::fee_parameters_type, (fee)(price_per_kbyte))
FC_REFLECT(graphene::chain::custom_account_authority_create_operation, (fee)(permission_id)(operation_type)(valid_from)(valid_to)(owner_account)(extensions))
FC_REFLECT(graphene::chain::custom_account_authority_update_operation::fee_parameters_type, (fee))
FC_REFLECT(graphene::chain::custom_account_authority_update_operation, (fee)(auth_id)(new_valid_from)(new_valid_to)(owner_account)(extensions))
FC_REFLECT(graphene::chain::custom_account_authority_delete_operation::fee_parameters_type, (fee))
FC_REFLECT(graphene::chain::custom_account_authority_delete_operation, (fee)(auth_id)(owner_account)(extensions))

View file

@ -1,73 +0,0 @@
#pragma once
#include <graphene/chain/protocol/base.hpp>
namespace graphene
{
namespace chain
{
struct custom_permission_create_operation : public base_operation
{
struct fee_parameters_type
{
uint64_t fee = GRAPHENE_BLOCKCHAIN_PRECISION;
uint32_t price_per_kbyte = GRAPHENE_BLOCKCHAIN_PRECISION;
};
asset fee;
account_id_type owner_account;
string permission_name;
authority auth;
extensions_type extensions;
account_id_type fee_payer() const { return owner_account; }
void validate() const;
share_type calculate_fee(const fee_parameters_type &k) const;
};
struct custom_permission_update_operation : public base_operation
{
struct fee_parameters_type
{
uint64_t fee = GRAPHENE_BLOCKCHAIN_PRECISION;
};
asset fee;
custom_permission_id_type permission_id;
optional<authority> new_auth;
account_id_type owner_account;
extensions_type extensions;
account_id_type fee_payer() const { return owner_account; }
void validate() const;
share_type calculate_fee(const fee_parameters_type &k) const { return k.fee; }
};
struct custom_permission_delete_operation : public base_operation
{
struct fee_parameters_type
{
uint64_t fee = GRAPHENE_BLOCKCHAIN_PRECISION;
};
asset fee;
custom_permission_id_type permission_id;
account_id_type owner_account;
extensions_type extensions;
account_id_type fee_payer() const { return owner_account; }
void validate() const;
share_type calculate_fee(const fee_parameters_type &k) const { return k.fee; }
};
} // namespace chain
} // namespace graphene
FC_REFLECT(graphene::chain::custom_permission_create_operation::fee_parameters_type, (fee)(price_per_kbyte))
FC_REFLECT(graphene::chain::custom_permission_create_operation, (fee)(owner_account)(permission_name)(auth)(extensions))
FC_REFLECT(graphene::chain::custom_permission_update_operation::fee_parameters_type, (fee))
FC_REFLECT(graphene::chain::custom_permission_update_operation, (fee)(permission_id)(new_auth)(owner_account)(extensions))
FC_REFLECT(graphene::chain::custom_permission_delete_operation::fee_parameters_type, (fee))
FC_REFLECT(graphene::chain::custom_permission_delete_operation, (fee)(permission_id)(owner_account)(extensions))

View file

@ -69,7 +69,6 @@ FC_REFLECT( graphene::app::full_account,
(limit_orders)
(call_orders)
(settle_orders)
(proposals)
(assets)
(withdraws)
(pending_dividend_payments)

View file

@ -1,148 +0,0 @@
#pragma once
#include <graphene/chain/protocol/base.hpp>
#include <graphene/chain/protocol/types.hpp>
namespace graphene { namespace chain {
struct nft_metadata_create_operation : public base_operation
{
struct fee_parameters_type
{
uint64_t fee = GRAPHENE_BLOCKCHAIN_PRECISION;
uint32_t price_per_kbyte = GRAPHENE_BLOCKCHAIN_PRECISION;
};
asset fee;
account_id_type owner;
std::string name;
std::string symbol;
std::string base_uri;
optional<account_id_type> revenue_partner;
optional<uint16_t> revenue_split;
bool is_transferable = false;
bool is_sellable = true;
// Accounts Role
optional<account_role_id_type> account_role;
extensions_type extensions;
account_id_type fee_payer()const { return owner; }
void validate() const;
share_type calculate_fee(const fee_parameters_type &k) const;
};
struct nft_metadata_update_operation : public base_operation
{
struct fee_parameters_type
{
uint64_t fee = GRAPHENE_BLOCKCHAIN_PRECISION;
uint32_t price_per_kbyte = GRAPHENE_BLOCKCHAIN_PRECISION;
};
asset fee;
account_id_type owner;
nft_metadata_id_type nft_metadata_id;
optional<std::string> name;
optional<std::string> symbol;
optional<std::string> base_uri;
optional<account_id_type> revenue_partner;
optional<uint16_t> revenue_split;
optional<bool> is_transferable;
optional<bool> is_sellable;
// Accounts Role
optional<account_role_id_type> account_role;
extensions_type extensions;
account_id_type fee_payer()const { return owner; }
void validate() const;
share_type calculate_fee(const fee_parameters_type &k) const;
};
struct nft_mint_operation : public base_operation
{
struct fee_parameters_type
{
uint64_t fee = GRAPHENE_BLOCKCHAIN_PRECISION;
uint32_t price_per_kbyte = GRAPHENE_BLOCKCHAIN_PRECISION;
};
asset fee;
account_id_type payer;
nft_metadata_id_type nft_metadata_id;
account_id_type owner;
account_id_type approved;
vector<account_id_type> approved_operators;
std::string token_uri;
extensions_type extensions;
account_id_type fee_payer()const { return payer; }
void validate() const;
share_type calculate_fee(const fee_parameters_type &k) const;
};
struct nft_safe_transfer_from_operation : public base_operation
{
struct fee_parameters_type
{
uint64_t fee = GRAPHENE_BLOCKCHAIN_PRECISION;
uint32_t price_per_kbyte = GRAPHENE_BLOCKCHAIN_PRECISION;
};
asset fee;
account_id_type operator_;
account_id_type from;
account_id_type to;
nft_id_type token_id;
string data;
extensions_type extensions;
account_id_type fee_payer()const { return operator_; }
share_type calculate_fee(const fee_parameters_type &k) const;
};
struct nft_approve_operation : public base_operation
{
struct fee_parameters_type { uint64_t fee = GRAPHENE_BLOCKCHAIN_PRECISION; };
asset fee;
account_id_type operator_;
account_id_type approved;
nft_id_type token_id;
extensions_type extensions;
account_id_type fee_payer()const { return operator_; }
share_type calculate_fee(const fee_parameters_type &k) const;
};
struct nft_set_approval_for_all_operation : public base_operation
{
struct fee_parameters_type { uint64_t fee = GRAPHENE_BLOCKCHAIN_PRECISION; };
asset fee;
account_id_type owner;
account_id_type operator_;
bool approved;
extensions_type extensions;
account_id_type fee_payer()const { return owner; }
share_type calculate_fee(const fee_parameters_type &k) const;
};
} } // graphene::chain
FC_REFLECT( graphene::chain::nft_metadata_create_operation::fee_parameters_type, (fee) (price_per_kbyte) )
FC_REFLECT( graphene::chain::nft_metadata_update_operation::fee_parameters_type, (fee) )
FC_REFLECT( graphene::chain::nft_mint_operation::fee_parameters_type, (fee) (price_per_kbyte) )
FC_REFLECT( graphene::chain::nft_safe_transfer_from_operation::fee_parameters_type, (fee) (price_per_kbyte) )
FC_REFLECT( graphene::chain::nft_approve_operation::fee_parameters_type, (fee) )
FC_REFLECT( graphene::chain::nft_set_approval_for_all_operation::fee_parameters_type, (fee) )
FC_REFLECT( graphene::chain::nft_metadata_create_operation, (fee) (owner) (name) (symbol) (base_uri) (revenue_partner) (revenue_split) (is_transferable) (is_sellable) (account_role) (extensions) )
FC_REFLECT( graphene::chain::nft_metadata_update_operation, (fee) (owner) (nft_metadata_id) (name) (symbol) (base_uri) (revenue_partner) (revenue_split) (is_transferable) (is_sellable) (account_role) (extensions) )
FC_REFLECT( graphene::chain::nft_mint_operation, (fee) (payer) (nft_metadata_id) (owner) (approved) (approved_operators) (token_uri) (extensions) )
FC_REFLECT( graphene::chain::nft_safe_transfer_from_operation, (fee) (operator_) (from) (to) (token_id) (data) (extensions) )
FC_REFLECT( graphene::chain::nft_approve_operation, (fee) (operator_) (approved) (token_id) (extensions) )
FC_REFLECT( graphene::chain::nft_set_approval_for_all_operation, (fee) (owner) (operator_) (approved) (extensions) )

View file

@ -1,143 +0,0 @@
#pragma once
#include <graphene/chain/protocol/base.hpp>
#include <graphene/chain/protocol/memo.hpp>
namespace graphene
{
namespace chain
{
/*
* @class offer_operation
* @brief To place an offer to buy or sell an item, a user broadcasts a
* proposed transaction
* @ingroup operations
* operation
*/
struct offer_operation : public base_operation
{
struct fee_parameters_type
{
uint64_t fee = GRAPHENE_BLOCKCHAIN_PRECISION;
uint32_t price_per_kbyte = GRAPHENE_BLOCKCHAIN_PRECISION; /// only required for large memos.
};
asset fee;
set<nft_id_type> item_ids;
// /**
// * minimum_price.asset_id == maximum_price.asset_id.
// * to set fixed price without auction minimum_price == maximum_price
// * If buying_item is true, and minimum_price != maximum_price, the user is
// proposing a “reverse auction”
// * where bidders can offer to sell the item for progressively lower prices.
// * In this case, minimum_price functions as the sell-it-now price for the
// reverse auction
// */
account_id_type issuer;
/// minimum_price is minimum bid price. 0 if no minimum_price required
asset minimum_price;
/// buy_it_now price. 0 if no maximum price
asset maximum_price;
/// true means user wants to buy item, false mean user is selling item
bool buying_item;
/// not transaction expiration date
fc::time_point_sec offer_expiration_date;
/// User provided data encrypted to the memo key of the "to" account
optional<memo_data> memo;
extensions_type extensions;
account_id_type fee_payer() const { return issuer; }
void validate() const;
share_type calculate_fee(const fee_parameters_type &k) const;
};
struct bid_operation : public base_operation
{
struct fee_parameters_type
{
uint64_t fee = GRAPHENE_BLOCKCHAIN_PRECISION;
};
asset fee;
account_id_type bidder;
asset bid_price;
offer_id_type offer_id;
extensions_type extensions;
account_id_type fee_payer() const { return bidder; }
void validate() const;
share_type calculate_fee(const fee_parameters_type &k) const;
};
struct cancel_offer_operation : public base_operation
{
struct fee_parameters_type
{
uint64_t fee = GRAPHENE_BLOCKCHAIN_PRECISION;
};
asset fee;
account_id_type issuer;
offer_id_type offer_id;
extensions_type extensions;
account_id_type fee_payer() const { return issuer; }
void validate() const;
share_type calculate_fee(const fee_parameters_type &k) const;
};
enum class result_type
{
Expired = 0,
ExpiredNoBid = 1,
Cancelled = 2
};
struct finalize_offer_operation : public base_operation
{
struct fee_parameters_type
{
uint64_t fee = 0;
};
asset fee;
account_id_type fee_paying_account;
offer_id_type offer_id;
result_type result;
extensions_type extensions;
account_id_type fee_payer() const { return fee_paying_account; }
void validate() const;
share_type calculate_fee(const fee_parameters_type &k) const;
};
} // namespace chain
} // namespace graphene
FC_REFLECT(graphene::chain::offer_operation::fee_parameters_type,
(fee)(price_per_kbyte));
FC_REFLECT(graphene::chain::offer_operation,
(fee)(item_ids)(issuer)(minimum_price)(maximum_price)(buying_item)(offer_expiration_date)(memo)(extensions));
FC_REFLECT(graphene::chain::bid_operation::fee_parameters_type,
(fee));
FC_REFLECT(graphene::chain::bid_operation,
(fee)(bidder)(bid_price)(offer_id)(extensions));
FC_REFLECT(graphene::chain::cancel_offer_operation::fee_parameters_type,
(fee));
FC_REFLECT(graphene::chain::cancel_offer_operation,
(fee)(issuer)(offer_id)(extensions));
FC_REFLECT_ENUM(graphene::chain::result_type, (Expired)(ExpiredNoBid)(Cancelled));
FC_REFLECT(graphene::chain::finalize_offer_operation::fee_parameters_type,
(fee));
FC_REFLECT(graphene::chain::finalize_offer_operation,
(fee)(fee_paying_account)(offer_id)(result)(extensions));

View file

@ -1,80 +0,0 @@
#pragma once
#include <graphene/chain/protocol/base.hpp>
#include <graphene/chain/sidechain_defs.hpp>
namespace graphene { namespace chain {
struct sidechain_address_add_operation : public base_operation
{
struct fee_parameters_type { uint64_t fee = 0; };
asset fee;
account_id_type payer;
account_id_type sidechain_address_account;
sidechain_type sidechain;
string deposit_public_key;
string deposit_address;
string deposit_address_data;
string withdraw_public_key;
string withdraw_address;
account_id_type fee_payer()const { return payer; }
share_type calculate_fee(const fee_parameters_type& k)const { return 0; }
};
struct sidechain_address_update_operation : public base_operation
{
struct fee_parameters_type { uint64_t fee = 0; };
asset fee;
account_id_type payer;
sidechain_address_id_type sidechain_address_id;
account_id_type sidechain_address_account;
sidechain_type sidechain;
optional<string> deposit_public_key;
optional<string> deposit_address;
optional<string> deposit_address_data;
optional<string> withdraw_public_key;
optional<string> withdraw_address;
account_id_type fee_payer()const { return payer; }
share_type calculate_fee(const fee_parameters_type& k)const { return 0; }
};
struct sidechain_address_delete_operation : public base_operation
{
struct fee_parameters_type { uint64_t fee = 0; };
asset fee;
account_id_type payer;
sidechain_address_id_type sidechain_address_id;
account_id_type sidechain_address_account;
sidechain_type sidechain;
account_id_type fee_payer()const { return payer; }
share_type calculate_fee(const fee_parameters_type& k)const { return 0; }
};
} } // namespace graphene::chain
FC_REFLECT(graphene::chain::sidechain_address_add_operation::fee_parameters_type, (fee) )
FC_REFLECT(graphene::chain::sidechain_address_add_operation, (fee)(payer)
(sidechain_address_account)(sidechain)
(deposit_public_key)(deposit_address)(deposit_address_data)
(withdraw_public_key)(withdraw_address) )
FC_REFLECT(graphene::chain::sidechain_address_update_operation::fee_parameters_type, (fee) )
FC_REFLECT(graphene::chain::sidechain_address_update_operation, (fee)(payer)
(sidechain_address_id)
(sidechain_address_account)(sidechain)
(deposit_public_key)(deposit_address)(deposit_address_data)
(withdraw_public_key)(withdraw_address) )
FC_REFLECT(graphene::chain::sidechain_address_delete_operation::fee_parameters_type, (fee) )
FC_REFLECT(graphene::chain::sidechain_address_delete_operation, (fee)(payer)
(sidechain_address_id)
(sidechain_address_account)(sidechain) )

View file

@ -1,88 +0,0 @@
#pragma once
#include <graphene/chain/protocol/base.hpp>
#include <graphene/chain/protocol/types.hpp>
#include <graphene/chain/sidechain_defs.hpp>
#include <graphene/chain/son_info.hpp>
namespace graphene { namespace chain {
struct sidechain_transaction_create_operation : public base_operation
{
struct fee_parameters_type { uint64_t fee = 0; };
asset fee;
account_id_type payer;
sidechain_type sidechain;
object_id_type object_id;
std::string transaction;
std::vector<son_info> signers;
account_id_type fee_payer()const { return payer; }
share_type calculate_fee(const fee_parameters_type& k)const { return 0; }
};
struct sidechain_transaction_sign_operation : public base_operation
{
struct fee_parameters_type { uint64_t fee = 0; };
asset fee;
son_id_type signer;
account_id_type payer;
sidechain_transaction_id_type sidechain_transaction_id;
std::string signature;
account_id_type fee_payer()const { return payer; }
share_type calculate_fee( const fee_parameters_type& k )const { return 0; }
};
struct sidechain_transaction_send_operation : public base_operation
{
struct fee_parameters_type { uint64_t fee = 0; };
asset fee;
account_id_type payer;
sidechain_transaction_id_type sidechain_transaction_id;
std::string sidechain_transaction;
account_id_type fee_payer()const { return payer; }
share_type calculate_fee( const fee_parameters_type& k )const { return 0; }
};
struct sidechain_transaction_settle_operation : public base_operation
{
struct fee_parameters_type { uint64_t fee = 0; };
asset fee;
account_id_type payer;
sidechain_transaction_id_type sidechain_transaction_id;
account_id_type fee_payer()const { return payer; }
share_type calculate_fee( const fee_parameters_type& k )const { return 0; }
};
} } // graphene::chain
FC_REFLECT( graphene::chain::sidechain_transaction_create_operation::fee_parameters_type, (fee) )
FC_REFLECT( graphene::chain::sidechain_transaction_create_operation, (fee)(payer)
(sidechain)
(object_id)
(transaction)
(signers) )
FC_REFLECT( graphene::chain::sidechain_transaction_sign_operation::fee_parameters_type, (fee) )
FC_REFLECT( graphene::chain::sidechain_transaction_sign_operation, (fee)(signer)(payer)
(sidechain_transaction_id)
(signature) )
FC_REFLECT( graphene::chain::sidechain_transaction_send_operation::fee_parameters_type, (fee) )
FC_REFLECT( graphene::chain::sidechain_transaction_send_operation, (fee)(payer)
(sidechain_transaction_id)
(sidechain_transaction) )
FC_REFLECT( graphene::chain::sidechain_transaction_settle_operation::fee_parameters_type, (fee) )
FC_REFLECT( graphene::chain::sidechain_transaction_settle_operation, (fee)(payer)
(sidechain_transaction_id) )

View file

@ -1,119 +0,0 @@
#pragma once
#include <graphene/chain/protocol/base.hpp>
#include <graphene/chain/sidechain_defs.hpp>
namespace graphene { namespace chain {
struct son_create_operation : public base_operation
{
struct fee_parameters_type { uint64_t fee = 0; };
asset fee;
account_id_type owner_account;
std::string url;
vesting_balance_id_type deposit;
public_key_type signing_key;
flat_map<sidechain_type, string> sidechain_public_keys;
vesting_balance_id_type pay_vb;
account_id_type fee_payer()const { return owner_account; }
share_type calculate_fee(const fee_parameters_type& k)const { return 0; }
};
struct son_update_operation : public base_operation
{
struct fee_parameters_type { uint64_t fee = 0; };
asset fee;
son_id_type son_id;
account_id_type owner_account;
optional<std::string> new_url;
optional<vesting_balance_id_type> new_deposit;
optional<public_key_type> new_signing_key;
optional<flat_map<sidechain_type, string>> new_sidechain_public_keys;
optional<vesting_balance_id_type> new_pay_vb;
account_id_type fee_payer()const { return owner_account; }
share_type calculate_fee(const fee_parameters_type& k)const { return 0; }
};
struct son_deregister_operation : public base_operation
{
struct fee_parameters_type { uint64_t fee = 0; };
asset fee;
son_id_type son_id;
account_id_type payer;
account_id_type fee_payer()const { return payer; }
share_type calculate_fee(const fee_parameters_type& k)const { return 0; }
};
struct son_heartbeat_operation : public base_operation
{
struct fee_parameters_type { uint64_t fee = 0; };
asset fee;
son_id_type son_id;
account_id_type owner_account;
time_point_sec ts;
account_id_type fee_payer()const { return owner_account; }
share_type calculate_fee(const fee_parameters_type& k)const { return 0; }
};
struct son_report_down_operation : public base_operation
{
struct fee_parameters_type { uint64_t fee = 0; };
asset fee;
son_id_type son_id;
account_id_type payer;
time_point_sec down_ts;
account_id_type fee_payer()const { return payer; }
share_type calculate_fee(const fee_parameters_type& k)const { return 0; }
};
enum class son_maintenance_request_type
{
request_maintenance,
cancel_request_maintenance
};
struct son_maintenance_operation : public base_operation
{
struct fee_parameters_type { uint64_t fee = 0; };
asset fee;
son_id_type son_id;
account_id_type owner_account;
son_maintenance_request_type request_type = son_maintenance_request_type::request_maintenance;
account_id_type fee_payer()const { return owner_account; }
share_type calculate_fee(const fee_parameters_type& k)const { return 0; }
};
} } // namespace graphene::chain
FC_REFLECT(graphene::chain::son_create_operation::fee_parameters_type, (fee) )
FC_REFLECT(graphene::chain::son_create_operation, (fee)(owner_account)(url)(deposit)(signing_key)(sidechain_public_keys)
(pay_vb) )
FC_REFLECT(graphene::chain::son_update_operation::fee_parameters_type, (fee) )
FC_REFLECT(graphene::chain::son_update_operation, (fee)(son_id)(owner_account)(new_url)(new_deposit)
(new_signing_key)(new_sidechain_public_keys)(new_pay_vb) )
FC_REFLECT(graphene::chain::son_deregister_operation::fee_parameters_type, (fee) )
FC_REFLECT(graphene::chain::son_deregister_operation, (fee)(son_id)(payer) )
FC_REFLECT(graphene::chain::son_heartbeat_operation::fee_parameters_type, (fee) )
FC_REFLECT(graphene::chain::son_heartbeat_operation, (fee)(son_id)(owner_account)(ts) )
FC_REFLECT(graphene::chain::son_report_down_operation::fee_parameters_type, (fee) )
FC_REFLECT(graphene::chain::son_report_down_operation, (fee)(son_id)(payer)(down_ts) )
FC_REFLECT_ENUM( graphene::chain::son_maintenance_request_type, (request_maintenance)(cancel_request_maintenance) )
FC_REFLECT(graphene::chain::son_maintenance_operation::fee_parameters_type, (fee) )
FC_REFLECT(graphene::chain::son_maintenance_operation, (fee)(son_id)(owner_account)(request_type) )

View file

@ -1,40 +0,0 @@
#pragma once
#include <graphene/chain/protocol/base.hpp>
#include <graphene/chain/son_info.hpp>
namespace graphene { namespace chain {
struct son_wallet_recreate_operation : public base_operation
{
struct fee_parameters_type { uint64_t fee = 0; };
asset fee;
account_id_type payer;
vector<son_info> sons;
account_id_type fee_payer()const { return payer; }
share_type calculate_fee(const fee_parameters_type& k)const { return 0; }
};
struct son_wallet_update_operation : public base_operation
{
struct fee_parameters_type { uint64_t fee = 0; };
asset fee;
account_id_type payer;
son_wallet_id_type son_wallet_id;
sidechain_type sidechain;
string address;
account_id_type fee_payer()const { return payer; }
share_type calculate_fee(const fee_parameters_type& k)const { return 0; }
};
} } // namespace graphene::chain
FC_REFLECT(graphene::chain::son_wallet_recreate_operation::fee_parameters_type, (fee) )
FC_REFLECT(graphene::chain::son_wallet_recreate_operation, (fee)(payer)(sons) )
FC_REFLECT(graphene::chain::son_wallet_update_operation::fee_parameters_type, (fee) )
FC_REFLECT(graphene::chain::son_wallet_update_operation, (fee)(payer)(son_wallet_id)(sidechain)(address) )

View file

@ -1,57 +0,0 @@
#pragma once
#include <graphene/chain/protocol/base.hpp>
#include <graphene/chain/sidechain_defs.hpp>
#include <fc/safe.hpp>
namespace graphene { namespace chain {
struct son_wallet_deposit_create_operation : public base_operation
{
struct fee_parameters_type { uint64_t fee = 0; };
asset fee;
account_id_type payer;
son_id_type son_id;
fc::time_point_sec timestamp;
uint32_t block_num;
sidechain_type sidechain;
std::string sidechain_uid;
std::string sidechain_transaction_id;
std::string sidechain_from;
std::string sidechain_to;
std::string sidechain_currency;
fc::safe<int64_t> sidechain_amount;
chain::account_id_type peerplays_from;
chain::account_id_type peerplays_to;
chain::asset peerplays_asset;
account_id_type fee_payer()const { return payer; }
share_type calculate_fee(const fee_parameters_type& k)const { return 0; }
};
struct son_wallet_deposit_process_operation : public base_operation
{
struct fee_parameters_type { uint64_t fee = 0; };
asset fee;
account_id_type payer;
son_wallet_deposit_id_type son_wallet_deposit_id;
account_id_type fee_payer()const { return payer; }
share_type calculate_fee(const fee_parameters_type& k)const { return 0; }
};
} } // namespace graphene::chain
FC_REFLECT(graphene::chain::son_wallet_deposit_create_operation::fee_parameters_type, (fee) )
FC_REFLECT(graphene::chain::son_wallet_deposit_create_operation, (fee)(payer)
(son_id) (timestamp) (block_num) (sidechain)
(sidechain_uid) (sidechain_transaction_id) (sidechain_from) (sidechain_to) (sidechain_currency) (sidechain_amount)
(peerplays_from) (peerplays_to) (peerplays_asset) )
FC_REFLECT(graphene::chain::son_wallet_deposit_process_operation::fee_parameters_type, (fee) )
FC_REFLECT(graphene::chain::son_wallet_deposit_process_operation, (fee)(payer)
(son_wallet_deposit_id) )

View file

@ -1,56 +0,0 @@
#pragma once
#include <graphene/chain/protocol/base.hpp>
#include <graphene/chain/sidechain_defs.hpp>
#include <fc/safe.hpp>
namespace graphene { namespace chain {
struct son_wallet_withdraw_create_operation : public base_operation
{
struct fee_parameters_type { uint64_t fee = 0; };
asset fee;
account_id_type payer;
son_id_type son_id;
fc::time_point_sec timestamp;
uint32_t block_num;
sidechain_type sidechain;
std::string peerplays_uid;
std::string peerplays_transaction_id;
chain::account_id_type peerplays_from;
chain::asset peerplays_asset;
sidechain_type withdraw_sidechain;
std::string withdraw_address;
std::string withdraw_currency;
safe<int64_t> withdraw_amount;
account_id_type fee_payer()const { return payer; }
share_type calculate_fee(const fee_parameters_type& k)const { return 0; }
};
struct son_wallet_withdraw_process_operation : public base_operation
{
struct fee_parameters_type { uint64_t fee = 0; };
asset fee;
account_id_type payer;
son_wallet_withdraw_id_type son_wallet_withdraw_id;
account_id_type fee_payer()const { return payer; }
share_type calculate_fee(const fee_parameters_type& k)const { return 0; }
};
} } // namespace graphene::chain
FC_REFLECT(graphene::chain::son_wallet_withdraw_create_operation::fee_parameters_type, (fee) )
FC_REFLECT(graphene::chain::son_wallet_withdraw_create_operation, (fee)(payer)
(son_id) (timestamp) (block_num) (sidechain)
(peerplays_uid) (peerplays_transaction_id) (peerplays_from) (peerplays_asset)
(withdraw_sidechain) (withdraw_address) (withdraw_currency) (withdraw_amount) )
FC_REFLECT(graphene::chain::son_wallet_withdraw_process_operation::fee_parameters_type, (fee) )
FC_REFLECT(graphene::chain::son_wallet_withdraw_process_operation, (fee)(payer)
(son_wallet_withdraw_id) )

View file

@ -5,22 +5,13 @@ set_source_files_properties( "${CMAKE_CURRENT_BINARY_DIR}/include/graphene/chain
add_dependencies( build_hardfork_hpp cat-parts )
file(GLOB HEADERS "include/graphene/chain/*.hpp")
file(GLOB HEADERS "include/graphene/chain/*.hpp" "${CMAKE_CURRENT_BINARY_DIR}/include/graphene/chain/hardfork.hpp")
file(GLOB CPP_FILES "*.cpp")
if( GRAPHENE_DISABLE_UNITY_BUILD )
set( GRAPHENE_DB_FILES
db_balance.cpp
db_bet.cpp
db_block.cpp
db_debug.cpp
db_getter.cpp
db_init.cpp
db_maint.cpp
db_management.cpp
db_market.cpp
db_update.cpp
db_witness_schedule.cpp
)
list(FILTER CPP_FILES EXCLUDE REGEX "[/]database[.]cpp$")
#message ("--- ${CPP_FILES}")
message( STATUS "Graphene database unity build disabled" )
else( GRAPHENE_DISABLE_UNITY_BUILD )
set( GRAPHENE_DB_FILES
@ -30,79 +21,7 @@ endif( GRAPHENE_DISABLE_UNITY_BUILD )
## SORT .cpp by most likely to change / break compile
add_library( graphene_chain
# As database takes the longest to compile, start it first
${GRAPHENE_DB_FILES}
fork_database.cpp
genesis_state.cpp
get_config.cpp
exceptions.cpp
evaluator.cpp
balance_evaluator.cpp
account_evaluator.cpp
assert_evaluator.cpp
witness_evaluator.cpp
committee_member_evaluator.cpp
asset_evaluator.cpp
lottery_evaluator.cpp
transfer_evaluator.cpp
proposal_evaluator.cpp
market_evaluator.cpp
vesting_balance_evaluator.cpp
tournament_evaluator.cpp
tournament_object.cpp
match_object.cpp
game_object.cpp
withdraw_permission_evaluator.cpp
worker_evaluator.cpp
confidential_evaluator.cpp
special_authority_evaluation.cpp
buyback.cpp
account_object.cpp
asset_object.cpp
fba_object.cpp
proposal_object.cpp
vesting_balance_object.cpp
small_objects.cpp
block_database.cpp
is_authorized_asset.cpp
sport_evaluator.cpp
event_group_evaluator.cpp
event_group_object.cpp
event_evaluator.cpp
event_object.cpp
betting_market_evaluator.cpp
betting_market_object.cpp
betting_market_group_object.cpp
custom_permission_evaluator.cpp
custom_account_authority_evaluator.cpp
affiliate_payout.cpp
offer_object.cpp
offer_evaluator.cpp
nft_evaluator.cpp
### protocol/nft.cpp
### protocol/account_role.cpp
account_role_evaluator.cpp
son_evaluator.cpp
son_object.cpp
son_wallet_evaluator.cpp
son_wallet_deposit_evaluator.cpp
son_wallet_withdraw_evaluator.cpp
sidechain_address_evaluator.cpp
sidechain_transaction_evaluator.cpp
${CPP_FILES}
${HEADERS}
"${CMAKE_CURRENT_BINARY_DIR}/include/graphene/chain/hardfork.hpp"
)

View file

@ -22,10 +22,6 @@
* THE SOFTWARE.
*/
#include <boost/multiprecision/integer.hpp>
#include <fc/uint128.hpp>
#include <graphene/chain/database.hpp>
#include <graphene/chain/fba_accumulator_id.hpp>
#include <graphene/chain/hardfork.hpp>
@ -42,6 +38,8 @@
#include <graphene/chain/market_object.hpp>
#include <graphene/chain/special_authority_object.hpp>
#include <graphene/chain/son_object.hpp>
#include <graphene/chain/son_wallet_object.hpp>
#include <graphene/chain/account_role_object.hpp>
#include <graphene/chain/vesting_balance_object.hpp>
#include <graphene/chain/vote_count.hpp>
#include <graphene/chain/witness_object.hpp>
@ -55,6 +53,8 @@
#include <numeric>
#include <boost/multiprecision/integer.hpp>
#define USE_VESTING_OBJECT_BY_ASSET_BALANCE_INDEX // vesting_balance_object by_asset_balance index needed
namespace graphene { namespace chain {

View file

@ -28,6 +28,7 @@
#include <graphene/protocol/operations.hpp>
#include <graphene/protocol/transaction.hpp>
#include <graphene/chain/database.hpp>
#include <graphene/chain/withdraw_permission_object.hpp>
#include <graphene/chain/worker_object.hpp>
#include <graphene/chain/confidential_object.hpp>
@ -47,7 +48,9 @@
#include <graphene/chain/offer_object.hpp>
#include <graphene/chain/custom_permission_object.hpp>
#include <graphene/chain/nft_object.hpp>
#include <graphene/chain/account_role_object.hpp>
#include <graphene/chain/sidechain_address_object.hpp>
#include <graphene/chain/son_object.hpp>
using namespace fc;
using namespace graphene::chain;
@ -597,6 +600,8 @@ void get_relevant_accounts( const object* obj, flat_set<account_id_type>& accoun
assert( aobj != nullptr );
accounts.insert( aobj->son_account );
break;
} case son_proposal_object_type:{
break;
} case son_wallet_object_type:{
break;
} case son_wallet_deposit_object_type:{
@ -641,7 +646,7 @@ void get_relevant_accounts( const object* obj, flat_set<account_id_type>& accoun
const auto& aobj = dynamic_cast<const transaction_history_object*>(obj);
FC_ASSERT( aobj != nullptr );
transaction_get_impacted_accounts( aobj->trx, accounts,
ignore_custom_operation_required_auths);
ignore_custom_operation_required_auths );
break;
} case impl_blinded_balance_object_type:{
const auto& aobj = dynamic_cast<const blinded_balance_object*>(obj);
@ -698,6 +703,10 @@ void get_relevant_accounts( const object* obj, flat_set<account_id_type>& accoun
if (aobj->bidder.valid())
accounts.insert(*aobj->bidder);
break;
} case impl_son_statistics_object_type: {
break;
} case impl_son_schedule_object_type: {
break;
}
}
}

View file

@ -30,12 +30,14 @@
#include <graphene/chain/hardfork.hpp>
#include <graphene/chain/market_object.hpp>
#include <graphene/chain/proposal_object.hpp>
#include <graphene/chain/son_proposal_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/tournament_object.hpp>
#include <graphene/chain/game_object.hpp>
#include <graphene/chain/betting_market_object.hpp>
#include <graphene/chain/offer_object.hpp>
#include <graphene/protocol/fee_schedule.hpp>

View file

@ -732,3 +732,4 @@ FC_REFLECT_DERIVED( graphene::chain::betting_market_object, (graphene::db::objec
FC_REFLECT_DERIVED( graphene::chain::bet_object, (graphene::db::object), (bettor_id)(betting_market_id)(amount_to_bet)(backer_multiplier)(back_or_lay)(end_of_delay) )
FC_REFLECT_DERIVED( graphene::chain::betting_market_position_object, (graphene::db::object), (bettor_id)(betting_market_id)(pay_if_payout_condition)(pay_if_not_payout_condition)(pay_if_canceled)(pay_if_not_canceled)(fees_collected) )

View file

@ -27,8 +27,6 @@
#include <fc/filesystem.hpp>
#include <fc/filesystem.hpp>
namespace graphene { namespace chain {
struct index_entry;
using namespace graphene::protocol;

View file

@ -23,8 +23,6 @@
*/
#pragma once
#include <graphene/protocol/fee_schedule.hpp>
#include <graphene/chain/global_property_object.hpp>
#include <graphene/chain/node_property_object.hpp>
#include <graphene/chain/account_object.hpp>
@ -34,19 +32,19 @@
#include <graphene/chain/genesis_state.hpp>
#include <graphene/chain/evaluator.hpp>
#include <graphene/chain/betting_market_object.hpp>
#include <graphene/chain/account_role_object.hpp>
#include <graphene/db/object_database.hpp>
#include <graphene/db/object.hpp>
#include <graphene/db/simple_index.hpp>
#include <graphene/protocol/fee_schedule.hpp>
#include <graphene/protocol/protocol.hpp>
#include <graphene/protocol/sidechain_defs.hpp>
#include <fc/signals.hpp>
#include <fc/crypto/hash_ctr_rng.hpp>
#include <graphene/protocol/protocol.hpp>
#include <graphene/protocol/sidechain_defs.hpp>
#include <fc/log/logger.hpp>
#include <map>
@ -64,6 +62,7 @@ namespace graphene { namespace chain {
class force_settlement_object;
class limit_order_object;
class call_order_object;
class account_role_object;
struct budget_record;

View file

@ -164,4 +164,6 @@ typedef generic_index<event_object, event_object_multi_index_type> event_object_
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))
FC_REFLECT_DERIVED(graphene::chain::event_object, (graphene::db::object),
(name)(season)(start_time)(event_group_id)(at_least_one_betting_market_group_settled)(scores))

View file

@ -173,6 +173,6 @@ FC_REFLECT_ENUM(graphene::chain::game_state,
(game_complete))
//FC_REFLECT_TYPENAME(graphene::chain::game_object) // manually serialized
FC_REFLECT(graphene::chain::game_object, (players))
FC_REFLECT_DERIVED(graphene::chain::game_object, (graphene::db::object), (players))

View file

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

View file

@ -26,10 +26,12 @@
#include <graphene/protocol/chain_parameters.hpp>
#include <graphene/protocol/son_info.hpp>
#include <graphene/chain/types.hpp>
#include <graphene/db/object.hpp>
#include <graphene/chain/hardfork.hpp>
#include <graphene/db/object.hpp>
namespace graphene { namespace chain {
/**

View file

@ -172,5 +172,5 @@ FC_REFLECT_ENUM(graphene::chain::match_state,
(match_complete))
//FC_REFLECT_TYPENAME(graphene::chain::match_object) // manually serialized
FC_REFLECT(graphene::chain::match_object, (players))
FC_REFLECT_DERIVED(graphene::chain::match_object, (graphene::db::object), (players))

View file

@ -3,7 +3,6 @@
#include <graphene/protocol/operations.hpp>
namespace graphene
{
namespace chain

View file

@ -100,7 +100,7 @@ class account_transaction_history_object : public abstract_object<account_trans
uint32_t sequence = 0; /// the operation position within the given account
account_transaction_history_id_type next;
};
struct by_seq;
struct by_op;
struct by_opid;

View file

@ -1,599 +0,0 @@
/*
* Copyright (c) 2015 Cryptonomex, Inc., and contributors.
*
* The MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#pragma once
#include <fc/container/flat_fwd.hpp>
#include <fc/io/varint.hpp>
#include <fc/io/enum_type.hpp>
#include <fc/crypto/sha224.hpp>
#include <fc/crypto/elliptic.hpp>
#include <fc/crypto/ripemd160.hpp>
#include <fc/reflect/reflect.hpp>
#include <fc/reflect/variant.hpp>
#include <fc/optional.hpp>
#include <fc/safe.hpp>
#include <fc/container/flat.hpp>
#include <fc/string.hpp>
#include <fc/io/datastream.hpp>
#include <fc/io/raw_fwd.hpp>
#include <fc/uint128.hpp>
#include <fc/static_variant.hpp>
#include <memory>
#include <vector>
#include <deque>
#include <cstdint>
#include <graphene/db/object_id.hpp>
#include <graphene/chain/protocol/config.hpp>
#define GRAPHENE_EXTERNAL_SERIALIZATION(ext, type) \
namespace fc { \
ext template void from_variant( const variant& v, type& vo, uint32_t max_depth ); \
ext template void to_variant( const type& v, variant& vo, uint32_t max_depth ); \
namespace raw { \
ext template void pack< datastream<size_t>, type >( datastream<size_t>& s, const type& tx, uint32_t _max_depth=FC_PACK_MAX_DEPTH ); \
ext template void pack< datastream<char*>, type >( datastream<char*>& s, const type& tx, uint32_t _max_depth=FC_PACK_MAX_DEPTH ); \
ext template void unpack< datastream<const char*>, type >( datastream<const char*>& s, type& tx, uint32_t _max_depth=FC_PACK_MAX_DEPTH ); \
} } // fc::raw
#define FC_REFLECT_DERIVED_NO_TYPENAME( TYPE, INHERITS, MEMBERS ) \
namespace fc { \
template<> struct reflector<TYPE> {\
typedef TYPE type; \
typedef fc::true_type is_defined; \
typedef fc::false_type is_enum; \
enum member_count_enum { \
local_member_count = 0 BOOST_PP_SEQ_FOR_EACH( FC_REFLECT_MEMBER_COUNT, +, MEMBERS ),\
total_member_count = local_member_count BOOST_PP_SEQ_FOR_EACH( FC_REFLECT_BASE_MEMBER_COUNT, +, INHERITS )\
}; \
FC_REFLECT_DERIVED_IMPL_INLINE( TYPE, INHERITS, MEMBERS ) \
}; \
} // fc
namespace graphene { namespace chain {
using namespace graphene::db;
using std::map;
using std::vector;
using std::unordered_map;
using std::string;
using std::deque;
using std::shared_ptr;
using std::weak_ptr;
using std::unique_ptr;
using std::set;
using std::pair;
using std::enable_shared_from_this;
using std::tie;
using std::make_pair;
using fc::smart_ref;
using fc::variant_object;
using fc::variant;
using fc::enum_type;
using fc::optional;
using fc::unsigned_int;
using fc::signed_int;
using fc::time_point_sec;
using fc::time_point;
using fc::safe;
using fc::flat_map;
using fc::flat_set;
using fc::static_variant;
using fc::ecc::range_proof_type;
using fc::ecc::range_proof_info;
using fc::ecc::commitment_type;
struct void_t{};
typedef fc::ecc::private_key private_key_type;
typedef fc::sha256 chain_id_type;
enum asset_issuer_permission_flags
{
charge_market_fee = 0x01, /**< an issuer-specified percentage of all market trades in this asset is paid to the issuer */
white_list = 0x02, /**< accounts must be whitelisted in order to hold this asset */
override_authority = 0x04, /**< issuer may transfer asset back to himself */
transfer_restricted = 0x08, /**< require the issuer to be one party to every transfer */
disable_force_settle = 0x10, /**< disable force settling */
global_settle = 0x20, /**< allow the bitasset issuer to force a global settling -- this may be set in permissions, but not flags */
disable_confidential = 0x40, /**< allow the asset to be used with confidential transactions */
witness_fed_asset = 0x80, /**< allow the asset to be fed by witnesses */
committee_fed_asset = 0x100 /**< allow the asset to be fed by the committee */
};
const static uint32_t ASSET_ISSUER_PERMISSION_MASK = charge_market_fee|white_list|override_authority|transfer_restricted|disable_force_settle|global_settle|disable_confidential
|witness_fed_asset|committee_fed_asset;
const static uint32_t UIA_ASSET_ISSUER_PERMISSION_MASK = charge_market_fee|white_list|override_authority|transfer_restricted|disable_confidential;
enum reserved_spaces
{
relative_protocol_ids = 0,
protocol_ids = 1,
implementation_ids = 2
};
inline bool is_relative( object_id_type o ){ return o.space() == 0; }
/**
* List all object types from all namespaces here so they can
* be easily reflected and displayed in debug output. If a 3rd party
* wants to extend the core code then they will have to change the
* packed_object::type field from enum_type to uint16 to avoid
* warnings when converting packed_objects to/from json.
*/
enum object_type
{
null_object_type,
base_object_type,
account_object_type,
asset_object_type,
force_settlement_object_type,
committee_member_object_type,
witness_object_type,
limit_order_object_type,
call_order_object_type,
custom_object_type,
proposal_object_type,
operation_history_object_type,
withdraw_permission_object_type,
vesting_balance_object_type,
worker_object_type,
balance_object_type,
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,
nft_metadata_type,
nft_object_type,
account_role_type,
son_object_type,
son_proposal_object_type,
son_wallet_object_type,
son_wallet_deposit_object_type,
son_wallet_withdraw_object_type,
sidechain_address_object_type,
sidechain_transaction_object_type,
OBJECT_TYPE_COUNT ///< Sentry value which contains the number of different object types
};
enum impl_object_type
{
impl_global_property_object_type,
impl_dynamic_global_property_object_type,
impl_reserved0_object_type, // formerly index_meta_object_type, TODO: delete me
impl_asset_dynamic_data_type,
impl_asset_bitasset_data_type,
impl_account_balance_object_type,
impl_account_statistics_object_type,
impl_transaction_object_type,
impl_block_summary_object_type,
impl_account_transaction_history_object_type,
impl_blinded_balance_object_type,
impl_chain_property_object_type,
impl_witness_schedule_object_type,
impl_budget_record_object_type,
impl_special_authority_object_type,
impl_buyback_object_type,
impl_fba_accumulator_object_type,
impl_asset_dividend_data_type,
impl_pending_dividend_payout_balance_for_holder_object_type,
impl_distributed_dividend_balance_data_type,
impl_betting_market_position_object_type,
impl_global_betting_statistics_object_type,
impl_lottery_balance_object_type,
impl_sweeps_vesting_balance_object_type,
impl_offer_history_object_type,
impl_son_statistics_object_type,
impl_son_schedule_object_type
};
//typedef fc::unsigned_int object_id_type;
//typedef uint64_t object_id_type;
class account_object;
class committee_member_object;
class witness_object;
class asset_object;
class force_settlement_object;
class limit_order_object;
class call_order_object;
class custom_object;
class proposal_object;
class operation_history_object;
class withdraw_permission_object;
class vesting_balance_object;
class worker_object;
class balance_object;
class blinded_balance_object;
class tournament_object;
class tournament_details_object;
class match_object;
class game_object;
class sport_object;
class event_group_object;
class event_object;
class betting_market_rules_object;
class betting_market_group_object;
class betting_market_object;
class bet_object;
class custom_permission_object;
class custom_account_authority_object;
class offer_object;
class nft_metadata_object;
class nft_object;
class account_role_object;
class son_object;
class son_proposal_object;
class son_wallet_object;
class son_wallet_deposit_object;
class son_wallet_withdraw_object;
class sidechain_address_object;
class sidechain_transaction_object;
typedef object_id< protocol_ids, account_object_type, account_object> account_id_type;
typedef object_id< protocol_ids, asset_object_type, asset_object> asset_id_type;
typedef object_id< protocol_ids, force_settlement_object_type, force_settlement_object> force_settlement_id_type;
typedef object_id< protocol_ids, committee_member_object_type, committee_member_object> committee_member_id_type;
typedef object_id< protocol_ids, witness_object_type, witness_object> witness_id_type;
typedef object_id< protocol_ids, limit_order_object_type, limit_order_object> limit_order_id_type;
typedef object_id< protocol_ids, call_order_object_type, call_order_object> call_order_id_type;
typedef object_id< protocol_ids, custom_object_type, custom_object> custom_id_type;
typedef object_id< protocol_ids, proposal_object_type, proposal_object> proposal_id_type;
typedef object_id< protocol_ids, operation_history_object_type, operation_history_object> operation_history_id_type;
typedef object_id< protocol_ids, withdraw_permission_object_type,withdraw_permission_object> withdraw_permission_id_type;
typedef object_id< protocol_ids, vesting_balance_object_type, vesting_balance_object> vesting_balance_id_type;
typedef object_id< protocol_ids, worker_object_type, worker_object> worker_id_type;
typedef object_id< protocol_ids, balance_object_type, balance_object> balance_id_type;
typedef object_id< protocol_ids, tournament_object_type, tournament_object> tournament_id_type;
typedef object_id< protocol_ids, tournament_details_object_type, tournament_details_object> tournament_details_id_type;
typedef object_id< protocol_ids, match_object_type, match_object> match_id_type;
typedef object_id< protocol_ids, game_object_type, game_object> game_id_type;
typedef object_id< protocol_ids, sport_object_type, sport_object> sport_id_type;
typedef object_id< protocol_ids, event_group_object_type, event_group_object> event_group_id_type;
typedef object_id< protocol_ids, event_object_type, event_object> event_id_type;
typedef object_id< protocol_ids, betting_market_rules_object_type, betting_market_rules_object> betting_market_rules_id_type;
typedef object_id< protocol_ids, betting_market_group_object_type, betting_market_group_object> betting_market_group_id_type;
typedef object_id< protocol_ids, betting_market_object_type, betting_market_object> betting_market_id_type;
typedef object_id< protocol_ids, bet_object_type, bet_object> bet_id_type;
typedef object_id< protocol_ids, custom_permission_object_type, custom_permission_object> custom_permission_id_type;
typedef object_id< protocol_ids, custom_account_authority_object_type, custom_account_authority_object> custom_account_authority_id_type;
typedef object_id< protocol_ids, offer_object_type, offer_object> offer_id_type;
typedef object_id< protocol_ids, nft_metadata_type, nft_metadata_object> nft_metadata_id_type;
typedef object_id< protocol_ids, nft_object_type, nft_object> nft_id_type;
typedef object_id< protocol_ids, account_role_type, account_role_object> account_role_id_type;
typedef object_id< protocol_ids, son_object_type, son_object> son_id_type;
typedef object_id< protocol_ids, son_proposal_object_type, son_proposal_object> son_proposal_id_type;
typedef object_id< protocol_ids, son_wallet_object_type, son_wallet_object> son_wallet_id_type;
typedef object_id< protocol_ids, son_wallet_deposit_object_type, son_wallet_deposit_object> son_wallet_deposit_id_type;
typedef object_id< protocol_ids, son_wallet_withdraw_object_type, son_wallet_withdraw_object> son_wallet_withdraw_id_type;
typedef object_id< protocol_ids, sidechain_address_object_type, sidechain_address_object> sidechain_address_id_type;
typedef object_id< protocol_ids, sidechain_transaction_object_type,sidechain_transaction_object> sidechain_transaction_id_type;
// implementation types
class global_property_object;
class dynamic_global_property_object;
class asset_dynamic_data_object;
class asset_bitasset_data_object;
class account_balance_object;
class account_statistics_object;
class transaction_object;
class block_summary_object;
class account_transaction_history_object;
class chain_property_object;
class witness_schedule_object;
class budget_record_object;
class special_authority_object;
class buyback_object;
class fba_accumulator_object;
class asset_dividend_data_object;
class pending_dividend_payout_balance_for_holder_object;
class betting_market_position_object;
class global_betting_statistics_object;
class lottery_balance_object;
class sweeps_vesting_balance_object;
class offer_history_object;
class son_statistics_object;
class son_schedule_object;
typedef object_id< implementation_ids, impl_global_property_object_type, global_property_object> global_property_id_type;
typedef object_id< implementation_ids, impl_dynamic_global_property_object_type, dynamic_global_property_object> dynamic_global_property_id_type;
typedef object_id< implementation_ids, impl_asset_dynamic_data_type, asset_dynamic_data_object> asset_dynamic_data_id_type;
typedef object_id< implementation_ids, impl_asset_bitasset_data_type, asset_bitasset_data_object> asset_bitasset_data_id_type;
typedef object_id< implementation_ids, impl_asset_dividend_data_type, asset_dividend_data_object> asset_dividend_data_id_type;
typedef object_id< implementation_ids,
impl_pending_dividend_payout_balance_for_holder_object_type,
pending_dividend_payout_balance_for_holder_object> pending_dividend_payout_balance_for_holder_object_type;
typedef object_id< implementation_ids, impl_account_balance_object_type, account_balance_object> account_balance_id_type;
typedef object_id< implementation_ids, impl_account_statistics_object_type, account_statistics_object> account_statistics_id_type;
typedef object_id< implementation_ids, impl_transaction_object_type, transaction_object> transaction_obj_id_type;
typedef object_id< implementation_ids, impl_block_summary_object_type, block_summary_object> block_summary_id_type;
typedef object_id< implementation_ids,
impl_account_transaction_history_object_type,
account_transaction_history_object> account_transaction_history_id_type;
typedef object_id< implementation_ids, impl_chain_property_object_type, chain_property_object> chain_property_id_type;
typedef object_id< implementation_ids, impl_witness_schedule_object_type, witness_schedule_object> witness_schedule_id_type;
typedef object_id< implementation_ids, impl_budget_record_object_type, budget_record_object > budget_record_id_type;
typedef object_id< implementation_ids, impl_blinded_balance_object_type, blinded_balance_object > blinded_balance_id_type;
typedef object_id< implementation_ids, impl_special_authority_object_type, special_authority_object > special_authority_id_type;
typedef object_id< implementation_ids, impl_buyback_object_type, buyback_object > buyback_id_type;
typedef object_id< implementation_ids, impl_fba_accumulator_object_type, fba_accumulator_object > fba_accumulator_id_type;
typedef object_id< implementation_ids, impl_betting_market_position_object_type, betting_market_position_object > betting_market_position_id_type;
typedef object_id< implementation_ids, impl_global_betting_statistics_object_type, global_betting_statistics_object > global_betting_statistics_id_type;
typedef object_id< implementation_ids, impl_lottery_balance_object_type, lottery_balance_object > lottery_balance_id_type;
typedef object_id< implementation_ids, impl_sweeps_vesting_balance_object_type, sweeps_vesting_balance_object> sweeps_vesting_balance_id_type;
typedef object_id< implementation_ids, impl_offer_history_object_type, offer_history_object> offer_history_id_type;
typedef object_id< implementation_ids, impl_son_statistics_object_type, son_statistics_object > son_statistics_id_type;
typedef object_id< implementation_ids, impl_son_schedule_object_type, son_schedule_object> son_schedule_id_type;
typedef fc::array<char, GRAPHENE_MAX_ASSET_SYMBOL_LENGTH> symbol_type;
typedef fc::ripemd160 block_id_type;
typedef fc::ripemd160 checksum_type;
typedef fc::ripemd160 transaction_id_type;
typedef fc::sha256 digest_type;
typedef fc::ecc::compact_signature signature_type;
typedef safe<int64_t> share_type;
typedef fc::ripemd160 secret_hash_type;
typedef uint16_t weight_type;
struct public_key_type
{
struct binary_key
{
binary_key() {}
uint32_t check = 0;
fc::ecc::public_key_data data;
};
fc::ecc::public_key_data key_data;
public_key_type();
public_key_type( const fc::ecc::public_key_data& data );
public_key_type( const fc::ecc::public_key& pubkey );
explicit public_key_type( const std::string& base58str );
operator fc::ecc::public_key_data() const;
operator fc::ecc::public_key() const;
explicit operator std::string() const;
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 );
};
struct extended_public_key_type
{
struct binary_key
{
binary_key() {}
uint32_t check = 0;
fc::ecc::extended_key_data data;
};
fc::ecc::extended_key_data key_data;
extended_public_key_type();
extended_public_key_type( const fc::ecc::extended_key_data& data );
extended_public_key_type( const fc::ecc::extended_public_key& extpubkey );
explicit extended_public_key_type( const std::string& base58str );
operator fc::ecc::extended_public_key() const;
explicit operator std::string() const;
friend bool operator == ( const extended_public_key_type& p1, const fc::ecc::extended_public_key& p2);
friend bool operator == ( const extended_public_key_type& p1, const extended_public_key_type& p2);
friend bool operator != ( const extended_public_key_type& p1, const extended_public_key_type& p2);
};
struct extended_private_key_type
{
struct binary_key
{
binary_key() {}
uint32_t check = 0;
fc::ecc::extended_key_data data;
};
fc::ecc::extended_key_data key_data;
extended_private_key_type();
extended_private_key_type( const fc::ecc::extended_key_data& data );
extended_private_key_type( const fc::ecc::extended_private_key& extprivkey );
explicit extended_private_key_type( const std::string& base58str );
operator fc::ecc::extended_private_key() const;
explicit operator std::string() const;
friend bool operator == ( const extended_private_key_type& p1, const fc::ecc::extended_private_key& p2);
friend bool operator == ( const extended_private_key_type& p1, const extended_private_key_type& p2);
friend bool operator != ( const extended_private_key_type& p1, const extended_private_key_type& p2);
};
typedef flat_map<std::string, std::string> internationalized_string_type;
typedef uint32_t bet_multiplier_type;
} } // graphene::chain
namespace fc
{
void to_variant( const graphene::chain::public_key_type& var, fc::variant& vo, uint32_t max_depth = 2 );
void from_variant( const fc::variant& var, graphene::chain::public_key_type& vo, uint32_t max_depth = 2 );
void to_variant( const graphene::chain::extended_public_key_type& var, fc::variant& vo, uint32_t max_depth = 2 );
void from_variant( const fc::variant& var, graphene::chain::extended_public_key_type& vo, uint32_t max_depth = 2 );
void to_variant( const graphene::chain::extended_private_key_type& var, fc::variant& vo, uint32_t max_depth = 2 );
void from_variant( const fc::variant& var, graphene::chain::extended_private_key_type& vo, uint32_t max_depth = 2 );
}
FC_REFLECT( graphene::chain::public_key_type, (key_data) )
FC_REFLECT( graphene::chain::public_key_type::binary_key, (data)(check) )
FC_REFLECT( graphene::chain::extended_public_key_type, (key_data) )
FC_REFLECT( graphene::chain::extended_public_key_type::binary_key, (check)(data) )
FC_REFLECT( graphene::chain::extended_private_key_type, (key_data) )
FC_REFLECT( graphene::chain::extended_private_key_type::binary_key, (check)(data) )
FC_REFLECT_ENUM( graphene::chain::object_type,
(null_object_type)
(base_object_type)
(account_object_type)
(force_settlement_object_type)
(asset_object_type)
(committee_member_object_type)
(witness_object_type)
(limit_order_object_type)
(call_order_object_type)
(custom_object_type)
(proposal_object_type)
(operation_history_object_type)
(withdraw_permission_object_type)
(vesting_balance_object_type)
(worker_object_type)
(balance_object_type)
(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)
(nft_metadata_type)
(nft_object_type)
(account_role_type)
(son_object_type)
(son_proposal_object_type)
(son_wallet_object_type)
(son_wallet_deposit_object_type)
(son_wallet_withdraw_object_type)
(sidechain_address_object_type)
(sidechain_transaction_object_type)
(OBJECT_TYPE_COUNT)
)
FC_REFLECT_ENUM( graphene::chain::impl_object_type,
(impl_global_property_object_type)
(impl_dynamic_global_property_object_type)
(impl_reserved0_object_type)
(impl_asset_dynamic_data_type)
(impl_asset_bitasset_data_type)
(impl_account_balance_object_type)
(impl_account_statistics_object_type)
(impl_transaction_object_type)
(impl_block_summary_object_type)
(impl_account_transaction_history_object_type)
(impl_blinded_balance_object_type)
(impl_chain_property_object_type)
(impl_witness_schedule_object_type)
(impl_budget_record_object_type)
(impl_special_authority_object_type)
(impl_buyback_object_type)
(impl_fba_accumulator_object_type)
(impl_asset_dividend_data_type)
(impl_pending_dividend_payout_balance_for_holder_object_type)
(impl_distributed_dividend_balance_data_type)
(impl_betting_market_position_object_type)
(impl_global_betting_statistics_object_type)
(impl_lottery_balance_object_type)
(impl_sweeps_vesting_balance_object_type)
(impl_offer_history_object_type)
(impl_son_statistics_object_type)
(impl_son_schedule_object_type)
)
FC_REFLECT_TYPENAME( graphene::chain::share_type )
FC_REFLECT_TYPENAME( graphene::chain::account_id_type )
FC_REFLECT_TYPENAME( graphene::chain::asset_id_type )
FC_REFLECT_TYPENAME( graphene::chain::force_settlement_id_type )
FC_REFLECT_TYPENAME( graphene::chain::committee_member_id_type )
FC_REFLECT_TYPENAME( graphene::chain::witness_id_type )
FC_REFLECT_TYPENAME( graphene::chain::limit_order_id_type )
FC_REFLECT_TYPENAME( graphene::chain::call_order_id_type )
FC_REFLECT_TYPENAME( graphene::chain::custom_id_type )
FC_REFLECT_TYPENAME( graphene::chain::proposal_id_type )
FC_REFLECT_TYPENAME( graphene::chain::operation_history_id_type )
FC_REFLECT_TYPENAME( graphene::chain::withdraw_permission_id_type )
FC_REFLECT_TYPENAME( graphene::chain::vesting_balance_id_type )
FC_REFLECT_TYPENAME( graphene::chain::worker_id_type )
FC_REFLECT_TYPENAME( graphene::chain::balance_id_type )
FC_REFLECT_TYPENAME( graphene::chain::sport_id_type )
FC_REFLECT_TYPENAME( graphene::chain::event_group_id_type )
FC_REFLECT_TYPENAME( graphene::chain::event_id_type )
FC_REFLECT_TYPENAME( graphene::chain::betting_market_rules_id_type )
FC_REFLECT_TYPENAME( graphene::chain::betting_market_group_id_type )
FC_REFLECT_TYPENAME( graphene::chain::betting_market_id_type )
FC_REFLECT_TYPENAME( graphene::chain::bet_id_type )
FC_REFLECT_TYPENAME( graphene::chain::tournament_id_type )
FC_REFLECT_TYPENAME( graphene::chain::offer_id_type )
FC_REFLECT_TYPENAME( graphene::chain::global_property_id_type )
FC_REFLECT_TYPENAME( graphene::chain::dynamic_global_property_id_type )
FC_REFLECT_TYPENAME( graphene::chain::asset_dynamic_data_id_type )
FC_REFLECT_TYPENAME( graphene::chain::asset_bitasset_data_id_type )
FC_REFLECT_TYPENAME( graphene::chain::account_balance_id_type )
FC_REFLECT_TYPENAME( graphene::chain::account_statistics_id_type )
FC_REFLECT_TYPENAME( graphene::chain::transaction_obj_id_type )
FC_REFLECT_TYPENAME( graphene::chain::block_summary_id_type )
FC_REFLECT_TYPENAME( graphene::chain::account_transaction_history_id_type )
FC_REFLECT_TYPENAME( graphene::chain::budget_record_id_type )
FC_REFLECT_TYPENAME( graphene::chain::special_authority_id_type )
FC_REFLECT_TYPENAME( graphene::chain::buyback_id_type )
FC_REFLECT_TYPENAME( graphene::chain::fba_accumulator_id_type )
FC_REFLECT_TYPENAME( graphene::chain::betting_market_position_id_type )
FC_REFLECT_TYPENAME( graphene::chain::global_betting_statistics_id_type )
FC_REFLECT_TYPENAME( graphene::chain::tournament_details_id_type )
FC_REFLECT_TYPENAME( graphene::chain::custom_permission_id_type )
FC_REFLECT_TYPENAME( graphene::chain::custom_account_authority_id_type )
FC_REFLECT_TYPENAME( graphene::chain::offer_history_id_type )
FC_REFLECT_TYPENAME( graphene::chain::nft_metadata_id_type )
FC_REFLECT_TYPENAME( graphene::chain::nft_id_type )
FC_REFLECT_TYPENAME( graphene::chain::account_role_id_type )
FC_REFLECT_TYPENAME( graphene::chain::son_id_type )
FC_REFLECT_TYPENAME( graphene::chain::son_proposal_id_type )
FC_REFLECT_TYPENAME( graphene::chain::son_wallet_id_type )
FC_REFLECT_TYPENAME( graphene::chain::son_wallet_deposit_id_type )
FC_REFLECT_TYPENAME( graphene::chain::son_wallet_withdraw_id_type )
FC_REFLECT_TYPENAME( graphene::chain::sidechain_address_id_type )
FC_REFLECT_TYPENAME( graphene::chain::sidechain_transaction_id_type )
FC_REFLECT( graphene::chain::void_t, )
FC_REFLECT_ENUM( graphene::chain::asset_issuer_permission_flags,
(charge_market_fee)
(white_list)
(transfer_restricted)
(override_authority)
(disable_force_settle)
(global_settle)
(disable_confidential)
(witness_fed_asset)
(committee_fed_asset)
)

View file

@ -1,5 +1,6 @@
#pragma once
#include <graphene/chain/evaluator.hpp>
#include <graphene/protocol/sidechain_address.hpp>
namespace graphene { namespace chain {

View file

@ -1,9 +1,10 @@
#pragma once
#include <graphene/protocol/types.hpp>
#include <graphene/db/object.hpp>
#include <graphene/db/generic_index.hpp>
#include <graphene/protocol/types.hpp>
#include <graphene/protocol/sidechain_defs.hpp>
#include <boost/multi_index/composite_key.hpp>
namespace graphene { namespace chain {

View file

@ -1,22 +0,0 @@
#pragma once
#include <fc/reflect/reflect.hpp>
namespace graphene { namespace chain {
enum class sidechain_type {
unknown,
bitcoin,
ethereum,
eos,
peerplays
};
} }
FC_REFLECT_ENUM(graphene::chain::sidechain_type,
(unknown)
(bitcoin)
(ethereum)
(eos)
(peerplays) )

View file

@ -1,5 +1,6 @@
#pragma once
#include <graphene/chain/evaluator.hpp>
#include <graphene/protocol/sidechain_transaction.hpp>
namespace graphene { namespace chain {

View file

@ -1,9 +1,10 @@
#pragma once
#include <boost/multi_index/composite_key.hpp>
#include <graphene/protocol/types.hpp>
#include <graphene/protocol/sidechain_defs.hpp>
#include <graphene/protocol/son_info.hpp>
#include <boost/multi_index/composite_key.hpp>
namespace graphene { namespace chain {
using namespace graphene::db;
using namespace graphene::protocol;
@ -70,6 +71,8 @@ FC_REFLECT_ENUM( graphene::chain::sidechain_transaction_status,
(sent)
(settled) )
MAP_OBJECT_ID_TO_TYPE(graphene::chain::sidechain_transaction_object)
FC_REFLECT_DERIVED( graphene::chain::sidechain_transaction_object, (graphene::db::object ),
(sidechain)
(object_id)

View file

@ -1,7 +1,8 @@
#pragma once
#include <graphene/chain/evaluator.hpp>
#include <graphene/protocol/son.hpp>
#include <graphene/chain/evaluator.hpp>
namespace graphene { namespace chain {
class create_son_evaluator : public evaluator<create_son_evaluator>

View file

@ -1,47 +0,0 @@
#pragma once
#include <graphene/chain/protocol/types.hpp>
#include <graphene/chain/sidechain_defs.hpp>
namespace graphene { namespace chain {
using namespace graphene::db;
/**
* @class son_info
* @brief tracks information about a SON info required to re/create primary wallet
* @ingroup object
*/
struct son_info {
son_id_type son_id;
weight_type weight = 0;
public_key_type signing_key;
flat_map<sidechain_type, string> sidechain_public_keys;
bool operator==(const son_info& rhs) {
bool son_sets_equal =
(son_id == rhs.son_id) &&
(weight == rhs.weight) &&
(signing_key == rhs.signing_key) &&
(sidechain_public_keys.size() == rhs.sidechain_public_keys.size());
if (son_sets_equal) {
bool sidechain_public_keys_equal = true;
for (size_t i = 0; i < sidechain_public_keys.size(); i++) {
const auto lhs_scpk = sidechain_public_keys.nth(i);
const auto rhs_scpk = rhs.sidechain_public_keys.nth(i);
sidechain_public_keys_equal = sidechain_public_keys_equal &&
(lhs_scpk->first == rhs_scpk->first) &&
(lhs_scpk->second == rhs_scpk->second);
}
son_sets_equal = son_sets_equal && sidechain_public_keys_equal;
}
return son_sets_equal;
}
};
} }
FC_REFLECT( graphene::chain::son_info,
(son_id)
(weight)
(signing_key)
(sidechain_public_keys) )

View file

@ -1,7 +1,8 @@
#pragma once
#include <graphene/protocol/types.hpp>
#include <graphene/db/object.hpp>
#include <graphene/db/generic_index.hpp>
#include <graphene/protocol/types.hpp>
#include <graphene/protocol/sidechain_defs.hpp>
namespace graphene { namespace chain {
@ -112,8 +113,8 @@ namespace graphene { namespace chain {
} } // graphene::chain
MAP_OBJECT_ID_TO_TYPE(graphene::chain::son_statistics_object)
MAP_OBJECT_ID_TO_TYPE(graphene::chain::son_object)
MAP_OBJECT_ID_TO_TYPE(graphene::chain::son_statistics_object)
FC_REFLECT_ENUM(graphene::chain::son_status, (inactive)(active)(request_maintenance)(in_maintenance)(deregistered) )

View file

@ -1,9 +1,10 @@
#pragma once
#include <graphene/protocol/types.hpp>
#include <graphene/db/object.hpp>
#include <graphene/db/generic_index.hpp>
#include <graphene/protocol/types.hpp>
namespace graphene { namespace chain {
enum class son_proposal_type
@ -37,6 +38,8 @@ using son_proposal_index = generic_index<son_proposal_object, son_proposal_multi
} } // graphene::chain
MAP_OBJECT_ID_TO_TYPE(graphene::chain::son_proposal_object)
FC_REFLECT_ENUM( graphene::chain::son_proposal_type, (son_deregister_proposal)(son_report_down_proposal) )
FC_REFLECT_DERIVED( graphene::chain::son_proposal_object, (graphene::chain::object), (proposal_id)(son_id)(proposal_type) )

View file

@ -50,5 +50,7 @@ namespace graphene { namespace chain {
using son_wallet_index = generic_index<son_wallet_object, son_wallet_multi_index_type>;
} } // graphene::chain
MAP_OBJECT_ID_TO_TYPE(graphene::chain::son_wallet_object)
FC_REFLECT_DERIVED( graphene::chain::son_wallet_object, (graphene::db::object),
(valid_from) (expires) (addresses) (sons) )

View file

@ -251,7 +251,7 @@ FC_REFLECT_DERIVED(graphene::chain::tournament_details_object, (graphene::db::ob
(players_payers)
(matches))
//FC_REFLECT_TYPENAME(graphene::chain::tournament_object) // manually serialized
FC_REFLECT(graphene::chain::tournament_object, (creator))
FC_REFLECT_DERIVED(graphene::chain::tournament_object, (graphene::db::object), (creator))
FC_REFLECT_ENUM(graphene::chain::tournament_state,
(accepting_registrations)
(awaiting_start)

View file

@ -22,6 +22,8 @@
* THE SOFTWARE.
*/
#pragma once
#include <graphene/chain/types.hpp>
#include <graphene/protocol/operations.hpp>
namespace graphene {

View file

@ -26,7 +26,6 @@
#include <graphene/protocol/vesting.hpp>
#include <graphene/protocol/asset.hpp>
#include <graphene/db/object.hpp>
#include <graphene/db/generic_index.hpp>

View file

@ -33,6 +33,13 @@
#include <fc/uint128.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 {
typedef hash_ctr_rng<
@ -103,7 +110,7 @@ class son_schedule_object : public graphene::db::abstract_object<son_schedule_ob
son_scheduler scheduler;
uint32_t last_scheduling_block;
uint64_t slots_since_genesis = 0;
std::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.

View file

@ -1,43 +0,0 @@
/*
* Copyright (c) 2015 Cryptonomex, Inc., and contributors.
*
* The MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <fc/io/raw.hpp>
#include <graphene/chain/index.hpp>
#include <graphene/chain/database.hpp>
namespace graphene { namespace chain {
void base_primary_index::save_undo( const object& obj )
{ _db.save_undo( obj ); }
void base_primary_index::on_add( const object& obj )
{
_db.save_undo_add( obj );
for( auto ob : _observers ) ob->on_add( obj );
}
void base_primary_index::on_remove( const object& obj )
{ _db.save_undo_remove( obj ); for( auto ob : _observers ) ob->on_remove( obj ); }
void base_primary_index::on_modify( const object& obj )
{for( auto ob : _observers ) ob->on_modify( obj ); }
} } // graphene::chain

View file

@ -6,6 +6,8 @@
#include <graphene/chain/account_role_object.hpp>
#include <graphene/chain/hardfork.hpp>
#include <graphene/protocol/operations.hpp>
namespace graphene { namespace chain {
void_result nft_metadata_create_evaluator::do_evaluate( const nft_metadata_create_operation& op )

View file

@ -2,11 +2,13 @@
#include <graphene/chain/account_object.hpp>
#include <graphene/chain/offer_object.hpp>
#include <graphene/chain/nft_object.hpp>
#include <graphene/protocol/operations.hpp>
#include <graphene/chain/account_role_object.hpp>
#include <graphene/chain/exceptions.hpp>
#include <graphene/chain/hardfork.hpp>
#include <graphene/chain/is_authorized_asset.hpp>
#include <graphene/protocol/operations.hpp>
#include <iostream>
namespace graphene
@ -94,7 +96,6 @@ namespace graphene
auto now = d.head_block_time();
FC_ASSERT(now >= HARDFORK_NFT_TIME, "Not allowed until NFT HF");
const auto &offer = op.offer_id(d);
op.bidder(d);
for (const auto &item : offer.item_ids)
{
const auto &nft_obj = item(d);

View file

@ -1,280 +0,0 @@
/*
* Copyright (c) 2015 Cryptonomex, Inc., and contributors.
*
* The MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <graphene/chain/config.hpp>
#include <graphene/chain/protocol/types.hpp>
#include <fc/crypto/base58.hpp>
#include <fc/crypto/ripemd160.hpp>
#include <fc/exception/exception.hpp>
#include <fc/io/raw.hpp>
namespace graphene { namespace chain {
public_key_type::public_key_type():key_data(){};
public_key_type::public_key_type( const fc::ecc::public_key_data& data )
:key_data( data ) {};
public_key_type::public_key_type( const fc::ecc::public_key& pubkey )
:key_data( pubkey ) {};
public_key_type::public_key_type( const std::string& base58str )
{
// TODO: Refactor syntactic checks into static is_valid()
// to make public_key_type API more similar to address API
std::string prefix( GRAPHENE_ADDRESS_PREFIX );
// TODO: This is temporary for testing
try
{
if( is_valid_v1( base58str ) )
prefix = std::string( "BTS" );
}
catch( ... )
{
}
try
{
if( is_valid_muse( base58str ) )
prefix = std::string( "MUSE" );
}
catch( ... )
{
}
const size_t prefix_len = prefix.size();
FC_ASSERT( base58str.size() > prefix_len );
FC_ASSERT( base58str.substr( 0, prefix_len ) == prefix , "", ("base58str", base58str) );
auto bin = fc::from_base58( base58str.substr( prefix_len ) );
auto bin_key = fc::raw::unpack<binary_key>(bin);
key_data = bin_key.data;
FC_ASSERT( fc::ripemd160::hash( key_data.data, key_data.size() )._hash[0] == bin_key.check );
};
bool public_key_type::is_valid_muse( const std::string& base58str )
{
std::string prefix( "MUSE" );
const size_t prefix_len = prefix.size();
FC_ASSERT( base58str.size() > prefix_len );
FC_ASSERT( base58str.substr( 0, prefix_len ) == prefix , "", ("base58str", base58str) );
auto bin = fc::from_base58( base58str.substr( prefix_len ) );
auto bin_key = fc::raw::unpack<binary_key>(bin);
key_data = bin_key.data;
FC_ASSERT( fc::ripemd160::hash( key_data.data, key_data.size() )._hash[0] == bin_key.check );
return true;
}
// TODO: This is temporary for testing
bool public_key_type::is_valid_v1( const std::string& base58str )
{
std::string prefix( "BTS" );
const size_t prefix_len = prefix.size();
FC_ASSERT( base58str.size() > prefix_len );
FC_ASSERT( base58str.substr( 0, prefix_len ) == prefix , "", ("base58str", base58str) );
auto bin = fc::from_base58( base58str.substr( prefix_len ) );
auto bin_key = fc::raw::unpack<binary_key>(bin);
fc::ecc::public_key_data key_data = bin_key.data;
FC_ASSERT( fc::ripemd160::hash( key_data.data, key_data.size() )._hash[0] == bin_key.check );
return true;
}
public_key_type::operator fc::ecc::public_key_data() const
{
return key_data;
};
public_key_type::operator fc::ecc::public_key() const
{
return fc::ecc::public_key( key_data );
};
public_key_type::operator std::string() const
{
binary_key k;
k.data = key_data;
k.check = fc::ripemd160::hash( k.data.data, k.data.size() )._hash[0];
auto data = fc::raw::pack( k );
return GRAPHENE_ADDRESS_PREFIX + fc::to_base58( data.data(), data.size() );
}
bool operator == ( const public_key_type& p1, const fc::ecc::public_key& p2)
{
return p1.key_data == p2.serialize();
}
bool operator == ( const public_key_type& p1, const public_key_type& p2)
{
return p1.key_data == p2.key_data;
}
bool operator != ( const public_key_type& p1, const public_key_type& p2)
{
return p1.key_data != p2.key_data;
}
// extended_public_key_type
extended_public_key_type::extended_public_key_type():key_data(){};
extended_public_key_type::extended_public_key_type( const fc::ecc::extended_key_data& data )
:key_data( data ){};
extended_public_key_type::extended_public_key_type( const fc::ecc::extended_public_key& extpubkey )
{
key_data = extpubkey.serialize_extended();
};
extended_public_key_type::extended_public_key_type( const std::string& base58str )
{
std::string prefix( GRAPHENE_ADDRESS_PREFIX );
const size_t prefix_len = prefix.size();
FC_ASSERT( base58str.size() > prefix_len );
FC_ASSERT( base58str.substr( 0, prefix_len ) == prefix , "", ("base58str", base58str) );
auto bin = fc::from_base58( base58str.substr( prefix_len ) );
auto bin_key = fc::raw::unpack<binary_key>(bin);
FC_ASSERT( fc::ripemd160::hash( bin_key.data.data, bin_key.data.size() )._hash[0] == bin_key.check );
key_data = bin_key.data;
}
extended_public_key_type::operator fc::ecc::extended_public_key() const
{
return fc::ecc::extended_public_key::deserialize( key_data );
}
extended_public_key_type::operator std::string() const
{
binary_key k;
k.data = key_data;
k.check = fc::ripemd160::hash( k.data.data, k.data.size() )._hash[0];
auto data = fc::raw::pack( k );
return GRAPHENE_ADDRESS_PREFIX + fc::to_base58( data.data(), data.size() );
}
bool operator == ( const extended_public_key_type& p1, const fc::ecc::extended_public_key& p2)
{
return p1.key_data == p2.serialize_extended();
}
bool operator == ( const extended_public_key_type& p1, const extended_public_key_type& p2)
{
return p1.key_data == p2.key_data;
}
bool operator != ( const extended_public_key_type& p1, const extended_public_key_type& p2)
{
return p1.key_data != p2.key_data;
}
// extended_private_key_type
extended_private_key_type::extended_private_key_type():key_data(){};
extended_private_key_type::extended_private_key_type( const fc::ecc::extended_key_data& data )
:key_data( data ){};
extended_private_key_type::extended_private_key_type( const fc::ecc::extended_private_key& extprivkey )
{
key_data = extprivkey.serialize_extended();
};
extended_private_key_type::extended_private_key_type( const std::string& base58str )
{
std::string prefix( GRAPHENE_ADDRESS_PREFIX );
const size_t prefix_len = prefix.size();
FC_ASSERT( base58str.size() > prefix_len );
FC_ASSERT( base58str.substr( 0, prefix_len ) == prefix , "", ("base58str", base58str) );
auto bin = fc::from_base58( base58str.substr( prefix_len ) );
auto bin_key = fc::raw::unpack<binary_key>(bin);
FC_ASSERT( fc::ripemd160::hash( bin_key.data.data, bin_key.data.size() )._hash[0] == bin_key.check );
key_data = bin_key.data;
}
extended_private_key_type::operator fc::ecc::extended_private_key() const
{
return fc::ecc::extended_private_key::deserialize( key_data );
}
extended_private_key_type::operator std::string() const
{
binary_key k;
k.data = key_data;
k.check = fc::ripemd160::hash( k.data.data, k.data.size() )._hash[0];
auto data = fc::raw::pack( k );
return GRAPHENE_ADDRESS_PREFIX + fc::to_base58( data.data(), data.size() );
}
bool operator == ( const extended_private_key_type& p1, const fc::ecc::extended_public_key& p2)
{
return p1.key_data == p2.serialize_extended();
}
bool operator == ( const extended_private_key_type& p1, const extended_private_key_type& p2)
{
return p1.key_data == p2.key_data;
}
bool operator != ( const extended_private_key_type& p1, const extended_private_key_type& p2)
{
return p1.key_data != p2.key_data;
}
} } // graphene::chain
namespace fc
{
using namespace std;
void to_variant( const graphene::chain::public_key_type& var, fc::variant& vo, uint32_t max_depth )
{
vo = std::string( var );
}
void from_variant( const fc::variant& var, graphene::chain::public_key_type& vo, uint32_t max_depth )
{
vo = graphene::chain::public_key_type( var.as_string() );
}
void to_variant( const graphene::chain::extended_public_key_type& var, fc::variant& vo, uint32_t max_depth )
{
vo = std::string( var );
}
void from_variant( const fc::variant& var, graphene::chain::extended_public_key_type& vo, uint32_t max_depth )
{
vo = graphene::chain::extended_public_key_type( var.as_string() );
}
void to_variant( const graphene::chain::extended_private_key_type& var, fc::variant& vo, uint32_t max_depth )
{
vo = std::string( var );
}
void from_variant( const fc::variant& var, graphene::chain::extended_private_key_type& vo, uint32_t max_depth )
{
vo = graphene::chain::extended_private_key_type( var.as_string() );
}
} // fc

View file

@ -29,8 +29,6 @@
#define MAX_NESTING (200)
#define MAX_NESTING (200)
namespace graphene { namespace db {
/**

View file

@ -143,6 +143,12 @@ namespace graphene { namespace db {
return static_cast<IndexType*>(_index[ObjectType::space_id][ObjectType::type_id].get());
}
template<typename SecondaryIndexType, typename PrimaryIndexType = typename SecondaryIndexType::watched_index>
SecondaryIndexType* add_secondary_index()
{
return get_mutable_index_type<PrimaryIndexType>().template add_secondary_index<SecondaryIndexType>();
}
void pop_undo();
fc::path get_data_dir()const { return _data_dir; }

View file

@ -57,3 +57,5 @@ INSTALL( TARGETS
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
file(GLOB HEADERS "include/graphene/egenesis/*.hpp")
INSTALL( FILES ${HEADERS} DESTINATION "include/graphene/egenesis" )

@ -1 +1 @@
Subproject commit 69ebbf4ba490482956de0e331b22f1018747d789
Subproject commit 21418ec46e7e9bb40f77b2312761976d909722ec

View file

@ -11,9 +11,9 @@ set(SOURCES node.cpp
add_library( graphene_net ${SOURCES} ${HEADERS} )
target_link_libraries( graphene_net
target_link_libraries( graphene_net
PUBLIC fc graphene_db graphene_protocol )
target_include_directories( graphene_net
target_include_directories( graphene_net
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include"
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../chain/include" "${CMAKE_CURRENT_BINARY_DIR}/../chain/include"
)

View file

@ -1,61 +0,0 @@
#include <graphene/chain/protocol/account_role.hpp>
#include <graphene/chain/protocol/operations.hpp>
namespace graphene
{
namespace chain
{
void account_role_create_operation::validate() const
{
FC_ASSERT(fee.amount >= 0, "Fee must not be negative");
FC_ASSERT(allowed_operations.size() > 0, "Allowed operations should be positive");
FC_ASSERT(whitelisted_accounts.size() > 0, "Whitelisted accounts should be positive");
}
void account_role_update_operation::validate() const
{
FC_ASSERT(fee.amount >= 0, "Fee must not be negative");
for (auto aop : allowed_operations_to_add)
{
FC_ASSERT(aop >= 0 && aop < operation::count(), "operation_type is not valid");
FC_ASSERT(allowed_operations_to_remove.find(aop) == allowed_operations_to_remove.end(),
"Cannot add and remove allowed operation at the same time.");
}
for (auto aop : allowed_operations_to_remove)
{
FC_ASSERT(aop >= 0 && aop < operation::count(), "operation_type is not valid");
FC_ASSERT(allowed_operations_to_add.find(aop) == allowed_operations_to_add.end(),
"Cannot add and remove allowed operation at the same time.");
}
for (auto acc : accounts_to_add)
{
FC_ASSERT(accounts_to_remove.find(acc) == accounts_to_remove.end(),
"Cannot add and remove accounts at the same time.");
}
for (auto acc : accounts_to_remove)
{
FC_ASSERT(accounts_to_add.find(acc) == accounts_to_add.end(),
"Cannot add and remove accounts at the same time.");
}
}
void account_role_delete_operation::validate() const
{
FC_ASSERT(fee.amount >= 0, "Fee must not be negative");
}
share_type account_role_create_operation::calculate_fee(const fee_parameters_type &k) const
{
return k.fee + calculate_data_fee(fc::raw::pack_size(*this), k.price_per_kbyte);
}
share_type account_role_update_operation::calculate_fee(const fee_parameters_type &k) const
{
return k.fee + calculate_data_fee(fc::raw::pack_size(*this), k.price_per_kbyte);
}
} // namespace chain
} // namespace graphene

View file

@ -1,92 +0,0 @@
#include <graphene/chain/protocol/chain_parameters.hpp>
#include <graphene/chain/protocol/fee_schedule.hpp>
namespace graphene { namespace chain {
chain_parameters::chain_parameters() {
current_fees = std::make_shared<fee_schedule>();
}
// copy constructor
chain_parameters::chain_parameters(const chain_parameters& other)
{
current_fees = std::make_shared<fee_schedule>(*other.current_fees);
safe_copy(*this, other);
}
// copy assignment
chain_parameters& chain_parameters::operator=(const chain_parameters& other)
{
if (&other != this)
{
current_fees = std::make_shared<fee_schedule>(*other.current_fees);
safe_copy(*this, other);
}
return *this;
}
// copies the easy stuff
void chain_parameters::safe_copy(chain_parameters& to, const chain_parameters& from)
{
to.block_interval = from.block_interval;
to.maintenance_interval = from.maintenance_interval;
to.maintenance_skip_slots = from.maintenance_skip_slots;
to.committee_proposal_review_period = from.committee_proposal_review_period;
to.maximum_transaction_size = from.maximum_transaction_size;
to.maximum_block_size = from.maximum_block_size;
to.maximum_time_until_expiration = from.maximum_time_until_expiration;
to.maximum_proposal_lifetime = from.maximum_proposal_lifetime;
to.maximum_asset_whitelist_authorities = from.maximum_asset_whitelist_authorities;
to.maximum_asset_feed_publishers = from.maximum_asset_feed_publishers;
to.maximum_witness_count = from.maximum_witness_count;
to.maximum_committee_count = from.maximum_committee_count;
to.maximum_authority_membership = from.maximum_authority_membership;
to.reserve_percent_of_fee = from.reserve_percent_of_fee;
to.network_percent_of_fee = from.network_percent_of_fee;
to.lifetime_referrer_percent_of_fee = from.lifetime_referrer_percent_of_fee;
to.cashback_vesting_period_seconds = from.cashback_vesting_period_seconds;
to.cashback_vesting_threshold = from.cashback_vesting_threshold;
to.count_non_member_votes = from.count_non_member_votes;
to.allow_non_member_whitelists = from.allow_non_member_whitelists;
to.witness_pay_per_block = from.witness_pay_per_block;
to.witness_pay_vesting_seconds = from.witness_pay_vesting_seconds;
to.worker_budget_per_day = from.worker_budget_per_day;
to.max_predicate_opcode = from.max_predicate_opcode;
to.fee_liquidation_threshold = from.fee_liquidation_threshold;
to.accounts_per_fee_scale = from.accounts_per_fee_scale;
to.account_fee_scale_bitshifts = from.account_fee_scale_bitshifts;
to.max_authority_depth = from.max_authority_depth;
to.witness_schedule_algorithm= from.witness_schedule_algorithm;
to.min_round_delay = from.min_round_delay;
to.max_round_delay = from.max_round_delay;
to.min_time_per_commit_move = from.min_time_per_commit_move;
to.max_time_per_commit_move = from.max_time_per_commit_move;
to.min_time_per_reveal_move = from.min_time_per_reveal_move;
to.max_time_per_reveal_move = from.max_time_per_reveal_move;
to.rake_fee_percentage = from.rake_fee_percentage;
to.maximum_registration_deadline = from.maximum_registration_deadline;
to.maximum_players_in_tournament = from.maximum_players_in_tournament;
to.maximum_tournament_whitelist_length = from.maximum_tournament_whitelist_length;
to.maximum_tournament_start_time_in_future= from.maximum_tournament_start_time_in_future;
to.maximum_tournament_start_delay = from.maximum_tournament_start_delay;
to.maximum_tournament_number_of_wins = from.maximum_tournament_number_of_wins;
to.extensions = from.extensions;
}
// move constructor
chain_parameters::chain_parameters(chain_parameters&& other)
{
current_fees = std::move(other.current_fees);
safe_copy(*this, other);
}
// move assignment
chain_parameters& chain_parameters::operator=(chain_parameters&& other)
{
if (&other != this)
{
current_fees = std::move(other.current_fees);
safe_copy(*this, other);
}
return *this;
}
}}

View file

@ -1,43 +0,0 @@
#include <graphene/chain/protocol/custom_account_authority.hpp>
#include <graphene/chain/protocol/operations.hpp>
namespace graphene
{
namespace chain
{
void custom_account_authority_create_operation::validate() const
{
FC_ASSERT(fee.amount >= 0, "Fee must not be negative");
FC_ASSERT(owner_account != GRAPHENE_TEMP_ACCOUNT && owner_account != GRAPHENE_COMMITTEE_ACCOUNT && owner_account != GRAPHENE_WITNESS_ACCOUNT && owner_account != GRAPHENE_RELAXED_COMMITTEE_ACCOUNT,
"Custom permissions and account auths cannot be created for special accounts");
FC_ASSERT(valid_from < valid_to, "valid_from should be earlier than valid_to");
FC_ASSERT(operation_type >= 0 && operation_type < operation::count(), "operation_type is not valid");
}
void custom_account_authority_update_operation::validate() const
{
FC_ASSERT(fee.amount >= 0, "Fee must not be negative");
FC_ASSERT(owner_account != GRAPHENE_TEMP_ACCOUNT && owner_account != GRAPHENE_COMMITTEE_ACCOUNT && owner_account != GRAPHENE_WITNESS_ACCOUNT && owner_account != GRAPHENE_RELAXED_COMMITTEE_ACCOUNT,
"Custom permissions and account auths cannot be created for special accounts");
FC_ASSERT(new_valid_from.valid() || new_valid_to.valid(), "Something must be updated");
if (new_valid_from && new_valid_to)
{
FC_ASSERT(*new_valid_from < *new_valid_to, "valid_from should be earlier than valid_to");
}
}
void custom_account_authority_delete_operation::validate() const
{
FC_ASSERT(fee.amount >= 0, "Fee must not be negative");
FC_ASSERT(owner_account != GRAPHENE_TEMP_ACCOUNT && owner_account != GRAPHENE_COMMITTEE_ACCOUNT && owner_account != GRAPHENE_WITNESS_ACCOUNT && owner_account != GRAPHENE_RELAXED_COMMITTEE_ACCOUNT,
"Custom permissions and account auths cannot be created for special accounts");
}
share_type custom_account_authority_create_operation::calculate_fee(const fee_parameters_type &k) const
{
return k.fee + calculate_data_fee( fc::raw::pack_size(*this), k.price_per_kbyte );
}
} // namespace chain
} // namespace graphene

View file

@ -1,85 +0,0 @@
#include <graphene/chain/protocol/custom_permission.hpp>
#include <graphene/chain/protocol/operations.hpp>
namespace graphene
{
namespace chain
{
bool is_valid_permission_name(const string &name)
{
try
{
const size_t len = name.size();
// RBAC_MIN_PERMISSION_NAME_LENGTH <= len minimum length check
if (len < RBAC_MIN_PERMISSION_NAME_LENGTH)
{
return false;
}
// len <= RBAC_MAX_PERMISSION_NAME_LENGTH max length check
if (len > RBAC_MAX_PERMISSION_NAME_LENGTH)
{
return false;
}
// First character should be a letter between a-z
if (!(name[0] >= 'a' && name[0] <= 'z'))
{
return false;
}
// Any character of a permission name should either be a small case letter a-z or a digit 0-9
for (const auto &ch : name)
{
if (!((ch >= 'a' && ch <= 'z') || (ch >= '0' && ch <= '9')))
{
return false;
}
}
// Don't accept active and owner permissions as we already have them by default
// This is for removing ambiguity for users, accepting them doesn't create any problems
if (name == "active" || name == "owner")
{
return false;
}
return true;
}
FC_CAPTURE_AND_RETHROW((name))
}
void custom_permission_create_operation::validate() const
{
FC_ASSERT(fee.amount >= 0, "Fee must not be negative");
FC_ASSERT(is_valid_permission_name(permission_name), "Invalid permission name provided");
FC_ASSERT(owner_account != GRAPHENE_TEMP_ACCOUNT && owner_account != GRAPHENE_COMMITTEE_ACCOUNT && owner_account != GRAPHENE_WITNESS_ACCOUNT && owner_account != GRAPHENE_RELAXED_COMMITTEE_ACCOUNT,
"Custom permissions and account auths cannot be created for special accounts");
FC_ASSERT(!auth.is_impossible(), "Impossible authority threshold auth provided");
FC_ASSERT(auth.address_auths.size() == 0, "Only account and key auths supported");
}
void custom_permission_update_operation::validate() const
{
FC_ASSERT(fee.amount >= 0, "Fee must not be negative");
FC_ASSERT(owner_account != GRAPHENE_TEMP_ACCOUNT && owner_account != GRAPHENE_COMMITTEE_ACCOUNT && owner_account != GRAPHENE_WITNESS_ACCOUNT && owner_account != GRAPHENE_RELAXED_COMMITTEE_ACCOUNT,
"Custom permissions and account auths cannot be created for special accounts");
FC_ASSERT(new_auth.valid(), "Something must be updated");
if (new_auth)
{
FC_ASSERT(!new_auth->is_impossible(), "Impossible authority threshold auth provided");
FC_ASSERT(new_auth->address_auths.size() == 0, "Only account and key auths supported");
}
}
void custom_permission_delete_operation::validate() const
{
FC_ASSERT(fee.amount >= 0, "Fee must not be negative");
FC_ASSERT(owner_account != GRAPHENE_TEMP_ACCOUNT && owner_account != GRAPHENE_COMMITTEE_ACCOUNT && owner_account != GRAPHENE_WITNESS_ACCOUNT && owner_account != GRAPHENE_RELAXED_COMMITTEE_ACCOUNT,
"Custom permissions and account auths cannot be created for special accounts");
}
share_type custom_permission_create_operation::calculate_fee(const fee_parameters_type &k) const
{
return k.fee + calculate_data_fee( fc::raw::pack_size(*this), k.price_per_kbyte );
}
} // namespace chain
} // namespace graphene

View file

@ -1,95 +0,0 @@
#include <graphene/chain/protocol/nft_ops.hpp>
#include <graphene/chain/protocol/operations.hpp>
namespace graphene
{
namespace chain
{
bool is_valid_nft_token_name(const string &name)
{
try
{
const size_t len = name.size();
// NFT_TOKEN_MIN_LENGTH <= len minimum length check
if (len < NFT_TOKEN_MIN_LENGTH)
{
return false;
}
// len <= NFT_TOKEN_MAX_LENGTH max length check
if (len > NFT_TOKEN_MAX_LENGTH)
{
return false;
}
// First character should be a letter between a-z/A-Z
if (!((name[0] >= 'a' && name[0] <= 'z') || (name[0] >= 'A' && name[0] <= 'Z')))
{
return false;
}
// Any character should either be a small case letter a-z or a digit 0-9
for (const auto &ch : name)
{
if (!((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9') || (ch == ' ')))
{
return false;
}
}
return true;
}
FC_CAPTURE_AND_RETHROW((name))
}
void nft_metadata_create_operation::validate() const
{
FC_ASSERT(fee.amount >= 0, "Fee must not be negative");
FC_ASSERT(is_valid_nft_token_name(name), "Invalid NFT name provided");
FC_ASSERT(is_valid_nft_token_name(symbol), "Invalid NFT symbol provided");
}
void nft_metadata_update_operation::validate() const
{
FC_ASSERT(fee.amount >= 0, "Fee must not be negative");
if(name)
FC_ASSERT(is_valid_nft_token_name(*name), "Invalid NFT name provided");
if(symbol)
FC_ASSERT(is_valid_nft_token_name(*symbol), "Invalid NFT symbol provided");
}
void nft_mint_operation::validate() const
{
FC_ASSERT(fee.amount >= 0, "Fee must not be negative");
}
share_type nft_metadata_create_operation::calculate_fee(const fee_parameters_type &k) const
{
return k.fee + calculate_data_fee( fc::raw::pack_size(*this), k.price_per_kbyte );
}
share_type nft_metadata_update_operation::calculate_fee(const fee_parameters_type &k) const
{
return k.fee + calculate_data_fee( fc::raw::pack_size(*this), k.price_per_kbyte );
}
share_type nft_mint_operation::calculate_fee(const fee_parameters_type &k) const
{
return k.fee + calculate_data_fee( fc::raw::pack_size(*this), k.price_per_kbyte );
}
share_type nft_safe_transfer_from_operation::calculate_fee(const fee_parameters_type &k) const
{
return k.fee + calculate_data_fee( fc::raw::pack_size(*this), k.price_per_kbyte );
}
share_type nft_approve_operation::calculate_fee(const fee_parameters_type &k) const
{
return k.fee;
}
share_type nft_set_approval_for_all_operation::calculate_fee(const fee_parameters_type &k) const
{
return k.fee;
}
} // namespace chain
} // namespace graphene

View file

@ -1340,7 +1340,7 @@ namespace graphene { namespace net { namespace detail {
uint32_t handshaking_timeout = _peer_inactivity_timeout;
fc::time_point handshaking_disconnect_threshold = fc::time_point::now() - fc::seconds(handshaking_timeout);
for( const peer_connection_ptr handshaking_peer : _handshaking_connections )
for( const peer_connection_ptr& handshaking_peer : _handshaking_connections )
if( handshaking_peer->connection_initiation_time < handshaking_disconnect_threshold &&
handshaking_peer->get_last_message_received_time() < handshaking_disconnect_threshold &&
handshaking_peer->get_last_message_sent_time() < handshaking_disconnect_threshold )
@ -1705,13 +1705,13 @@ namespace graphene { namespace net { namespace detail {
dlog("is_already_connected_to_id returning true because the peer is us");
return true;
}
for (const peer_connection_ptr active_peer : _active_connections)
for (const peer_connection_ptr& active_peer : _active_connections)
if (node_id == active_peer->node_id)
{
dlog("is_already_connected_to_id returning true because the peer is already in our active list");
return true;
}
for (const peer_connection_ptr handshaking_peer : _handshaking_connections)
for (const peer_connection_ptr& handshaking_peer : _handshaking_connections)
if (node_id == handshaking_peer->node_id)
{
dlog("is_already_connected_to_id returning true because the peer is already in our handshaking list");
@ -2878,7 +2878,7 @@ namespace graphene { namespace net { namespace detail {
item_id advertised_item_id(item_ids_inventory_message_received.item_type, item_hash);
bool we_advertised_this_item_to_a_peer = false;
bool we_requested_this_item_from_a_peer = false;
for (const peer_connection_ptr peer : _active_connections)
for (const peer_connection_ptr& peer : _active_connections)
{
if (peer->inventory_advertised_to_peer.find(advertised_item_id) != peer->inventory_advertised_to_peer.end())
{

View file

@ -1,57 +0,0 @@
#include <graphene/chain/protocol/offer.hpp>
#include <fc/io/raw.hpp>
namespace graphene
{
namespace chain
{
share_type offer_operation::calculate_fee(const fee_parameters_type &schedule) const
{
return schedule.fee + calculate_data_fee( fc::raw::pack_size(*this), schedule.price_per_kbyte );
}
void offer_operation::validate() const
{
FC_ASSERT(item_ids.size() > 0);
FC_ASSERT(fee.amount >= 0);
FC_ASSERT(minimum_price.asset_id == maximum_price.asset_id);
FC_ASSERT(minimum_price.amount >= 0 && maximum_price.amount > 0);
FC_ASSERT(maximum_price >= minimum_price);
}
share_type bid_operation::calculate_fee(const fee_parameters_type &schedule) const
{
share_type core_fee_required = schedule.fee;
return core_fee_required;
}
void bid_operation::validate() const
{
FC_ASSERT(fee.amount.value >= 0);
FC_ASSERT(bid_price.amount.value >= 0);
}
void cancel_offer_operation::validate() const
{
FC_ASSERT(fee.amount.value >= 0);
}
share_type cancel_offer_operation::calculate_fee(const fee_parameters_type &schedule) const
{
share_type core_fee_required = schedule.fee;
return core_fee_required;
}
void finalize_offer_operation::validate() const
{
FC_ASSERT(fee.amount.value >= 0);
}
share_type finalize_offer_operation::calculate_fee(const fee_parameters_type &schedule) const
{
share_type core_fee_required = schedule.fee;
return core_fee_required;
}
} // namespace chain
} // namespace graphene

View file

@ -24,7 +24,7 @@
#include <graphene/net/peer_connection.hpp>
#include <graphene/net/exceptions.hpp>
#include <graphene/net/config.hpp>
#include <graphene/chain/config.hpp>
#include <graphene/protocol/config.hpp>
#include <graphene/protocol/fee_schedule.hpp>
#include <fc/io/raw_fwd.hpp>

View file

@ -1,43 +0,0 @@
/*
* Copyright (c) 2019 BitShares Blockchain Foundation, and contributors.
*
* The MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <graphene/chain/protocol/balance.hpp>
#include <graphene/chain/protocol/buyback.hpp>
#include <graphene/chain/protocol/fba.hpp>
#include <graphene/chain/protocol/fee_schedule.hpp>
#include <graphene/chain/protocol/vesting.hpp>
#include <graphene/chain/protocol/chain_parameters.hpp>
#include <fc/io/raw.hpp>
GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::balance_claim_operation )
GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::buyback_account_options )
GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::fba_distribute_operation )
GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::vesting_balance_create_operation::fee_parameters_type )
GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::vesting_balance_withdraw_operation::fee_parameters_type )
GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::vesting_balance_create_operation )
GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::vesting_balance_withdraw_operation )
GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::chain_parameters )

View file

@ -64,6 +64,8 @@ class persistent_bet_object_helper : public secondary_index
public:
virtual ~persistent_bet_object_helper() {}
using watched_index = primary_index<bet_object_index>;
virtual void object_inserted(const object& obj) override;
//virtual void object_removed( const object& obj ) override;
//virtual void about_to_modify( const object& before ) override;
@ -99,6 +101,8 @@ class persistent_betting_market_object_helper : public secondary_index
public:
virtual ~persistent_betting_market_object_helper() {}
using watched_index = primary_index<betting_market_object_index>;
virtual void object_inserted(const object& obj) override;
//virtual void object_removed( const object& obj ) override;
//virtual void about_to_modify( const object& before ) override;
@ -134,6 +138,8 @@ class persistent_betting_market_group_object_helper : public secondary_index
public:
virtual ~persistent_betting_market_group_object_helper() {}
using watched_index = primary_index<betting_market_group_object_index>;
virtual void object_inserted(const object& obj) override;
//virtual void object_removed( const object& obj ) override;
//virtual void about_to_modify( const object& before ) override;
@ -169,6 +175,8 @@ class persistent_event_object_helper : public secondary_index
public:
virtual ~persistent_event_object_helper() {}
using watched_index = primary_index<event_object_index>;
virtual void object_inserted(const object& obj) override;
//virtual void object_removed( const object& obj ) override;
//virtual void about_to_modify( const object& before ) override;
@ -465,45 +473,31 @@ void bookie_plugin::plugin_set_program_options(boost::program_options::options_d
void bookie_plugin::plugin_initialize(const boost::program_options::variables_map& options)
{
ilog("bookie plugin: plugin_startup() begin");
ilog("bookie plugin: plugin_initialize() begin");
database().force_slow_replays();
database().applied_block.connect( [&]( const signed_block& b){ my->on_block_applied(b); } );
database().changed_objects.connect([&](const vector<object_id_type>& changed_object_ids, const fc::flat_set<graphene::chain::account_id_type>& impacted_accounts){ my->on_objects_changed(changed_object_ids); });
database().new_objects.connect([this](const vector<object_id_type>& ids, const flat_set<account_id_type>& impacted_accounts) { my->on_objects_new(ids); });
database().removed_objects.connect([this](const vector<object_id_type>& ids, const vector<const object*>& objs, const flat_set<account_id_type>& impacted_accounts) { my->on_objects_removed(ids); });
//auto event_index =
database().add_index<primary_index<detail::persistent_event_index> >();
database().add_index<primary_index<detail::persistent_betting_market_group_index> >();
database().add_index<primary_index<detail::persistent_betting_market_index> >();
database().add_index<primary_index<detail::persistent_bet_index> >();
const primary_index<bet_object_index>& bet_object_idx = database().get_index_type<primary_index<bet_object_index> >();
primary_index<bet_object_index>& nonconst_bet_object_idx = const_cast<primary_index<bet_object_index>&>(bet_object_idx);
detail::persistent_bet_object_helper* persistent_bet_object_helper_index = nonconst_bet_object_idx.add_secondary_index<detail::persistent_bet_object_helper>();
persistent_bet_object_helper_index->set_plugin_instance(this);
const primary_index<betting_market_object_index>& betting_market_object_idx = database().get_index_type<primary_index<betting_market_object_index> >();
primary_index<betting_market_object_index>& nonconst_betting_market_object_idx = const_cast<primary_index<betting_market_object_index>&>(betting_market_object_idx);
detail::persistent_betting_market_object_helper* persistent_betting_market_object_helper_index = nonconst_betting_market_object_idx.add_secondary_index<detail::persistent_betting_market_object_helper>();
persistent_betting_market_object_helper_index->set_plugin_instance(this);
const primary_index<betting_market_group_object_index>& betting_market_group_object_idx = database().get_index_type<primary_index<betting_market_group_object_index> >();
primary_index<betting_market_group_object_index>& nonconst_betting_market_group_object_idx = const_cast<primary_index<betting_market_group_object_index>&>(betting_market_group_object_idx);
detail::persistent_betting_market_group_object_helper* persistent_betting_market_group_object_helper_index = nonconst_betting_market_group_object_idx.add_secondary_index<detail::persistent_betting_market_group_object_helper>();
persistent_betting_market_group_object_helper_index->set_plugin_instance(this);
const primary_index<event_object_index>& event_object_idx = database().get_index_type<primary_index<event_object_index> >();
primary_index<event_object_index>& nonconst_event_object_idx = const_cast<primary_index<event_object_index>&>(event_object_idx);
detail::persistent_event_object_helper* persistent_event_object_helper_index = nonconst_event_object_idx.add_secondary_index<detail::persistent_event_object_helper>();
persistent_event_object_helper_index->set_plugin_instance(this);
ilog("bookie plugin: plugin_startup() end");
ilog("bookie plugin: plugin_initialize() end");
}
void bookie_plugin::plugin_startup()
{
ilog("bookie plugin: plugin_startup()");
// Register secondary indexes
database().add_secondary_index<detail::persistent_bet_object_helper>()->set_plugin_instance(this);
database().add_secondary_index<detail::persistent_betting_market_object_helper>()->set_plugin_instance(this);
database().add_secondary_index<detail::persistent_betting_market_group_object_helper>()->set_plugin_instance(this);
database().add_secondary_index<detail::persistent_event_object_helper>()->set_plugin_instance(this);
my->fill_localized_event_strings();
}

View file

@ -180,7 +180,7 @@ void bitcoin_transaction_builder::add_out(payment_type type, int64_t amount, con
const auto pubkey_bytes = bytes(pubkey.begin(), pubkey.begin() + pubkey.size());
add_out(type, amount, pubkey_bytes, front);
} else {
const auto hash256 = fc::sha256::hash((char*)pubkey.begin(), pubkey.size());
const auto hash256 = fc::sha256::hash((const char*)pubkey.begin(), pubkey.size());
const auto hash160 = fc::ripemd160::hash(hash256.data(), hash256.data_size());
add_out(type, amount, bytes(hash160.data(), hash160.data() + hash160.data_size()), front);
}

View file

@ -3,6 +3,7 @@
#include <graphene/peerplays_sidechain/bitcoin/types.hpp>
#include <graphene/peerplays_sidechain/bitcoin/utils.hpp>
using namespace graphene::protocol;
namespace graphene { namespace peerplays_sidechain { namespace bitcoin {
@ -216,6 +217,7 @@ public:
private:
void create_redeem_script(const fc::ecc::public_key &user_key_data, const std::vector<std::pair<fc::ecc::public_key, uint16_t>> &keys_data);
public:
uint32_t latency_;
};

View file

@ -186,7 +186,7 @@ inline void pack(Stream &s, const bitcoin_transaction &tx, bool with_witness = t
pack(s, out);
if (flags & 1) {
for (const auto in : tx.vin) {
for (const auto& in : tx.vin) {
pack_compact_size(s, in.scriptWitness.size());
for (const auto &sc : in.scriptWitness)
pack(s, sc);
@ -294,13 +294,13 @@ inline void pack_tx_witness_signature(Stream &s, const std::vector<char> &script
{
fc::datastream<size_t> ps;
for (const auto in : tx.vin)
for (const auto& in : tx.vin)
pack(ps, in.prevout);
std::vector<char> vec(ps.tellp());
if (vec.size()) {
fc::datastream<char *> ds(vec.data(), size_t(vec.size()));
for (const auto in : tx.vin)
for (const auto& in : tx.vin)
pack(ds, in.prevout);
}
@ -309,13 +309,13 @@ inline void pack_tx_witness_signature(Stream &s, const std::vector<char> &script
{
fc::datastream<size_t> ps;
for (const auto in : tx.vin)
for (const auto& in : tx.vin)
pack(ps, in.nSequence);
std::vector<char> vec(ps.tellp());
if (vec.size()) {
fc::datastream<char *> ds(vec.data(), size_t(vec.size()));
for (const auto in : tx.vin)
for (const auto& in : tx.vin)
pack(ds, in.nSequence);
}
@ -324,13 +324,13 @@ inline void pack_tx_witness_signature(Stream &s, const std::vector<char> &script
{
fc::datastream<size_t> ps;
for (const auto out : tx.vout)
for (const auto& out : tx.vout)
pack(ps, out);
std::vector<char> vec(ps.tellp());
if (vec.size()) {
fc::datastream<char *> ds(vec.data(), size_t(vec.size()));
for (const auto out : tx.vout)
for (const auto& out : tx.vout)
pack(ds, out);
}

View file

@ -6,7 +6,7 @@
namespace graphene { namespace peerplays_sidechain { namespace bitcoin {
class bitcoin_transaction;
struct bitcoin_transaction;
const secp256k1_context_t *btc_context();

View file

@ -9,7 +9,7 @@
namespace graphene { namespace peerplays_sidechain { namespace bitcoin {
class bitcoin_transaction;
struct bitcoin_transaction;
using bytes = std::vector<char>;
using accounts_keys = std::map<graphene::protocol::son_id_type, graphene::protocol::public_key_type>;

View file

@ -1,6 +1,7 @@
#pragma once
#include <graphene/chain/son_wallet_object.hpp>
#include <graphene/peerplays_sidechain/bitcoin/bitcoin_address.hpp>
#include <graphene/peerplays_sidechain/sidechain_net_handler.hpp>

View file

@ -1,6 +1,7 @@
#pragma once
#include <graphene/protocol/sidechain_defs.hpp>
#include <graphene/peerplays_sidechain/peerplays_sidechain_plugin.hpp>
#include <graphene/peerplays_sidechain/sidechain_net_handler.hpp>

View file

@ -5,11 +5,12 @@
#include <boost/range/algorithm_ext/insert.hpp>
#include <fc/log/logger.hpp>
#include <graphene/chain/proposal_object.hpp>
#include <graphene/protocol/transfer.hpp>
#include <graphene/chain/sidechain_address_object.hpp>
#include <graphene/chain/son_wallet_object.hpp>
#include <graphene/chain/son_wallet_withdraw_object.hpp>
#include <graphene/protocol/transfer.hpp>
#include <graphene/peerplays_sidechain/sidechain_net_manager.hpp>
#include <graphene/utilities/key_conversion.hpp>

View file

@ -13,9 +13,10 @@
#include <graphene/protocol/son_info.hpp>
#include <graphene/chain/account_object.hpp>
#include <graphene/protocol/son_wallet.hpp>
#include <graphene/chain/sidechain_transaction_object.hpp>
#include <graphene/chain/son_wallet_object.hpp>
#include <graphene/protocol/son_wallet.hpp>
#include <graphene/protocol/son_info.hpp>
#include <graphene/peerplays_sidechain/bitcoin/bitcoin_address.hpp>
#include <graphene/peerplays_sidechain/bitcoin/bitcoin_transaction.hpp>
#include <graphene/peerplays_sidechain/bitcoin/serialize.hpp>

View file

@ -17,6 +17,8 @@
#include <graphene/protocol/son_info.hpp>
#include <graphene/chain/account_object.hpp>
#include <graphene/chain/son_wallet_object.hpp>
#include <graphene/protocol/son_wallet.hpp>
#include <graphene/protocol/son_info.hpp>
#include <graphene/utilities/key_conversion.hpp>
namespace graphene { namespace peerplays_sidechain {

View file

@ -23,6 +23,7 @@
*/
#include <graphene/protocol/authority.hpp>
#include <fc/io/raw.hpp>
namespace graphene { namespace protocol {

View file

@ -81,5 +81,5 @@ share_type custom_permission_create_operation::calculate_fee(const fee_parameter
return k.fee + calculate_data_fee( fc::raw::pack_size(*this), k.price_per_kbyte );
}
} // namespace chain
} // namespace protocol
} // namespace graphene

View file

@ -298,7 +298,7 @@ FC_REFLECT_ENUM( graphene::protocol::app_tag, (bookie)(rps) )
FC_REFLECT( graphene::protocol::affiliate_reward_distribution, (_dist) );
FC_REFLECT( graphene::protocol::affiliate_reward_distributions, (_dists) );
FC_REFLECT(graphene::protocol::account_create_operation::ext, (null_ext)(owner_special_authority)(active_special_authority)(buyback_options) )
FC_REFLECT(graphene::protocol::account_create_operation::ext, (null_ext)(owner_special_authority)(active_special_authority)(buyback_options)(affiliate_distributions) )
FC_REFLECT_TYPENAME(graphene::protocol::extension<graphene::protocol::account_create_operation::ext>)
FC_REFLECT( graphene::protocol::account_create_operation,
(fee)(registrar)

View file

@ -22,11 +22,9 @@
* THE SOFTWARE.
*/
#pragma once
#include <memory>
#include <graphene/protocol/base.hpp>
#include <graphene/protocol/config.hpp>
#include <graphene/protocol/ext.hpp>
#include <graphene/protocol/types.hpp>
#include <graphene/protocol/base.hpp>
#include <memory>
@ -76,7 +74,7 @@ namespace graphene { namespace protocol {
chain_parameters(chain_parameters&& other);
chain_parameters& operator=(const chain_parameters& other);
chain_parameters& operator=(chain_parameters&& other);
/** using a smart ref breaks the circular dependency created between operations and the fee schedule */
/** using a shared_ptr breaks the circular dependency created between operations and the fee schedule */
std::shared_ptr<fee_schedule> current_fees; ///< current schedule of fees
uint8_t block_interval = GRAPHENE_DEFAULT_BLOCK_INTERVAL; ///< interval in seconds between blocks
uint32_t maintenance_interval = GRAPHENE_DEFAULT_MAINTENANCE_INTERVAL; ///< interval in sections between blockchain maintenance events

View file

@ -131,7 +131,7 @@ namespace graphene { namespace protocol {
share_type calculate_fee(const fee_parameters_type &k) const;
};
} } // graphene::chain
} } // graphene::protocol
FC_REFLECT( graphene::protocol::nft_metadata_create_operation::fee_parameters_type, (fee) (price_per_kbyte) )
FC_REFLECT( graphene::protocol::nft_metadata_update_operation::fee_parameters_type, (fee) )
@ -146,3 +146,4 @@ FC_REFLECT( graphene::protocol::nft_mint_operation, (fee) (payer) (nft_metadata_
FC_REFLECT( graphene::protocol::nft_safe_transfer_from_operation, (fee) (operator_) (from) (to) (token_id) (data) (extensions) )
FC_REFLECT( graphene::protocol::nft_approve_operation, (fee) (operator_) (approved) (token_id) (extensions) )
FC_REFLECT( graphene::protocol::nft_set_approval_for_all_operation, (fee) (owner) (operator_) (approved) (extensions) )

View file

@ -30,6 +30,10 @@
#include <string>
#include <fc/variant.hpp>
#include <fc/io/datastream.hpp>
#include <fc/io/raw_fwd.hpp>
#include <fc/variant.hpp>
namespace fc { namespace ecc { class public_key; } }
namespace graphene { namespace protocol {

View file

@ -239,7 +239,6 @@ FC_REFLECT_DERIVED( graphene::protocol::signed_transaction, (graphene::protocol:
FC_REFLECT_DERIVED( graphene::protocol::processed_transaction, (graphene::protocol::signed_transaction),
(operation_results) )
GRAPHENE_EXTERNAL_SERIALIZATION(extern, graphene::protocol::transaction)
GRAPHENE_EXTERNAL_SERIALIZATION(extern, graphene::protocol::signed_transaction)
GRAPHENE_EXTERNAL_SERIALIZATION(extern, graphene::protocol::processed_transaction)

View file

@ -135,7 +135,7 @@ 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::dormant_vesting_policy_initializer )
FC_REFLECT(graphene::protocol::dormant_vesting_policy_initializer, )
FC_REFLECT_TYPENAME( graphene::protocol::vesting_policy_initializer )
FC_REFLECT_ENUM( graphene::protocol::vesting_balance_type, (normal)(gpos)(son) )

View file

@ -81,7 +81,7 @@ namespace graphene { namespace protocol {
} } // graphene::protocol
FC_REFLECT( graphene::protocol::witness_create_operation::fee_parameters_type, (fee) )
FC_REFLECT( graphene::protocol::witness_create_operation, (fee)(witness_account)(url)(block_signing_key) )
FC_REFLECT( graphene::protocol::witness_create_operation, (fee)(witness_account)(url)(block_signing_key)(initial_secret) )
FC_REFLECT( graphene::protocol::witness_update_operation::fee_parameters_type, (fee) )
FC_REFLECT( graphene::protocol::witness_update_operation, (fee)(witness)(witness_account)(new_url)(new_signing_key)(new_initial_secret) )

View file

@ -113,4 +113,3 @@ GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::protocol::proposal_de
GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::protocol::proposal_create_operation )
GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::protocol::proposal_update_operation )
GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::protocol::proposal_delete_operation )

View file

@ -65,3 +65,4 @@ FC_IMPLEMENT_DERIVED_EXCEPTION( invalid_committee_approval, transaction_exceptio
FC_IMPLEMENT_DERIVED_EXCEPTION( insufficient_fee, transaction_exception, 4010007, "insufficient fee" )
} } // graphene::protocol

View file

@ -265,8 +265,9 @@ void verify_authority( const vector<operation>& ops, const flat_set<public_key_t
flat_set<account_id_type> required_active;
flat_set<account_id_type> required_owner;
vector<authority> other;
flat_set<public_key_type> available_keys;
sign_state s(sigs,get_active);
sign_state s(sigs,get_active, available_keys);
s.max_recursion = max_recursion_depth;
for( auto& id : active_aprovals )
s.approved_by.insert( id );
@ -450,10 +451,11 @@ void signed_transaction::verify_authority(
bool ignore_custom_operation_required_auths,
uint32_t max_recursion )const
{ try {
graphene::protocol::verify_authority( operations, get_signature_keys( chain_id ), get_active, get_owner, get_custom, ignore_custom_operation_required_auths, max_recursion );
graphene::protocol::verify_authority( operations, get_signature_keys( chain_id ), get_active, get_owner,
get_custom, ignore_custom_operation_required_auths, max_recursion );
} FC_CAPTURE_AND_RETHROW( (*this) ) }
} } // graphene::chain
} } // graphene::protocol
GRAPHENE_EXTERNAL_SERIALIZATION(/*not extern*/, graphene::protocol::transaction)
GRAPHENE_EXTERNAL_SERIALIZATION(/*not extern*/, graphene::protocol::signed_transaction)

View file

@ -108,8 +108,8 @@ def validate_members(name2members_ref, name2members_test):
error_items.append(name)
print("")
print("error in", name)
print("doxygen:", name2members_ref[name])
print("fc :", name2members_test[name])
print("doxygen:", sorted(name2members_ref[name]))
print("fc :", sorted(name2members_test[name]))
else:
ok_items.append(name)
return

View file

@ -242,10 +242,9 @@ int main( int argc, char** argv )
if( options.count( "rpc-tls-certificate" ) )
cert_pem = options.at("rpc-tls-certificate").as<string>();
std::shared_ptr<fc::http::websocket_tls_server> _websocket_tls_server;
auto _websocket_tls_server = std::make_shared<fc::http::websocket_tls_server>(cert_pem, "");
if( options.count("rpc-tls-endpoint") )
{
_websocket_tls_server = std::make_shared<fc::http::websocket_tls_server>(cert_pem, "");
_websocket_tls_server->on_connection([&]( const fc::http::websocket_connection_ptr& c ){
auto wsc = std::make_shared<fc::rpc::websocket_api_connection>(c, GRAPHENE_MAX_NESTED_OBJECTS);
wsc->register_api(wapi);

View file

@ -132,115 +132,6 @@ using namespace graphene::chain::keywords;
// 1.58 50:29 | 2.34 50:67 | 4.6 5:18 | 25 1:24 | 430 1:429 |
// 1.59 100:59 | 2.36 25:34 | 4.7 10:37
template<class O> object_id<O::space_id, O::type_id> to_id(const O& o) { return o.id; }
#define CREATE_ICE_HOCKEY_BETTING_MARKET(never_in_play, delay_before_settling) \
create_sport({{"en", "Ice Hockey"}, {"zh_Hans", "冰球"}, {"ja", "アイスホッケー"}}); \
generate_blocks(1); \
const auto ice_hockey_id = to_id(*db.get_index_type<sport_object_index>().indices().get<by_id>().rbegin()); \
create_event_group({{"en", "NHL"}, {"zh_Hans", "國家冰球聯盟"}, {"ja", "ナショナルホッケーリーグ"}}, ice_hockey_id); \
generate_blocks(1); \
const auto nhl_id = to_id(*db.get_index_type<event_group_object_index>().indices().get<by_id>().rbegin()); \
create_event({{"en", "Washington Capitals/Chicago Blackhawks"}, {"zh_Hans", "華盛頓首都隊/芝加哥黑鷹"}, {"ja", "ワシントン・キャピタルズ/シカゴ・ブラックホークス"}}, {{"en", "2016-17"}}, nhl_id); \
generate_blocks(1); \
const auto capitals_vs_blackhawks_id = to_id(*db.get_index_type<event_object_index>().indices().get<by_id>().rbegin()); \
create_betting_market_rules({{"en", "NHL Rules v1.0"}}, {{"en", "The winner will be the team with the most points at the end of the game. The team with fewer points will not be the winner."}}); \
generate_blocks(1); \
const auto betting_market_rules_id = to_id(*db.get_index_type<betting_market_rules_object_index>().indices().get<by_id>().rbegin()); \
create_betting_market_group({{"en", "Moneyline"}}, capitals_vs_blackhawks_id, betting_market_rules_id, asset_id_type(), never_in_play, delay_before_settling); \
generate_blocks(1); \
const auto moneyline_betting_markets_id = to_id(*db.get_index_type<betting_market_group_object_index>().indices().get<by_id>().rbegin()); \
create_betting_market(moneyline_betting_markets_id, {{"en", "Washington Capitals win"}}); \
generate_blocks(1); \
const auto capitals_win_market_id = to_id(*db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin()); \
create_betting_market(moneyline_betting_markets_id, {{"en", "Chicago Blackhawks win"}}); \
generate_blocks(1); \
const auto blackhawks_win_market_id = to_id(*db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin()); \
(void)capitals_win_market_id; (void)blackhawks_win_market_id;
// create the basic betting market, plus groups for the first, second, and third period results
#define CREATE_EXTENDED_ICE_HOCKEY_BETTING_MARKET(never_in_play, delay_before_settling) \
CREATE_ICE_HOCKEY_BETTING_MARKET(never_in_play, delay_before_settling) \
create_betting_market_group({{"en", "First Period Result"}}, capitals_vs_blackhawks_id, betting_market_rules_id, asset_id_type(), never_in_play, delay_before_settling); \
generate_blocks(1); \
const auto first_period_result_betting_markets_id = to_id(*db.get_index_type<betting_market_group_object_index>().indices().get<by_id>().rbegin()); \
create_betting_market(first_period_result_betting_markets_id, {{"en", "Washington Capitals win"}}); \
generate_blocks(1); \
const auto first_period_capitals_win_market_id = to_id(*db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin()); \
create_betting_market(first_period_result_betting_markets_id, {{"en", "Chicago Blackhawks win"}}); \
generate_blocks(1); \
const auto first_period_blackhawks_win_market_id = to_id(*db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin()); \
(void)first_period_capitals_win_market_id; (void)first_period_blackhawks_win_market_id; \
\
create_betting_market_group({{"en", "Second Period Result"}}, capitals_vs_blackhawks_id, betting_market_rules_id, asset_id_type(), never_in_play, delay_before_settling); \
generate_blocks(1); \
const auto second_period_result_betting_markets_id = to_id(*db.get_index_type<betting_market_group_object_index>().indices().get<by_id>().rbegin()); \
create_betting_market(second_period_result_betting_markets_id, {{"en", "Washington Capitals win"}}); \
generate_blocks(1); \
const auto second_period_capitals_win_market_id = to_id(*db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin()); \
create_betting_market(second_period_result_betting_markets_id, {{"en", "Chicago Blackhawks win"}}); \
generate_blocks(1); \
const auto second_period_blackhawks_win_market_id = to_id(*db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin()); \
(void)second_period_capitals_win_market_id; (void)second_period_blackhawks_win_market_id; \
\
create_betting_market_group({{"en", "Third Period Result"}}, capitals_vs_blackhawks_id, betting_market_rules_id, asset_id_type(), never_in_play, delay_before_settling); \
generate_blocks(1); \
const auto third_period_result_betting_markets_id = to_id(*db.get_index_type<betting_market_group_object_index>().indices().get<by_id>().rbegin()); \
create_betting_market(third_period_result_betting_markets_id, {{"en", "Washington Capitals win"}}); \
generate_blocks(1); \
const auto third_period_capitals_win_market_id = to_id(*db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin()); \
create_betting_market(third_period_result_betting_markets_id, {{"en", "Chicago Blackhawks win"}}); \
generate_blocks(1); \
const auto third_period_blackhawks_win_market_id = to_id(*db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin()); \
(void)third_period_capitals_win_market_id; (void)third_period_blackhawks_win_market_id;
#define CREATE_TENNIS_BETTING_MARKET() \
create_betting_market_rules({{"en", "Tennis Rules v1.0"}}, {{"en", "The winner is the player who wins the last ball in the match."}}); \
generate_blocks(1); \
const auto tennis_rules_id = to_id(*db.get_index_type<betting_market_rules_object_index>().indices().get<by_id>().rbegin()); \
create_sport({{"en", "Tennis"}}); \
generate_blocks(1); \
const auto tennis_id = to_id(*db.get_index_type<sport_object_index>().indices().get<by_id>().rbegin()); \
create_event_group({{"en", "Wimbledon"}}, tennis_id); \
generate_blocks(1); \
const auto wimbledon_id = to_id(*db.get_index_type<event_group_object_index>().indices().get<by_id>().rbegin()); \
create_event({{"en", "R. Federer/T. Berdych"}}, {{"en", "2017"}}, wimbledon_id); \
generate_blocks(1); \
const auto berdych_vs_federer_id = to_id(*db.get_index_type<event_object_index>().indices().get<by_id>().rbegin()); \
create_event({{"en", "M. Cilic/S. Querrye"}}, {{"en", "2017"}}, wimbledon_id); \
generate_blocks(1); \
const auto cilic_vs_querrey_id = to_id(*db.get_index_type<event_object_index>().indices().get<by_id>().rbegin()); \
create_betting_market_group({{"en", "Moneyline 1st sf"}}, berdych_vs_federer_id, tennis_rules_id, asset_id_type(), false, 0); \
generate_blocks(1); \
const auto moneyline_berdych_vs_federer_id = to_id(*db.get_index_type<betting_market_group_object_index>().indices().get<by_id>().rbegin()); \
create_betting_market_group({{"en", "Moneyline 2nd sf"}}, cilic_vs_querrey_id, tennis_rules_id, asset_id_type(), false, 0); \
generate_blocks(1); \
const auto moneyline_cilic_vs_querrey_id = to_id(*db.get_index_type<betting_market_group_object_index>().indices().get<by_id>().rbegin()); \
create_betting_market(moneyline_berdych_vs_federer_id, {{"en", "T. Berdych defeats R. Federer"}}); \
generate_blocks(1); \
const auto berdych_wins_market_id = to_id(*db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin()); \
create_betting_market(moneyline_berdych_vs_federer_id, {{"en", "R. Federer defeats T. Berdych"}}); \
generate_blocks(1); \
const auto federer_wins_market_id = to_id(*db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin()); \
create_betting_market(moneyline_cilic_vs_querrey_id, {{"en", "M. Cilic defeats S. Querrey"}}); \
generate_blocks(1); \
const auto cilic_wins_market_id = to_id(*db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin()); \
create_betting_market(moneyline_cilic_vs_querrey_id, {{"en", "S. Querrey defeats M. Cilic"}});\
generate_blocks(1); \
const auto querrey_wins_market_id = to_id(*db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin()); \
create_event({{"en", "R. Federer/M. Cilic"}}, {{"en", "2017"}}, wimbledon_id); \
generate_blocks(1); \
const auto cilic_vs_federer_id = to_id(*db.get_index_type<event_object_index>().indices().get<by_id>().rbegin()); \
create_betting_market_group({{"en", "Moneyline final"}}, cilic_vs_federer_id, tennis_rules_id, asset_id_type(), false, 0); \
generate_blocks(1); \
const auto moneyline_cilic_vs_federer_id = to_id(*db.get_index_type<betting_market_group_object_index>().indices().get<by_id>().rbegin()); \
create_betting_market(moneyline_cilic_vs_federer_id, {{"en", "R. Federer defeats M. Cilic"}}); \
generate_blocks(1); \
const auto federer_wins_final_market_id = to_id(*db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin()); \
create_betting_market(moneyline_cilic_vs_federer_id, {{"en", "M. Cilic defeats R. Federer"}}); \
generate_blocks(1); \
const auto cilic_wins_final_market_id = to_id(*db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin()); \
(void)federer_wins_market_id;(void)cilic_wins_market_id;(void)federer_wins_final_market_id; (void)cilic_wins_final_market_id; (void)berdych_wins_market_id; (void)querrey_wins_market_id;
BOOST_FIXTURE_TEST_SUITE( betting_tests, database_fixture )
@ -2513,6 +2404,7 @@ BOOST_AUTO_TEST_CASE(event_driven_progression_errors_2)
// as soon as a block is generated, the betting market group will settle, and the market
// and group will cease to exist. The event should transition to "settled", then removed
fc::variants objects_from_bookie = bookie_api.get_objects({capitals_vs_blackhawks_id});
wdump((objects_from_bookie)(capitals_vs_blackhawks_id(db)));
BOOST_CHECK_EQUAL(objects_from_bookie[0]["status"].as<std::string>(1), "settled");
// we can't go back to upcoming, in_progress, frozen, or finished once we're canceled.

View file

@ -30,113 +30,115 @@
using namespace graphene::chain;
template<class O> object_id<O::space_id, O::type_id> to_id(const O& o) { return o.id; }
#define CREATE_ICE_HOCKEY_BETTING_MARKET(never_in_play, delay_before_settling) \
create_sport({{"en", "Ice Hockey"}, {"zh_Hans", "冰球"}, {"ja", "アイスホッケー"}}); \
generate_blocks(1); \
const sport_object& ice_hockey = *db.get_index_type<sport_object_index>().indices().get<by_id>().rbegin(); \
create_event_group({{"en", "NHL"}, {"zh_Hans", "國家冰球聯盟"}, {"ja", "ナショナルホッケーリーグ"}}, ice_hockey.id); \
const auto ice_hockey_id = to_id(*db.get_index_type<sport_object_index>().indices().get<by_id>().rbegin()); \
create_event_group({{"en", "NHL"}, {"zh_Hans", "國家冰球聯盟"}, {"ja", "ナショナルホッケーリーグ"}}, ice_hockey_id); \
generate_blocks(1); \
const event_group_object& nhl = *db.get_index_type<event_group_object_index>().indices().get<by_id>().rbegin(); \
create_event({{"en", "Washington Capitals/Chicago Blackhawks"}, {"zh_Hans", "華盛頓首都隊/芝加哥黑鷹"}, {"ja", "ワシントン・キャピタルズ/シカゴ・ブラックホークス"}}, {{"en", "2016-17"}}, nhl.id); \
const auto nhl_id = to_id(*db.get_index_type<event_group_object_index>().indices().get<by_id>().rbegin()); \
create_event({{"en", "Washington Capitals/Chicago Blackhawks"}, {"zh_Hans", "華盛頓首都隊/芝加哥黑鷹"}, {"ja", "ワシントン・キャピタルズ/シカゴ・ブラックホークス"}}, {{"en", "2016-17"}}, nhl_id); \
generate_blocks(1); \
const event_object& capitals_vs_blackhawks = *db.get_index_type<event_object_index>().indices().get<by_id>().rbegin(); \
const auto capitals_vs_blackhawks_id = to_id(*db.get_index_type<event_object_index>().indices().get<by_id>().rbegin()); \
create_betting_market_rules({{"en", "NHL Rules v1.0"}}, {{"en", "The winner will be the team with the most points at the end of the game. The team with fewer points will not be the winner."}}); \
generate_blocks(1); \
const betting_market_rules_object& betting_market_rules = *db.get_index_type<betting_market_rules_object_index>().indices().get<by_id>().rbegin(); \
create_betting_market_group({{"en", "Moneyline"}}, capitals_vs_blackhawks.id, betting_market_rules.id, asset_id_type(), never_in_play, delay_before_settling); \
const auto betting_market_rules_id = to_id(*db.get_index_type<betting_market_rules_object_index>().indices().get<by_id>().rbegin()); \
create_betting_market_group({{"en", "Moneyline"}}, capitals_vs_blackhawks_id, betting_market_rules_id, asset_id_type(), never_in_play, delay_before_settling); \
generate_blocks(1); \
const betting_market_group_object& moneyline_betting_markets = *db.get_index_type<betting_market_group_object_index>().indices().get<by_id>().rbegin(); \
create_betting_market(moneyline_betting_markets.id, {{"en", "Washington Capitals win"}}); \
const auto moneyline_betting_markets_id = to_id(*db.get_index_type<betting_market_group_object_index>().indices().get<by_id>().rbegin()); \
create_betting_market(moneyline_betting_markets_id, {{"en", "Washington Capitals win"}}); \
generate_blocks(1); \
const betting_market_object& capitals_win_market = *db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin(); \
create_betting_market(moneyline_betting_markets.id, {{"en", "Chicago Blackhawks win"}}); \
const auto capitals_win_market_id = to_id(*db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin()); \
create_betting_market(moneyline_betting_markets_id, {{"en", "Chicago Blackhawks win"}}); \
generate_blocks(1); \
const betting_market_object& blackhawks_win_market = *db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin(); \
(void)capitals_win_market; (void)blackhawks_win_market;
const auto blackhawks_win_market_id = to_id(*db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin()); \
(void)capitals_win_market_id; (void)blackhawks_win_market_id;
// create the basic betting market, plus groups for the first, second, and third period results
#define CREATE_EXTENDED_ICE_HOCKEY_BETTING_MARKET(never_in_play, delay_before_settling) \
CREATE_ICE_HOCKEY_BETTING_MARKET(never_in_play, delay_before_settling) \
create_betting_market_group({{"en", "First Period Result"}}, capitals_vs_blackhawks.id, betting_market_rules.id, asset_id_type(), never_in_play, delay_before_settling); \
create_betting_market_group({{"en", "First Period Result"}}, capitals_vs_blackhawks_id, betting_market_rules_id, asset_id_type(), never_in_play, delay_before_settling); \
generate_blocks(1); \
const betting_market_group_object& first_period_result_betting_markets = *db.get_index_type<betting_market_group_object_index>().indices().get<by_id>().rbegin(); \
create_betting_market(first_period_result_betting_markets.id, {{"en", "Washington Capitals win"}}); \
const auto first_period_result_betting_markets_id = to_id(*db.get_index_type<betting_market_group_object_index>().indices().get<by_id>().rbegin()); \
create_betting_market(first_period_result_betting_markets_id, {{"en", "Washington Capitals win"}}); \
generate_blocks(1); \
const betting_market_object& first_period_capitals_win_market = *db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin(); \
create_betting_market(first_period_result_betting_markets.id, {{"en", "Chicago Blackhawks win"}}); \
const auto first_period_capitals_win_market_id = to_id(*db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin()); \
create_betting_market(first_period_result_betting_markets_id, {{"en", "Chicago Blackhawks win"}}); \
generate_blocks(1); \
const betting_market_object& first_period_blackhawks_win_market = *db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin(); \
(void)first_period_capitals_win_market; (void)first_period_blackhawks_win_market; \
const auto first_period_blackhawks_win_market_id = to_id(*db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin()); \
(void)first_period_capitals_win_market_id; (void)first_period_blackhawks_win_market_id; \
\
create_betting_market_group({{"en", "Second Period Result"}}, capitals_vs_blackhawks.id, betting_market_rules.id, asset_id_type(), never_in_play, delay_before_settling); \
create_betting_market_group({{"en", "Second Period Result"}}, capitals_vs_blackhawks_id, betting_market_rules_id, asset_id_type(), never_in_play, delay_before_settling); \
generate_blocks(1); \
const betting_market_group_object& second_period_result_betting_markets = *db.get_index_type<betting_market_group_object_index>().indices().get<by_id>().rbegin(); \
create_betting_market(second_period_result_betting_markets.id, {{"en", "Washington Capitals win"}}); \
const auto second_period_result_betting_markets_id = to_id(*db.get_index_type<betting_market_group_object_index>().indices().get<by_id>().rbegin()); \
create_betting_market(second_period_result_betting_markets_id, {{"en", "Washington Capitals win"}}); \
generate_blocks(1); \
const betting_market_object& second_period_capitals_win_market = *db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin(); \
create_betting_market(second_period_result_betting_markets.id, {{"en", "Chicago Blackhawks win"}}); \
const auto second_period_capitals_win_market_id = to_id(*db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin()); \
create_betting_market(second_period_result_betting_markets_id, {{"en", "Chicago Blackhawks win"}}); \
generate_blocks(1); \
const betting_market_object& second_period_blackhawks_win_market = *db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin(); \
(void)second_period_capitals_win_market; (void)second_period_blackhawks_win_market; \
const auto second_period_blackhawks_win_market_id = to_id(*db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin()); \
(void)second_period_capitals_win_market_id; (void)second_period_blackhawks_win_market_id; \
\
create_betting_market_group({{"en", "Third Period Result"}}, capitals_vs_blackhawks.id, betting_market_rules.id, asset_id_type(), never_in_play, delay_before_settling); \
create_betting_market_group({{"en", "Third Period Result"}}, capitals_vs_blackhawks_id, betting_market_rules_id, asset_id_type(), never_in_play, delay_before_settling); \
generate_blocks(1); \
const betting_market_group_object& third_period_result_betting_markets = *db.get_index_type<betting_market_group_object_index>().indices().get<by_id>().rbegin(); \
create_betting_market(third_period_result_betting_markets.id, {{"en", "Washington Capitals win"}}); \
const auto third_period_result_betting_markets_id = to_id(*db.get_index_type<betting_market_group_object_index>().indices().get<by_id>().rbegin()); \
create_betting_market(third_period_result_betting_markets_id, {{"en", "Washington Capitals win"}}); \
generate_blocks(1); \
const betting_market_object& third_period_capitals_win_market = *db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin(); \
create_betting_market(third_period_result_betting_markets.id, {{"en", "Chicago Blackhawks win"}}); \
const auto third_period_capitals_win_market_id = to_id(*db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin()); \
create_betting_market(third_period_result_betting_markets_id, {{"en", "Chicago Blackhawks win"}}); \
generate_blocks(1); \
const betting_market_object& third_period_blackhawks_win_market = *db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin(); \
(void)third_period_capitals_win_market; (void)third_period_blackhawks_win_market;
const auto third_period_blackhawks_win_market_id = to_id(*db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin()); \
(void)third_period_capitals_win_market_id; (void)third_period_blackhawks_win_market_id;
#define CREATE_TENNIS_BETTING_MARKET() \
create_betting_market_rules({{"en", "Tennis Rules v1.0"}}, {{"en", "The winner is the player who wins the last ball in the match."}}); \
generate_blocks(1); \
const betting_market_rules_object& tennis_rules = *db.get_index_type<betting_market_rules_object_index>().indices().get<by_id>().rbegin(); \
const auto tennis_rules_id = to_id(*db.get_index_type<betting_market_rules_object_index>().indices().get<by_id>().rbegin()); \
create_sport({{"en", "Tennis"}}); \
generate_blocks(1); \
const sport_object& tennis = *db.get_index_type<sport_object_index>().indices().get<by_id>().rbegin(); \
create_event_group({{"en", "Wimbledon"}}, tennis.id); \
const auto tennis_id = to_id(*db.get_index_type<sport_object_index>().indices().get<by_id>().rbegin()); \
create_event_group({{"en", "Wimbledon"}}, tennis_id); \
generate_blocks(1); \
const event_group_object& wimbledon = *db.get_index_type<event_group_object_index>().indices().get<by_id>().rbegin(); \
create_event({{"en", "R. Federer/T. Berdych"}}, {{"en", "2017"}}, wimbledon.id); \
const auto wimbledon_id = to_id(*db.get_index_type<event_group_object_index>().indices().get<by_id>().rbegin()); \
create_event({{"en", "R. Federer/T. Berdych"}}, {{"en", "2017"}}, wimbledon_id); \
generate_blocks(1); \
const event_object& berdych_vs_federer = *db.get_index_type<event_object_index>().indices().get<by_id>().rbegin(); \
create_event({{"en", "M. Cilic/S. Querrye"}}, {{"en", "2017"}}, wimbledon.id); \
const auto berdych_vs_federer_id = to_id(*db.get_index_type<event_object_index>().indices().get<by_id>().rbegin()); \
create_event({{"en", "M. Cilic/S. Querrye"}}, {{"en", "2017"}}, wimbledon_id); \
generate_blocks(1); \
const event_object& cilic_vs_querrey = *db.get_index_type<event_object_index>().indices().get<by_id>().rbegin(); \
create_betting_market_group({{"en", "Moneyline 1st sf"}}, berdych_vs_federer.id, tennis_rules.id, asset_id_type(), false, 0); \
const auto cilic_vs_querrey_id = to_id(*db.get_index_type<event_object_index>().indices().get<by_id>().rbegin()); \
create_betting_market_group({{"en", "Moneyline 1st sf"}}, berdych_vs_federer_id, tennis_rules_id, asset_id_type(), false, 0); \
generate_blocks(1); \
const betting_market_group_object& moneyline_berdych_vs_federer = *db.get_index_type<betting_market_group_object_index>().indices().get<by_id>().rbegin(); \
create_betting_market_group({{"en", "Moneyline 2nd sf"}}, cilic_vs_querrey.id, tennis_rules.id, asset_id_type(), false, 0); \
const auto moneyline_berdych_vs_federer_id = to_id(*db.get_index_type<betting_market_group_object_index>().indices().get<by_id>().rbegin()); \
create_betting_market_group({{"en", "Moneyline 2nd sf"}}, cilic_vs_querrey_id, tennis_rules_id, asset_id_type(), false, 0); \
generate_blocks(1); \
const betting_market_group_object& moneyline_cilic_vs_querrey = *db.get_index_type<betting_market_group_object_index>().indices().get<by_id>().rbegin(); \
create_betting_market(moneyline_berdych_vs_federer.id, {{"en", "T. Berdych defeats R. Federer"}}); \
const auto moneyline_cilic_vs_querrey_id = to_id(*db.get_index_type<betting_market_group_object_index>().indices().get<by_id>().rbegin()); \
create_betting_market(moneyline_berdych_vs_federer_id, {{"en", "T. Berdych defeats R. Federer"}}); \
generate_blocks(1); \
const betting_market_object& berdych_wins_market = *db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin(); \
create_betting_market(moneyline_berdych_vs_federer.id, {{"en", "R. Federer defeats T. Berdych"}}); \
const auto berdych_wins_market_id = to_id(*db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin()); \
create_betting_market(moneyline_berdych_vs_federer_id, {{"en", "R. Federer defeats T. Berdych"}}); \
generate_blocks(1); \
const betting_market_object& federer_wins_market = *db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin(); \
create_betting_market(moneyline_cilic_vs_querrey.id, {{"en", "M. Cilic defeats S. Querrey"}}); \
const auto federer_wins_market_id = to_id(*db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin()); \
create_betting_market(moneyline_cilic_vs_querrey_id, {{"en", "M. Cilic defeats S. Querrey"}}); \
generate_blocks(1); \
const betting_market_object& cilic_wins_market = *db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin(); \
create_betting_market(moneyline_cilic_vs_querrey.id, {{"en", "S. Querrey defeats M. Cilic"}});\
const auto cilic_wins_market_id = to_id(*db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin()); \
create_betting_market(moneyline_cilic_vs_querrey_id, {{"en", "S. Querrey defeats M. Cilic"}});\
generate_blocks(1); \
const betting_market_object& querrey_wins_market = *db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin(); \
create_event({{"en", "R. Federer/M. Cilic"}}, {{"en", "2017"}}, wimbledon.id); \
const auto querrey_wins_market_id = to_id(*db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin()); \
create_event({{"en", "R. Federer/M. Cilic"}}, {{"en", "2017"}}, wimbledon_id); \
generate_blocks(1); \
const event_object& cilic_vs_federer = *db.get_index_type<event_object_index>().indices().get<by_id>().rbegin(); \
create_betting_market_group({{"en", "Moneyline final"}}, cilic_vs_federer.id, tennis_rules.id, asset_id_type(), false, 0); \
const auto cilic_vs_federer_id = to_id(*db.get_index_type<event_object_index>().indices().get<by_id>().rbegin()); \
create_betting_market_group({{"en", "Moneyline final"}}, cilic_vs_federer_id, tennis_rules_id, asset_id_type(), false, 0); \
generate_blocks(1); \
const betting_market_group_object& moneyline_cilic_vs_federer = *db.get_index_type<betting_market_group_object_index>().indices().get<by_id>().rbegin(); \
create_betting_market(moneyline_cilic_vs_federer.id, {{"en", "R. Federer defeats M. Cilic"}}); \
const auto moneyline_cilic_vs_federer_id = to_id(*db.get_index_type<betting_market_group_object_index>().indices().get<by_id>().rbegin()); \
create_betting_market(moneyline_cilic_vs_federer_id, {{"en", "R. Federer defeats M. Cilic"}}); \
generate_blocks(1); \
const betting_market_object& federer_wins_final_market = *db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin(); \
create_betting_market(moneyline_cilic_vs_federer.id, {{"en", "M. Cilic defeats R. Federer"}}); \
const auto federer_wins_final_market_id = to_id(*db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin()); \
create_betting_market(moneyline_cilic_vs_federer_id, {{"en", "M. Cilic defeats R. Federer"}}); \
generate_blocks(1); \
const betting_market_object& cilic_wins_final_market = *db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin(); \
(void)federer_wins_market;(void)cilic_wins_market;(void)federer_wins_final_market; (void)cilic_wins_final_market; (void)berdych_wins_market; (void)querrey_wins_market;
const auto cilic_wins_final_market_id = to_id(*db.get_index_type<betting_market_object_index>().indices().get<by_id>().rbegin()); \
(void)federer_wins_market_id;(void)cilic_wins_market_id;(void)federer_wins_final_market_id; (void)cilic_wins_final_market_id; (void)berdych_wins_market_id; (void)querrey_wins_market_id;
// set up a fixture that places a series of two matched bets, we'll use this fixture to verify
// the result in all three possible outcomes
@ -149,25 +151,23 @@ struct simple_bet_test_fixture : database_fixture {
{
ACTORS( (alice)(bob) );
CREATE_ICE_HOCKEY_BETTING_MARKET(false, 0);
capitals_win_betting_market_id = capitals_win_market_id;
blackhawks_win_betting_market_id = blackhawks_win_market_id;
// give alice and bob 10k each
transfer(account_id_type(), alice_id, asset(10000));
transfer(account_id_type(), bob_id, asset(10000));
// place bets at 10:1
place_bet(alice_id, capitals_win_market.id, bet_type::back, asset(100, asset_id_type()), 11 * GRAPHENE_BETTING_ODDS_PRECISION);
place_bet(bob_id, capitals_win_market.id, bet_type::lay, asset(1000, asset_id_type()), 11 * GRAPHENE_BETTING_ODDS_PRECISION);
place_bet(alice_id, capitals_win_market_id, bet_type::back, asset(100, asset_id_type()), 11 * GRAPHENE_BETTING_ODDS_PRECISION);
place_bet(bob_id, capitals_win_market_id, bet_type::lay, asset(1000, asset_id_type()), 11 * GRAPHENE_BETTING_ODDS_PRECISION);
// reverse positions at 1:1
place_bet(alice_id, capitals_win_market.id, bet_type::lay, asset(1100, asset_id_type()), 2 * GRAPHENE_BETTING_ODDS_PRECISION);
place_bet(bob_id, capitals_win_market.id, bet_type::back, asset(1100, asset_id_type()), 2 * GRAPHENE_BETTING_ODDS_PRECISION);
capitals_win_betting_market_id = capitals_win_market.id;
blackhawks_win_betting_market_id = blackhawks_win_market.id;
moneyline_betting_markets_id = moneyline_betting_markets.id;
place_bet(alice_id, capitals_win_market_id, bet_type::lay, asset(1100, asset_id_type()), 2 * GRAPHENE_BETTING_ODDS_PRECISION);
place_bet(bob_id, capitals_win_market_id, bet_type::back, asset(1100, asset_id_type()), 2 * GRAPHENE_BETTING_ODDS_PRECISION);
// close betting to prepare for the next operation which will be grading or cancel
update_betting_market_group(moneyline_betting_markets.id, graphene::chain::keywords::_status = betting_market_group_status::closed);
update_betting_market_group(moneyline_betting_markets_id, graphene::chain::keywords::_status = betting_market_group_status::closed);
generate_blocks(1);
}
};

View file

@ -1615,6 +1615,7 @@ void database_fixture::resolve_betting_market_group(betting_market_group_id_type
betting_market_group_resolve_operation betting_market_group_resolve_op;
betting_market_group_resolve_op.betting_market_group_id = betting_market_group_id;
betting_market_group_resolve_op.resolutions = resolutions;
wdump((resolutions)(betting_market_group_resolve_op));
process_operation_by_witnesses(betting_market_group_resolve_op);
} FC_CAPTURE_AND_RETHROW( (betting_market_group_id)(resolutions) ) }

View file

@ -193,7 +193,8 @@ BOOST_AUTO_TEST_CASE(weighted_multisig_spend_test) {
int32_t hash_type = 1; // implement SIGHASH_ALL scheme
for (auto &key : priv_keys) {
bytes key_data(key.get_secret().data(), key.get_secret().data() + key.get_secret().data_size());
auto secret = key.get_secret();
bytes key_data(secret.data(), secret.data() + secret.data_size());
std::vector<bytes> sigs = sign_witness_transaction_part(tx, {redeem_script}, {amount}, key_data, btc_context(), hash_type);
// insert signatures in reverse order
tx.vin[0].scriptWitness.insert(tx.vin[0].scriptWitness.begin(), sigs[0]);
@ -335,7 +336,8 @@ BOOST_AUTO_TEST_CASE(user_sig_one_or_weighted_multisig_spend_test) {
uint64_t amount = 10000;
int32_t hash_type = 1; // implement SIGHASH_ALL scheme
bytes key_data(user_key.get_secret().data(), user_key.get_secret().data() + user_key.get_secret().data_size());
auto secret = user_key.get_secret();
bytes key_data(secret.data(), secret.data() + secret.data_size());
std::vector<bytes> sigs = sign_witness_transaction_part(tx, {redeem_script}, {amount}, key_data, btc_context(), hash_type);
tx.vin[0].scriptWitness.push_back(sigs[0]);
sign_witness_transaction_finalize(tx, {redeem_script}, false);
@ -369,7 +371,8 @@ BOOST_AUTO_TEST_CASE(user_sig_one_or_weighted_multisig_spend_test) {
int32_t hash_type = 1; // implement SIGHASH_ALL scheme
for (auto &key : priv_keys) {
bytes key_data(key.get_secret().data(), key.get_secret().data() + key.get_secret().data_size());
auto secret = key.get_secret();
bytes key_data(secret.data(), secret.data() + secret.data_size());
std::vector<bytes> sigs = sign_witness_transaction_part(tx, {redeem_script}, {amount}, key_data, btc_context(), hash_type);
// insert signatures in reverse order
tx.vin[0].scriptWitness.insert(tx.vin[0].scriptWitness.begin(), sigs[0]);
@ -435,7 +438,8 @@ BOOST_AUTO_TEST_CASE(user_sig_timelocked_one_or_weighted_multisig_spend_test) {
uint64_t amount = 10000;
int32_t hash_type = 1; // implement SIGHASH_ALL scheme
bytes key_data(user_key.get_secret().data(), user_key.get_secret().data() + user_key.get_secret().data_size());
auto secret = user_key.get_secret();
bytes key_data(secret.data(), secret.data() + secret.data_size());
std::vector<bytes> sigs = sign_witness_transaction_part(tx, {redeem_script}, {amount}, key_data, btc_context(), hash_type);
tx.vin[0].scriptWitness.push_back(sigs[0]);
sign_witness_transaction_finalize(tx, {redeem_script}, false);

View file

@ -16,6 +16,9 @@
#include <graphene/chain/account_role_object.hpp>
#include <graphene/chain/offer_object.hpp>
#include <graphene/protocol/operations.hpp>
#include <graphene/protocol/protocol.hpp>
#include <graphene/db/simple_index.hpp>
#include <fc/crypto/digest.hpp>

View file

@ -524,17 +524,17 @@ BOOST_AUTO_TEST_CASE( bookie_payout_test )
CREATE_ICE_HOCKEY_BETTING_MARKET(false, 0);
// place bets at 10:1
place_bet(ath.paula_id, capitals_win_market.id, bet_type::back, asset(10000, asset_id_type()), 11 * GRAPHENE_BETTING_ODDS_PRECISION);
place_bet(ath.penny_id, capitals_win_market.id, bet_type::lay, asset(100000, asset_id_type()), 11 * GRAPHENE_BETTING_ODDS_PRECISION);
place_bet(ath.paula_id, capitals_win_market_id, bet_type::back, asset(10000, asset_id_type()), 11 * GRAPHENE_BETTING_ODDS_PRECISION);
place_bet(ath.penny_id, capitals_win_market_id, bet_type::lay, asset(100000, asset_id_type()), 11 * GRAPHENE_BETTING_ODDS_PRECISION);
// reverse positions at 1:1
place_bet(ath.paula_id, capitals_win_market.id, bet_type::lay, asset(110000, asset_id_type()), 2 * GRAPHENE_BETTING_ODDS_PRECISION);
place_bet(ath.penny_id, capitals_win_market.id, bet_type::back, asset(110000, asset_id_type()), 2 * GRAPHENE_BETTING_ODDS_PRECISION);
place_bet(ath.paula_id, capitals_win_market_id, bet_type::lay, asset(110000, asset_id_type()), 2 * GRAPHENE_BETTING_ODDS_PRECISION);
place_bet(ath.penny_id, capitals_win_market_id, bet_type::back, asset(110000, asset_id_type()), 2 * GRAPHENE_BETTING_ODDS_PRECISION);
update_betting_market_group(moneyline_betting_markets.id, graphene::chain::keywords::_status = betting_market_group_status::closed);
resolve_betting_market_group(moneyline_betting_markets.id,
{{capitals_win_market.id, betting_market_resolution_type::win},
{blackhawks_win_market.id, betting_market_resolution_type::not_win}});
update_betting_market_group(moneyline_betting_markets_id, graphene::chain::keywords::_status = betting_market_group_status::closed);
resolve_betting_market_group(moneyline_betting_markets_id,
{{capitals_win_market_id, betting_market_resolution_type::win},
{blackhawks_win_market_id, betting_market_resolution_type::not_win}});
generate_block();
uint16_t rake_fee_percentage = db.get_global_properties().parameters.betting_rake_fee_percentage();
@ -559,10 +559,10 @@ BOOST_AUTO_TEST_CASE( bookie_payout_test )
issue_uia( ath.paula_id, asset( 1000000, btc_id ) );
issue_uia( ath.petra_id, asset( 1000000, btc_id ) );
create_event({{"en", "Washington Capitals/Chicago Blackhawks"}, {"zh_Hans", "華盛頓首都隊/芝加哥黑鷹"}, {"ja", "ワシントン・キャピタルズ/シカゴ・ブラックホークス"}}, {{"en", "2016-17"}}, nhl.id); \
create_event({{"en", "Washington Capitals/Chicago Blackhawks"}, {"zh_Hans", "華盛頓首都隊/芝加哥黑鷹"}, {"ja", "ワシントン・キャピタルズ/シカゴ・ブラックホークス"}}, {{"en", "2016-17"}}, nhl_id); \
generate_blocks(1); \
const event_object& capitals_vs_blackhawks2 = *db.get_index_type<event_object_index>().indices().get<by_id>().rbegin(); \
create_betting_market_group({{"en", "Moneyline"}}, capitals_vs_blackhawks2.id, betting_market_rules.id, btc_id, false, 0);
create_betting_market_group({{"en", "Moneyline"}}, capitals_vs_blackhawks2.id, betting_market_rules_id, btc_id, false, 0);
generate_blocks(1);
const betting_market_group_object& moneyline_betting_markets2 = *db.get_index_type<betting_market_group_object_index>().indices().get<by_id>().rbegin();
create_betting_market(moneyline_betting_markets2.id, {{"en", "Washington Capitals win"}});

View file

@ -1,4 +1,3 @@
#include <boost/test/unit_test.hpp>
#include <graphene/chain/hardfork.hpp>
#include <graphene/chain/database.hpp>
#include <graphene/protocol/protocol.hpp>

View file

@ -5,6 +5,7 @@
#include <graphene/chain/hardfork.hpp>
#include <graphene/chain/son_object.hpp>
#include <graphene/chain/sidechain_address_object.hpp>
#include <graphene/protocol/sidechain_defs.hpp>
using namespace graphene::chain;

View file

@ -4,6 +4,7 @@
#include <graphene/chain/hardfork.hpp>
#include <graphene/chain/son_wallet_object.hpp>
#include <graphene/protocol/sidechain_defs.hpp>
using namespace graphene;