Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [compilation]

For questions regarding contracts compilation.

1
vote
2answers
245 views

Unable to run truffle compile

I want to run truffle compile on my AWS Ubuntu 18.4 server. I'm able to compile the same contracts on my local with no compilation errors but when I tried to run truffle compile on AWS ubuntu server ...
1
vote
0answers
40 views

My code compiles on remix.ethereum.org but not on etherscan.io please help! [closed]

I get this error " ParserError: Function, variable, struct or modifier declaration expected. function transferFrom(address _from, address _to, uint _value) public returns (bool) ^ " everytime I ...
-1
votes
0answers
8 views

Build Tag documentation to help compile geth with gccgo

I was wondering if it is possible to compile geth with gccgo or more precisely where I can find some build tag documentation for that. Adding the gccgo tag to my build didn't compile, as some ...
1
vote
1answer
40 views

How come npmjs website shows that Truffle latest version is 4.1.14, and that it was published 3 days ago?

According to this page, Truffle latest version is 4.1.14, and it was published 3 days ago. However: I have been using this version for months now. I have noticed this "published 3 days ago" several ...
6
votes
1answer
77 views

When did the Ethereum “free memory pointer” change? (6060… -> 6080…)

I have been digging a bit deeper into the Ethereum bytecode with the specific goal to do contract verification from the source code. I noticed, while doing some tests, that the initial bytes of the ...
1
vote
1answer
209 views

Remix is compiling the smart contract but not solc command

I am able to successfully compile a smart contract in remix IDE. However when I try to do the same with solc npm command, it shows a JSON error when compiling. Voting.sol pragma solidity ^0.4.25; ...
1
vote
1answer
48 views

Solidity: Function with same name but different parameter possible? [duplicate]

