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
0
votes
1answer
7 views

on_notify fails to compile

I'm following the guidance at https://developers.eos.io/eosio-home/docs/notification-handlers where it states I can decorate a method with: [[eosio::on_notify("eosio.token::transfer”)]] however, ...
0
votes
0answers
4 views

How to interpret the contract?

LLVM was designed the way(Picture). And I want to know if i understand correctly. Smart Contract is byte code. So EOSIO need to interpret the byte code. EOSIO use WAVM converting to Middle End IR ...
0
votes
1answer
12 views

How to parse json string in contract?

My contract want to receive transfer with memo in json format, is there any libraries supporting the json parse?
0
votes
0answers
99 views

eosio.contract unit_test error “critical check validate()” when added new global table and bps change

i get the an error from the eosio.contract unit_test as follow: /eosio/1.8/include/eosio/testing/tester.hpp(364): fatal error: in "eosio_system_tests/vote_producers_in_and_out": critical check ...
0
votes
1answer
17 views

I would like to make listener contract

I would like to make a contract, wich listens to the incoming transfers. How do I make a listener contract, wich listens to incoming transfers on the account?
0
votes
0answers
13 views

Amount deposited not being recorded in contract

I'm learning to make my own contract and I'm having a hard time getting LNX that is transferred to the contract to be recorded ad a balance. #include <eosio/eosio.hpp> #include <eosio/asset....
0
votes
2answers
24 views

How to pay for user resources cost for payable action?

I have a smart contract which has a payable action defined. I want to cover the cost of transfering token to my contract, what's the best way to do this? Thanks.
0
votes
1answer
24 views

Static values get mangled

if you run the following (on eosio v1.8.4): #include <eosio/eosio.hpp> #include <eosio/asset.hpp> namespace eosio { class UTL { public: static name code; ...
0
votes
0answers
10 views

Intersect multi index with vector

So i have a vector with eosio::names and my table has a primary key of the same type. I want the result of the intersection in my table as end result. Existing table data (other row fields) need to be ...
0
votes
1answer
16 views

Function not giving expected output Eos smart contract

