Questions tagged [compilation]

For questions regarding contracts compilation.

Filter by
Sorted by
Tagged with
2
votes
1answer
19 views

Status of ABIEncoderV2 now

Do you know the current status of ABIEncoderV2? I want to know the current status of ABIEncoderV2 Live projects using ABIEncoderV2 right now Restriction on the normal encoder Risks of using ...
0
votes
1answer
16 views

#pragma compilation Error [duplicate]

pragma solidity ^0.4.0; contract test { event test_value(uint256 indexed value1); uint256 value_test; function test_f() { //value_test processing test_value(value_test)...
0
votes
0answers
24 views

Compile solidity smart contract using compiler version provided in the contract

I have been using solc-js in javascript to compile .sol contracts. However, many old smart contracts use older compiler versions that are specified using pragma in the smart contract source code. How ...
1
vote
2answers
39 views

Get values from stack when certain Opcode is called

I am currently trying to use genetic algorithms to automatically generate test cases that for ethereum smart contracts similar to https://ieeexplore.ieee.org/abstract/document/7840029>this paper. In ...
0
votes
0answers
32 views

Compile two .sol file with solc

I'm trying to compile two different sol file with 1 smart contract each and output the compiled code of each one in two different json file. But when i run the code the .json file return empty, i dont ...
0
votes
1answer
73 views

I am getting solc error while compiling solidity code via py-solc. Is it due tonew update of py-solc ? how to fix it?

from . import views File "/home/manzik/Desktop/Ethereum Voting/voting/home/views.py", line 5, in import commission.views as comm File "/home/manzik/Desktop/Ethereum Voting/voting/commission/...
1
vote
1answer
165 views

How to compile Solidity ^0.5.5 contract with Node.js?

I am terribly new in Solidity and now I try to learn how to compile a contract in Solidity ^0.5.5 (No versions below). I have the contract as follow (UsersContract.sol) pragma solidity ^0.5.5; ...
0
votes
1answer
307 views

Invalid implicit conversion from address to address payable requested

first of all really nice to find this forum, I'm starting coding Solidity. Here the problem I get compiling a template of crowdsale smart contract ExampleTokenCrowdsale.sol, from this tutorial. The ...
0
votes
0answers
16 views

Unexpected behaviour. Huge size increase when adding new SubContract()

I have a contract similar to: contract Contract01 { SubContract _refContract; ... constructor() public { refContract = new SubContract(); } function setSubContractRef(SubContract ...
0
votes
1answer
29 views

how to change approveAndCall() function for upgraded compiler version of solidity 0.5.1 from 0.4.6?

Here is the code snipped which is used when I'am working with compiler version 0.4.6 : function approveAndCall(address _spender, uint256 _value, bytes memory _extraData) public returns (bool success) ...
1
vote
2answers
974 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
71 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 ...
1
vote
1answer
58 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 ...
7
votes
1answer
149 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
435 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
164 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
89 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
56 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
46 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
2answers
264 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
20 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
25 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
1answer
388 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
43 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
82 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
106 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
654 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
192 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
119 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
301 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
41 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
327 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
217 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
51 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
66 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
2answers
130 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
202 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
131 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
77 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
556 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
115 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
708 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
54 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
2answers
451 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
451 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
81 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
70 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
33 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
62 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
2k 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? ...