Stack Exchange Network

Stack Exchange network consists of 174 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 [c++]

All questions related to the use of C++ within the EOSIO framework

0
votes
1answer
31 views

Does permission_level (_self) means that only contract can use this method?

If yes, then how do I make sure that anyone or any specified address can call a method? If not then what is the usage of permission_level (_self ...)? action{ permission_level{_self, "active"_n}...
0
votes
1answer
39 views

EOSIO: name.value secondary index returns end iterator, even though searched value exists in table

I've got a multi-index table going with two secondary indices: TABLE entry { uint64_t id = 0; eosio::name player; std::vector<uint16_t> allocation; ...
1
vote
1answer
68 views

Using transfer to send tokens within a smart contract results in “unable to find key”

This is my example code deployed on myaccount #include <eosiolib/eosio.hpp> #include <eosiolib/print.hpp> #include <eosiolib/currency.hpp> using namespace eosio; class ...
1
vote
1answer
50 views

Can I use uint256_t in EOS smart contracts?

I want to use uint256_t in my EOS smart contract but I am getting following error unknown type name 'uint256_t'; did you mean 'uint16_t'? I thought EOS supports uint256_t as I read it in some EOS ...
1
vote
2answers
96 views

Error 3015004 when creating tokens in tutorial

Caseys-MBP:eosio.token casey$ cleos push action eosio.token create '[ "eosio", "1000000000.0000 SYS"]' -p eosio.token@active Error 3015004: The type defined in the ABI is invalid Error Details: ...
2
votes
1answer
92 views

eosio.cdt 1.3.2 indexed_by error: non-type template argument is not a constant expression

I'm trying to shift my contract and build it with the latest CDT, v1.3.2. The transition docs say to use the new ""_n name constructor but it doesn't appear to be working. I have: typedef ...
1
vote
1answer
37 views

How to handle exceptions in the smart contract?

Let's say I need to send some EOS to 2 different addresses from within a smart contract! Now, let's suppose that one of those addresses is actually a smart contract and can reject the transfer! In ...
3
votes
1answer
180 views

Whats the use of EOSLIB_SERIALIZE?

I understand that it is used for serialization and deserialization of a struct but why does anybody want to serialize/deserialize the struct? What's the use case?
0
votes
1answer
192 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
1answer
192 views

Assertion failure after updating a smart contract with tables

Before the update Before the update of the code of my c++ smart contract, this uses to work absolutely fine. Data storing on the table and actions execution were done successfully. After the update ...
1
vote
1answer
64 views

Smart contract error while calling recover_key

Specs I am using the function recover_key from the library crypto.h at the following link: https://github.com/EOSIO/eos/blob/master/contracts/eosiolib/crypto.h Code int compressed_size = ...
1
vote
1answer
41 views

Time dependent EOS unit test

My contract has time dependent actions, which I want to test. How can I mock the clock in the smart contract such that I can set it to any time I want? An example of one action that is time ...
3
votes
2answers
77 views

Do all Smart Contracts use the eosio namespace?

I'm new to creating Smart Contracts on EOS and I've followed a few tutorials (for example the official Hello World guide). Would someone be able explain why all of the examples seem to use the ...
2
votes
0answers
127 views

What are the main differences betwen EOSIO multi_index and Boost multi_index?

Inspired by this comment, I was wondering what are the main differences between eosio::multi_index and boost:multi_index and why do they exist? The documentation notes that there are important ...
3
votes
1answer
426 views

What's the difference between “time” and “time_point_sec”?

Seems that they are both datatype for storing number of seconds that have elapsed since 1970. So what's the difference between them, when should I use which? Edit: An example of the "time" datatype I'...
4
votes
2answers
595 views

How to convert asset to string in a contract?

How to convert asset to string in a contract? asset my_asset = asset(10000, S(4, EOS)); string my_asset_string = ??? //How to convert my_asset to a string "1.0000 EOS"?
0
votes
1answer
64 views

Is it possible to compile a smart contract using g++ or clang?

I want to write and execute some unit tests on a smart contract outside of nodeos, but to do that I need to be able to compile the code the normal C++ way, using g++ or clang, so that I get object or ...
0
votes
1answer
337 views

Convert string to float or double

I am trying to convert a string to a float or double, however none of the standard C/C++ methods seem to work. I have tried: atof strtof strtod sscanf In each case, I get an error message when ...
1
vote
1answer
58 views

How to retrieve data from multi index table? i a=have stored data dynamically using emplace method now how to get it back as a Record?

I have used this code to store the data(name and marks) in the table, now i want to retrieve that data in the form of record. how can i get that? void addmarks(account_name examiner, account_name ...
1
vote
1answer
135 views

Error 30700002: Smart contract's apply function not exported; non-existent; or wrong type

I have written a smart contract and I want to start testing it, it contains an apply function, which currently checks for a transfer, and then calls the appropriate function: void mycontract::apply(...
2
votes
2answers
649 views

Which IDE can I use for EOS C++ source code?

What I need is an IDE as advanced as Eclipse, that would tell me if certain imports are missing, variables not declared, compile errors, and so on... I am using Linux so Visual Studio won't work for ...
3
votes
2answers
211 views

Building smart contract error: redefinition of 'time' as different kind of symbol typedef uint32_t time;

I am pretty desperate at this point to search for hints on this issue, though I am pretty sure it's because I'm new to C++ include system. I am getting an error while trying to run a wasm executable ...
1
vote
1answer
104 views

How to get current RAM price inside a contract in C++?

How can I programatically get the current(last) RAM price inside an EOS smart contract in C++? I need to handle the data inside the smart contract for an experiment.
0
votes
0answers
35 views

Generating helper functions that serialize/deserialize types in ABI spec

According to the soon-to-be-deprecated documentation, "eosiocpp can also be used to generate helper functions that serialize/deserialize the types defined in the ABI spec." The example provided is: ...
1
vote
1answer
91 views

how to create an account except the way of using cleos?

guys!I am a beginner of eos. As it is said on the title, i want to create accounts by the way other than using cleos. I have traversed the doc of eos, but not seen the interface to create an account ...
-3
votes
2answers
144 views

Setting up C++ developing environment

I'm a C++ dev and spent last months trying out solidity stuff but defintely want to try EOS now. How do I get started to understand all the terms and various parts of EOS ? I've seen gas works ...
7
votes
2answers
161 views

What libraries are supported by contracts?

What libraries can be used when writing a contract in C++? What are the limitations? If I have a library I normally use and like, how do I compile it for use by contracts?
3
votes
1answer
139 views

How can I call third party APIs from inside a smart contract at a set time or interval?

In a scenario where a smart contract needs to check against a third party service (Let's say an API with weather information from a trusted source like Weather.com) and make a decision on moving ...
7
votes
1answer
242 views

Which version of C++ can I use in smart contracts?

Which version of C++ can I use to implement smart contracts? For example: C++11, C++14 or C++17? Do we have any constant or doc where it is defined? Also, in my understanding the code is sandboxed, ...