My contract .Cpp part void mainloan::adduwr(name acc_name, double interest, uint64_t loan_amount ) { print("Adding underwriter", acc_name); // require_auth( _self ); uwr_table.emplace(get_self(...
0
votes
1answer
15 views

Convert String to double (flaot32/float64) in EOSIO [duplicate]

serialize support for float types is not added in flutter and thats why i have to come to this way,so if anyone have any working example for this,ill be really thankful for that. I have tried this ...
0
votes
1answer
8 views

How min_activated_stake and total_activated_stake is calculated?

I have a query, in the producer_pay contract, i don't understand how min_activated_stake is calculated here. Also how total_activated_stake is calculated, I've seen that default it's value is defined ...
0
votes
0answers
39 views

Code abstraction

I need a little guidance. I've been structuring my code like this: #include <eosio/eosio.hpp> class [[eosio::contract("table")]] Square { private: struct [[eosio::table]] square { ...
0
votes
1answer
16 views

call to implicitly-deleted copy constructor

I'm unable to compile a small test contract and am hoping for guidance. I have a class called Account, in the following 2 files: // --- account.hpp #pragma once #include <string> #include &...
0
votes
1answer
8 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
1answer
65 views

How can we retrieve table data with secondary Index in EOS table

this is my table struct [[eosio::table]] payment_made { uint64_t pay_id; uint64_t loan_id; uint64_t pay_amunt; time_point_sec pay_date_req; time_point_sec pay_date_approve; ...
0
votes
2answers
22 views

SELECT value from “column” for which row is retrieved

Problem Say I have a table with the following structure. int value | asset tokenType 4 | 0 bitcoin 7 | 0 altcoin. Now I also have this function where I pass in an asset and i want to ...
0
votes
0answers
25 views

Problem in deferred transaction function

I have added the problem statement as a comment in code so please read the commented line in code. void mainloan::checkdaily(uint64_t loan_id) { require_auth(_self); auto itr = loan_table.find(...
0
votes
2answers
37 views

how do i use current_time_point() to store date in eos table

I have tried This way and its not getting store,infact its giving me error,please sugguest if im making any mistake. error: use of undeclared identifier 'current_time_point'; did you mean '...
0
votes
1answer
13 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
0answers
12 views

How to use md5.sum in eos contract

I search nothing about md5 in eosio source code. When i use external md5 lib, i encounter the link error like this 'env._Z7md5sum6NSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE ...
0
votes
1answer
34 views

Store enum value in table

I have a simple enum (or enum class, neither one is working ) enum vote_option { upvote = 0, downvote and a table which will store a value of that enum type. struct [[eosio::table]] poll { ...
0
votes
1answer
24 views

How to remove deployed smart contract?

I want to sorta "undeploy" smart contract as it was not deployed ever. If it is possible, I hope it will cleanup account's RAM. And I'm not talking about freezing .
1
vote
0answers
14 views

How to retrieve tx object within contract

I'm trying to retrieve tx within contract, but I only can find tx_hash using read_transaction. Anybody can help me?
2
votes
1answer
28 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 ...
1
vote
0answers
17 views

How to view Macro extended code?

I use this command is ok: eosio-cpp hello.cpp -o hello.wasm But I want to view Macro extended code by option -E - Only run the preprocessor, I use this command: eosio-cpp hello.cpp -E And get ...
1
vote
1answer
37 views

Wondering how to fix eosio.token transfer error in contract

I am developing an EOS dapp game When the user acts on the contract after Scatter authentication, the logic is to deposit the bet amount from the user to the contract account. But I get an eosio....
0
votes
0answers
11 views

Using eosio.cdt with Clang-Specific Compiler Options

As the cdt is build around Clang 7, is it possible to use the cdt with Clang-specific compiler options? There are some options to customize/optimize the compilation-process like -ffast-math which ...
0
votes
0answers
26 views

Catch errors when calling deposit

When I send EOS in a contract to several recipients, it can happen that this fails, e.g. because a recipient has a contract running like that: Example contract of one recipient: [[eosio::on_notify("...
0
votes
3answers
41 views

How does Jungle testnet create new account?

I have created new account in https://monitor.jungletestnet.io . I have a copy of the log # eosio <= eosio::newaccount {"creator":"junglefaucet","name":"myaccount","owner":{"threshold":1,"keys":[{...
0
votes
0answers
19 views

How to get/change resource limits for account?

On Jungle testnet I have bidded account name and the auction is closed now, so the name is "mine". I try to create an account with that name and receive an error: account xxxxx has insufficient ram; ...
0
votes
1answer
60 views

how to connect eos smart contact with flutter app

flutter has this package name Eosdart,Im able to get the detail from blockchain with app like account detail,but im unable to push the transaction. I want to push a transaction which carry argument ...
1
vote
0answers
98 views

Sending transaction with Scatter from a single-page application

Request for help: I need a simple example of sending transaction (pushing a contract action test) by Scatter written in plain JS for a single-page browser scrip without any requirjs , vue , angularjs ...
0
votes
0answers
45 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 ...
0
votes
1answer
34 views

COMPILATION ERROR error: static_assert failed "Something went wrong. Please report this issue to the github

Getting an error when the code reaches this particular function. Is there something obvious I am missing here? Kindly Note this is Deferred transaction Please ask if anything else is required from ...
0
votes
1answer
30 views

multi_index table get const_iterator at a specific position

is there a better way than a loop to get the value/const_iterator at a specific position in multi_index table? current: auto idx = _table.get_index<"name"_n>(); const_iterator b; int count = ...
0
votes
0answers
19 views

How to get active key within smart-contract

I need to get account public key within smart contract. I tried to find public keys in system contracts, but unsuccessfully. Anybody knows how to do it?
0
votes
1answer
27 views

COMPILATION ERROR error: non-type template argument is not a constant expression

what is causing this error while im compiling ? struct [[eosio::table]] requestForLoan{ uint64_t req_id; name borr_name; uint64_t borr_id; name uwr_name; uint64_t uwr_id;...
0
votes
0answers
30 views

Error message assertion failure with message: “read”

I made my own smart contract. and tried to erase my table. But it didn't. I will attach the following error { "code": 500, "message": "Internal Service Error", "error": { "code": 3050003, ...
0
votes
1answer
13 views

Is there RPC API endpoint to request how much resources account uses?

Is there any way to track or get information about current user account resources consumption using RPC API? I.e. how many operations can be executed with the current tokens or how much RAM or CPU is ...
1
vote
2answers
53 views

How to free up used memory

I have this picture for my account memory: quota: 220.4 KiB used: 207.5 KiB I want to free the memory and sellram. Is it possible, and if yes, how to do that?
0
votes
1answer
48 views

Deferred transaction on EOS [duplicate]

Is it 100% sure that deferred transaction will run on what delay is defined? Is there any possibility that deferred transaction failed to run on defined day? If it fails what is the alternative? ...
0
votes
1answer
68 views

Can we store date on eosio table?

Is there any direct datatype in eosio to store date? and if not then how can we store dates in eosio table? void mainloan::paymentConfirm(uint64_t pay_id,uint64_t pay_date,double pay_amunt,name from ...
0
votes
1answer
58 views

How to upgrade a multi_index table in a smart contract

I have initially the following multi_index table: struct [[eosio::table]] plastict { uint64_t id; uint64_t type; uint64_t primary_key() const { return id; } }; typedef eosio::multi_index&...
0
votes
2answers
78 views

How to loop a multi_index table in a smart contract

I have very simple table items with the following structure: struct [[eosio::table]] item { uint64_t id; uint64_t state; string description; uint64_t primary_key() ...
1
vote
1answer
27 views

what is get(),find(),end(),raw() keywords in eos smart contract?

how and when to useall these keywords and what they actually means? and what is the difference in these 2 statement given below auto itr = loan_table.get(loan_id); auto itr1 = loan_table.find(...
0
votes
0answers
81 views

When deploying a contract what is important (overall contract/wasm size or amount of functions etc) to not get transaction took too long

when I try to deploy the system.contract I sometimes get transaction took too long with the new eosio version 1.8.1. Now I would like to know on which part of a contract do I need to pay attention ...
1
vote
1answer
37 views

EOSIO's BP Benchmark

Today, I am researching how I can draw a diagram for BPs Benchmark, and luckily I found information about Ahola. But I cannot figure it out, how I can get value from Ahola's smart contract to draw a ...
0
votes
1answer
113 views

how to compile eosio.system contracts?

I cloned the eosio.contracts folder from github and made some changes in some of the contracts. Now I would like to compile them and test them, but when I try to compile them with eosio.cdt I get ...
0
votes
2answers
28 views

Zero amount transfer?

I just want to use EOSIO as a DB of some events by sending transactions when other events fire. Is it possible to send ZERO amount transfers? The events are millions a day, and I don't know how to ...