0

I am trying to transfer some tokens as part of my contract action, but I get an error:

ACTION maincontract::sendtoken(const name sender, const name receiver) {
  action(
    permission_level{ get_self(), "active"_n },
      "eosio.token"_n, 
      "transfer"_n,
      std::make_tuple(sender, receiver, "120000 MYTOKEN", "memo")
  ).send();
}

the error I get in EOS Studio is:

assertion failure with message: read
{
  "code": 500,
  "message": "Internal Service Error",
  "error": {
    "code": 3050003,
    "name": "eosio_assert_message_exception",
    "what": "eosio_assert_message assertion failure",
    "details": [
      {
        "message": "assertion failure with message: read",
        "file": "wasm_interface.cpp",
        "line_number": 1075,
        "method": "eosio_assert"
      },
      {
        "message": "pending console output: ",
        "file": "apply_context.cpp",
        "line_number": 113,
        "method": "exec_one"

UPDATE: it seems that the contract cannot transfer money on behalf of the user. I cannot expect all the users to give permission to the contract. So, how can I resolve this?

0

how did you create the MYTOKEN token? can you please explain the procedure you used to create this token?

1
0

I think these threads will answer your question in detail (see the other questions linked in the initial question as well):

Transfer tokens inside a smart contract from an account to another account

here you get more detailed explanations as well: https://github.com/EOSIO/eos/issues/3847

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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