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,743 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
2answers
597 views

Solidity Event logs

I have a JS code which is connected to ganache. I am trying to call a solidity function which in tern emit the event. In JS i am watching the event. Now when i call the function first time it sets ...
2
votes
0answers
182 views

Signature generated through web3.eth.sign not leading to same address after fromRpcSig

I am trying to write sign a challenge using web3.eth.sign, web3 uses ganache.provider(), But when i do fromRpcSig(signature) ecrecover(challenge) which results in different address. But when i sign ...
2
votes
0answers
62 views

Estimated gas is always low

web3.eth.estimateGas is always calculating low gas for the transaction. Here is a reference to a trasaction in ropsten. https://ropsten.etherscan.io/tx/...
2
votes
0answers
236 views

Getting Json file from remix

I have been deploying contracts on rinkeby but we are almost done to go to mainnet. I have been comparing deployments with truffle and remix and there is a huge difference in gas uses, so I would ...
2
votes
1answer
58 views

What order is code copied for inheritance?

The Solidity documentation says it supports inheritance by copying code, but is unclear about where the code is copied to. I am building a genesis block for a Quorum-based chain, starting from the ...
2
votes
1answer
143 views

Created Crowdsales contract, sending ropsten ETH to the contract and Failed

I created crowdsale contract - https://ropsten.etherscan.io/address/0xfbb2759ef0b7169d0a2effa971845ea0f99f87b1 My token - https://ropsten.etherscan.io/token/0x0f26c1c05f1bbBC7Eff0488F1a98619e8a9758cf ...
2
votes
1answer
55 views

Any way to do compile-time computation using rational_const and a constant value?

Of the following three declarations ufixed constant TEST1 = 256; uint constant TEST2 = 256; uint[] testTable1 = [uint(0.001 * TEST1), uint(0.01 * TEST1), uint(1.1 * TEST1)]; uint[] testTable2 = [uint(...
2
votes
1answer
119 views

Function to return tuples throws error on frontend

I have similar functions like this and they work fine: function getBarsOfParticipant() external view returns (uint256[], uint16[], bool[]) { uint256[] barIds = participantToBarIds[msg.sender];...
2
votes
1answer
448 views

web3.py constructor(address type)

I tried to deploy the contract on my testrpc, but I get error when my constructor using "address" type. Here is my python code: import json import web3 from solc import compile_source from web3....
2
votes
1answer
43 views

I am unable to verify my contract on etherscan

Unable to verify my contract on etherscan. This is the link - https://ropsten.etherscan.io/address/0xc68c67a1864060631817be1eebdb91e8661fae7a . Please help. Its urgent. Here is my code: pragma ...
2
votes
2answers
924 views

Gas estimation failed in Remix

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 compiler message is so ...
2
votes
0answers
62 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
153 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
436 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
219 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
30 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
254 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
2answers
367 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
259 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
55 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
706 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
740 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
0answers
142 views

How to catch errors in web3.py

How can I catch revert or out of gas errors in web3.py? I'd like to call a function through web3.py and in case it gets reverted I'd like to try it again after a couple of seconds.
2
votes
1answer
150 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
406 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
372 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
89 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
33 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
2answers
495 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
481 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
284 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
177 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
106 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
113 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
331 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
979 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
203 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
218 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
0answers
116 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
155 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
774 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
79 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
0answers
254 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
15k 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
106 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
91 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
245 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
194 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
530 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/...

1 2 3 4 5 35