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.
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
1 Asked on January 5, 2022 by mashup
1 Asked on January 5, 2022 by coder
1 Asked on January 5, 2022 by phillip-hamnett-eos42
1 Asked on January 3, 2022 by zaigham-javed
1 Asked on January 3, 2022 by lomtax-ladamberti
1 Asked on November 24, 2021 by sachin-murali
1 Asked on November 10, 2021 by rsmets
1 Asked on August 20, 2021 by eosneedhelp
2 Asked on August 20, 2021 by josh-arnet
1 Asked on August 20, 2021 by shashi
1 Asked on August 20, 2021 by chris-de-jong
1 Asked on August 20, 2021 by artem-maluga
1 Asked on August 20, 2021 by gianmaria-toccotelli
1 Asked on August 20, 2021
0 Asked on August 20, 2021 by gary2133
Get help from others!
Recent Questions
Recent Answers
© 2023 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP