Skip to content

Latest commit

 

History

History
237 lines (220 loc) · 7.55 KB

0.6.0.md

File metadata and controls

237 lines (220 loc) · 7.55 KB

0.6.0

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
> 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,
    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,
};

sidechain::config

Used in global_property_object

struct config
{
    std::string eth_contract_address;
    eth_method  eth_committee_update_method;
    eth_method  eth_gen_address_method;
    eth_method  eth_withdraw_method;
    std::string eth_committee_updated_topic;
    std::string eth_gen_address_topic;
    std::string eth_deposit_topic;
    std::string eth_withdraw_topic;
    graphene::chain::asset_id_type ETH_asset_id;
}

struct eth_method
{
    std::string method;
    uint64_t gas;
}

Account addresses

https://echo-dev.io/how-to/generate-address/

Address type - ripemd160(40 char hex string)

address creation

Used to create an address for your account

struct account_address_create_operation 
{
    asset fee;

    account_id_type owner;
    string label;
    extensions_type   extensions;
};

API methods

    vector<account_address_object> get_account_addresses( const account_id_type account_id, const uint64_t from, const unsigned limit, const uint64_t to )const;

    optional<account_id_type> get_account_by_address( const fc::ripemd160 address )const;

Transafer to address

An operation was added to transfer funds to the address:

struct transfer_to_address_operation : public base_operation
{
    asset            fee;
    /// Account to transfer asset from
    account_id_type  from;
    /// Address of account to transfer asset to
    fc::ripemd160  to;
    /// The amount of asset to transfer from @ref from to @ref to
    asset            amount;

    extensions_type   extensions;
}

Ethereum sidechain

Ethereum sidechain allows to transfer ETH in the ethereum blockchain to eETH asset in echo blockchain and eETH back to ETH. In order to deposit ETH user should generate address in ethereum blockchain connected to echo account id and transfer funds to that address. In order to withdraw ETH user should provide any address in ethereum blockchain and withdraw available eETH funds to that address. Both steps are described below in detail.

address generation and deposit

generate_eth_address_operation should be used to generate address in ETH blockchain. After the address is generated eth_address_object(s) will be created in echo db and can be retrieved using get_eth_address method. Until one of the objects will receive sufficient amount of approvals the number of objects connected to account id can be more than one.

    struct generate_eth_address_operation
    {
        asset fee;
        account_id_type account_id;
        extensions_type extensions;
    };
    class eth_address_object
    {
    public:
        account_id_type acc_id;
        std::string eth_addr;
        bool is_approved;
        vector<account_id_type> approves;
    };
    std::vector<eth_address_object > get_eth_address (const account_id_type& acc_id) const;

After the funds are sent to the appropriate ETH address deposit_eth_object(s) will be created in the echo db and can be retrieved using get_deposit_eth method. Again until one of the objects will receive sufficient amount of approvals the number of objects connected to deposit_id can be more than one.

    class deposit_eth_object
    {
    public:
        uint64_t deposit_id;
        account_id_type acc_id;
        uint64_t value;
        bool is_approved;
        vector<account_id_type> approves;
    };
    std::vector<deposit_eth_object > get_deposit_eth (const uint64_t deposit_id ) const;

ETH withdrawal

In order to withdraw ETH user should use withdraw_eth_operation. After the funds will be deposited to provided ethereum address withdraw_eth_object will be created in the echo db and can be retrieved using get_withdraw_eth method. And again until one of the objects will receive sufficient amount of approvals the number of objects connected to withdraw_id can be more than one.

    struct withdraw_eth_operation
    {
        asset fee;
        account_id_type acc_id;
        std::string eth_addr;
        uint64_t value;
        extensions_type extensions;
    };
    class withdraw_eth_object
    {
    public:
        uint64_t withdraw_id;
        account_id_type acc_id;
        std::string eth_addr;
        uint64_t value;
        bool is_approved;
        vector<account_id_type> approves;
    };
    withdraw_eth_object get_withdraw_eth(const uint64_t withdraw_id) const;