TransWikia.com

Eos-sharp jungle Error 3090003 when trying to call external smart contract

EOS.IO Asked by Lomtax LADAMBERTI on January 3, 2022

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.

One Answer

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();

Answered by Phillip Hamnett - EOS42 on January 3, 2022

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP