1

I’m trying to achieve something quite simple. I try to call eosio.token transfer from one of my smartContract (lomtaxjungle dopurchase), but after severals days i still don’t manage to do it. From what i understand this is a permission issue, so i added the [email protected] to lomtaxjungle active public key. But still when i try to transfer EOS from one account to another with the dopurchase action it returns :

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

So I think there is still something I don’t understand but I can’t figuring out what!

Here is my smart contract code :

ACTION purchase::dopurchase(name from, name to, asset quantity, string memo) 
{
    require_auth(from);

    action
    {
        permission_level{from, "active"_n},
            "eosio.token"_n,
            "transfer"_n,
        std::make_tuple(from, to, quantity, memo)
    }.send();
}

EOSIO_DISPATCH(purchase, (dopurchase))

My lomtaxjungle permissions: https://jungle.bloks.io/account/lomtaxjungle#keys

And my c# call to my contract:

    string result = "";

        result = await esoManager.CreateTransaction(new Transaction()
        {
            actions = new List<EosSharp.Core.Api.v1.Action>()
            {
                new EosSharp.Core.Api.v1.Action()
                {
                    account = "lomtaxjungle",
                    authorization = new List<PermissionLevel>()
                    {
                        new PermissionLevel() {actor = accountLoged.AccountName, permission = accountLoged.Authority },
                    },
                    name = "dopurchase",
                    data = new Dictionary<string, string>()
                    {
                        { "from", accountLoged.AccountName },
                        { "to", to },
                        { "quantity", "0.0001 EOS" },
                        { "memo", "you transefered 0.0001 EOS to " + to }
                    }
                }
            }
        });

Thank you all.

1 Answer 1

0

The problem is your inline action, you are trying to transfer the funds onto the to account, but you are trying to do this with the permission of the from account, but it should be with the permission of self.

So change your inline action to say:

action
{
    permission_level{get_self(), "active"_n},
        "eosio.token"_n,
        "transfer"_n,
    std::make_tuple(get_self(), to, quantity, memo)
}.send();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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