Skip to content

Latest commit

 

History

History
411 lines (363 loc) · 11.8 KB

0.8.0.md

File metadata and controls

411 lines (363 loc) · 11.8 KB

0.8.0

CORE precision

Precision asset ECHO now 8

New list of operations

typedef fc::static_variant<
    transfer_operation,
    limit_order_create_operation,
    limit_order_cancel_operation,
    call_order_update_operation,
    fill_order_operation,           // VIRTUAL
    account_create_operation,
    account_update_operation,
    account_whitelist_operation,
    account_upgrade_operation,
    account_transfer_operation,
    asset_create_operation,
    asset_update_operation,
    asset_update_bitasset_operation,
    asset_update_feed_producers_operation,
    asset_issue_operation,
    asset_reserve_operation,
    asset_fund_fee_pool_operation,
    asset_settle_operation,
    asset_global_settle_operation,
    asset_publish_feed_operation,
    proposal_create_operation,
    proposal_update_operation,
    proposal_delete_operation,
    withdraw_permission_create_operation,
    withdraw_permission_update_operation,
    withdraw_permission_claim_operation,
    withdraw_permission_delete_operation,
    committee_member_create_operation,
    committee_member_update_operation,
    committee_member_update_global_parameters_operation,
    vesting_balance_create_operation,
    vesting_balance_withdraw_operation,
    custom_operation,
    assert_operation,
    balance_claim_operation,
    override_transfer_operation,
    asset_settle_cancel_operation,      // VIRTUAL
    asset_claim_fees_operation,
    bid_collateral_operation,
    execute_bid_operation,              // VIRTUAL
    create_contract_operation,
    call_contract_operation,
    contract_transfer_operation,
    change_sidechain_config_operation,  // Temporary operation for tests
    account_address_create_operation,
    transfer_to_address_operation,
    generate_eth_address_operation,
    create_eth_address_operation,
    deposit_eth_operation,
    withdraw_eth_operation,
    approve_withdraw_eth_operation,
    contract_fund_pool_operation,
    contract_whitelist_operation,
    sidechain_issue_operation,          // VIRTUAL
    sidechain_burn_operation,           // VIRTUAL
    register_erc20_token_operation,
    deposit_erc20_token_operation,
    withdraw_erc20_token_operation,
    approve_erc20_token_withdraw_operation,
    contract_update_operation
> operation;

New objects order

enum object_type
{
    null_object_type,
    base_object_type,
    account_object_type,
    asset_object_type,
    force_settlement_object_type,
    committee_member_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,
    balance_object_type,
    contract_object_type,
    contract_result_object_type,
    block_result_object_type,
    eth_address_object_type,
    deposit_eth_object_type,
    withdraw_eth_object_type,
    erc20_token_object_type,
    deposit_erc20_token_object_type,
    withdraw_erc20_token_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,
    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_chain_property_object_type,
    impl_budget_record_object_type,
    impl_special_authority_object_type,
    impl_buyback_object_type,
    impl_collateral_bid_object_type,
    impl_contract_balance_object_type,
    impl_contract_history_object_type,
    impl_contract_statistics_object_type,
    impl_account_address_object_type,
    impl_contract_pool_object_type,
    impl_malicious_committeemen_object_type
};

extensions

Many objects lacked the required extensions field, which is of type flat_set<static_variant<void_t>>. Added last field in the following operations and objects:

Operations:

balance_claim_operation, committee_member_create_operation, committee_member_update_operation, committee_member_update_global_parameters_operation, create_contract_operation, call_contract_operation, contract_fund_pool_operation, contract_whitelist_operation, custom_operation, fill_order_operation, execute_bid_operation, change_sidechain_config_operation, sidechain_issue_operation, sidechain_burn_operation, vesting_balance_create_operation, vesting_balance_withdraw_operation, withdraw_permission_claim_operation, withdraw_permission_delete_operation

Objects:

account_address_object, account_statistics_object, account_balance_object, account_object, contract_balance_object, contract_object, contract_statistics_object, contract_result_object, block_result_object, eth_address_object, deposit_eth_object, withdraw_eth_object, asset_dynamic_data_object, asset_object, asset_bitasset_data_object, limit_order_object, call_order_object, force_settlement_object, collateral_bid_object, committee_member_object, proposal_object, operation_history_object, account_transaction_history_object, contract_history_object, withdraw_permission_object, vesting_balance_object, balance_object, dynamic_global_property_object, contract_pool_object, transaction_object, block_summary_object, chain_property_object, budget_record_object, special_authority_object, buyback_object

As an example of use extensions - asset_create_operation.

price_per_kbyte

Of options fee in operations transfer_operation, override_transfer_operation, withdraw_permission_claim_operation field is removed price_per_kbyte.

chain_parameters

Field is added to the sidechain::erc20_config erc20_config after sidechain_config.

struct erc20_config
{
    std::string contract_code;
    uint64_t create_token_fee;
    std::string transfer_topic;
    eth_method check_balance_method;
    eth_method burn_method;
    eth_method issue_method;
};

contract_object

Moved field type

class contract_object
{
public:
    echo::vm::vm_type type;
    bool destroyed = false;
    contract_statistics_id_type statistics;
    fc::optional<asset_id_type> supported_asset_id;
    fc::optional<account_id_type> owner;

    extensions_type extensions;
}

contract_fund_pool_operation

Moved field fee

struct contract_fund_pool_operation
{
    asset fee;
    account_id_type sender;
    contract_id_type contract;
    asset value;
    
    extensions_type extensions;
}

contract_whitelist_operation

Moved field fee

struct contract_whitelist_operation
{
    asset fee;
    account_id_type sender;
    contract_id_type contract;

    set<account_id_type> add_to_whitelist;
    set<account_id_type> remove_from_whitelist;
    set<account_id_type> add_to_blacklist;
    set<account_id_type> remove_from_blacklist;

    extensions_type   extensions;
}

contract_update_operation

Added a new operation to update the contract owner.

struct contract_update_operation : public base_operation
{
    asset fee;
    account_id_type sender;
    contract_id_type contract;
    
    fc::optional<account_id_type> new_owner;

    extensions_type extensions;
};

account_statistics_object

Added fields generated_eth_address, committeeman_rating. New field order

class account_statistics_object
{
    account_id_type  owner;
    account_transaction_history_id_type most_recent_op;
    uint32_t total_ops = 0;
    uint32_t removed_ops = 0;
    uint32_t total_blocks = 0;
    share_type total_core_in_orders;
    share_type lifetime_fees_paid;
    share_type pending_fees;
    share_type pending_vested_fees;
    bool generated_eth_address = false;
    int64_t committeeman_rating = 0;
    extensions_type extensions;
};

account_address_create_operation

Changed parameters fee:

struct fee_parameters_type
{
    uint64_t fee             = 5*ECHO_BLOCKCHAIN_PRECISION; ///< the cost to register the cheapest non-free account
    uint32_t price_per_kbyte = ECHO_BLOCKCHAIN_PRECISION;
};

committee_member_create_operation

Field eth_address now a set of bytes serialized as vector<char> of size 20.

committee_member_update_operation

Field new_eth_address now a set of bytes serialized as vector<char> of size 20.

withdraw_eth_operation

Field eth_addr now a set of bytes serialized as vector<char> of size 20.

register_erc20_token_operation

Used to register a token in the sidechain.

struct register_erc20_token_operation
{
    asset fee;

    account_id_type account;
    eth_address_type eth_addr; // address of the contract in ethereum

    extensions_type extensions;
};

deposit_erc20_token_operation

An internal operation by which committee members confirm the entry of tokens.

struct deposit_erc20_token_operation
    asset fee;
    
    account_id_type committee_member_id;
    std::vector<account_id_type> malicious_committeemen;

    account_id_type account;
    eth_address_type erc20_token_addr; // address of the contract in ethereum
    std::string value;
    sha256 transaction_hash;

    extensions_type extensions;
};

withdraw_erc20_token_operation

Executed by the user and initiates the withdrawal of the token from the Echo network to the specified address.

struct withdraw_erc20_token_operation
{
    asset fee;

    account_id_type account;
    eth_address_type to; // withdrawal address
    erc20_token_id_type erc20_token; // contract id of the token
    std::string value;

    extensions_type extensions;
};

approve_erc20_token_withdraw_operation

An internal operation by which committee members confirm the removal of tokens.

struct approve_erc20_token_withdraw_operation
{
    asset fee;

    account_id_type committee_member_id;
    eth_address_type to;
    std::string value;
    sha256 transaction_hash;

    extensions_type extensions;
};

malicious_committeemen_object

class malicious_committeemen_object
{
    object_id_type related;
    std::map<std::vector<account_id_type>, uint16_t> sets_of_malicious;
};

erc20_token_object

class erc20_token_object : public abstract_object<erc20_token_object>
{
    account_id_type owner;
    eth_address_type eth_addr;
    contract_id_type contract;
};

deposit_erc20_token_object

class deposit_erc20_token_object : public abstract_object<deposit_erc20_token_object>
{
    account_id_type account;
    eth_address_type erc20_addr;
    std::string value;
    sha256 transaction_hash;

    bool is_approved = false;
    set<account_id_type> approves;
};

withdraw_erc20_token_object

class withdraw_erc20_token_object : public abstract_object<withdraw_erc20_token_object>
{
    uint64_t withdraw_id = 0;
    account_id_type account;
    eth_address_type to;
    erc20_token_id_type erc20_token;
    std::string value;
    sha256 transaction_hash;

    bool is_approved = false;
    set<account_id_type> approves;
};

sidechain::config

eth_contract_address - now is a set of bytes with a length of 20.

New field:

    eth_method  eth_withdraw_token_method;
    eth_method  eth_collect_tokens_method;
    std::string erc20_deposit_topic;
    sidechain_fines fines;
    uint32_t waiting_blocks;
struct sidechain_fines
{
    int64_t generate_eth_address;
};
struct config
{
    eth_address_type eth_contract_address;
    eth_method  eth_committee_update_method;
    eth_method  eth_gen_address_method;
    eth_method  eth_withdraw_method;
    eth_method  eth_update_addr_method;
    eth_method  eth_withdraw_token_method;
    eth_method  eth_collect_tokens_method;
    std::string eth_committee_updated_topic;
    std::string eth_gen_address_topic;
    std::string eth_deposit_topic;
    std::string eth_withdraw_topic;
    std::string erc20_deposit_topic;
    graphene::chain::asset_id_type ETH_asset_id;
    sidechain_fines fines;
    uint32_t waiting_blocks;
}