This repository was archived by the owner on Aug 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 513
Authorization problem when calling ”eosio.token::transfer“ action in another contract #498
Copy link
Copy link
Open
Description
I called eosio::token transfer action in contractA's method "method1" as rex's deposit action like this:
but why I encountered this error as follows, it seems checking authorizaions cannot find provided_permissions and provided_keys.
cleos push action user1 method1 ‘[“user1”,”user2","1.00000000 TBC”,”send TBC”]’ -p
user1@active
Error 3090003: Provided keys, permissions, and delays do not satisfy declared authorizations
Ensure that you have the related private keys inside your wallet and your wallet is unlocked.
Error Details:
transaction declares authority '${auth}', but does not have signatures for it under a provided
delay of 0 ms, provided permissions ${provided_permissions}, provided keys
${provided_keys}, and a delay max limit of 3888000000 ms
my code:
#include <eosio.system/eosio.system.hpp>
#include <eosio.token/eosio.token.hpp>
using eosio::token;
using eosiosystem::system_contract;
void contractA::method1(const name &from,
const name &to,
const asset &quantity,
const string &memo) {
check(from != to, "cannot transfer to self");
require_auth(from);
check(is_account(to), "to account does not exist");
auto sym = quantity.symbol.code();
symbol fee_sym = st.supply.symbol;
int64_t amount = st.fee;
asset fee = asset(amount, fee_sym);
auto payer = has_auth(to) ? to : from;
token::transfer_action transfer_act{
system_contract::token_account,
{ payer, system_contract::active_permission }
};
transfer_act.send( payer, to, fee, "fee");
}
Metadata
Metadata
Assignees
Labels
No labels
