8 votes
Accepted

How to do something when your contract is an action notification recipient (like when it receives funds)?

Extend EOSIO_ABI macro to handle eosio.token transfer notification. Please pay attention to if statements: if( code == self || **code == N(eosio.token)** || action == N(onerror) ) DO NOT USE THIS ...
ofo's user avatar
  • 320
7 votes

How to debug eosio::on_notify("eosio.token::transfer") actions?

Using the EOSIO_DISPATCH macros disables the automatic inclusion of actions and on_notifys, and assumes that you will deal with them manually. To fix this, you have to remove the EOSIO_DISPATCH macro ...
Phillip Hamnett - EOS42's user avatar
4 votes

How to do something when your contract is an action notification recipient (like when it receives funds)?

The solution is to redefine EOSIO_ABI macro. @ofo's solution is correct for the code generation part but to make auto abi generation work EOSIO_ABI macro has to be used. To do this you first undefine ...
eosx's user avatar
  • 41
4 votes

assertion failure with message: no balance object found

This error message is caused because you are trying to transfer a token that you do not own and have never owned. You have no balance, which is not the same as having a balance of zero. Usually you ...
Phillip Hamnett - EOS42's user avatar
3 votes
Accepted

Make a transfer inline

The problem is you are trying to transfer tokens, which requires mycontract@active permission. But when you send tokens from within a contract, the permission is [email protected] - even if you ...
Phillip Hamnett - EOS42's user avatar
3 votes
Accepted

Why do token transfers on EOSIO consume RAM?

I don't think the other answers clarify this aspect, so I'll post this as well: I just can't figure out why token transfers on EOS are stored in (expensive) RAM and not just simply in the ...
confused00's user avatar
  • 5,554
3 votes
Accepted

How to transfer EOS after a particular delay?

