Code formatting
This commit is contained in:
parent
7689d5adc0
commit
cfaf31e705
5 changed files with 887 additions and 890 deletions
|
|
@ -57,7 +57,7 @@ typedef fc::static_variant<
|
||||||
delegate_vesting_shares_operation>
|
delegate_vesting_shares_operation>
|
||||||
ethereum_operation;
|
ethereum_operation;
|
||||||
|
|
||||||
}}} // namespace graphene::peerplays_sidechain::hive
|
}}} // namespace graphene::peerplays_sidechain::ethereum
|
||||||
|
|
||||||
namespace fc {
|
namespace fc {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
#include <graphene/peerplays_sidechain/ethereum/operations.hpp>
|
#include <graphene/peerplays_sidechain/ethereum/operations.hpp>
|
||||||
|
|
||||||
namespace graphene { namespace peerplays_sidechain { namespace ethereum {
|
namespace graphene { namespace peerplays_sidechain { namespace ethereum {
|
||||||
typedef fc::ecc::private_key private_key_type;
|
typedef fc::ecc::private_key private_key_type;
|
||||||
typedef fc::sha256 chain_id_type;
|
typedef fc::sha256 chain_id_type;
|
||||||
|
|
||||||
class transaction {
|
class transaction {
|
||||||
|
|
@ -29,7 +29,7 @@ public:
|
||||||
void set_expiration(fc::time_point_sec expiration_time);
|
void set_expiration(fc::time_point_sec expiration_time);
|
||||||
void set_reference_block(const block_id_type &reference_block);
|
void set_reference_block(const block_id_type &reference_block);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
/// Serialises this transaction to an RLPStream.
|
/// Serialises this transaction to an RLPStream.
|
||||||
/// @throws TransactionIsUnsigned if including signature was requested but it was not initialized
|
/// @throws TransactionIsUnsigned if including signature was requested but it was not initialized
|
||||||
void streamRLP(RLPStream& _s, IncludeSignature _sig = WithSignature, bool _forEip155hash = false) const;
|
void streamRLP(RLPStream& _s, IncludeSignature _sig = WithSignature, bool _forEip155hash = false) const;
|
||||||
|
|
|
||||||
|
|
@ -14,257 +14,256 @@
|
||||||
#include <fc/api.hpp>
|
#include <fc/api.hpp>
|
||||||
#include <fc/log/logger.hpp>
|
#include <fc/log/logger.hpp>
|
||||||
|
|
||||||
#include <websocketpp/config/asio_client.hpp>
|
|
||||||
#include <websocketpp/client.hpp>
|
#include <websocketpp/client.hpp>
|
||||||
|
#include <websocketpp/config/asio_client.hpp>
|
||||||
|
|
||||||
#include <fc/thread/thread.hpp>
|
#include <fc/thread/thread.hpp>
|
||||||
|
|
||||||
#include <boost/multiprecision/cpp_int.hpp>
|
#include <boost/multiprecision/cpp_int.hpp>
|
||||||
|
|
||||||
using namespace boost::multiprecision::literals;
|
using namespace boost::multiprecision::literals;
|
||||||
using u256 = boost::multiprecision::number<boost::multiprecision::cpp_int_backend<256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void>>;
|
using u256 = boost::multiprecision::number<boost::multiprecision::cpp_int_backend<256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void>>;
|
||||||
using s256 = boost::multiprecision::number<boost::multiprecision::cpp_int_backend<256, 256, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, void>>;
|
using s256 = boost::multiprecision::number<boost::multiprecision::cpp_int_backend<256, 256, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, void>>;
|
||||||
u256 constexpr Invalid256 = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff_cppui256;
|
u256 constexpr Invalid256 = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff_cppui256;
|
||||||
using byte = uint8_t;
|
using byte = uint8_t;
|
||||||
using bytes = std::vector<byte>;
|
using bytes = std::vector<byte>;
|
||||||
|
|
||||||
|
|
||||||
namespace graphene { namespace peerplays_sidechain {
|
namespace graphene { namespace peerplays_sidechain {
|
||||||
|
|
||||||
typedef websocketpp::client<websocketpp::config::asio_client> client;
|
typedef websocketpp::client<websocketpp::config::asio_client> client;
|
||||||
|
|
||||||
using websocketpp::lib::placeholders::_1;
|
using websocketpp::lib::bind;
|
||||||
using websocketpp::lib::placeholders::_2;
|
using websocketpp::lib::placeholders::_1;
|
||||||
using websocketpp::lib::bind;
|
using websocketpp::lib::placeholders::_2;
|
||||||
|
|
||||||
// pull out the type of messages sent by our config
|
// pull out the type of messages sent by our config
|
||||||
typedef websocketpp::config::asio_tls_client::message_type::ptr message_ptr;
|
typedef websocketpp::config::asio_tls_client::message_type::ptr message_ptr;
|
||||||
typedef websocketpp::lib::shared_ptr<boost::asio::ssl::context> context_ptr;
|
typedef websocketpp::lib::shared_ptr<boost::asio::ssl::context> context_ptr;
|
||||||
typedef client::connection_ptr connection_ptr;
|
typedef client::connection_ptr connection_ptr;
|
||||||
|
|
||||||
class eth_rpc_client {
|
class eth_rpc_client {
|
||||||
public:
|
public:
|
||||||
typedef eth_rpc_client type;
|
typedef eth_rpc_client type;
|
||||||
|
|
||||||
enum req_t {
|
enum req_t {
|
||||||
ETH_CHAIN_ID,
|
ETH_CHAIN_ID,
|
||||||
ETH_GET_TRANSACTION_RECEIPT,
|
ETH_GET_TRANSACTION_RECEIPT,
|
||||||
ETH_CALL,
|
ETH_CALL,
|
||||||
ETH_SEND_TRANSACTION,
|
ETH_SEND_TRANSACTION,
|
||||||
ETH_SEND_RAW_TRANSACTION,
|
ETH_SEND_RAW_TRANSACTION,
|
||||||
ETH_GET_CODE,
|
ETH_GET_CODE,
|
||||||
ETH_GET_BALANCE,
|
ETH_GET_BALANCE,
|
||||||
ETH_SIGN,
|
ETH_SIGN,
|
||||||
ETH_COINBASE,
|
ETH_COINBASE,
|
||||||
GET_LIST_OWNERS,
|
GET_LIST_OWNERS,
|
||||||
ADD_OWNER,
|
ADD_OWNER,
|
||||||
REMOVE_OWNER
|
REMOVE_OWNER
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class multi_type {
|
enum class multi_type {
|
||||||
script,
|
script,
|
||||||
address
|
address
|
||||||
};
|
};
|
||||||
struct multi_params {
|
struct multi_params {
|
||||||
multi_params(multi_type _type, const std::string &_address_or_script, const std::string &_label = "") :
|
multi_params(multi_type _type, const std::string &_address_or_script, const std::string &_label = "") :
|
||||||
type{_type},
|
type{_type},
|
||||||
address_or_script{_address_or_script},
|
address_or_script{_address_or_script},
|
||||||
label{_label} {
|
label{_label} {
|
||||||
}
|
}
|
||||||
|
|
||||||
multi_type type;
|
multi_type type;
|
||||||
std::string address_or_script;
|
std::string address_or_script;
|
||||||
std::string label;
|
std::string label;
|
||||||
};
|
};
|
||||||
|
|
||||||
eth_rpc_client(const std::string &url, const std::string &user_name, const std::string &password, bool debug_rpc_calls);
|
eth_rpc_client(const std::string &url, const std::string &user_name, const std::string &password, bool debug_rpc_calls);
|
||||||
|
|
||||||
void start();
|
void start();
|
||||||
void stop();
|
void stop();
|
||||||
void on_socket_init(websocketpp::connection_hdl);
|
void on_socket_init(websocketpp::connection_hdl);
|
||||||
void on_fail(websocketpp::connection_hdl hdl);
|
void on_fail(websocketpp::connection_hdl hdl);
|
||||||
void on_open(websocketpp::connection_hdl hdl);
|
void on_open(websocketpp::connection_hdl hdl);
|
||||||
void on_message(websocketpp::connection_hdl hdl, message_ptr msg);
|
void on_message(websocketpp::connection_hdl hdl, message_ptr msg);
|
||||||
void on_close(websocketpp::connection_hdl);
|
void on_close(websocketpp::connection_hdl);
|
||||||
|
|
||||||
uint64_t get_chain_id();
|
uint64_t get_chain_id();
|
||||||
uint64_t eth_getTransactionReceipt(const std::string& tx_id);
|
uint64_t eth_getTransactionReceipt(const std::string &tx_id);
|
||||||
uint64_t eth_call(const std::string& to, const std::string& data);
|
uint64_t eth_call(const std::string &to, const std::string &data);
|
||||||
uint64_t eth_sendTransaction(const std::string& from, const std::string& to, const std::string& data);
|
uint64_t eth_sendTransaction(const std::string &from, const std::string &to, const std::string &data);
|
||||||
uint64_t eth_sendRawTransaction(const std::string& params);
|
uint64_t eth_sendRawTransaction(const std::string ¶ms);
|
||||||
uint64_t eth_getCode(const std::string& addr);
|
uint64_t eth_getCode(const std::string &addr);
|
||||||
uint64_t eth_getBalance(const std::string& addr);
|
uint64_t eth_getBalance(const std::string &addr);
|
||||||
uint64_t eth_sign(const string& addr, const string& message);
|
uint64_t eth_sign(const string &addr, const string &message);
|
||||||
uint64_t eth_coinbase();
|
uint64_t eth_coinbase();
|
||||||
|
|
||||||
uint64_t get_list_owners(const std::string& safe_account);
|
uint64_t get_list_owners(const std::string &safe_account);
|
||||||
uint64_t add_owner(const std::string& addr );
|
uint64_t add_owner(const std::string &addr);
|
||||||
uint64_t remove_owner(const std::string& addr, uint32_t threshold);
|
uint64_t remove_owner(const std::string &addr, uint32_t threshold);
|
||||||
|
|
||||||
std::string addmultisigaddress(const uint32_t nrequired, const std::vector<std::string> public_keys);
|
std::string addmultisigaddress(const uint32_t nrequired, const std::vector<std::string> public_keys);
|
||||||
std::string combinepsbt(const vector<std::string> &psbts);
|
std::string combinepsbt(const vector<std::string> &psbts);
|
||||||
|
|
||||||
uint64_t createmultisig(const uint32_t nrequired, const std::vector<std::string> owner_addresses, const std::string &private_key);
|
uint64_t createmultisig(const uint32_t nrequired, const std::vector<std::string> owner_addresses, const std::string &private_key);
|
||||||
|
|
||||||
std::string createpsbt();
|
std::string createpsbt();
|
||||||
std::string createrawtransaction();
|
std::string createrawtransaction();
|
||||||
std::string createwallet(const std::string &wallet_name);
|
std::string createwallet(const std::string &wallet_name);
|
||||||
std::string decodepsbt(std::string const &tx_psbt);
|
std::string decodepsbt(std::string const &tx_psbt);
|
||||||
std::string decoderawtransaction(std::string const &tx_hex);
|
std::string decoderawtransaction(std::string const &tx_hex);
|
||||||
std::string encryptwallet(const std::string &passphrase);
|
std::string encryptwallet(const std::string &passphrase);
|
||||||
uint64_t estimatesmartfee(uint16_t conf_target = 128);
|
uint64_t estimatesmartfee(uint16_t conf_target = 128);
|
||||||
std::string finalizepsbt(std::string const &tx_psbt);
|
std::string finalizepsbt(std::string const &tx_psbt);
|
||||||
std::string getaddressinfo(const std::string &address);
|
std::string getaddressinfo(const std::string &address);
|
||||||
std::string getblock(const std::string &block_hash, int32_t verbosity = 2);
|
std::string getblock(const std::string &block_hash, int32_t verbosity = 2);
|
||||||
std::string getrawtransaction(const std::string &txid, const bool verbose = false);
|
std::string getrawtransaction(const std::string &txid, const bool verbose = false);
|
||||||
std::string getnetworkinfo();
|
std::string getnetworkinfo();
|
||||||
std::string gettransaction(const std::string &txid, const bool include_watch_only = false);
|
std::string gettransaction(const std::string &txid, const bool include_watch_only = false);
|
||||||
std::string getblockchaininfo();
|
std::string getblockchaininfo();
|
||||||
void importaddress(const std::string &address_or_script, const std::string &label = "", const bool rescan = true, const bool p2sh = false);
|
void importaddress(const std::string &address_or_script, const std::string &label = "", const bool rescan = true, const bool p2sh = false);
|
||||||
void importmulti(const std::vector<multi_params> &address_or_script_array, const bool rescan = true);
|
void importmulti(const std::vector<multi_params> &address_or_script_array, const bool rescan = true);
|
||||||
std::string loadwallet(const std::string &filename);
|
std::string loadwallet(const std::string &filename);
|
||||||
std::string sendrawtransaction(const std::string &tx_hex);
|
std::string sendrawtransaction(const std::string &tx_hex);
|
||||||
std::string signrawtransactionwithwallet(const std::string &tx_hash);
|
std::string signrawtransactionwithwallet(const std::string &tx_hash);
|
||||||
std::string unloadwallet(const std::string &filename);
|
std::string unloadwallet(const std::string &filename);
|
||||||
std::string walletlock();
|
std::string walletlock();
|
||||||
std::string walletprocesspsbt(std::string const &tx_psbt);
|
std::string walletprocesspsbt(std::string const &tx_psbt);
|
||||||
bool walletpassphrase(const std::string &passphrase, uint32_t timeout = 60);
|
bool walletpassphrase(const std::string &passphrase, uint32_t timeout = 60);
|
||||||
|
|
||||||
std::string chain_id;//256 bit value
|
std::string chain_id; //256 bit value
|
||||||
std::vector<std::string> owners;
|
std::vector<std::string> owners;
|
||||||
std::string safe_account_addr;
|
std::string safe_account_addr;
|
||||||
private:
|
|
||||||
/// Encodes an Ethereum transaction for exporting in JSON
|
|
||||||
class Transaction
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
/// JSON serialization
|
|
||||||
std::string serialize(const std::string& from, const std::string& to, const std::string& tx_id, u256 const& _value, u256 const& _gasPrice, u256 const& _gas, bytes const& _data, u256 const& _nonce = Invalid256);
|
|
||||||
protected:
|
|
||||||
/// Type of transaction.
|
|
||||||
enum Type
|
|
||||||
{
|
|
||||||
NullTransaction, ///< Null transaction.
|
|
||||||
ContractCreation, ///< Transaction to create contracts - receiveAddress() is ignored.
|
|
||||||
MessageCall ///< Transaction to invoke a message call - receiveAddress() is used.
|
|
||||||
};
|
|
||||||
|
|
||||||
Type m_type = NullTransaction; ///< Is this a contract-creation transaction or a message-call transaction?
|
private:
|
||||||
u256 m_nonce; ///< The transaction-count of the sender.
|
/// Encodes an Ethereum transaction for exporting in JSON
|
||||||
u256 m_value; ///< The amount of ETH to be transferred by this transaction. Called 'endowment' for contract-creation transactions.
|
class Transaction {
|
||||||
u256 m_gasPrice; ///< The base fee and thus the implied exchange rate of ETH to GAS.
|
public:
|
||||||
u256 m_gas; ///< The total gas to convert, paid for from sender's account. Any unused gas gets refunded once the contract is ended.
|
/// JSON serialization
|
||||||
bytes m_data; ///< The data associated with the transaction, or the initialiser if it's a creation transaction.
|
std::string serialize(const std::string &from, const std::string &to, const std::string &tx_id, u256 const &_value, u256 const &_gasPrice, u256 const &_gas, bytes const &_data, u256 const &_nonce = Invalid256);
|
||||||
};
|
|
||||||
|
|
||||||
class ethereum_function_call_encoder {
|
protected:
|
||||||
public:
|
/// Type of transaction.
|
||||||
enum operation_t {
|
enum Type {
|
||||||
OPERATION_CALL,
|
NullTransaction, ///< Null transaction.
|
||||||
OPERATION_DELEGATE_CALL
|
ContractCreation, ///< Transaction to create contracts - receiveAddress() is ignored.
|
||||||
};
|
MessageCall ///< Transaction to invoke a message call - receiveAddress() is used.
|
||||||
|
};
|
||||||
|
|
||||||
static constexpr const char*const default_prev_addr = "0000000000000000000000000000000000000001";
|
Type m_type = NullTransaction; ///< Is this a contract-creation transaction or a message-call transaction?
|
||||||
|
u256 m_nonce; ///< The transaction-count of the sender.
|
||||||
|
u256 m_value; ///< The amount of ETH to be transferred by this transaction. Called 'endowment' for contract-creation transactions.
|
||||||
|
u256 m_gasPrice; ///< The base fee and thus the implied exchange rate of ETH to GAS.
|
||||||
|
u256 m_gas; ///< The total gas to convert, paid for from sender's account. Any unused gas gets refunded once the contract is ended.
|
||||||
|
bytes m_data; ///< The data associated with the transaction, or the initialiser if it's a creation transaction.
|
||||||
|
};
|
||||||
|
|
||||||
std::string encode_function_signature(const std::string& function_signature);
|
class ethereum_function_call_encoder {
|
||||||
std::string encode_address(const std::string& addr);
|
public:
|
||||||
std::string encode_uint256(const std::string& value);
|
enum operation_t {
|
||||||
std::string encode_uint8(uint8_t value);
|
OPERATION_CALL,
|
||||||
std::string encode_bytes(const std::string& values);
|
OPERATION_DELEGATE_CALL
|
||||||
};
|
};
|
||||||
|
|
||||||
class safe_transaction_encoder {
|
static constexpr const char *const default_prev_addr = "0000000000000000000000000000000000000001";
|
||||||
public:
|
|
||||||
static constexpr const char*const default_safe_tx_gas = "0";
|
|
||||||
static constexpr const char*const default_data_gas = "0";
|
|
||||||
static constexpr const char*const default_gas_price = "0";
|
|
||||||
static constexpr const char*const default_gas_token = "0000000000000000000000000000000000000000";
|
|
||||||
static constexpr const char*const default_refund_receiver = "0000000000000000000000000000000000000000";
|
|
||||||
|
|
||||||
std::string create_safe_address(const std::vector<std::string>& owner_addresses, uint32_t threshold);
|
std::string encode_function_signature(const std::string &function_signature);
|
||||||
std::string build_transaction(const std::string& safe_account_addr, const std::string& value, const std::string& data, uint8_t operation, const std::string& safeTxGas, const std::string& dataGas, const std::string& gasPrice, const std::string& gasToken, const std::string& refundReceiver);
|
std::string encode_address(const std::string &addr);
|
||||||
|
std::string encode_uint256(const std::string &value);
|
||||||
|
std::string encode_uint8(uint8_t value);
|
||||||
|
std::string encode_bytes(const std::string &values);
|
||||||
|
};
|
||||||
|
|
||||||
private:
|
class safe_transaction_encoder {
|
||||||
ethereum_function_call_encoder m_ethereum_function_call_encoder;
|
public:
|
||||||
};
|
static constexpr const char *const default_safe_tx_gas = "0";
|
||||||
|
static constexpr const char *const default_data_gas = "0";
|
||||||
|
static constexpr const char *const default_gas_price = "0";
|
||||||
|
static constexpr const char *const default_gas_token = "0000000000000000000000000000000000000000";
|
||||||
|
static constexpr const char *const default_refund_receiver = "0000000000000000000000000000000000000000";
|
||||||
|
|
||||||
ethereum_function_call_encoder m_ethereum_function_call_encoder;
|
std::string create_safe_address(const std::vector<std::string> &owner_addresses, uint32_t threshold);
|
||||||
safe_transaction_encoder m_safe_transaction_encoder;
|
std::string build_transaction(const std::string &safe_account_addr, const std::string &value, const std::string &data, uint8_t operation, const std::string &safeTxGas, const std::string &dataGas, const std::string &gasPrice, const std::string &gasToken, const std::string &refundReceiver);
|
||||||
|
|
||||||
std::shared_ptr<fc::thread> _thread;
|
private:
|
||||||
std::string signature;
|
ethereum_function_call_encoder m_ethereum_function_call_encoder;
|
||||||
std::string geth_url;
|
};
|
||||||
uint64_t t_id;
|
|
||||||
std::string account_address;
|
|
||||||
std::string transaction_id;
|
|
||||||
uint32_t threshold;
|
|
||||||
std::unordered_map<uint64_t, req_t> m_requests;
|
|
||||||
std::string balance;
|
|
||||||
std::string code;
|
|
||||||
|
|
||||||
std::string ip;
|
ethereum_function_call_encoder m_ethereum_function_call_encoder;
|
||||||
uint32_t rpc_port;
|
safe_transaction_encoder m_safe_transaction_encoder;
|
||||||
std::string user;
|
|
||||||
std::string password;
|
|
||||||
std::string wallet;
|
|
||||||
std::string wallet_password;
|
|
||||||
bool debug_rpc_calls;
|
|
||||||
|
|
||||||
fc::http::header authorization;
|
std::shared_ptr<fc::thread> _thread;
|
||||||
|
std::string signature;
|
||||||
|
std::string geth_url;
|
||||||
|
uint64_t t_id;
|
||||||
|
std::string account_address;
|
||||||
|
std::string transaction_id;
|
||||||
|
uint32_t threshold;
|
||||||
|
std::unordered_map<uint64_t, req_t> m_requests;
|
||||||
|
std::string balance;
|
||||||
|
std::string code;
|
||||||
|
|
||||||
client m_endpoint;
|
std::string ip;
|
||||||
websocketpp::connection_hdl m_hdl;
|
uint32_t rpc_port;
|
||||||
};
|
std::string user;
|
||||||
|
std::string password;
|
||||||
|
std::string wallet;
|
||||||
|
std::string wallet_password;
|
||||||
|
bool debug_rpc_calls;
|
||||||
|
|
||||||
// =============================================================================
|
fc::http::header authorization;
|
||||||
|
|
||||||
class sidechain_net_handler_eth : public sidechain_net_handler {
|
client m_endpoint;
|
||||||
public:
|
websocketpp::connection_hdl m_hdl;
|
||||||
sidechain_net_handler_eth(peerplays_sidechain_plugin &_plugin, const boost::program_options::variables_map &options);
|
};
|
||||||
virtual ~sidechain_net_handler_eth();
|
|
||||||
|
|
||||||
bool process_proposal(const proposal_object &po);
|
// =============================================================================
|
||||||
void process_primary_wallet();
|
|
||||||
void process_sidechain_addresses();
|
|
||||||
bool process_deposit(const son_wallet_deposit_object &swdo);
|
|
||||||
bool process_withdrawal(const son_wallet_withdraw_object &swwo);
|
|
||||||
std::string process_sidechain_transaction(const sidechain_transaction_object &sto);
|
|
||||||
std::string send_sidechain_transaction(const sidechain_transaction_object &sto);
|
|
||||||
bool settle_sidechain_transaction(const sidechain_transaction_object &sto, asset &settle_amount);
|
|
||||||
|
|
||||||
private:
|
class sidechain_net_handler_ethereum : public sidechain_net_handler {
|
||||||
std::string url;
|
public:
|
||||||
uint32_t rpc_port;
|
sidechain_net_handler_ethereum(peerplays_sidechain_plugin &_plugin, const boost::program_options::variables_map &options);
|
||||||
|
virtual ~sidechain_net_handler_ethereum();
|
||||||
|
|
||||||
std::string rpc_user;
|
bool process_proposal(const proposal_object &po);
|
||||||
std::string rpc_password;
|
void process_primary_wallet();
|
||||||
std::string wallet;
|
void process_sidechain_addresses();
|
||||||
std::string wallet_password;
|
bool process_deposit(const son_wallet_deposit_object &swdo);
|
||||||
|
bool process_withdrawal(const son_wallet_withdraw_object &swwo);
|
||||||
|
std::string process_sidechain_transaction(const sidechain_transaction_object &sto);
|
||||||
|
std::string send_sidechain_transaction(const sidechain_transaction_object &sto);
|
||||||
|
bool settle_sidechain_transaction(const sidechain_transaction_object &sto, asset &settle_amount);
|
||||||
|
|
||||||
std::unique_ptr<eth_rpc_client> eth_client;
|
private:
|
||||||
|
std::string url;
|
||||||
|
uint32_t rpc_port;
|
||||||
|
|
||||||
fc::future<void> on_changed_objects_task;
|
std::string rpc_user;
|
||||||
|
std::string rpc_password;
|
||||||
|
std::string wallet;
|
||||||
|
std::string wallet_password;
|
||||||
|
|
||||||
std::mutex event_handler_mutex;
|
std::unique_ptr<eth_rpc_client> eth_client;
|
||||||
typedef std::lock_guard<decltype(event_handler_mutex)> scoped_lock;
|
|
||||||
|
|
||||||
std::string create_primary_wallet_address(const std::vector<son_info> &son_pubkeys);
|
fc::future<void> on_changed_objects_task;
|
||||||
|
|
||||||
std::string create_primary_wallet_transaction(const son_wallet_object &prev_swo, std::string new_sw_address);
|
std::mutex event_handler_mutex;
|
||||||
std::string create_deposit_transaction(const son_wallet_deposit_object &swdo);
|
typedef std::lock_guard<decltype(event_handler_mutex)> scoped_lock;
|
||||||
std::string create_withdrawal_transaction(const son_wallet_withdraw_object &swwo);
|
|
||||||
|
|
||||||
std::string create_transaction();
|
std::string create_primary_wallet_address(const std::vector<son_info> &son_pubkeys);
|
||||||
std::string sign_transaction(const sidechain_transaction_object &sto);
|
|
||||||
std::string send_transaction(const sidechain_transaction_object &sto);
|
|
||||||
|
|
||||||
void handle_event(const std::string &event_data);
|
std::string create_primary_wallet_transaction(const son_wallet_object &prev_swo, std::string new_sw_address);
|
||||||
std::vector<info_for_vin> extract_info_from_block(const std::string &_block);
|
std::string create_deposit_transaction(const son_wallet_deposit_object &swdo);
|
||||||
void on_changed_objects(const vector<object_id_type> &ids, const flat_set<account_id_type> &accounts);
|
std::string create_withdrawal_transaction(const son_wallet_withdraw_object &swwo);
|
||||||
void on_changed_objects_cb(const vector<object_id_type> &ids, const flat_set<account_id_type> &accounts);
|
|
||||||
|
|
||||||
std::vector<char> parse_hex(const std::string &str);
|
std::string create_transaction();
|
||||||
fc::ecc::public_key_data create_public_key_data(const std::vector<char> &public_key);
|
std::string sign_transaction(const sidechain_transaction_object &sto);
|
||||||
};
|
std::string send_transaction(const sidechain_transaction_object &sto);
|
||||||
|
|
||||||
|
void handle_event(const std::string &event_data);
|
||||||
|
std::vector<info_for_vin> extract_info_from_block(const std::string &_block);
|
||||||
|
void on_changed_objects(const vector<object_id_type> &ids, const flat_set<account_id_type> &accounts);
|
||||||
|
void on_changed_objects_cb(const vector<object_id_type> &ids, const flat_set<account_id_type> &accounts);
|
||||||
|
|
||||||
|
std::vector<char> parse_hex(const std::string &str);
|
||||||
|
fc::ecc::public_key_data create_public_key_data(const std::vector<char> &public_key);
|
||||||
|
};
|
||||||
|
|
||||||
}} // namespace graphene::peerplays_sidechain
|
}} // namespace graphene::peerplays_sidechain
|
||||||
|
|
|
||||||
|
|
@ -222,8 +222,8 @@ void peerplays_sidechain_plugin_impl::plugin_initialize(const boost::program_opt
|
||||||
|
|
||||||
sidechain_enabled_ethereum = options.at("ethereum-sidechain-enabled").as<bool>();
|
sidechain_enabled_ethereum = options.at("ethereum-sidechain-enabled").as<bool>();
|
||||||
config_ready_ethereum = options.count("ethereum-node-rpc-url");
|
config_ready_ethereum = options.count("ethereum-node-rpc-url");
|
||||||
//options.count("ethereum-address") &&
|
//options.count("ethereum-address") &&
|
||||||
//options.count("ethereum-public-key") && options.count("ethereum-private-key");
|
//options.count("ethereum-public-key") && options.count("ethereum-private-key");
|
||||||
if (!config_ready_ethereum) {
|
if (!config_ready_ethereum) {
|
||||||
wlog("Haven't set up Ethereum sidechain parameters");
|
wlog("Haven't set up Ethereum sidechain parameters");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue