peerplays_migrated/libraries/chain/include/graphene/chain/genesis_state.hpp

126 lines
4.5 KiB
C++

#pragma once
#include <graphene/chain/protocol/chain_parameters.hpp>
#include <graphene/chain/protocol/types.hpp>
#include <graphene/chain/immutable_chain_parameters.hpp>
#include <fc/crypto/sha256.hpp>
#include <string>
#include <vector>
namespace graphene { namespace chain {
using std::string;
using std::vector;
struct genesis_state_type {
struct initial_account_type {
initial_account_type(const string& name = string(),
const public_key_type& owner_key = public_key_type(),
const public_key_type& active_key = public_key_type(),
bool is_lifetime_member = false)
: name(name),
owner_key(owner_key),
active_key(active_key == public_key_type()? owner_key : active_key),
is_lifetime_member(is_lifetime_member)
{}
string name;
public_key_type owner_key;
public_key_type active_key;
bool is_lifetime_member = false;
};
struct initial_asset_type {
struct initial_collateral_position {
address owner;
share_type collateral;
share_type debt;
};
string symbol;
string issuer_name;
string description;
uint8_t precision;
share_type max_supply;
share_type accumulated_fees;
bool is_bitasset = false;
vector<initial_collateral_position> collateral_records;
};
struct initial_balance_type {
address owner;
string asset_symbol;
share_type amount;
};
struct initial_vesting_balance_type {
address owner;
string asset_symbol;
share_type amount;
time_point_sec begin_timestamp;
uint32_t vesting_duration_seconds = 0;
share_type begin_balance;
};
struct initial_witness_type {
/// Must correspond to one of the initial accounts
string owner_name;
public_key_type block_signing_key;
};
struct initial_committee_member_type {
/// Must correspond to one of the initial accounts
string owner_name;
};
struct initial_worker_type {
/// Must correspond to one of the initial accounts
string owner_name;
share_type daily_pay;
};
time_point_sec initial_timestamp;
share_type max_core_supply = GRAPHENE_MAX_SHARE_SUPPLY;
chain_parameters initial_parameters;
immutable_chain_parameters immutable_parameters;
vector<initial_account_type> initial_accounts;
vector<initial_asset_type> initial_assets;
vector<initial_balance_type> initial_balances;
vector<initial_vesting_balance_type> initial_vesting_balances;
uint64_t initial_active_witnesses;
vector<initial_witness_type> initial_witness_candidates;
vector<initial_committee_member_type> initial_committee_candidates;
vector<initial_worker_type> initial_worker_candidates;
/**
* Get the chain_id corresponding to this genesis state.
*
* This is the SHA256 serialization of the genesis_state.
*/
chain_id_type compute_chain_id() const;
};
} } // namespace graphene::chain
FC_REFLECT(graphene::chain::genesis_state_type::initial_account_type, (name)(owner_key)(active_key)(is_lifetime_member))
FC_REFLECT(graphene::chain::genesis_state_type::initial_asset_type,
(symbol)(issuer_name)(description)(precision)(max_supply)(accumulated_fees)(is_bitasset)(collateral_records))
FC_REFLECT(graphene::chain::genesis_state_type::initial_asset_type::initial_collateral_position,
(owner)(collateral)(debt))
FC_REFLECT(graphene::chain::genesis_state_type::initial_balance_type,
(owner)(asset_symbol)(amount))
FC_REFLECT(graphene::chain::genesis_state_type::initial_vesting_balance_type,
(owner)(asset_symbol)(amount)(begin_timestamp)(vesting_duration_seconds)(begin_balance))
FC_REFLECT(graphene::chain::genesis_state_type::initial_witness_type, (owner_name)(block_signing_key))
FC_REFLECT(graphene::chain::genesis_state_type::initial_committee_member_type, (owner_name))
FC_REFLECT(graphene::chain::genesis_state_type::initial_worker_type, (owner_name)(daily_pay))
FC_REFLECT(graphene::chain::genesis_state_type,
(initial_timestamp)(max_core_supply)(initial_parameters)(initial_accounts)(initial_assets)(initial_balances)
(initial_vesting_balances)(initial_active_witnesses)(initial_witness_candidates)
(initial_committee_candidates)(initial_worker_candidates)
(immutable_parameters))