/* * 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 #include #include #include #include #include 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_bts_account_type { struct initial_authority { uint32_t weight_threshold; flat_map account_auths; // uses account name instead of account id flat_map key_auths; flat_map address_auths; }; struct initial_cdd_vesting_policy { uint32_t vesting_seconds; fc::uint128_t coin_seconds_earned; fc::time_point_sec start_claim; fc::time_point_sec coin_seconds_earned_last_update; }; struct initial_linear_vesting_policy { fc::time_point_sec begin_timestamp; uint32_t vesting_cliff_seconds; uint32_t vesting_duration_seconds; share_type begin_balance; }; struct initial_vesting_balance { string asset_symbol; share_type amount; std::string policy_type; // either "linear" or "cdd" fc::variant policy; // either an initial_cdd_vesting_policy or initial_linear_vesting_policy }; initial_bts_account_type(const string& name = string(), const initial_authority& owner_authority = initial_authority(), const initial_authority& active_authority = initial_authority(), const share_type& core_balance = share_type()) : name(name), owner_authority(owner_authority), active_authority(active_authority), core_balance(core_balance) {} string name; initial_authority owner_authority; initial_authority active_authority; share_type core_balance; fc::optional > vesting_balances; }; 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 = GRAPHENE_BLOCKCHAIN_PRECISION_DIGITS; share_type max_supply; share_type accumulated_fees; bool is_bitasset = false; vector 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; fc::optional vesting_cliff_seconds; 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_bts_accounts; vector initial_accounts; vector initial_assets; vector initial_balances; vector initial_vesting_balances; uint64_t initial_active_witnesses = GRAPHENE_DEFAULT_MIN_WITNESS_COUNT; vector initial_witness_candidates; vector initial_committee_candidates; vector initial_worker_candidates; /** * Temporary, will be moved elsewhere. */ chain_id_type initial_chain_id; /** * 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_cliff_seconds)(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_bts_account_type::initial_authority, (weight_threshold) (account_auths) (key_auths) (address_auths)) FC_REFLECT(graphene::chain::genesis_state_type::initial_bts_account_type::initial_cdd_vesting_policy, (vesting_seconds) (coin_seconds_earned) (start_claim) (coin_seconds_earned_last_update)) FC_REFLECT(graphene::chain::genesis_state_type::initial_bts_account_type::initial_linear_vesting_policy, (begin_timestamp) (vesting_cliff_seconds) (vesting_duration_seconds) (begin_balance)) FC_REFLECT(graphene::chain::genesis_state_type::initial_bts_account_type::initial_vesting_balance, (asset_symbol) (amount) (policy_type) (policy)) FC_REFLECT(graphene::chain::genesis_state_type::initial_bts_account_type, (name) (owner_authority) (active_authority) (core_balance) (vesting_balances)) FC_REFLECT(graphene::chain::genesis_state_type, (initial_timestamp)(max_core_supply)(initial_parameters)(initial_bts_accounts)(initial_accounts)(initial_assets)(initial_balances) (initial_vesting_balances)(initial_active_witnesses)(initial_witness_candidates) (initial_committee_candidates)(initial_worker_candidates) (initial_chain_id) (immutable_parameters))