1

My inline transfer causes the following error.

Error 3050003: eosio_assert_message assertion failure
Error Details:
assertion failure with message: read

I dont know how to solve it. I simplify my code in the following version

test.hpp

#ifndef TEST_HPP
#define TEST_HPP

#include <eosiolib/asset.hpp>
#include <eosiolib/eosio.hpp>

using namespace eosio;

class test: public contract {
public:
    //@abi action
    test(account_name _self): contract(_self) {}
    void func();
};
#endif

test.cpp

#include "test.hpp"

void test::func() {
    require_auth(_self);
    action(
        permission_level {_self,N(active)},
        N(eosio.token),N(transfer),
        std::make_tuple(_self,N(eosio.token),asset(10000,symbol_type(S(4,SYS))),"")
    ).send();
}

EOSIO_ABI(test,(func))

I altered permission to allow inline transferring with command

cleos --wallet-url http://localhost:8899 -u http://localhost:8788 set account permission test active '{"threshold":1,"keys":[{"key":"EOS5BL1oic5zZfzbS681xPKgBGH8cE6f3FiGAoB2gfqDpu15fyU1L","weight":1}],"accounts":[{"permission":{"actor":"test","permission":"eosio.code"},"weight":1}],"waits":[]}' owner -p test -x 10

How can I deal with the error?

  • seems that all people use this method to change contract permissions,haha – Jimmy Guo Jun 29 '18 at 5:56
3

std::make_tuple(_self,N(eosio.token),asset(10000,symbol_type(S(4,SYS))),std::string(""))

is okay.

  • Thx, it works. the memo is a trap. – user41635 Jun 29 '18 at 5:24
2

This is a limitation of std::make_tuple, the type of const char* is not the same as std::string, and will package this as a pointer. The type of the memo field is an std::string, so explicit construction is needed for make_tuple to do the right thing.

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.