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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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, ...
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.
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 ...
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 ...
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 ...
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 ...
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 ...
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, ...
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: ...
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 ...
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.
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 ...
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'...
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
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 ...
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 ...
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 ...
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, ...
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 ...
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 ...
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 ...
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.
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/...
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)
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
transfer × 48smart-contract × 18
eosio.token × 11
transactions × 10
tokens × 10
action × 4
permissions × 4
cleos × 3
c++ × 2
rpc × 2
testnet × 2
deferred-transactions × 2
exchange × 2
nft × 2
eosjs × 1
eosio-code × 1
accounts × 1
ram × 1
eosio.cdt × 1
mainnet × 1
blockchains × 1
staking × 1
resources × 1
private-blockchain × 1
public-key × 1