You need to call the transfer action of eosio.token contract with the appropriate arguments after your preferred delay: void send(account_name from, account_name to, asset amount, string memo, ...
confused00's user avatar
  • 5,554
3 votes
Accepted

inline transfer causes error

std::make_tuple(_self,N(eosio.token),asset(10000,symbol_type(S(4,SYS))),std::string("")) is okay.
sam's user avatar
  • 101
2 votes

I tried to transfer token EOSDAC, but getting below error, can someone help me in this

I found the answer for my question. cleos --url http://api.eosnewyork.io push action eosadddddddd transfer '[ "ge4dimrzgige", "ironmanineos", "0.0001 ADD", "m" ]' -p ge4dimrzgige as of now the ...
subbu494's user avatar
2 votes

How do I ensure my Action Listener responds only to authentic senders?

There are two ways that you can prevent this: You remove the buy function from the ABI, it can therefore never be called manually, but only through another function that is part of the ABI. You ...
Phillip Hamnett - EOS42's user avatar
2 votes

Why do token transfers on EOSIO consume RAM?

The tokens are stored in RAM which is the expensive data storage since smart contracts a.k.a. dApps only have access to info in RAM. This is the design choice of EOSIO and helps keep up the ...
Ami Heines's user avatar
  • 1,686
2 votes
Accepted

Is there any possibility to hide account balance or transaction origination?

Currently, EOS does not support this kind of functionality directly. However, smart contracts may enable this kind of functionality in the future. Nothing prevents EOS to adopt Ethereum style privacy ...
Mikko Ohtamaa's user avatar
2 votes

Is there any way to "request transfer" from another EOS account without "multisig"

Account B could give account A permission to access his account's transfer action. But that wouldn't limit the amount of money that was transferable, so it would be very dangerous for account B to do ...
Phillip Hamnett - EOS42's user avatar
2 votes
Accepted

How to write a contract to stake my own token without doing transfer?

This problem I have solved by using table query. I hope my solution can help you. First I publish my stake contract to account A, it has "stake, unstake" actions, and has "stat, staking_log, ...
Astaldo's user avatar
  • 51
2 votes

Why am I getting Error 3010014: Invalid symbol when I perform a simple transfer

Nodeos: v1.5 CDT: v1.5 cleos -u https://jungle2.cryptolions.io:443 transfer chesseosches eosiostackmm "1.0000 EOS" executed transaction: ...
Nat's user avatar
  • 3,425
2 votes

inline transfer causes error

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 ...
judgefudge's user avatar
2 votes

Is it possible to get the initiating contract name from a token transfer?

You can use get_first_receiver() to get the name of the contract from where the notification comes.
conr2d's user avatar
  • 2,320
1 vote
Accepted

Zero amount transfer?

You can keep track of events by simply calling actions. An example of an action is a transfer, but you can make arbitrary actions using a smart contract. In this way you can have a very modular way to ...
Phillip Hamnett - EOS42's user avatar
1 vote

Zero amount transfer?

If you remove line 93 from eosio.token.cpp check( quantity.amount > 0, "must transfer positive quantity" ); you will be able to send zero amount transfers. But to be honest, that doesn'...
cmadh's user avatar
  • 1,929
1 vote

Make a transfer inline

After deploying the smart contract you need to add the following permission: cleos set account permission contract_name active --add-code
S-K''s user avatar
  • 151
1 vote
Accepted

How to transfer token and do some action inline?Or how to parse string to signature and publickey?

One day I was looking for a function sha256_to_hex, but I surprisingly find a utils.hpp in github, this code has the functions I need and more, it has the functions that can parse string signature and ...
Astaldo's user avatar
  • 51
1 vote
Accepted

Using transfer to send tokens within a smart contract results in "unable to find key"

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 ...
colin's user avatar
  • 267
1 vote

Why do token transfers on EOSIO consume RAM?

To answer this question, you should look at in the code. Normally, to get index of new data, contract owner should store index key in RAM (faster access), that why "do token transfer" need ram in the ...
Quoc Le's user avatar
  • 174
1 vote

Hello contract: How do i execute "hi" action when notified by eosio.token contract of an EOS transfer?

I finally found a way by redefining EOSIO_ABI. The "transfer" function in my contract get called when an EOS transfer is done through eosio.token contract. #undef EOSIO_ABI #define EOSIO_ABI( TYPE, ...
Sucrenoir's user avatar
  • 156
1 vote
Accepted

How does one prevent smart contracts from taking all your tokens, when you give them your auth?

When a contract sends an inline action, it cannot send with the permission level passed by the caller; it sends with a special eosio.code permission name. In your example, makepokemon can only use ...
confused00's user avatar
  • 5,554
1 vote

How does one prevent smart contracts from taking all your tokens, when you give them your auth?

So the user pushes the action with -p user@active, and now the contract can "steal" those tokens unrightfully? Or am I missing something? No, that can not steal the tokens because you check the ...
Rajat Chaudhary's user avatar
1 vote

How do I ensure my Action Listener responds only to authentic senders?

The problem isn't the "buy" (you can just leave that out of the ABI), it is calling "transfer" directly - not by way of eosio.token. The "transfer" function must be part of the the ABI macro or it ...
joehitt's user avatar
  • 155
1 vote

Is there a way to create offline transaction with cleos (or any other safe tool)?

I write it myself with java, cleos only support to sign from keosd, if you'd like, try to reuse the wallet-sign method.
Jimmy Guo's user avatar
  • 1,066
1 vote

Can not unpack data from received eosio.token::transfer action

Please take a look at MonsterEOS.io contract, I use an extended macro to support the token::transfer detection. This is the function that listens for the transfer action: https://github.com/leordev/...
Leo Ribeiro's user avatar
  • 3,023
1 vote

How can I transfer tokens using RPC?

Most simple way is using Js library for rpc. Alternatively, you can see JavaWrapper (this is old realisation, but I see this)
Alexander Ozertsov's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible