5

That is typically caused by a bad import statement. Check that something isn't being included incorrectly. A good example would be something like: import 'MyContract.sol'; as opposed to import './MyContract.sol';


5

I'm afraid that truffle is still using the old solc compiler, that's why you get that error. Indeed $ truffle version Truffle v4.1.3 (core: 4.1.3) //this is the last truffle version Solidity v0.4.19 (solc-js) You can try to update solc manually and the issue will be fixed. $ cd /usr/local/lib/node_modules/truffle $ npm install solc@0.4.21 this will ...


4

OZ has updated their code besides restructuring some of the folders. Old Answer (pre 2.X.X release) Look here: https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/token/ERC20/BasicToken.sol Your direct answer: totalSupply_ (the underscore) is the variable name you're looking for. Current Answer Update (12/11/18): uint256 private ...


3

I don't know if there is a real answer for that, but I use this solution: I change the migration file and I write the ABI and its address after the deploy var fs = require('fs'); var MyContract = artifacts.require('./MyContract.sol'); var fileContent = require('../build/contracts/MyContract.json'); module.exports = function(deployer) { deployer.deploy(...


3

It's possible but there's no easy way to do it. You either have to do some bitwise xor and shifting to build the uint, or use inline assembly to mload. Here's the working code, feel free to copy paste function sliceUint(bytes bs, uint start) internal pure returns (uint) { require(bs.length >= start + 32, "slicing out of range"); uint x; ...


3

The --reset flag will force to run all your migrations scripts again. Compiling if some of the contracts have changed. You have to pay gas for the whole migration again. For ganache/testrpc it should not be an issue it is just a extra delay. But for deploying against a public network: mainnet, rinkeby, ropsten, etc. it can be really annoying to have to wait ...


3

There are two problems with Truffle compilation output (JSON files), which make it difficult to keep them under version-control: The updatedAt field indicates the compilation time of the source file The bytecode field encodes the absolute path of the source file Due to problem #1, compiling the same input will always yield a different output. Due to ...


2

I figured it out after deciding to post additional details with the versions of truffle and node. $ node --version v6.11.5 $ truffle test // no support for async ... install the latest node. $ node --version v8.9.0 $ truffle test // async now works :D


2

The other thing you can do to use Oraclize with Truffle is just copying the http://github.com/oraclize/ethereum-api/oraclizeAPI_0.4.sol file locally and importing that file in the contract where you want to use it. Truffle needs the contract to be named the same as the file in order to compile it, so you will need to rename the Oraclize file to ...


2

I copy-pasted the Oraclize contract into my Truffle and I was able to migrate the contracts to Kovan by running a Parity node locally. Were you running an account that had Ether on it? Looking at the Truffle docs, there is an EthPM registry that they suggest to install dependencies using: http://truffleframework.com/docs/getting_started/packages-ethpm. On ...


2

Even, I had the same error. From the Doc When using the Command Prompt on Windows, the default configuration file name can cause a conflict with the truffle executable.If this is the case, we recommend using Windows PowerShell or Git BASH as these shells do not have this conflict. Alternatively, you can rename the configuration file to truffle-config.js ...


2

You were trying to verify the "Migrations" contract that you used in your truffle configuration. You incrementer contract was the next contract you created, and can be found here: https://ropsten.etherscan.io/address/0x8705c513da621a16fd1defc9de8ae7cdead01fb8#code I verified it for you, using the Optimizer but setting it to 0 optimizations. You were using ...


2

There is no direct access to the fields from another contract. The public keyword in address[16] public adopters will generate a getter function with the same name, hence adoption.adopters(8).


2

From the docs: Up to three parameters can receive the attribute indexed which will cause the respective arguments to be searched for: It is possible to filter for specific values of indexed arguments in the user interface.


2

I had a similar problem. In my case it was the system version of solc I had installed. Here's what I had. I had solc installed through Homebrew, and also truffle installed. when I run truffle version: Truffle v4.1.14 (core: 4.1.14) Solidity v0.4.24 (solc-js) So I had the latest version of truffle and seemingly, solc as well. However, when I run solc --...


2

I haven't actually tried what you're doing, but I noticed a possible misinterpretation of the linked docs. Maybe it will help. If I'm not mistaken, their "native" is bundled with truffle, and the syntax you used for solc-js v0.5.0 is for docker containers that I don't think you are using. Did you try?: // Relative or absolute path to an npm installed ...


2

I managed to fix the problem. After googling the problem again I found these two links: Nested structs that are part of a mapping broken in Solidity 0.5.0? and Nested structs that are part of a mapping broken in Solidity 0.5.0? which sent me in the right direction. The problem ended up coming from having functions that an inherited contract will be using ...


2

My guess is that your file is encoded in UTF-8 with BOM. BOM encoding injects a sequence of bytes at the beginning of file mostly to signal a few things to a program reading the file. [Wikipedia] In the case of a Solidty file, the compiler expects a file starting with pragma but with UTF-8 BOM file, it starts with random bytes like 0xEF,0xBB,0xBF followed ...


2

To start: yes you can commit them, there's nothing sensitive in them. As far as I can tell, there is no real consensus about whether the build directory should be added to version control or not. Adding them mostly won't hurt, but it too has some side effects (the files contain some user-specific stuff). OpenZeppelin seems to add the build directory into ....


2

Nevermind, the issue was that I had a missing bracket at the end of the contract. It is possible to compile files with different contract names with truffle (not possible with sol-compiler though).


1

This looks like a misuse of the payable keyword. Players[i].account.payable(amount); We don't have enough code to know where Players[] came from, but possibly something like: address[] payable public players; or in a struct struct myStruct { address payable account; } Unrelated to payable, you'll want to watch out for scalability issues because you'...


1

the problem was that the truffle framework had a different version of the solidity pragma, my contract used the 0.4.23 and truffle 0.5.0


1

You've given space between '*' and '=' in j* = 10; , it's like this: j *= 10; Good Luck!


1

Solidity do not expose variables directly, but it creates a public getter function. Your example will behave like this. contract DappToken { uint256 public _totalSupply; function DappToken () public { _totalSupply = 10000000; } function totalSupply() public view returns (uint256) { return _totalSupply; } } To get the total supply you ...


1

Here, in this declaration add address in along with uint in the returns function ScheduleCall(uint256 blocknumber, address to, uint256 value, uint256 gaslimit, uint256 gasprice, bytes data, bool schedType) public payable returns (uint,address); Then it would work.


1

It's little wordy on the command line. You're looking for new. Try: var c; ExampleContract.new(arg1, arg2) .then(function(instance) { c = instance; }); That will deploy a new one with args passed to the constructor. It did not use the deployer, so won't update the migrations registry. Hope it helps.


1

uint not unit. It might be helpful to play around in Remix just to catch errors like that before moving on to Truffle. Set the compiler version to the same solc you see when do a truffle version. Hope it helps.


1

I was able to verify the contract at 0x746612a6d4dcadbff55619bedeba403c0c252361 (from the gist you linked to) using the source code from the gist and the following ABI-encoded constructor parameters: ...


1

Run solc --abi on whatever source files, and any imports will be pulled in my solc, and also compiled giving all the ABIs of every contract that was imported into that source file.


1

You can use truffle exec to do extra setup after deployment. Often you may want to run external scripts that interact with your contracts. Truffle provides an easy way to do this, bootstrapping your contracts based on your desired network and connecting to your Ethereum client automatically per your project configuration. Source Below is the example ...


Only top voted, non community-wiki answers of a minimum length are eligible