Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [action]

Actions specify and implement the behaviour for smart contracts and operate primarily in a message-based communication model. Questions may relate to sending, receiving, analysing, interpreting, and implementing actions; action specification and rules, and others.

0
votes
1answer
40 views

Transfer tokens inside a smart contract from an account to another account

I need to write a simple function that would send tokens using a different account action. Exactly the same situation as in these questions: one and two But I have to use not eosio.token contract but ...
1
vote
0answers
13 views

How to view links between actions and permissions?

Currently I create permissions perm* for user user, and authorize it to push action action* to the code-containing account code like so: cleos set account permission user perm* PUBLIC_KEY active ...
0
votes
2answers
22 views

How to automatically push an action when EOS is sent to the contract

I am looking for an alternative to the payable function of Ethereum in EOSIO. I want to invoke an action when EOS is sent to the contract. Is it possible?
1
vote
2answers
37 views

How do I confirm that the person sending an action is the same as a user in the parameter?

Specific example from a contract: ... void hi(name user){ // verification here, require_auth(user)? print(user); } ... I've tried require_auth(user) but that seems to always fail unless the user ...
2
votes
1answer
59 views

Is it possible to create new contract from another?

Ethereum has a opportunity to create new contract from another. Does eosio has the same? I found a code with new account creation, but I didn't find nothing about setting code and abi from contract.
2
votes
0answers
21 views

How to get the parent action in the inline action?

There's a contract A with action void a(string memo), it calls an inline action for contract B with action void b(), can I get the "memo" parameter in the function void b()? Note that I can't modify ...
0
votes
2answers
30 views

Transaction took too long while using std::shuffle

Get the error when I push a action on my contract on the local testnet: But if I remove this code from the action I called, there is no problem: class urng: Does anyone know what caused this?I just ...
2
votes
0answers
74 views

What could be the reason for 'Error 3050008: Abort Called'

I'm getting the following error without any further description. What could be the issue for that? I'm performing some binary arithmetics when calling this action, are there any known problems with ...
2
votes
1answer
124 views

Make a transfer inline

I would like to send SYS token owned by the smart contract account to a third party account when anyone call a specific action. I have tried the following code but I am getting an error: [[eosio::...
2
votes
1answer
23 views

Cannot pass arguments to push action in bash script

I am using a bash script to push actions. Here is the script : echo "------------------> Pushing action $1" #cleos -u https://api-kylin.eoslaomao.com:443 push action user1account issue '["...
3
votes
1answer
47 views

Different actions count returned in every request

I launched private EOS network with bios boot tutorial. Then I pushed some transactions to the network. Now I want to retrieve all actions for an account useraaaaaaah. But every time I make a request ...
0
votes
1answer
20 views

Is it possible to overload contract actions?

I had a method: -- t.hpp -- [[eosio::action]] void exchange(); -- t.cpp -- void token::exchange() { ... } EOSIO_DISPATCH(eosio::token, (exchange)) and then decided that if a parameter were ...
1
vote
2answers
78 views

Passing a string to an action?

I have an action that needs to operate on a string: void token::MyAction(std::string key); so I would expect I can make the call like this: cleos push action MyAccount MyAction '["burn"]' -p ...
1
vote
0answers
63 views

When receive a transaction, how to EOS push it into block chain?

I am researching how to transaction work in Block producer(BP). I knew when BP received a transaction from user, maybe it start from push_transaction function then to apply_context::exec and ...
0
votes
1answer
234 views

cleos get actions returns empty list!

I am running EOS on my computer as a local network. I created a smart contract and am able to invoke the actions using both cleos commands and through eosjs. When I run cleos get table command I see ...
1
vote
1answer
205 views

How to solve !action_type.empty(): Unknown action hi in contract hello?

I am following this doc: https://developers.eos.io/eosio-home/docs/your-first-contract. This is the hello.cpp contract code which is successfully deployed: #include <eosiolib/eosio.hpp> #...
1
vote
0answers
66 views

How to solve !action_type.empty(): Unknown action hi in contract hello?

I am following this doc: https://developers.eos.io/eosio-home/docs/your-first-contract. This is the hello.cpp contract code which is successfully deployed: #include <eosiolib/eosio.hpp> #...
3
votes
1answer
161 views

Transaction took too long

I occurred this Error 3080006: transaction took too long when push my own contract action. the push action cmd had no setting '-X'. It's weird because I pushed the same action with two different ...
1
vote
1answer
85 views

correct usage for send_context_free()

I have a very simple ACTION in a contract that writes to a table (multi-index) which has two columns: a string name and an auto-generated primary key called id. This part works fine and I am able to ...
6
votes
3answers
309 views

Why the first time I execute an action I get “Error 3080006: transaction took too long”?

WHAT I WANT Call an action and see it succeed at the first execution. WHAT IS NOT WORKING The function, which I am executing, the first time fails with error: Error 3080006: Transaction took too ...
0
votes
1answer
332 views

How to pass a list / array / vector to an action? [duplicate]

I need to pass a list of integers to an action. It would be fine to use vectors or arrays, but I can't find one that works. Using vector in the smart contract compiles fine, but then I get this error ...
2
votes
0answers
25 views

Can I determine the number of actions implied in the actual running transaction?

transaction_size() returns the size in bytes but is not useful to determine the number of actions implied. Can I get the count?
1
vote
1answer
278 views

How do permissions on deferred transactions work?

I'm playing around with deferred transactions and encountered an oddity. Say, we have a contract deployed on contract, and an account account. contract has contract@eosio.code as part of its active ...
1
vote
2answers
109 views

How to pass an empty parameter into action with cleos

I have an action that looks like the following: hello ( name person ) { if ( name == 0 ) { ; // do something } else { ; // do something else } } and I wanted to pass ...
1
vote
1answer
146 views

Can we use default parameters in EOS smart contract?

I have a action in my contract : // @abi action void ContractClass::submittxn(string memo,string memo2,uint64_t a = 61) { ... } I try to set a as default parameter but when I push the ...
1
vote
1answer
38 views

How to check if smartcontract action has been actually run? How to count how many times?

Imagine an action, which is not const, and sometimes (but not always) modify a defined multi index. I would like to count, how many times a specific action was run. I do not want to introduce any ...
0
votes
0answers
121 views

Are multiple actions in a single transaction guaranteed to happen sequentially?

Suppose I have a transaction with two actions, A and B, listed one after another. Like this: { <...>, "actions": [ { "account": "my.token", "name": "action_a", <...&...
0
votes
2answers
809 views

Transfer EOS tokens inside a smart contract from an account to another

I want to implement, in my smart contract(C++), a function that forwards EOS token to another account. This is actually a basic question, but is that possible actually? Please, could you share the ...
3
votes
1answer
206 views

How to push a vector to an action

I'm troubled with a problem about how I can use command line cleos push action to push a vector to an already existing action, such as: void vectortest(const std::vector &vec) ; Anyone who can ...
1
vote
3answers
193 views

Interacting with a smart contract

How can a user interact with the contract? Is typing the command cleos push action the only option?
2
votes
2answers
56 views

A contract that generates another contract

If I want to create a smart contract with an action 'Create Game' and on calling that action a new contract be formed, how is it possible?
6
votes
1answer
38 views

Make Ledger Reflect All RAM Changes

If we want those witnessing the chain to know about our apps state without any knowledge of our service layer, what might be the best approach? Since the ledger only records the data given to it in an ...
2
votes
1answer
150 views

empty actions - abi file

Any help why I'm getting empty actions? { "____comment": "This file was generated by eosio-abigen. DO NOT EDIT - 2018-08-22T01:21:53", "version": "eosio::abi/1.0", "types": [], "structs": [{ ...
2
votes
2answers
502 views

List of available datatypes for action parameter

I am wondering where I can find a list of supported datatypes that can be used in an actions parameters. Edit: Should have specified this better. I am writing some actions such as: /// @abi action ...
3
votes
2answers
91 views

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

I have an apply function that listeners for transfers to my contract from eosio.token. On notification of a transfer, a function (buy) is called within the contract. How do I ensure that this "buy" ...
2
votes
1answer
565 views

How to call action of another contract within a contract?

If I'm right then to call the event of another contract, I need to configure the permissions (allow the call). For example, I have contract aliceclass: class aliceclass : public contract { public: ...
1
vote
1answer
467 views

Can we get all the actions from all blocks?

Somebody say we can get all the blocks through rpc, then we can get all the actions. But I found that in the block information, there're no inline actions, so many inline actions will lose, right?
3
votes
2answers
1k views

How to send an action from one contract to another?

From contract A, I want to send an action to contract B. How to do that? There is SEND_INLINE_ACTION but that seems to need a pointer to the contract (usually *this), correct? Solution Using action....
0
votes
1answer
252 views

How to link permission to action?

I created a publish permission, and I want to this permission can only execute the publish action in my tweet contract. How to link the permission to the action?
4
votes
3answers
2k views

How to get operations history of account?

Should I analyze all the blocks or are there some methods in the eosjs library?
2
votes
2answers
1k views

How to call an action within the contract with custom permissions?

Here is my code: void play(account_name player, asset amount) { require_auth(player); //The part that is throwing the error action { permission_level{player, N(active)}, //Using the ...
3
votes
1answer
214 views

Account of caller of action

Is there a way to get the account of the caller within an action? If not, I would need to add an extra parameter to the action containing the action name and then do some verification. It would be ...
0
votes
1answer
419 views

How to add a “memo” to an action?

In an action in my contract, I want to attach some text to it, so that users can see the text in their transaction history using a block explore like eosflare.io. I see that eosio.token has a "memo" ...
2
votes
1answer
59 views

Corrupted account name in nodeos log during action pushing

Have an issue with the action push: cleos --wallet-url "http://localhost:8889" push action contractx put '["test", "75c88c9593bec6b716f2cb9b60db79282b6f3389a39f3be9adef45e06b379b48"]' -p test Error ...
4
votes
2answers
986 views

How to perform something when my contract receives a eosio.token transfer notification?

I know a very similar question has been asked here (How to do something when your contract is an action notification recipient (like when it receives funds)?), however I don't have enough reputation ...
2
votes
0answers
279 views

Getting ALL the actions for a given account using cleos

If I run: $ cleos -u <api endpoint> -j --full <account> I do not get all the actions. I don't know what the default range is. So I tried: $ cleos -u <api endpoint> -j --full <...
2
votes
1answer
77 views

How do you stream data from an input file when writing contracts on EOS?

I emulated the tic.tac.toe tutorial code and made a simple contract that allows me to add and remove car information. However, I can only push action one at a time and this only allows me to add/...
3
votes
1answer
2k views

Reading table rows with EOSJS

Is there a way to receive the return output of an action with EOSJS? Say for example I have an action that reads columns from a table, sums a row and returns the result. How would I structure the ...
4
votes
2answers
387 views

How is the action data encoded?

Take for example this action belonging to a newaccount transaction: { "account": "eosio", "name": "newaccount", "authorization": [{ "actor": "eosio", "permission"...
3
votes
1answer
190 views

Can an action in a smart contract concurrently executed?

In a smart contract if an action is executed simultaneously and if it tries to modify the same record in a table(using multi index API), How to add mutual exclusion to the shared resources? For eg. ...