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.

Filter by
Sorted by
Tagged with
0
votes
1answer
8 views

What should I do to specify an optional action parameter for cleos?

I wrote an action that has an optional parameter, as something like: [[eosio::action]] void foo(..., const std::optional<name>& recipient); Then in the generated .abi, it is represented as:...
0
votes
1answer
31 views

Are all actions on a transaction supposed to be included in the block?

I've noticed something strange that is confusing me. I have a transaction that includes multiple actions on it, but it appears that the "transfer" action did not get recorded in the actual block. You ...
4
votes
2answers
129 views

How to calculate `action_mroot`

UPDATE #3 for future action_mroot calculators: The two critical bits of info needed to do this (that are neither easy to find nor documented) are: There exists an extra action (which has a receipt) ...
0
votes
1answer
13 views

Return token to owner after initiating a transfer to my contract

Good Day, I am working on a contract where for example, If I send 2 ETH to a contract, ( 1 ETH = 2 Cryptokitty tokens ) then that contract is supposed to return me 4 Cryptokitty tokens. What I Have ...
0
votes
0answers
10 views

Missing permission of account, but permission is given to acting account

I have account1 and account2. account1 has a contract with an action called update(): void mycontract::update(){ require_auth(get_self()); table_t t(get_self(),scope); auto r = t.find(index); ...
2
votes
1answer
28 views

Execution order of actions

I want to implement "continious minting" which means first I should call issue, and only then transfer. My contract has a functionality of eosio.token . I call create to create my token with ...
0
votes
0answers
45 views

How can i Improve my code (Transaction took too long)

I have Enough CPU and NET i have staked 13 EOS for each and still unable to run the code. Please suggest if i can improve anything. IS there any problem of table index Got this from developer.io if ...
2
votes
1answer
55 views

Symbol prints wrong value

I have a method like this: void token::test(asset qty) { print("\n", qty); print("\n", qty.symbol); } and the output I get is something like this: 10.00000000 XXX 8,XXX3 why the 3? ...
1
vote
1answer
90 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
14 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
47 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
38 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
71 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
29 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
44 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 ...
3
votes
0answers
162 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
272 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
28 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 '["...
4
votes
1answer
63 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
46 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
91 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
81 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
467 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
311 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
87 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
225 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
102 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
438 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
466 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
27 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
329 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
170 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
3answers
233 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
39 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
175 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
1k 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
259 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
240 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
61 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
41 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
165 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
821 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
103 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
688 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
544 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
2k 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
292 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
282 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 ...