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
1
vote
1answer
119 views

Example of resource staking from contract

I'm looking for any relevant code example or documentation describing how to make contract stake resources for some account. I'm aware of delegatebw function of cleos however, I need the following ...
3
votes
1answer
237 views

Deploy Contract from browser using eosjs

so I would like to deploy an EOS contract using eosjs. I encountered several problems (especially with converting the .abi and .wasm files). All the examples either use node (so fs is available) or an ...
2
votes
0answers
88 views

Where are deferred transaction errors logged to?

I'm trying to learn about deferred transactions. I'm creating a bogus deferred transaction that invokes a non-existent action "fakeaction": transaction out{}; out.actions.emplace_back(...
0
votes
1answer
36 views

Can a contract know the creation date of accounts?

Is the creation date of accounts part of consensus? Can I query it within contracts? If so, how to do it?
0
votes
1answer
429 views

How to list all balances of tokens managed by an eosio.token contract?

Let's say I have deployed the standard eosio.token contract to an account called "myeosiotoken," and I have used it to create an "ABC" token. Then, I issue 1,000 ABC to "someaccount1" and 2,000 ABC to ...
1
vote
1answer
120 views

How to extend the functionality of eosio.token?

I want to create an EOSIO token with additional functionality. For example, I want users to be able to claim() an additional token per day (since e.g. account creation date). Should I create a new ...
0
votes
1answer
173 views

Token transfer missing_auth_exception

{ "code":500,"message":"Internal Service Error", "error":{"code":3090004,"name":"missing_auth_exception", "what":"Missing required authority", "details":[{"message":"missing authority of thomsoimj21","...
0
votes
1answer
88 views

How to deploy a contract to api-kylin.eosasia.one testnet

I have written a helloworld contract and got compiled that successfully thomsonim123 is my kylin testnet account with some EOS when I want to deploy the contracct to the testnet I get few errors. ...
0
votes
1answer
67 views

Is it possible to overload contract actions?

I had a method: -- t.hpp -- [[eosio::action]] void exchange(); -- t.cpp -- void token::exchange() { ... } EOSIO_DISPATCH(eosio::token, (exchange)) and then decided that if a parameter were ...
1
vote
1answer
432 views

Authorisation failure with deferred transaction

I have a contract action that does some cleanup: void token::cleanup() { ... } that I want to run asynchronously from another action like this: schedule("cleanup", 10). my scheduling method looks ...
0
votes
0answers
75 views

Exception Details: 3080006 deadline_exception: Transaction took too long

I'm getting this error and have read all there is to read on the net (which isn't much) about it. mostly I see others complaining about this error when they run an action for the first time in my ...
0
votes
2answers
238 views

Erasing records with for loops

if I want to erase a table: orderbook b(_self, _self.value); auto m = b.get_index<name("idxprod")>(); for (auto &i : m) { m.erase(i); } I get the error: Error 3160005: The table ...
4
votes
1answer
259 views

How to sort a table?

I'm following this explanation https://developers.eos.io/eosio-cpp/v1.1.0/docs/multi-index-table-tutorial using v1.5.0 of the CDT. Here's what I've got: struct [[eosio::table]] order_struct { ...
1
vote
1answer
36 views

Symbol stringification?

an action in my contract accepts an asset: void token::burn(asset a) which I want to print out: printf("Asset [%s] burnt\n", a.symbol.to_string()); except the symbol class does not offer ...
1
vote
2answers
42 views

Is there a way to check the histroy of a contract's table?

Is there a way to check the history after deleting the information in the table? For example, check yesterday's table information.
0
votes
2answers
57 views

Asset instantiation woes

if I declare an asset: asset a(10, symbol("TST", 0); and I print it: a.print(); I get pretty much what I'd expect: TST the format's not quite right (10 TST would have been better), but ...
1
vote
1answer
88 views

Multiple print statements?

given the lack of debugging facilities in EOS contract development I add print() statements to my code, but I'm finding that only the first one gets printed, so: print("HERE\n"); print("HERE\n"); ...
0
votes
1answer
365 views

no member named 'print' in 'std::__1::basic_string<char>'

if I declare a string and attempt to print it like this: std::string s; eosio::print(s); the EOS compiler pukes: In file included from t.cpp:1: In file included from ./t.hpp:4: In file included ...
1
vote
2answers
122 views

Passing a string to an action?

I have an action that needs to operate on a string: void token::MyAction(std::string key); so I would expect I can make the call like this: cleos push action MyAccount MyAction '["burn"]' -p ...
0
votes
2answers
47 views

Referring to permissioned account within contract code?

I've created a table within a contract where I want to store user information. the .emplace() method's first parameter specifies the "scope" (I guess) for data to be stored and thus the user account ...
0
votes
1answer
88 views

delay_sec is not accurate for deferred transaction

I have set some seconds but sometimes it is delayed more than 10 minutes. I know that delay_sec is not the accurate time because of the block production mechanism. The real time is much later than it ...
1
vote
2answers
42 views

Error about billed CPU time when set Hello World Smart Contract

My VM Spec (VMWare ESXI) CPU : Xeon CPU E5-2620 v2 @ 2.10GHz Memory : 8GB HDD : 70GB EOS 1.5.3 , EOS.CDT 1.4.1 Compile from Source Code with AutoBuild Scripts. I try to create first smart contract ...
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; ...
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 ...
2
votes
1answer
93 views

Multiple Inheritance within ABI files

I have various classes that use multiple inheritance, i.e.: class A { }; class B { }; class C : public A, public B { }; Single inheritance in an ABI file is possible using the base layer as ...
0
votes
2answers
208 views

Best way to read data from contract using eosjs or Cleos

How you read the data from your contracts, just by using actions? Or there is another way? Thanks!
2
votes
3answers
78 views

Updating existing token contract code

I have deployed a token on main net and called the create method to issue tokens. However, I would like to update the token code to add an extra feature. I can't find any information on the best ...
2
votes
1answer
157 views

Fixing a smart contract written in old version of eosio.cdt

I am using Ubuntu 18.04 LTS first of all. So I am trying to look up how to start building an EOS dApp, starting with this example on Github. Here is the link: https://github.com/eosasia/eos-todo I ...
2
votes
2answers
285 views

A possible alternative sign in/login process instead of firebase auth / amazon cognito using an eos contract?

I had the the idea of a secure alternative login process using an EOS smart contract instead of firebase or Amazon cognito. I would like to know if something like this feasible? My idea is somewhat ...
1
vote
1answer
51 views

In Eosbetdice contract, in the transfer action, why it is able to emplace a new row in this table?

In Eosbetdice contract, https://gitlab.com/EOSBetCasino/eosbetdice_public/blob/master/EOSBetDice.cpp#L193 The code of the contract in this line should be "eosio.token". I wonder why it doesn't get "...
0
votes
1answer
49 views

Blacklisting specific addresses on token::transfer

I've issued a token using eosio.token standard contract. I want to prevent transfers to a number of specific accounts, for a limited time. Since it is temporary, I think I can simply hardcode the ...
1
vote
1answer
46 views

hello contract: not printing the name

I just set the hello contract and pushed action hi. But it did not print the name. Here is my test command. $cleos --wallet-url http://172.18.0.1:8899 -u http://172.18.0.1:8888 push action shlee ...
0
votes
2answers
292 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 ...
1
vote
1answer
343 views

How to write a contract to stake my own token without doing transfer?

In my case, I need to write a contract which has an action can stake my own token (issued by my account with eosio.token, like TADO). If A has 10 TADO already, when he stakes 4 TADO, his balance still ...
2
votes
1answer
321 views

Using name as secondary index

I want to save name in table, and to search by it. It doesn't seems that it is possible to have secondary index with type name for some reason. I would like also to pass name in function and to have ...
0
votes
1answer
193 views

eos smart contract constructor

when is smart contract constructor triggered for the first time? I know it is triggered every time action is pushed, but what if i want something to be triggered when smart contract is deployed for ...
0
votes
1answer
631 views

What does “require_recipient” function actually do in eos?

What does "require_recipient" function actually do? What's the difference between require_recipient and inline action? If contract A calls contract B using require_recipient, can contract B use ...
3
votes
1answer
497 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
222 views

Access public variables of a TABLE in an EOS Smart Contract

I'm trying to access data inside a smart contract. The contract is visible here for example. The documentation for the smart contract is accessible here An example of an instance of the contract (...
0
votes
1answer
95 views

What is the ledger in EOS?

When I create a smart contract, e.g: game. what does the ledger store? (EOS tokens, or heathy points, level of user). If the ledger stores heathy points, level, so how I can push it into block (...
1
vote
2answers
108 views

EOSIO Tutorial : publishing contract error

I'm working on EOSIO tutorial and now I'm workingon https://developers.eos.io/eosio-home/docs/data-persistence part. Right now, I'm stuck on deploying contract. jongbok@DESKTOP-96ICBPJ:~/eos/...
1
vote
2answers
339 views

How to get balance using smartcontract in the new CDT

Is there a way to access the balance(of EOS or any token for that matter) of a given account using smart contract in the new CDT? Thank you
0
votes
1answer
198 views

How to include external library to smart contract?

I am trying to add libcryptopp library to my contract but when I try to compile with eosio-cpp I get an error that header files cannot be found. This is my code: #include <eosiolib/eosio.hpp> #...
0
votes
1answer
123 views

get data from a smart contract

I am a bit out of my depth here but I'm trying hard to keep up. I'm trying to call a method from a smart contract on EOS. That's the Bancor Smart Contract I'm interested in in particular. Just for ...
2
votes
1answer
267 views

how to solve Error Details: Cannot charge RAM to other accounts during notify on testnet

I need help for an issue developing an EOS dapp. I want to call a contract function when someone transfer EOS to my contract. For this i used the apply method to call the function upon any transfer ...
0
votes
1answer
95 views

Using Proxy token contract from a smart contract

I am reading through the documentation of EOS Proxy contract but I am having hard time understanding the following You can do this from a smart contract without using this intermediate proxy. ...
3
votes
1answer
405 views

What is a context free action?

I have been doing some digging into the system smart contracts and eosio core code, and I found context free actions. Can somebody please explain what the difference between a context free action and ...
1
vote
0answers
33 views

Payment to dapp with text comments best practice

I am new in eos, so maybe i say something strange. I want to create a dapp that can receive payments from mobile wallets with text comments. I imagine this like front end where user type text and ...
1
vote
1answer
52 views

How to get number of users, transactions and volume for a given EOS contract on given day?

I am trying to figure out how to get the number of users, transactions, and volume for any given EOS contract for any given date. Does anyone know how to do this?
0
votes
2answers
164 views

How to get list of active smart-contracts on EOS

It appears cleos has no way of returning a list of active smart-contracts. Is there another way?

1
3 4
5
6 7
12