2

This is my example code deployed on myaccount

#include <eosiolib/eosio.hpp>
#include <eosiolib/print.hpp>
#include <eosiolib/currency.hpp>
using namespace eosio;

class exampleSendToken : public eosio::contract
{
public:
  using contract::contract;
  exampleSendToken(account_name caller) : contract(caller) {}

  /// @abi action
  void send()
  {
    action(permission_level{_self, N(active)}, N(eosio.token), N(transfer),
           currency::transfer{.from=_self, .to=N(myotheraccount), .quantity=asset(1), .memo="sent by contract"}).send();

  }
};

EOSIO_ABI( exampleSendToken, (send))

I used this line to give [email protected] the permissions to use active and initiate the transfer.

cleos set account permission myaccount active '{"threshold": 1,"keys": [{"key": "EOS7Qcpqm8....3T9amgDJu8v","weight": 1}], "accounts": [{"permission":{"actor":"myaccount","permission":"eosio.code"},"weight":1}]}' owner -p myaccount@owner

When I call cleos --print-response push action myaccount send [] -p myaccount

the returned error is
Error 3050003: eosio_assert_message assertion failure Error Details: assertion failure with message: unable to find key pending console output:

The both accounts exist and the full returned response asks for a key that I have in my wallet

"required_keys": [ "EOS7Qcpqm8....3T9amgDJu8v"

What is the problem here?

1 Answer 1

1

I solved the issue (with help from a related thread 1859). Please correct me if I am wrong but on jungle testnet the CORE_SYMBOL is set to SYS but there is no SYS token available. The "key" therefore does not refer to a cryptographic key but a key in a database.

The solution is to define the asset correctly to use EOS:

asset(1, S(4, EOS))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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