All Questions
Tagged with smart-contract action
41 questions
0
votes
1
answer
44
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
114
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
92
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
138
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
1
answer
55
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
111
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
39
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
104
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 ...
0
votes
1
answer
162
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
44
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 ...
2
votes
1
answer
160
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
0
answers
62
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 ...
1
vote
1
answer
484
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
2
answers
51
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
107
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.
0
votes
2
answers
84
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 ...
5
votes
1
answer
606
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
2
answers
704
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::...
0
votes
1
answer
83
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
174
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
1
answer
625
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
0
answers
106
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>
#...
7
votes
3
answers
1k
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 long
...
0
votes
1
answer
980
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 ...
1
vote
1
answer
60
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 ...
3
votes
1
answer
448
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
3
answers
340
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
2
answers
73
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
1
answer
51
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 ...
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:
...
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....
0
votes
1
answer
588
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
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
1
answer
105
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
1
answer
303
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. ...
4
votes
1
answer
757
views
How can I create a custom permission within a contract and limit it to certain actions?
For example, say I wanted to create a custom permission called delegatee. An account with this permission would be only permitted to preform certain actions within my contract. Is this possible as of ...
1
vote
1
answer
542
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
417
views
Example of smart contract action that itself executes a transaction
Can anyone point me to example code for writing a smart contract that calls actions on other smart contracts? The general method of doing this is documented here but example code is not provided.
3
votes
1
answer
733
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 ...
12
votes
1
answer
2k
views
What is the purpose of `require_recipient`?
I saw the description of the function require_recipient and it says:
Add the specified account to set of accounts to be notified
I would like to understand what's the purpose of receive this ...
11
votes
1
answer
986
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 ...