2

Here is my code:

void play(account_name player, asset amount) {
   require_auth(player);

   //The part that is throwing the error
   action {
     permission_level{player, N(active)}, //Using the passed in `player` account as ther permission
     N(eosio.token),
     N(transfer),
     currency::transfer {
         .from=player, .to=_self, .quantity=amount, .memo="Deposit"
       }
    }.send();
}

When I call the function using:

cleos push action mycontract deposit '["myaccount", "30 EOS"]' -p myaccount

This is the error I get:

3192155ms thread-0   http_plugin.cpp:406           handle_exception     ] Exception Details: 3090003 unsatisfied_authorization: provided keys, permissions, and delays do not satisfy declared authorizations
transaction declares authority '{"actor":"myaccount","permission":"active"}', but does not have signatures for it under a provided delay of 0 ms, provided permissions [{"actor":"myaccount","permission":"eosio.code"}], and provided keys []
    {"auth":{"actor":"myaccount","permission":"active"},"provided_delay":0,"provided_permissions":[{"actor":"myaccount","permission":"eosio.code"}],"provided_keys":[],"delay_max_limit_ms":3888000000}
    thread-0  authorization_manager.cpp:409 check_authorization

Is there a way to perform this action with passed in account_name's as the permission?

How would the behavior need to be changed if I deploy this contract to the mainnet?

1

You need to give the caller eosio.code permission. Look at this issue:

https://github.com/EOSIO/eos/issues/4348

|improve this answer|||||
0

Before you push action you can do this:

cleos set account permission youraccount active '{"threshold":
 1,"keys": [{"key": "your pub-key","weight": 1}],"accounts":
 [{"permission":{"actor":"you
 account","permission":"**eosio.code**"},"weight":1}]}' owner -p your
 account
|improve this answer|||||
  • 1
    Hello @fenchen, normally code should be formatted as code block (indenting four spaces or pressing ctrl+k in the editor). But I think the blockquote formatting is ok in this case, as the highlight is needed. – MEE - Reinstate Monica Aug 5 '18 at 14:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.