All Questions
Tagged with contract or smart-contract
618 questions
2
votes
1
answer
191
views
Is it possible to deploy contract via curl?
Using command line i am deploying smart contract "eosio.token".
cleos -u http://127.0.0.1:8888 set contract eosio.token ./eosio.token -p eosio.token
Is it possible to deploy smart contract using ...
0
votes
1
answer
107
views
check (within smart contract) if an account is a proxy
How can I verify within a smart contract that an account is a proxy? I know that there is a function is_account, which verifies that a name is an existing account.
Is there a way to check if an ...
3
votes
1
answer
496
views
How can i burn the tokens i create with eosio.token
I want to burn the tokens i created for some reasons, I found the method "retire" in eosio.token. But, this method only change the supply of the token, the maximum supply is still the same as it is ...
1
vote
2
answers
242
views
How to pass a map into an action
I'm trying to pass a map into action, but there is serialization error:
Error: expected object containing data: undefined
There is a function signature:
void init(uint64_t id, const map<uint8_t, ...
4
votes
3
answers
1k
views
`env.is_feature_activated` error when set contract
I'm trying to set up my eos enviroment. When I post the system contracts I get this error msg:
Error 3070000: WASM Exception
Error Details: env.is_feature_activated unresolveable
enviroment: ubuntu ...
1
vote
1
answer
142
views
Is it possible to set up a smart contract with multiple .cpp and .hpp files?
If we want to make our smart contract code modular, and keep each class, contract, and table in its own file, is it possible to do this, and if so, how?
1
vote
1
answer
73
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 ...
1
vote
1
answer
339
views
what does the same_payer mean in eosio contract?
user_stakes.modify(sk,same_payer,[&](auto &s){
The variable same_payer confused me sometime, so, what does the same_payer mean in eosio contract ?
0
votes
0
answers
96
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 ...
1
vote
0
answers
28
views
Hide information in the blockchain
Lets say I want to create a player vs player game with a battlefield and moving armies, the movement and data about the armies and where is it going is put on the blockchain.
My question is how to ...
2
votes
1
answer
2k
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
1
answer
67
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 ...
1
vote
1
answer
177
views
no member named 'check' in namespace 'eosio'
I am trying to build a contract and receiving this error:
In file included from /usr/opt/eosio.cdt/1.6.1/bin/../include/eosiolib/contracts/eosio/system.hpp:6:[0K
/usr/opt/eosio.cdt/1.6.1/bin/../...
1
vote
2
answers
207
views
How to get a contract to accept tokens as payment
I keep getting the following error:
transaction declares authority '{"actor":"test2","permission":"active"}', but does not have signatures for it under a provided delay of 0 ms, provided permissions [...
0
votes
2
answers
128
views
Is there a way to issue tokens infinitely?
I want to design a system where token supply can grow infinitely.
Is it possible not to fix total supply at the token creation moment?
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
1
answer
100
views
What exactly the merkle function is returning?
In the below file,
https://github.com/EOSIO/eos/blob/v1.7.4/libraries/chain/merkle.cpp,
what do ids.front() mean?;
what exactly this function Merkle is returning?
Could you please explain what this ...
3
votes
1
answer
511
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 ...
0
votes
3
answers
282
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 ...
7
votes
1
answer
705
views
How to debug eosio::on_notify("eosio.token::transfer") actions?
I'm working on a contract that will run an action when receiving tokens. The following code does not run when the account receives EOS or JUNGLE tokens on the Jungle Testnet.
#include "./test.hpp"
.....
1
vote
1
answer
113
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
2
answers
100
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
1
answer
477
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
2
answers
92
views
Ico smart contract update
I would like to update this code, because it is CDT 1.2.
I would like to update for CDT 1.5 or CDT 1.6.
What do I need to change?
#include <eosiolib/eosio.hpp>
#include <eosiolib/currency....
1
vote
2
answers
175
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
1
answer
31
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 ...
0
votes
2
answers
826
views
Why is [[eosio::on_notify("eosio.token::transfer")]] not working?
Network: kylin testnet.
I transferred eos to this contract, but it the "deposit" function was not called. What do I miss?
0
votes
1
answer
34
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 ...
0
votes
0
answers
95
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?
1
vote
2
answers
970
views
Using find on multi index table
I have a table defined as the following:
struct [[ eosio::table, eosio::contract("voting") ]] identity
{
uint64_t key;
key256 identityHash;
time_point_sec createdAt;
uint64_t ...
1
vote
0
answers
74
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 ...
3
votes
3
answers
146
views
What are the advantages and disadvantages of using multiple smart contracts?
I have noticed many EOS contract programmers choose to have a token contract and a separate smart contract for other things to do with those tokens. What are the advantages and disadvantages to this ...
0
votes
1
answer
118
views
read datastream of length 29 over by -4
enum house_status: uint64_t {
NEW = 10,
FULL = 20,
ONGOING = 30,
OVER = 40
};
struct [[eosio::table, eosio::contract("game")]] house{
uint64_t id;
uint64_t owner_player_id;
...
1
vote
1
answer
161
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
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 ...
0
votes
1
answer
76
views
Is there a way to call a multisig approval programmatically from within a contract?
Following scenario:
There's an action which requires 3 signatures - two are 'normal accounts' and the third one is like 'system or robot', which does some verifications from within the smart contract....
0
votes
1
answer
44
views
How is memory aligned in the EOSIO smart contract consensus memory?
Are there any memory savings if I declare a table record that has, say, a 64-bit integer (occupies 8 bytes) and a 16-bit integer (occupies 2 bytes)? Or is it aligned at 64 bits and said record would ...
3
votes
1
answer
124
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 ...
0
votes
1
answer
103
views
How do I access a contract class variable from an extern “C” function "void apply()"?
In some scenarios, It's convenient to configure the conditions for monitoring some certain transactions by using this method
extern "C" {
void apply(uint64_t receiver, uint64_t code, uint64_t ...
0
votes
0
answers
21
views
Can I deploy a contract from within a contract? [duplicate]
We can create accounts from contract code:
https://github.com/angelol/smart_account_creator
and we can query things about accounts:
https://github.com/nsjames/Account-Has-Code
is there a way to ...
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.
1
vote
1
answer
53
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 ...
2
votes
1
answer
244
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 ...
2
votes
1
answer
405
views
Why does using available_primary_key() as scope for a table result in this behaviour?
Scenario:
Two tables, each using uint64_t as a primary key
Table A rows need to reference rows in Table B
Why? Relational database data duplication reasoning etc etc
Both table's primary keys are ...
1
vote
2
answers
146
views
Why actions can't have return values?
I can't understand why actions can't return values.
A simple use case is for adding records in multi_index.
I need to return the primary key to link that to my off-chain data.
1
vote
1
answer
397
views
on_notify not being fired on local or jungle testnet
I'm using the following contract on both my local and jungle testnets, the on_notify methods are not being fired. Everything appears to be in order, I'm hoping I've missed something obvious.
I ...
1
vote
1
answer
1k
views
Duplicate symbol WASM compilation error when using header/hpp for contract
I'm looking to use a hpp file as an interface for multiple contracts. I've created a test contract and receiving a WASM compilation error. I based the test contract on the format used by eosio.token....
0
votes
1
answer
61
views
Is there a library for encryption/decryption in EOS? [duplicate]
I want to perform some encryption on a given message, so I am wondering if there is a library that I can use in EOS? And I have checked the post Cryptographic Operations in Smart Contracts?, but the ...
0
votes
3
answers
338
views
Smart contract - find on two columns
I am currently writing a blog PoC on EOS. I would like the ability to delete a post. Now deleting by the ID alone is simple, I have it implemented as follows:
whisper::post_index posts(_code, _code....
0
votes
1
answer
71
views
Stake EOS and then unstake
Is there any documentation on staking or unstaking EOS using smart contracts?
I basically want to provide an escrow service where the seller needs to stake the value of the item and the buyer stakes ...