提交 6f0cac9d 编写于 作者: K Kevin Heifner

Moving to non-native transfer

上级 aff77933
...@@ -10,8 +10,16 @@ ...@@ -10,8 +10,16 @@
"fields": [ "fields": [
{"name":"from", "type":"account_name"}, {"name":"from", "type":"account_name"},
{"name":"to", "type":"account_name"}, {"name":"to", "type":"account_name"},
{"name":"quantity", "type":"uint64"} {"name":"quantity", "type":"asset"},
{"name":"memo", "type":"string"}
] ]
},{
"name": "issue",
"base": "",
"fields": [
{"name":"to", "type":"account_name"},
{"name":"quantity", "type":"asset"}
]
},{ },{
"name": "account", "name": "account",
"base": "", "base": "",
...@@ -24,6 +32,9 @@ ...@@ -24,6 +32,9 @@
"actions": [{ "actions": [{
"name": "transfer", "name": "transfer",
"type": "transfer" "type": "transfer"
},{
"name": "issue",
"type": "issue"
} }
], ],
"tables": [{ "tables": [{
......
...@@ -41,14 +41,10 @@ namespace eosiosystem { ...@@ -41,14 +41,10 @@ namespace eosiosystem {
static void apply( account_name code, action_name act ) { static void apply( account_name code, action_name act ) {
if( !eosio::dispatch<contract, if( !eosio::dispatch<contract, regproducer, regproxy>( code, act) ) {
// typename currency::transfer_memo, if ( !eosio::dispatch<currency, typename currency::transfer_memo, typename currency::issue>( code, act ) ) {
// typename currency::issue, assert( false, "received unexpected action" );
regproducer, }
regproxy
>( code, act) )
{
assert( false, "received unexpected action" );
} }
} /// apply } /// apply
}; };
......
...@@ -19,6 +19,7 @@ const static uint64_t system_account_name = N(eosio); ...@@ -19,6 +19,7 @@ const static uint64_t system_account_name = N(eosio);
const static uint64_t nobody_account_name = N(nobody); const static uint64_t nobody_account_name = N(nobody);
const static uint64_t anybody_account_name = N(anybody); const static uint64_t anybody_account_name = N(anybody);
const static uint64_t producers_account_name = N(producers); const static uint64_t producers_account_name = N(producers);
const static uint64_t eosio_system_acount_name = N(eosio.system);
const static uint64_t eosio_auth_scope = N(eosio.auth); const static uint64_t eosio_auth_scope = N(eosio.auth);
const static uint64_t eosio_all_scope = N(eosio.all); const static uint64_t eosio_all_scope = N(eosio.all);
......
...@@ -222,7 +222,6 @@ struct faucet_testnet_plugin_impl { ...@@ -222,7 +222,6 @@ struct faucet_testnet_plugin_impl {
auto& plugin = _app.get_plugin<chain_plugin>(); auto& plugin = _app.get_plugin<chain_plugin>();
plugin.get_chain_id(chainid); plugin.get_chain_id(chainid);
chain_controller& cc = plugin.chain(); chain_controller& cc = plugin.chain();
const uint64_t deposit = 1;
signed_transaction trx; signed_transaction trx;
auto memo = fc::variant(fc::time_point::now()).as_string() + " " + fc::variant(fc::time_point::now().time_since_epoch()).as_string(); auto memo = fc::variant(fc::time_point::now()).as_string() + " " + fc::variant(fc::time_point::now().time_since_epoch()).as_string();
...@@ -233,7 +232,7 @@ struct faucet_testnet_plugin_impl { ...@@ -233,7 +232,7 @@ struct faucet_testnet_plugin_impl {
auto recovery_auth = chain::authority{1, {}, {{{_create_account_name, "active"}, 1}}}; auto recovery_auth = chain::authority{1, {}, {{{_create_account_name, "active"}, 1}}};
trx.actions.emplace_back(vector<chain::permission_level>{{_create_account_name,"active"}}, trx.actions.emplace_back(vector<chain::permission_level>{{_create_account_name,"active"}},
contracts::newaccount{_create_account_name, new_account_name, owner_auth, active_auth, recovery_auth, deposit}); contracts::newaccount{_create_account_name, new_account_name, owner_auth, active_auth, recovery_auth});
trx.expiration = cc.head_block_time() + fc::seconds(30); trx.expiration = cc.head_block_time() + fc::seconds(30);
trx.set_reference_block(cc.head_block_id()); trx.set_reference_block(cc.head_block_id());
......
...@@ -75,14 +75,14 @@ struct txn_test_gen_plugin_impl { ...@@ -75,14 +75,14 @@ struct txn_test_gen_plugin_impl {
signed_transaction trx; signed_transaction trx;
trx.expiration = cc.head_block_time() + fc::seconds(30); trx.expiration = cc.head_block_time() + fc::seconds(30);
trx.set_reference_block(cc.head_block_id()); trx.set_reference_block(cc.head_block_id());
trx.actions.emplace_back(vector<chain::permission_level>{{creator,"active"}}, contracts::lock{creator, creator, 300}); //todo trx.actions.emplace_back(vector<chain::permission_level>{{creator,"active"}}, contracts::lock{creator, creator, 300});
//create "A" account //create "A" account
{ {
auto owner_auth = eosio::chain::authority{1, {{txn_text_receiver_A_pub_key, 1}}, {}}; auto owner_auth = eosio::chain::authority{1, {{txn_text_receiver_A_pub_key, 1}}, {}};
auto active_auth = eosio::chain::authority{1, {{txn_text_receiver_A_pub_key, 1}}, {}}; auto active_auth = eosio::chain::authority{1, {{txn_text_receiver_A_pub_key, 1}}, {}};
auto recovery_auth = eosio::chain::authority{1, {}, {{{creator, "active"}, 1}}}; auto recovery_auth = eosio::chain::authority{1, {}, {{{creator, "active"}, 1}}};
trx.actions.emplace_back(vector<chain::permission_level>{{creator,"active"}}, contracts::newaccount{creator, newaccountA, owner_auth, active_auth, recovery_auth, stake}); //todo trx.actions.emplace_back(vector<chain::permission_level>{{creator,"active"}}, contracts::newaccount{creator, newaccountA, owner_auth, active_auth, recovery_auth, stake});
} }
//create "B" account //create "B" account
{ {
...@@ -90,7 +90,7 @@ struct txn_test_gen_plugin_impl { ...@@ -90,7 +90,7 @@ struct txn_test_gen_plugin_impl {
auto active_auth = eosio::chain::authority{1, {{txn_text_receiver_B_pub_key, 1}}, {}}; auto active_auth = eosio::chain::authority{1, {{txn_text_receiver_B_pub_key, 1}}, {}};
auto recovery_auth = eosio::chain::authority{1, {}, {{{creator, "active"}, 1}}}; auto recovery_auth = eosio::chain::authority{1, {}, {{{creator, "active"}, 1}}};
trx.actions.emplace_back(vector<chain::permission_level>{{creator,"active"}}, contracts::newaccount{creator, newaccountB, owner_auth, active_auth, recovery_auth, stake}); //todo trx.actions.emplace_back(vector<chain::permission_level>{{creator,"active"}}, contracts::newaccount{creator, newaccountB, owner_auth, active_auth, recovery_auth, stake});
} }
trx.sign(creator_priv_key, chainid); trx.sign(creator_priv_key, chainid);
cc.push_transaction(trx); cc.push_transaction(trx);
......
...@@ -831,22 +831,28 @@ int main( int argc, char** argv ) { ...@@ -831,22 +831,28 @@ int main( int argc, char** argv ) {
transfer->add_flag("-s,--skip-sign", skip_sign, localized("Specify that unlocked wallet keys should not be used to sign transaction")); transfer->add_flag("-s,--skip-sign", skip_sign, localized("Specify that unlocked wallet keys should not be used to sign transaction"));
add_standard_transaction_options(transfer); add_standard_transaction_options(transfer);
transfer->set_callback([&] { transfer->set_callback([&] {
auto transfer = fc::mutable_variant_object
("from", sender)
("to", recipient)
("quantity", asset(amount))
("memo", memo);
auto args = fc::mutable_variant_object
("code", name(config::eosio_system_acount_name))
("action", "transfer")
("args", transfer);
cerr << "before call" << endl;
auto result = call(json_to_bin_func, args);
cerr << "after call" << endl;
signed_transaction trx; signed_transaction trx;
trx.actions.emplace_back(vector<chain::permission_level>{{sender,"active"}},
config::eosio_system_acount_name, "transfer", result.get_object()["binargs"].as<bytes>());
if (tx_force_unique) { if (tx_force_unique) {
if (memo.size() == 0) { trx.actions.emplace_back( generate_nonce() );
// use the memo to add a nonce
memo = fc::to_string(generate_nonce_value());
} else {
// add a nonce actions
trx.actions.emplace_back( generate_nonce() );
}
} }
trx.actions.emplace_back( vector<chain::permission_level>{{sender,"active"}},
contracts::transfer{ .from = sender, .to = recipient, .amount = amount, .memo = memo});
auto info = get_info(); auto info = get_info();
trx.expiration = info.head_block_time + tx_expiration; trx.expiration = info.head_block_time + tx_expiration;
trx.set_reference_block( info.head_block_id); trx.set_reference_block( info.head_block_id);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册