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
27 views

How to check in my contract the incomming amount?

I would like to check in my contract the incomming amount. I tried these: void mycontract(name from, name to, eosio::asset quantity, std::string memo){ check( quantity.amount > 50, "must ...
0
votes
0answers
13 views

Tools for development at the current stage of EOS

I am a developer coming here from Ethereum. Joining your Telegram chats and following the discussions in it, in my view, you have a lot of experience and helps the new devs. You are actually my dream ...
0
votes
0answers
9 views

Use EOS to check integrity of data

I would like to use EOS to guarantee the integrity of my data stored in a database. Each time I save the data in BD I send the corresponding hash in the Blochain. My questions are as follows: 1- Is ...
0
votes
2answers
24 views

Use UUID as primary key in multi_index

How can I use a uuid as the primary. struct [[eosio::table]] blackboxdata { name user; std::string uuid; std::string hash; std::string sqlrequest; uint64_t ...
0
votes
1answer
19 views

Is it possible to see the RAM delta of a multi_index table operation, or see who is currently paying for a row in a table

My question is in the context of smart contract development, so I'm looking for solutions that work within smart contracts: 1st: Is is possible to see the RAM delta of either an individual ...
0
votes
2answers
22 views

I have some doubts about open function of eosio.token smartcontract

async function openAccount (tokenCreator ) { try{ const result = await api.transact({ actions: [{ account: tokenCreator, //'eosio.token', name: 'open', //'transfer'...
0
votes
0answers
10 views

Callback never gets called

I've got a basic contract working that issues a query and gets a query ID. however, the callback is never getting called. I have the CONTRACT_NAME and ORACLIZE_NETWORK_NAME set correctly (the latter ...
0
votes
0answers
8 views

Checking query IDs on the testnet?

I'm entering query IDs I get when running on Kylin on this website: https://app.provable.xyz/home/check_query but it's failing to find my IDs. I have a feeling that site is looking at mainnet (even ...
0
votes
0answers
10 views

Provable: incorrect account

in reading through this guide: https://docs.provable.xyz/#eos-advanced-topics I'm attempting to see the queries issued to the contract: cleos get actions oraclizeex1a -1 -4 --console but the account ...
0
votes
0answers
12 views

When does start eos_vm in 2.0.0-rc3?

Recently I downloaded the v2.0.0-rc3. I want to know how can eos_vm work on blockchain and when does it start. So I found it. void wasm_interface::apply(...) #ifdef EOSIO_EOS_VM_OC_RUNTIME_ENABLED ....
0
votes
0answers
17 views

How to limit the maximum CPU usage in transcation in EOS smart contracts?

when I used "cleos push action ..... or push transation .....",I used "--max-cpu-usage-ms" to limit the actions not consume more cpu usage. and choice the most economical way to send Non-emergency ...
0
votes
1answer
22 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
7 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
22 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
118 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
24 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
15 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
32 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
25 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
11 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
19 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
22 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
15 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
27 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
93 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
27 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
28 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
50 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
14 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
39 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
26 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
34 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
47 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
29 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
77 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
20 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
64 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
126 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
46 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
37 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
33 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
22 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
30 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
53 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, ...