AnswerBun.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!

Related Questions

What is the difference between std::string and eosio::string?

1  Asked on January 5, 2022 by phillip-hamnett-eos42

   

How to use scatter without node.js?

2  Asked on December 11, 2021

 

Ico smart contract update

2  Asked on November 22, 2021 by efraim

   

How does one print an iso timestamp in a smart contract

1  Asked on August 20, 2021 by chris-de-jong

 

can’t generate abi when using map

1  Asked on August 20, 2021 by vishal-singh

   

Action setprods on EOSIO v2.0 private chain

2  Asked on August 20, 2021 by scott-owen

 

How to unstake ALL my EOS from EOS Voter Greymass

1  Asked on August 20, 2021 by gianmaria-toccotelli

 

Ask a Question

Get help from others!

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