Questions tagged [solidity]

Solidity is a contract-oriented, high-level language whose syntax is similar to that of JavaScript and it is designed for writing smart contracts in Ethereum to run on the EVM. Solidity is statically typed, supports inheritance, libraries and complex user-defined types among other features.

1,617 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
2answers
658 views

Gas Estimation Failed in Remix

Found my own problem. Can't really use the transfer function as it is written. It assumes the owner uses it. So made a new function for the "minting" function for the faucet to use. Not sure why the ...
2
votes
0answers
58 views

Gas Estimation Failed for Airdrop for sending Tokens to Multiple Addresses using Remix

I have deployed a Crowdsale contract and now I need to send my Tokens to a list of addresses using remix and injected web3. I am using below code for Airdrop but when I send tokens to multiple ...
2
votes
0answers
147 views

calling method from another contract throws Revert

I have a smart Contract "RecommendContract" contains this method: function addVacancy(address sender, bytes32 vacancyId, uint256 incentive) external { Vacancy vacancy = vacancies[...
2
votes
1answer
328 views

How to unsubscribe logs / events?

There are two ways to subscribe/watch to logs/events: Subscribe: var subscription = web3.eth.subscribe('logs', { address: '0x123456..', topics: ['0x12345...'] }, function(error, result){ ...
2
votes
1answer
172 views

Disable nasty pseudo-error message in solium

Solium treats now require without error message as error that obviously incorrect. I have a lot of require inside my contract and do not want to garbage it with disabling comments. In the same time I ...
2
votes
0answers
27 views

Data Scientist wanting to simulate a DAO on private network, unsure of where to begin

My apologies for such a broad question, I couldn't find anything remotely similar to my case and I've got lots of questions - I'll try to narrow the scope down here. Premise: I'm a data science ...
2
votes
0answers
232 views

Comparing solidity sha3 with web3 sha3 inside smart-contract

The problem is that sha3 in solidity returns bytes32 and I have a string returned from IPFS by oraclize, and if hash calculated in solidity and returned to web3js (bytes32 got interpreted as a string) ...
2
votes
1answer
301 views

Declaring a memory array of storage pointers in Solidity

I would like to declare a variable as a memory array of pointers to storage arrays of uint256. For example: pragma solidity ^0.4.24; contract A { uint256[] public array0; uint256[] public ...
2
votes
1answer
218 views

Calling function from another contract reverts

I've been developing a dApp that needs ERC721 tokens. I have three contracts, a base contract, the one to mint tokens and another one for auctions. The inheritance looks like Base > Token > Auctions. ...
2
votes
0answers
48 views

Which solidity dev environments support the use of already deployed library contracts?

So, I'm looking into using libraries in order to prevent re-deployment/re-use of the same code. I was hoping that I would be able to specify the address of a library in solidity code, using syntax ...
2
votes
1answer
575 views

Error from sendSignedTransaction: Error: Returned error: replacement transaction underpriced

I am the beginner in Ethereum stuff need guidance please help I am running a private ethereum network and using mist wallet here is my contract code pragma solidity ^0.4.0; contract MyFirstContract ...
2
votes
1answer
602 views

How to unpack/decode parameters encoded with web3.eth.abi.encodeParameters in Solidity?

My client app (nodejs) packs some arguments to pass to a smart contracts as bytes _data (similar to ERC223 calls with fallback). I pack the arguments in my JS client like this: const packedArgs = ...
2
votes
1answer
136 views

Library function overloading

I have 3 libraries, one exposes struct and 2 others expose method with same signature/return type (first one provides default method implementation and second - extended and customized one). When ...
2
votes
0answers
328 views

JsonParseException while generating java wrapper object with web3j

so a few weeks ago I created a java wrapper object with web3j for a smart contract and was able to work with it with no problems. following exactly what I did a few weeks ago I keep getting a ...
2
votes
2answers
304 views

How do I use filter EVM log events by an indexed field in web3j?

I've looked through the documentation, but there doesn't seem to be this scenario listed. What I want to do is filter the Ethereum event log of a specific contract by an indexed field with Web3j. ...
2
votes
1answer
76 views

ERC20 with custom sale mechanisms?

Let's say I want to create a token, but I don't want this token to be exchanged too freely, in order to avoid too much of speculation (real estate for example). People willing to sell the asset will ...
2
votes
0answers
30 views

Elements disappearing from array

I have a smart contract with the field bytes32[] public listSlas; which contains a list of sha3 hashes. On top of the smart contract, I have a webapp which needs to retrieve the content of that list (...
2
votes
1answer
343 views

ERC-20 contract from another contract

I am trying to create contract which can access functions of any ERC-20 standard token contract. At first, I'd like to get balance of given address. I run private testnet using geth, I have deployed ...
2
votes
0answers
441 views

Truffle test - No events were emitted + TypeError: test.titlePath is not a function

1) test_initial_badge_creation > No events were emitted 2 passing (2s) 1 failing /usr/local/lib/node_modules/truffle/node_modules/mocha/lib/reporters/base.js:178 failures.forEach(...
2
votes
0answers
252 views

Passing struct into new contract through constructor

I have a function in my ChangeManager contract which should create multiple ChangeRequests. I tried to model a Change by using a struct and pass this from my ChangeManager to the ChangeRequest: Code ...
2
votes
0answers
161 views

delegatecall on library always run out of gas

I'm trying to replicate the Dynamic Library attack of this paper under a recent version of solidity and the EVM. Streamlining down the code, I've created this very simple contract (which is, in ...
2
votes
0answers
92 views

Append address to bytecode and then deploy it

I'm trying to write a deployer function which would allow me do deploy arbitraty code. So far, I can deploy a contract with parameters using this snippet found here: // js truffle const tokenWeb3 = ...
2
votes
0answers
109 views

Import contracts, compiling and deployment

quick question. I have a set of contracts A,B,C. A contains import 'B' and import 'C'. Should I just compile A and then deploy it on the blockchain for the functions in B and C to be implemented ...
2
votes
0answers
295 views

Unexpected behavior with `block.timestamp` in truffle test

I am doing some experiments with block.timestamp(which is now's alias). I wrote some code to see if block.timestamp really represents the timestamp of the last mined block. From the documentation: ...
2
votes
0answers
944 views

Invalid asm.js: Invalid member of stdlib when loading Remix IDE

When I try to load the remix ide on browser I'm getting the following on the console of the browser Loading https://solc-bin.ethereum.org/bin/soljson-v0.4.21+commit.dfe3193c.js without worker ...
2
votes
1answer
160 views

call graphs for solidity smart contracts

Do we have some open source tools where we can get call graphs for solidity smart contracts execution ? For ex: Suppose Function A in contract C calls some other function B so the graph should contain ...
2
votes
0answers
180 views

“queue limit” error

I try to deploy a smart contract and every time i receive "queue limit" error. Here is what i do: Web3 = require("web3") web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); ...
2
votes
2answers
198 views

Why do people hash the address?

I recently saw a smart contract where the user used keccak256(address), is there any reason to do this, instead of just storing the address in the mapping?
2
votes
0answers
110 views

Solidity libraries with public visibility

Suppose I have the following Contracts and a Library: pragma solidity ^0.4.21; library UserLib { function insertUser(address dbAddr, bytes32 user) public { DB(dbAddr).setUser(user); } } ...
2
votes
0answers
302 views

How to use logx in Solidity?

Aim: To log data from a smart contract. Following function is written in accordance with low level interface to Logs in ethereum. However, due to lack of documentation, and being new in Solidity, I ...
2
votes
0answers
152 views

How to get meaningful error msg from truffle unit test?

I am writing unit tests in truffle. No matter it's solidity unit tests or js unit tests, all of the error msg I can get is: Error: VM Exception while processing transaction: revert at Object....
2
votes
4answers
625 views

Tracking tokenholders of a token with web3

If I have a token address how can I navigate and find certain things like: tokenholder addresses transactions for the token holders including when they made the transaction I'm new to smart ...
2
votes
0answers
73 views

Can a view function from a funded smart contract execute a send() transaction on an external contract?

I'm creating an open source voting app with a Node.JS front end. I'm hoping I can create a smart contract that can use funds allocated to it at creation time, so that participating voters don't have ...
2
votes
0answers
1k views

How to integrate smart contracts with android app using web3j

I want to integrate smart contracts with the android app. I wrote a simple smart contract and I want to call that smart contract from android app. For example, in UI part of Android, I put one ...
2
votes
1answer
290 views

Why public variables aren't able to implement interface functions?

I'm curious why interfaces don't accept public variables as implementations, since public variables have getter functions generated for them. For example why couldn't the ERC20 balanceOf interface ...
2
votes
0answers
241 views

withdraw eth from contract

I have contract and function which accepts ether. How can I transfer ether from contract to any other wallet? I'm using ganache-cli. Function work, and I spent 10 eth on contract(private network). ...
2
votes
2answers
11k views

TypeError: Cannot read property 'then' of undefined

I am having an error with Web3. After going through all possibilities I decided to post a question hoping for someone with a solution. The error I keep getting is: TypeError: Cannot read property '...
2
votes
0answers
104 views

ERC223 Transfer Arguments

There are 2 transfer functions in Dexaran's ERC223 contract. One includes data and the other one doesn't. Does this mean we should choose one transfer function to use in our contracts and ignore the ...
2
votes
0answers
84 views

Unable to update contract variables

I have this contract pragma solidity ^0.4.20; contract cntrct { uint public testVal; function runF() payable public { testVal += msg.value; } function reader() public ...
2
votes
0answers
239 views

Create a child contract from parent contract via remix

I was trying to create a new contract from another one like this: pragma solidity ^0.4.8; contract Child { address public owner; function Child() public { owner = msg.sender; } }...
2
votes
0answers
184 views

Reduce gas usage in contract that creates other contracts

I have a contract that is exceeding block gas limits (using something like 8000000 gas) when I deploy it. I think it is because it is importing a bunch of other contracts and has functions that create ...
2
votes
0answers
453 views

Importing files from an “outside” folder

I am trying to import files from a relative path outside of my Truffle-project folder: import '../../../common/solidity/contracts/token/ERC20/BurnableToken.sol'; import '../../../common/solidity/...
2
votes
1answer
616 views

Transaction does not trigger a Solidity revert statement.↵

when I make a transaction on ropsten from metamask. metamash thorws this error after 2 minutes StatusError {message: "Transaction: 0xedceb98a6fa59803022bc688bef7546034d… does not trigger a Solidity `...
2
votes
0answers
403 views

Working with time in smart contracts

I know there have been quite a few questions surrounding time, and the use of block.timestamp. However, I still have a few questions design-wise. At what point exactly is it 'dangerous' to use block....
2
votes
0answers
42 views

Where does Ethereum Dapps go in known design paterns

I am doing a Dapp for a school project and I am supposed to choose a design pattern to work with. I want to know the possibilities for design patterns concerning the ethereum dapps, or if they have ...
2
votes
0answers
131 views

how to wrap data for transferAndCall to invoke another contract?

I have a token, and a service contract. I implemented the token based on ERC677, and tried to use transferAndCall to call my service contract. In my service contract, there will be several methods ...
2
votes
0answers
351 views

truffle assert equal not accurate for small differences

For some reason my truffle test suite "should send coin correctly" passes when it shouldn't. I'm just running a test suite on the standard ERC20 code found on ethereum.org. When you take 1e+21 -1010, ...
2
votes
0answers
205 views

Arabic letters not read by web3.toUtf8

I am using arab letters in bytes32 data stored in a smart contract, when reading the data and converting to utf-8 with web3.toUtf8() i get errors like unknown utf character or Invalid continuation ...
2
votes
0answers
258 views

transfer function is not working for the smart contract

Below is the Scenario of the problem: I made some changes in the real concept because it will hard to understand the problem so I try to make it real simple. I make a contract to facilitate some ...
2
votes
0answers
93 views

Using smaller parent contract consumes less gas?

Here's my Test Code pragma solidity ^0.4.20; // StandardToken is from zepplin-solidity. import "./StandardToken.sol"; contract Callee { address public caller_; function setCaller() public ...