Added sidechain_proposal_object

This commit is contained in:
a.suslikov 2019-01-18 18:08:43 +03:00
parent fd5a650eeb
commit 9c7694a5e4
4 changed files with 51 additions and 0 deletions

View file

@ -52,6 +52,7 @@
#include <graphene/chain/info_for_vout_object.hpp>
#include <graphene/chain/bitcoin_address_object.hpp>
#include <graphene/chain/primary_wallet_vout_object.hpp>
#include <graphene/chain/sidechain_proposal_object.hpp>
#include <graphene/chain/sport_object.hpp>
@ -313,6 +314,7 @@ void database::initialize_indexes()
add_index< primary_index<info_for_vout_index > >();
add_index< primary_index<bitcoin_address_index > >();
add_index< primary_index<primary_wallet_vout_index > >();
add_index< primary_index<sidechain_proposal_index > >();
}
void database::init_genesis(const genesis_state_type& genesis_state)

View file

@ -148,6 +148,7 @@ namespace graphene { namespace chain {
info_for_vout_object_type,
bitcoin_address_object_type,
primary_wallet_vout_object_type,
sidechain_proposal_object_type,
OBJECT_TYPE_COUNT ///< Sentry value which contains the number of different object types
};
@ -208,6 +209,7 @@ namespace graphene { namespace chain {
class info_for_vout_object;
class bitcoin_address_object;
class primary_wallet_vout_object;
class sidechain_proposal_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;
@ -237,6 +239,7 @@ namespace graphene { namespace chain {
typedef object_id< protocol_ids, info_for_vout_object_type, info_for_vout_object> info_for_vout_id_type;
typedef object_id< protocol_ids, bitcoin_address_object_type, bitcoin_address_object> bitcoin_address_id_type;
typedef object_id< protocol_ids, primary_wallet_vout_object_type,primary_wallet_vout_object> primary_wallet_vout_id_type;
typedef object_id< protocol_ids, sidechain_proposal_object_type, sidechain_proposal_object> sidechain_proposal_id_type;
// implementation types
class global_property_object;
@ -414,6 +417,7 @@ FC_REFLECT_ENUM( graphene::chain::object_type,
(info_for_vout_object_type)
(bitcoin_address_object_type)
(primary_wallet_vout_object_type)
(sidechain_proposal_object_type)
(OBJECT_TYPE_COUNT)
)
FC_REFLECT_ENUM( graphene::chain::impl_object_type,
@ -468,6 +472,7 @@ FC_REFLECT_TYPENAME( graphene::chain::tournament_id_type )
FC_REFLECT_TYPENAME( graphene::chain::info_for_vout_id_type )
FC_REFLECT_TYPENAME( graphene::chain::bitcoin_address_id_type )
FC_REFLECT_TYPENAME( graphene::chain::primary_wallet_vout_id_type )
FC_REFLECT_TYPENAME( graphene::chain::sidechain_proposal_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 )

View file

@ -0,0 +1,35 @@
#pragma once
#include <graphene/db/generic_index.hpp>
#include <graphene/chain/protocol/types.hpp>
#include <sidechain/types.hpp>
namespace graphene { namespace chain {
class sidechain_proposal_object : public abstract_object<sidechain_proposal_object>
{
public:
static const uint8_t space_id = protocol_ids;
static const uint8_t type_id = sidechain_proposal_object_type;
sidechain_proposal_id_type get_id()const { return id; }
proposal_id_type proposal_id;
sidechain::sidechain_proposal_type proposal_type;
};
struct by_proposal;
struct by_type;
typedef boost::multi_index_container<
sidechain_proposal_object,
indexed_by<
ordered_unique< tag< by_id >, member< object, object_id_type, &object::id > >,
ordered_unique< tag< by_proposal >, member< sidechain_proposal_object, proposal_id_type, &sidechain_proposal_object::proposal_id > >,
ordered_non_unique< tag< by_type >, member< sidechain_proposal_object, sidechain::sidechain_proposal_type, &sidechain_proposal_object::proposal_type > >
>
> sidechain_multi_index_container;
typedef generic_index<sidechain_proposal_object, sidechain_multi_index_container> sidechain_proposal_index;
} } // graphene::chain
FC_REFLECT_DERIVED( graphene::chain::sidechain_proposal_object, (graphene::chain::object), (proposal_id)(proposal_type) )

View file

@ -25,6 +25,14 @@ enum class payment_type
P2SH_WSH
};
enum class sidechain_proposal_type
{
ISSUE_PBTC,
SEND_BTC_TRANSACTION,
WITHDRAW_PBTC,
RETURN_PBTC_BACK
};
struct prev_out
{
std::string hash_tx;
@ -35,4 +43,5 @@ struct prev_out
}
FC_REFLECT_ENUM( sidechain::payment_type, (NULLDATA)(P2PK)(P2PKH)(P2SH)(P2WPKH)(P2WSH)(P2SH_WPKH)(P2SH_WSH) );
FC_REFLECT_ENUM( sidechain::sidechain_proposal_type, (ISSUE_PBTC)(SEND_BTC_TRANSACTION)(WITHDRAW_PBTC)(RETURN_PBTC_BACK) );
FC_REFLECT( sidechain::prev_out, (hash_tx)(n_vout)(amount) );