Questions tagged [smart-contract]

Anything related to decentralized application (dApp) development, concepts, and possibilities with smart contracts, or technical questions for the development of smart contracts.

Filter by
Sorted by
Tagged with
3
votes
1answer
109 views

Error 3030002 when trying to set contract steps

I'm following steps from exchange-tutorial-python's README file inside the Docker container: $ docker run -it eosio/eos # nodeosd.sh 2>/dev/null & # cleos wallet create Creating wallet: ...
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....
4
votes
3answers
174 views

How can a contract obtain and process variable data from the outside world?

Suppose I have a contract which depends on the current price of a real-world asset (like the price of gold). How would the contract obtain that price? How would I ensure that every time the contract ...
4
votes
1answer
640 views

“dice” contract “withdraw” action problem

I wonder if anyone experienced a similar problem and managed to resolve it. I'm testing the "dice" contract on my local tesnet. I've setup up all necessary contracts and could deposit assets to the "...
5
votes
2answers
224 views

Where should tables be created? In the contract or in each action?

In the simple blog dapp (https://github.com/EOSIO/eosio-project-demux-example) the table (for posts) was defined in the contract but is not instantiated as a field. What are the advantages/...
6
votes
1answer
73 views

How does eosio support complex structure as the input of a contract's method?

AFAIK, the data type in Wasm only supports i32,i64,f32,f64, but when we use eosio contract, we can pass a string as a parameter. Anyone can tell me how eosio does that?
5
votes
1answer
2k views

How to do an action in a contract to transfer tokens to other user accounts without adding permission in dawn4.0? [closed]

How to do an action in a contract to transfer tokens to other user accounts without adding permission? Actually, in dawn3.0 i can use the function like this below, but in dawn 4.0 it doesn't work ...
5
votes
1answer
553 views

How to calculate the RAM size of a contract in EOSIO and then i can know how much EOS i need to pay for every contract

How can I calculate the RAM size of a contract in EOSIO? I mean, is there any tool from EOSIO? Could this tool help me to know how much EOS I need to prepare for every contract.
6
votes
1answer
138 views

How to add third part libraries when developing smart contracts in EOS?

For example, if I want to add a random digital generator library, what can I do? I want to add all the source files into my contract directory?
7
votes
1answer
425 views

Unit testing custom contracts [duplicate]

What is the best way to write contracts in a TDD style? The eos source repo has unit tests which seem to be focused around testing the platform but my question is focused at the next level up (based ...
7
votes
1answer
736 views

How can a action be scheduled to execute at specific timestamp or block?

Is it possible to schedule an action defined within a contract to be automatically executed at a specific timestamp or block? I know it's possible to get a timestamp inside of a contract but, I'm ...
7
votes
2answers
358 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?
8
votes
0answers
109 views

How do you properly change/add to the struct that is stored in a table as part of a contract upgrade? [duplicate]

Does this even work? Seems like I've broken my tables doing this but I have changed my contract pretty significantly. I'd imagine that someone may want to add a new "column" (member) to their "...
9
votes
2answers
623 views

Is there any method to remove a useless contract from the blockchain just like “selfdestruct” in ETH?

As I know, in ETH, when a contract would be useless, it could be destroyed by using the "selfdestruct" action. So, is there any same method to remove a useless contract from the eos blockchain?
11
votes
2answers
571 views

How to airdrop a new token to EOS holders?

If I'm developing a project on EOS that will require a new custom token I might want to do an airdrop of that token to existing EOS holders. Are there best practices on how to go about that? Roughly ...
11
votes
1answer
839 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
1answer
34 views

Can smart contract trigger some action on specified timestamp and change certain account balances?

Imagine I have a poll with specified timestamp for the end. At that point in time votes should be tallied and voters token balances should be adjusted in both directions (increase and decrease). How ...
0
votes
0answers
82 views

Make a transfer from contract code on behalf of user [duplicate]

Installed: eosio: 1.7.3; eosio.cdt: 1.6.1 Implemented and locally deployed: sample market contract and eosio.token contract. In order to make an inline transfer from market contract in behalf of a ...
2
votes
1answer
186 views

CPU-Usage Optimization

I'm trying to figure out how to optimize one of my smart contracts for less billed CPU-usage. There are typically different methods to optimize performance of algorithms but I'm not clear about if a ...
3
votes
1answer
95 views

Ricardian Contract

Does eosio also sign the transaction with the ricardian contract of user consent and/or how does the application proove that a party agreed on said ricardian contract? I have integrated the ricardian ...
4
votes
1answer
51 views

Creating a base contract with (virtual?) base methods that can be overriden

is there a possibility to create a base contract with methods that can be overridden in contracts that inherits from it? Cheers
6
votes
1answer
1k views

How I can typecast the “0.0001 EOS” into eosio::asset

I declared a variable value = "0.0001 EOS"; , inside my action I want to transfer those asset to a account .I am having difficulty to typacasting this string into the eosio::asset value . my code goes ...
3
votes
1answer
515 views

How do I create a Multi-Index DB secondary index from a String?

I'm developing a Smart Contract for EOSIO. I have a Multi-Index table with a uint64_t primary key. I'd like to add a secondary index to the table. Ideally the data I'd be indexing on would be a std::...
0
votes
1answer
838 views

assertion failure with message: no balance object found

This error message occurs when trying to do a transfer: assertion failure with message: no balance object found What causes it and how can it be avoided?
0
votes
1answer
237 views

eosio-cpp command not found error?

When I am trying to run hello world smart contract using a command eosio-cpp -abigen -o hello.wasm hello.cpp shown an error eosio-cpp: command not found?
0
votes
1answer
163 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; ...
0
votes
1answer
49 views

Unable to publish to Kylin

I have been developing against a local node, for which I created a key-pair. Now that it's time to publish to the testnet, I've imported said private key into Scatter and linked it to the account to ...
0
votes
2answers
298 views

I have got “cannot modify objects in table of another contract” when trying to modify a table in my transfer function

I saw some contract implement a handler which will be triggered when receiving EOS token via eosio.token::transfer. I tried to have the same transfer handler and change some row of my table. But I ...
0
votes
3answers
211 views

Can not find `eosio/eosio.hpp` while compiling with eosio-cpp

I used the documentation provided by EOSI. I made all the required installation as suggested in the docs. While writing the hello world contract, I face this issue when running the following command ...
5
votes
2answers
2k views

Clearing RAM tables of eosio.token contract

What I am trying to do is clear the RAM table completely. This question is not a duplicate since it is asking for a full and a working solution. The contract that I was executing filling the RAM ...
3
votes
6answers
614 views

eosiocpp -g generates empty abi file

I have created smart contract inside the /build/contracts and running this comman generates empty abi file. eosiocpp -g eosio.test.abi eosio.test.cpp tried both hpp and cpp but same result.
4
votes
1answer
99 views

BUG when two accounts send action at the same time to modify multiindex table

It took me several days to find the bug. I got a table like this TABLE t {uint64_t key, name player1, name player2, uint64_t status}; When the contract received the specific action, it will go ...
2
votes
1answer
245 views

What is the meaning of “scope” in a Smart Contract?

Since I have read the tutorial. I don't understanding the following: Note that scopes are used to logically separate tables within a multi-index (see the eosio.token contract multi-index for an ...
3
votes
2answers
87 views

eosiocpp tool generates different types

If you look into every ABI file in the contract folder you will find: { "version": "eosio::abi/1.0", "types": [{ "new_type_name": "account_name", "type": "name" }], ... } when I am ...
1
vote
1answer
89 views

Can a deferred transaction make the initial transaction fail

Imagine a user sending me some eosio.token to my contract and when I receive the notification, I start a new deferred transaction that fails later. Can the deferred transaction make the initial ...
1
vote
1answer
77 views

How to delete record on EOS if I forget table structure

I issue an EOS token for fun half a year ago and I'm planning to release my EOS ram recently. The problem is that I forget the table structure I made before and I overwrite the contract and there is ...
0
votes
1answer
58 views

Can I use Timers?

I know that there's no timer in other smart contracts and even this is not possible in regular blockchains. But, EOS uses C++, and they already did lots stuffs which makes smart contracts more usable. ...
0
votes
1answer
162 views

What's the difference between eosio.token and currency.hpp?

What's the difference between eosio.token and currency.hpp found in the contracts/eosiolib folder? They seem quite similar.
3
votes
1answer
177 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
2answers
152 views

Contract compilation fails during elemental battles tutorial

I have followed the elemental battles tutorial until lesson 2 step 4, and at the end of it, the tutorial instructs to compile the existing code with eosio-cpp -o destination.abi source.cpp -abigen (...
0
votes
1answer
28 views

EOS Token contract audit issue

My token contract was done by a third party vendor that did not share source code of the token contract with me. Can you help me on how to find the code, so that I can submit it to you for audit ...
1
vote
0answers
54 views

Get symbol & contract from asset

I currently have an asset property that stores a value, i.e. 100 EOS which could also be another token like 100 TLOS. Is there a way to extract the symbol and possibly the token contract from that ...
0
votes
1answer
32 views

Acting on upon a receipt of a token, using v1.6 c++ libraries

Let's say I wanted to act upon receipt of a token and/or a message to a smart contract. Previous versions of EOS used the apply function to do this, however as of v1.6 things have changed to pure cpp ...
4
votes
1answer
622 views

How to set “deep structures” for Smart Contracts Tables?

I have a table that I'm playing with that I want to have a map that links the id with a specific structure. I tried to use map and the code compiles fine, but when generating the abi file it takes ...
0
votes
0answers
79 views

Time point to string

I am currently trying to get the current time using time_point_sec(now()); Does someone know how to convert that to a std::string?
2
votes
1answer
152 views

Issue while compiling smart contract - eosio.cdt

I have installed eosio.cdt in Ubuntu system by using commands from EOS Developers Portal wget https://github.com/EOSIO/eosio.cdt/releases/download/v1.4.1/eosio.cdt-1.4.1.x86_64.deb sudo apt install ./...
1
vote
1answer
124 views

Serialization Error Processing WASM while following hello.cpp tutorial

I am following along the tutorial on the EOS website at https://developers.eos.io/eosio-home/docs/your-first-contract At the first smart contract development section, I cannot manage to publish the ...
1
vote
1answer
493 views

Verify user's signature in contract

User A has signed a message msg with signature sig.How can the third party verify this message in a contract? The verify method contract is like this: void verify_user_sig(account_name user,string ...
1
vote
1answer
108 views

Why wouldn't it be good to store lots of data in eos logs instead of smart contract?

'm curious where to save big data. I don't want to save it in my private db and not in ipfs. I want it to be visible on blockchain. So It's visible on blockchain etherscan If I'd go to store data in ...
1
vote
1answer
42 views

Is it possible to lock publish contract with set permission?

Is it possible to setup a lock (multisig) for the command cleos set contract ? in order to request one or more signatures to deploy a contract ? cleos set action permission eosio eosio set ...

1
4 5
6
7 8
12