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
1 vote
1 answer
614 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
1 answer
454 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 ...
0 votes
1 answer
145 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
1 answer
79 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 ...
2 votes
1 answer
138 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
1 answer
156 views

Building a contact in EOS Studio and getting eosio.code permissions when calling it

After deploying a contract built in EOS Studio ... on my call to another action where I have called 'permission_level()' ... I get a permission error "transaction declares authority '{"actor&...
0 votes
1 answer
105 views

Is there a C++ library just like eosjs?

I want to sign and send transactions (generally trigger any smart contract action) from a c++ external app. How can I do this? If my app was in javascript, that would be easy since I know that I can ...
0 votes
1 answer
791 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
1 answer
131 views

Dispatcher in smart contract

I want to implement dispatcher in a smart contract. I research about this and understand theoretically but I am not getting practically. Exactly why the dispatcher is to be used? The basic thing I got ...
0 votes
0 answers
17 views

Error: assertion failure with message: Signing value already used

I try to do several actions in one transaction on Wax blockchain in Node.JS. All accounts share same active key. Sometimes it works and everything is fine, but mostly I get an error: "assertion ...
0 votes
1 answer
32 views

How to get account name of current action?

I am gonna get account name of caller(wallet) in my action of smart contract. I used functions current_receiver(), get_sender(), get_first_receiver(). but I got contract`s account name and empty ...
0 votes
1 answer
104 views

Passing struct as a parameter to smart contract action

I want to save data in the blockchain table whose format is as below: { "docsample": { "id": 1, "creationDate": "2012-05-16T18:25:43.511Z", "...
0 votes
1 answer
89 views

Traverse multi-index table through non-primary value and delete the record

Below is my smart contract: #include <eosio/eosio.hpp> #include <eosio/print.hpp> #include <eosio/system.hpp> #include <string> using namespace eosio; using std::string; ...
1 vote
1 answer
39 views

Difference between Action and functions?

I want to know what is an action? What is the difference between actions and functions.
0 votes
1 answer
50 views

cleos: add auth level to account with specific key pair and limited permissions

Each EOS account has two key pairs: "@owner" and "@active". I want to add another key pair under the name "@limited" which I can use in an unsafe environment (VPS) to ...
2 votes
1 answer
384 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 [email protected] as part of its active ...
6 votes
4 answers
2k 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 ...
5 votes
1 answer
218 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 ...
1 vote
1 answer
28 views

addressbook example. Where is the message used in the notify action?

Section 2.6 of the EOSIO developer docs https://developers.eos.io/welcome/latest/getting-started/smart-contract-development/adding-inline-actions describes how send an inline action. It all works fine ...
0 votes
1 answer
49 views

EOSlime TypeError: Contract.actionname is not a function

This is my test file: const assert = require('assert'); const TOKEN_WASM_PATH = './contracts/group/group.wasm'; const TOKEN_ABI_PATH = './contracts/group/group.abi'; describe("EOSIO Group", ...
0 votes
0 answers
83 views

How to generate unique string id from given array of strings in smart contract?

I am writing an EOS smart contract in which need to write the action to generate a unique id from the given array. Array consisting of n number of string elements (UUID). Suppose I pass 10 strings to ...
0 votes
1 answer
38 views

Take output from GetActions and send to database using eossharp

I am using eos-sharp to get data from the eos smart contract. I am trying to get actions data by using: var resultaction = await eos.GetActions("dqzmember", 0, 30); I need information from ...
0 votes
1 answer
99 views

how to save data in mongodb from eos smart contract?

I am getting the actions log data using an action constructor in a smart contract. I need to save this data in MongoDB from the smart contract. How can I do this? I didn't get exactly my required ...
2 votes
2 answers
696 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::...
5 votes
1 answer
580 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 ...
3 votes
2 answers
1k 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: ...
4 votes
2 answers
519 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 ...
4 votes
2 answers
281 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
1 answer
41 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
0 answers
59 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
3 answers
429 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 ...
2 votes
1 answer
77 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? ...
0 votes
1 answer
972 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 ...
0 votes
2 answers
79 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 ...
0 votes
1 answer
584 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" ...
1 vote
1 answer
541 views

Where is 'INLINE_ACTION_SENDER' macro defined?

I am trying to use INLINE_ACTION_SENDER to use an action from another contract but get the following error. error: use of undeclared identifier 'INLINE_ACTION_SENDER' How do I include this macro in ...
2 votes
1 answer
75 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 ...
2 votes
2 answers
72 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?
3 votes
1 answer
731 views

Can actions have return types?

I've been looking at most of the example contracts and every action seems to return void. Does this mean that you can not have a return type for your actions? Instead, would you have to send a ...
3 votes
2 answers
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....
11 votes
1 answer
975 views

What are naming rules for actions, tables and contracts?

Since strings internally are converted to uint64 for space efficiency on the eos.io blockchain what are the restrictions that need to be followed for: actions tables index identifiers (within ...
1 vote
0 answers
34 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
2 answers
142 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
2 answers
50 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
1 answer
99 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
0 answers
51 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 ...
2 votes
1 answer
62 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 '["...
1 vote
2 answers
352 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 ...
0 votes
1 answer
82 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
2 answers
170 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 ...