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?