Will the contract auto detect wether I am calling the function with or without parameter? pragma solidity 0.4.25; contract A{ function test() public{ //do something } function ...
1
vote
1answer
41 views

Discrepancy in Solidity compiler output for Remix and offline (same version, same code)

I'm compiling the following contract locally and on Remix and getting two different bytecode results. Contract pragma solidity ^0.4.25; contract ReadBool { bool public flag; function ...
2
votes
1answer
55 views

What is this evm code produced by solc in this public array checking, and why?

When solc creates code for arrays when they are declared public. In particular, it contains a check on the length of the array. For example, this: contract OutOfBoundsException { uint256[8] ...
1
vote
0answers
29 views

Error on contract constructor - CompilerError: Stack too deep, try removing local variables [duplicate]

I have the following constructor on a contract: constructor( string name, string symbol, uint8 tokenResolution, string defaultUnderlying, uint maturityTimestamp, uint rate, ...
0
votes
1answer
147 views

Remix warning - Is constant but potentially should not be.

I am getting the warning on the code shown below. Could you please assist me know to resolve this warning ? warning message - "Is constant but potentially should not be"
1
vote
0answers
17 views

Manually configure EVM Assembly Tag

I have read that Ethereum during the compilation splits the code into tags. The solc optimizer doesn’t optimize across tags. If we consider “1+1”, it can be optimized to 0x2 if under the same tag: /...
1
vote
0answers
23 views

Compiling from remix onto geth console

I found how to deploy a contract onto MEW, but I do not understand, partially due to meta references and missing/assumed knowledge. I'm just looking from help on a walk through. I'm including the ...
0
votes
0answers
190 views

Error compiling OpenZeppelin imported contracts

I'm running a truffle project and have imported OpenZeppelin contracts. While running truffle compile I'm facing following error: github.com/OpenZeppelin/openzeppelin-solidity/contracts/crowdsale/...
0
votes
1answer
19 views

Sending contract's source code to deployed contract in order to deploy it

I am writing a factory contract in solidity. I want to be able to add some more contracts to be deployed by the factory after it has been deployed. I thought sending the contract's source code to my ...
2
votes
1answer
55 views

Can't use constructor() when deploying a contract from ethereum wallet

Take the following code: pragma solidity 0.4.24; contract TestCoin { mapping(address => uint256) public balanceOf; uint256 public totalSupply; constructor(uint256 initialSupply) ...
3
votes
1answer
75 views

v0.4.22 solc compile failing - not predictable behavior

Error: Warning: Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. function CappedCrowdsale(uint256 _cap) public { ^ (...
1
vote
2answers
358 views

Solidity Compiler - Error: Identifier already declared

Full source code of the file 'Test.sol' : pragma solidity ^0.4.23; contract Mortal{ address owner; string ownerInfo = "Contract Owner name XYZ"; constructor () public { owner =...
2
votes
1answer
130 views

solc producing different contract binary depending on OS

I have a Linux, and another person has a Mac. We have the same solc compiler version, except for the OS extension (I have 0.4.24+commit.e67f0147.Linux.g++, they have 0.4.24+commit.e67f0147.Darwin....
0
votes
2answers
85 views

How do I find out what compiler version was used to deploy with MyEtherWallet

If I deploy a contract on MyEtherWallet.com how can I find out what compiler version was used, for verifying the code on etherscan, etc.?
0
votes
1answer
247 views

Deploying a smart contract with several solidity files

I have a contract contains 4 .sol files and when I generate its bytecode and api as follows: > solc --bin GreenToken.sol > solc --abi GreenToken.sol I receive: ======= BasicToken.sol:...
1
vote
1answer
36 views

Use shared library type in contracts

I want to reuse on type DateRange in two contracts. However, I fail with multiple errors. Currently I have one error: G21FE98E9 Member "endTicks" not found or not visible after argument-dependent ...
0
votes
0answers
90 views

Deploying a smart contract in a server on a consortium using parity

I have a smart contract including several .sol files and it has been compiled locally with solc and now I have all bin and abi files with binarycode.text and ABI.js. I now want to compile it after ...
0
votes
0answers
240 views

Solcjs doesn't use the last version of compiler

I am compiling a contract using the npm package solcjs. The package is at version 0.4.21 (npm view solc). However compilation fails because my pragma is set to ^0.4.21 while solcjs states current ...
4
votes
1answer
164 views

Difference between unoptimized and optimized solidity code

I am trying to find a source on what the difference is between optimized and unoptimized code. My main question is what the unoptimized compiler does, especially in the sense of calling the SSTORE ...
0
votes
0answers
36 views

Automatically deploy a contract with generated Web3js code

I want a command line tool which having only contract source would automatically not only compile it but also automatically create the JS code which can deploy the contract through Web3.js (using user ...
1
vote
0answers
53 views

About using Solidity optimization

It is a well known fact that in optimizing mode compilers usually have more bugs than in non-optimizing mode. As such, do you recommend to use the Solidity compiler with or without optimization? My ...
0
votes
0answers
36 views

Parity Compilation Fails

I am using parity to test smart contracts on Kovan. I tried to compile a contract(that compiles perfectly in truffle) using the online IDE but every time I try to run it I get: EvalError: Refused ...
0
votes
2answers
90 views

How would I best resolve this specific type of 'Unused local variable' warning?

I have a function which returns multiple values. In some places I use all of them, while in other places I use only some of them. This short snippet can illustrate the problem: contract A { ...
5
votes
1answer
157 views

Why does inserting a Struct cost 5,000 extra gas per item in the Struct?

Related to the findings in: Solidity bool size in Structs Why does inserting a Struct cause an increase of 5,000 gas per item in the Struct? For example: // A Struct that, when tightly packed, is ...
1
vote
0answers
103 views

What's the difference between unlinked_binary and bytecode?

I have two different projects. In one, the build/token.json file contains an unlinked_binary field. In the other, there's no unlinked_binary, but there's bytecode. What's the difference between the ...
2
votes
0answers
71 views

Too many variables with production contract [duplicate]

We have a contract that is in production already and has a getPerson() function. This is a public function that returns 12 uint256 values. We are attempting to call this function from another contract ...
0
votes
2answers
341 views

Compile error - Warning: Unused local variable

I am getting warning errors on a few variables such as deposit, totalpayment and duration which are necessary for taking payments from users. The error I am receiving is: Warning: Unused local ...
0
votes
0answers
92 views

How does the constructor turn your compiled contract into a deployed contract?

The input is: you just compiled a contract The output is: your contract is deployed How did your constructor get from A to B? And how is the state storage reserved which is associated with your ...
5
votes
4answers
615 views

I can't verify my contract on the Rinkeby etherscan site

I'm getting the following error when verifying on the RINKEBY etherscan site: Error! Unable to verify source code Exception #1 Occured: ERROR|The Contract solidity compilation has exceeded the ...
0
votes
1answer
40 views

TypeError at compile for public mapping of address ==> uint?

Maybe this is really obvious but for some reason I can't shake this error. At compile I get the following error: TypeError: Indexed expression has to be a type, mapping or array (is uint256) ...
0
votes
0answers
234 views

Truffle: 'compile' is really slow - how can I execute 'test' without it?

When I execute truffle test, it rebuilds all the contracts under the target folder. This seems to take a very long time. I'd like to somehow force truffle to use the "native" Solidity compiler ...
0
votes
2answers
357 views

How to get an output similar to remix in solc, woth opcodes + comments from source

I would like to compile my contracts and to get an output with the opcodes in detail (not just assembly) but with references to the solidity source code at each line. This is the output one gets by ...
0
votes
1answer
387 views

How does solc generate the bytecode for a contract?

I got sick of using remix and copying-pasting my web3 deploy text so I'm trying to write a python script that will generate this deploy test for me. However, one of the fields in the instantiation ...
0
votes
1answer
64 views

Can I trust Solidity compiler to replace MOD with AND when possible

According to the EVM Gas Cost Yellow Paper (can be found here): The cost of % is 5 The cost of & is 3 When x is a power of 2, the expression a % x is equivalent to a & (x - 1). If x is a ...
0
votes
1answer
53 views

Compiling with outdated compiler

In my contracts I've been placing pragma solidity ^0.4.2; Without knowing my compiler is outdated at 0.4.16! Interestingly, all contracts still compile and are able to migrate to testrpc. Still, I ...
0
votes
1answer
29 views

Can't recompile old “Block King” solidity contract

I've been trying to compile and analyze the so-called "Block King" contract, which can be found on Etherscan. However, I can't find a way to run the compiler which is claimed to have produced the EVM ...
0
votes
1answer
53 views

LLL preprocessing/optimization issue

I have written a simple nested macro in LLL, but I can't get it to reduce to the simplest expression when calling the compiler with the optimization option. My macro looks like this: (def 'mcopy (pos ...
2
votes
2answers
1k views

unable to verify the contract on etherscan.io. How to resolve this issue?

I am unable to verify the contract in etherscan.io. I was able to deploy the same solidity code in (Geth, Mist). But the same code I am unable to verify in etherscan.io. What mistake am I doing here? ...
4
votes
1answer
164 views

How to disable 'Gas requirement not constant' warning in Solidity

I keep getting these warnings when compiling Solidity code: Gas requirement of function [...] unknown or not constant. I know that the gas requirement is not constant, and I've implemented a ...
1
vote
1answer
190 views

Generic remapping of “import” statements

I have vim setup to report solc errors while editing via syntastic. If I have the line: import 'zeppelin-solidity/contracts/token/StandardToken.sol'; I receive the error: Source "zeppelin-solidity/...
4
votes
2answers
650 views

Why and how does the “low security” functions affect the biggest multi signature contract?

People use this contract everyday http://github.com/ethereum/dapp-bin/blob/master/wallet/wallet.sol and it's also the contract with most ethereums right now. Also you can create a multisig account on ...
2
votes
0answers
110 views

Is it possible to get compiler version from the bytecode and smart contract code?

The problem is that I have deployed some contract on the etherscan.io some time ago. Now I want to verify it, so I need to specify: Smart contract code Compiler version ABI encoded constructor ...
4
votes
2answers
533 views

totalSupply() Solidity signature causing conflict error

I'm writing a very basic ERC20 token using solidity in the Mist wallet. For some reason the compiler doesn't like the totalSupply() function name. If I change this name it compiles fine. To be ERC20 ...
0
votes
1answer
1k views

Solidity compiler command-line utility (solcjs) various problems

I am trying to compile a file using solcjs from a command-line, and running into various problems. First of all, I need to supply in the command-line all the files that are imported by the primary ...