8

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 CODE ABOVE ANYMORE, OR YOU WILL BE ATTACKED! if( ((code == self && action != N(transfer) ) || (code == N(eosio.token) && action == N(transfer)) || action == N(...


5

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 from your header file. An additional note, as of eosio.cdt 1.6 there is a bug when using on_notify with a wildcard for the contract name, this can be fixed ...


4

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 macro and than define it again: #undef EOSIO_ABI #define EOSIO_ABI(TYPE, MEMBERS) \ ....


3

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 mycontract@eosio.code - even if you sign the transaction with your mycontract@active key. There are then two problems with the example you post: You sign the action with bob@active, it should be ...


3

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 blockchain? Token transfers are stored in the blockchain, not in RAM. The balances for tokens are stored in RAM for the reasons mentioned in other answers, but the ...


3

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, uint64_t delay) { eosio::transaction t{}; t.actions.emplace_back( eosio::permission_level(from, N(active)), // with `from@active` permission ...


3

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


2

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 eosdac token is frozen for 24 hrs, I checked above command for ADD coin and it worked so it will work for eosdac too.


2

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 restrict access to the buy function to only be accessible by the contract itself, using require_auth(_self). Ideally do both, as you can never be too safe...


2

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 performance of this blockchain type since RAM is the fastest memory type to access by the computer of the block producers. This allows processing up to 4000 transactions ...


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.


2

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 transaction smart contracts. For example, Ethereum has AZTEC, that allows ZCash like operations on any tokens.


2

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 this. However, to do it you would set up the permissions such that there was a threshold of 1, with both account B and account A having weight 1.


2

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, unstaking_log, account" tables. "stat" save the total staking and unstaking data, "staking_log" save user staked quantity, "unstaking_log" save user unstaking data, "...


2

Nodeos: v1.5 CDT: v1.5 cleos -u https://jungle2.cryptolions.io:443 transfer chesseosches eosiostackmm "1.0000 EOS" executed transaction: 861f71e89de2ae7d12bf2738e09bd2501e672e17bb9f4727f1d715cccedcd38a 128 bytes 790 us # eosio.token <= eosio.token::transfer {"from":"chesseosches","to":"eosiostackmm","quantity":"1.0000 EOS","memo":""} # ...


1

Create simple contract for AccountB. Explanation: eosio.token::transfer uses require_recipient(to) which sends notification to the account/contract. What it effectively means is that your contract will execute action with eosio::on_notify("eosio.token::transfer") hook as inline action. ALL Inline actions need to succeed in order to transaction be valid. ...


1

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 keep track of the events on chain. An example way you could do this is as follows (in a smart contract): ACTION zerotransfer(std::string const & ...


1

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't sound like a good and smart idea. If you want to use EOSIO as database without the need to execute logic that depends on the state of the blockchain that's ...


1

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 would get this error if you make a mistake where you think you have tried to transfer a token, but you have accidentally transferred a token that doesn't exist. ...


1

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 string publickey!! I modified the code that can be compiled by eosio.cdt 1.3+ . Here's the code: #include <eosiolib/crypto.h> #include <eosiolib/...


1

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 first time because it store index of new balance. void token::add_balance( account_name owner, asset value, account_name ram_payer ) { accounts to_acnts( ...


1

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, MEMBERS ) \ extern "C" { \ void apply( uint64_t receiver, uint64_t code, uint64_t action ) { \ if( action == N(onerror)) { \ /* onerror is only ...


1

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 makepokemon@eosio.code and not user@active, so user has to explictily give makepokemon permission to transfer tokens if they want to.


1

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 authenticity inside the action itself. Then, it does not matter what permission are you sending via command line. Your makepokemon action should check the ...


1

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 won't accept require_recipient calls from eosio.token - I just verified this to be sure. So then the question I believe you are asking is how to I check that the ...


1

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

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/monstereos/blob/master/contracts/pet/pet.cpp#L197-L234 The above code just add funds to an accounts table with the deposited amount. This is the ABI extension ...


1

Most simple way is using Js library for rpc. Alternatively, you can see JavaWrapper (this is old realisation, but I see this)


1

Please refer to the following link. https://steemit.com/eos/@noprom/using-eos-rpc-api-to-transfer-eos


1

It's used to optionally describe the transfer. In Steem for example, you see this kind of thing:


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