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

About Updation of contract

I have 2 questions about updation of contract and multi-indexed tables? 1)Can i update contract as if i want to change ram payer for multi indexed tables can i change it after deploying contract ? ...
7
votes
1answer
130 views

Using "native" wat/wasm function in smart-contract

I have to do some heavy computation in my smart-contract, like say a+b. Fortunately, I have written some very efficient implementation in "native" (web)assembly, like: File add.wast: (module (func ...
0
votes
1answer
91 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
68 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
442 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 ...
1
vote
1answer
144 views

Tables and storage issues

Am I right to say that the data stored in a contract are stored as tables and that for every row, we would have to emplace that row to a user, who would then pay for the storage? Or is one particular ...
2
votes
1answer
154 views

Are EOS smart contract self executing? Can a contract monitor an external API call from a weather site and send a transaction if it's sunny?

Ethereum contracts require someone to execute the contract and are not self aware. Are EOS contracts self executing if some external thing happens like the weather changing when detected from a ...
1
vote
1answer
112 views

Is there a way to have a 2 dimensional vector in my table?

I can have a string vector by manually changing the type in my abi file to string[] but if I try string[][] I get an ABI error in my node: Error 3015004: The type defined in the ABI is invalid Any ...
0
votes
0answers
79 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 ...
4
votes
1answer
265 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
95 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
2answers
62 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 ...
2
votes
1answer
214 views

how to make public_key to be table index?

The contract in eos only support idx64, idx128, idx256 type for the secondary index, and key only support idx64, how can I set the public_key as the index? The public_key in is char[34], it's length ...
2
votes
1answer
62 views

How to auth the issue permission to another contract?

I created a token "ABC" from account "tokenabc" and deployed a airdrop contract "airdroptoken". And I hope that everyone who transfers EOS token to this contract will get some airdrop token "ABC". ...
8
votes
1answer
2k views

How to clear all of the data in my contract table? [duplicate]

I know I can user erase to clear the table, but this method only clear one data at a time and must write a action to do that. Is there any easy way to do that?
1
vote
2answers
543 views

How to convert from name type to account_name type in contract?

I know how to do the other way round but don't know how to convert from name to account_name unless I convert it to string first. Please help. Thanks.
8
votes
1answer
430 views

How to add a unit test for a new contract [duplicate]

I am currently on eosio v1.1 but will be upgrading to v1.2 shortly. I am trying to create a new unit test for my contract. The existing unittest work when I run the following: cd eos/build/unittest ...
0
votes
1answer
93 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
133 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
48 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
659 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 ...
1
vote
2answers
43 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 ...
2
votes
3answers
82 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 ...
0
votes
1answer
200 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> #...
2
votes
1answer
96 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 ...
4
votes
2answers
460 views

Custom struct abi serialization

I am trying to understand, how the string "100000000.000 SYS" is serialized into struct asset from eosio.token example ( cleos push action eosio.token create '[ "eosio", "1000000000.0000 SYS", 0, 0, 0]...
0
votes
2answers
219 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
1answer
162 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 ...
3
votes
2answers
247 views

eosio-cpp -abigen hello.cpp -o hello.wasm

Ubuntu 18.04.1 on VMware (Windows 10 64bit) EOSIO v1.4.1 eosio.cdt-1.3.2 i just run the compiler like this : win@ubuntu:~/eos$ eosio-cpp -abigen hello.cpp -o hello.wasm then, the terminal stopped ...
2
votes
2answers
706 views

Unable to compile eosio.token

I'm following the https://developers.eos.io/eosio-home/docs/token-contract block one tutorial using the latest eosio/eos-dev docker image (v1.4.0). I have some issues when I compile eosio.token.cpp ...
3
votes
1answer
228 views

Issue setting permissions for use of eosio.token in smart contract

I have an action in a smart contract called submanager that I want to make use of the transfer action from eosio.token (I'm using eosio.cdt v1.3). ACTION subscribe(name from, name to, asset quantity,...
3
votes
1answer
160 views

how to implement a 48-char-long symbol token with balances like "10.0000 custom.name.of.the.token"?

I need to create my.token smart contract on EOS that will be exactly the same as eosio.token contract but my.token's symbol_code will allow a much bigger string. Something like 50 character long ...
3
votes
1answer
83 views

do i still need to pay after deployed an eos contract

I have deployed a contract. and I am confused about the fees: Do I still need to pay for resources such as RAM and CPU for actions like emplace and modify after I deployed a contract? Or can I just ...
1
vote
2answers
351 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
1
vote
1answer
353 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 ...
0
votes
1answer
52 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 ...
2
votes
2answers
200 views

Invoke the emplace function when developing contracts seems not executed?

I want to develop a contract and save data by using emplace function. Below is my code: offer_bets_index offerbets(_self, player); eosio::print("begin to write db\n"); auto bets_itr = offerbets....
4
votes
2answers
571 views

Tables are not generated in abi file

I have the contract class test : public contract { public: using contract::contract; test(account_name self) : contract(self) {} ... private: struct test_rec { test_hash ...
2
votes
1answer
347 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 ...
2
votes
2answers
235 views

unpack_action_data for transfer in newer CDT version

in the newer version of CDT, currency is removed from eoslib. Therefore, for unpack_action_data<currency::transfer>(), what value should substitute currency::transfer?
0
votes
1answer
196 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
230 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
125 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 ...
0
votes
1answer
101 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. ...
2
votes
1answer
126 views

How to send a data from on contract to other?

https://developers.eos.io/eosio-home/docs/sending-an-inline-transaction-to-external-contract In above tutorial, I can see that 'addressbook' send notofication message to 'abcounter', but the data(...
3
votes
1answer
430 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
35 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
53 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
166 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?
2
votes
3answers
335 views

Need to perform automatic smart contract function execution

Can we have a function in a smart contract to be executed automatically after some time? for example, transfer some tokens after every 5 seconds.

1
6 7
8
9 10
12