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?