3

I deployed a contract omes.user. In the reguser(account_name user) action of contract omes.user I want to send an inline action to another contract eosio.token to issue some tokens to user.

Here is the setup. Create accounts eosio.token, omes.token, omes.user. Deploy contracts eosio.token and omes.user. Using eosio.token contract to create token OMES with omes.token as the issuer.

cleos push action eosio.token create '[ "omes.token", "1000000.0000 OMES", 0, 0, 0]' -p eosio.token

omes.token can now issues OMES tokens to accounts.

Add an permission airdrop to omes.token to authorize omes.user. Link the airdrop permission of omes.token to eosio.token issue action.

cleos set account permission omes.token airdrop  '{"threshold":1, "accounts":[{"permission": {"actor":"omes.user", "permission":"active"}, "weight": 1}]}' -p omes.token
cleos set action permission omes.token eosio.token issue airdrop

With above setup, omes.user can issue OMES tokens on behalf of omes.token.

easypayx@easypayxs-MacBook-Pro:~/eosio-commands $ cleos push action eosio.token issue '[ "user", "100.0000 OMES", "memo" ]' -p omes.token@airdrop 

executed transaction: f6543e4412f894a7522f131e9d551db7ebd932e1213e288a4f018c6c2f69a0bd  128 bytes  1875 us
        #   eosio.token <= eosio.token::issue           {"to":"user","quantity":"100.0000 OMES","memo":"memo"}
        #   eosio.token <= eosio.token::transfer        {"from":"omes.token","to":"user","quantity":"100.0000 OMES","memo":"memo"}
        #    omes.token <= eosio.token::transfer        {"from":"omes.token","to":"user","quantity":"100.0000 OMES","memo":"memo"}
        #          user <= eosio.token::transfer        {"from":"omes.token","to":"user","quantity":"100.0000 OMES","memo":"memo"}

Now, in the reguser(account_name user) action of omes.user contract, I want to call eosio.token issue action to issue some OMES tokens to user.

INLINE_ACTION_SENDER(eosio::token, issue)( N(eosio.token), {N(omes.user),N(active)},
              { user, asset(1000, S(4, OMES)), std::string("bid name ") } );

I have tried a lot different combinations for N(eosio.token), {N(omes.user),N(active)} using N(omes.token) and {N(omes.token),N(airdrop)} etc. None of them works. Here is the error I got.

Error 3090003: provided keys, permissions, and delays do not satisfy declared authorizations

So what is wrong with the calling of INLINE_ACTION_SENDER? Is this kind of operation supported by EOS?

0

It seems to be a problem of permission name "active". Following issue is could be helpful. https://github.com/EOSIO/eos/issues/3013

We enhanced the security under Dawn 4.0, you need to set the permission level "kc.code@eosio.code" rather than "kc.code@active". Actions dispatched by code are no longer dispatched with "active" authority, but with a special "eosio.code" authority level.

eos@ubuntu:~/eosio-wallet$ cleos set account permission mk active '{"threshold": 1,"keys": [{"key": "EOS7ijWCBmoXBi3CgtK7DJxentZZeTkeUnaSDvyro9dq7Sd1C3dC4","weight":1}],"accounts": [{"permission":{"actor":"ck.code","permission":"eosio.code"},"weight":1}]}' owner -p mk

Therefore, the issue is a misconfigured authority on account mk.

In your case, you should have {"actor":"omes.user", "permission":"eosio.code"} instead of {"actor":"omes.user", "permission":"active"}

| improve this answer | |
  • The solution decribed in that issue is to add permission eosio.code to user omes.user – friedger Jul 19 '18 at 8:40

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.