Questions tagged [compiler]

A compiler is a computer program that translates a higher-level programming language into a lower-level language. For example: Solidity is compiled into EVM opcodes.

Filter by
Sorted by
Tagged with
0
votes
2answers
18 views

Can't compile Truffle project that imports a .sol with different pragma version

I have a contract pragma solidity 0.6.12 version that imports several 0.6.12 version contracts and one pragma solidity 0.8.0. My truffle-config: compilers: { solc: { version: "^0.6.12 &...
1
vote
0answers
18 views

Contract migration from Ethereum to L2

I am trying to figure out is it posible and how to migrate contracts from Ethereum main net to other L2. So here what I found: Migrating from contract in Solidity from Ethereum to Optimism is ...
0
votes
1answer
67 views

Hardhat.config.js: Expected a value of type HttpNetworkConfig?

Why is Hardhat throwing an error? I copy n pasted the default config file from https://hardhat.org/config/? Error HH8: There's one or more errors in your config file: Invalid value {"url":&...
0
votes
0answers
8 views

Brownie compile does not use correct compiler version (VScode)

I'm having and issue with the "brownie compile" command. I've copied and pasted this contract from openzeppelin following a youtube tutorial, I then right clicked on it to change the ...
0
votes
1answer
16 views

contracts/ISwapRouter.sol:11:26: TypeError: Interfaces cannot inherit

So I am using some uniswapv3 contracts (which are pragma 0.7+) within another contract (which is pragma 0.5.0) and when compiling I have this error : ```These files import other files that use a ...
0
votes
1answer
9 views

I can't compile, on my library SafeMath it says "parsererror: function, vairable, struct or modifier declaration expected, please help me

pragma solidity ^0.8.2; contract Token { mapping(address => uint) public balances; mapping(address => mapping(address => uint)) public allowance; uint public totalSupply = ...
0
votes
0answers
15 views

Is there any solidity ide and compiler app for android or other mobie OS?

Please, I am teaching some secondary school pupils solidity and they wish to know if there are any IDEs and compiler apps for android devices. They are young and most of them do not have PCs to ...
1
vote
1answer
44 views

etherscan contract verification unable to match bytecodes due to $-signs

I have a contract called Test , which uses a library called LCG. They are respectively defined in the .sol files with the same name as the contract: // SPDX-License-Identifier: GPL-3.0 pragma solidity ...
0
votes
0answers
16 views

Error! Unable to generate Contract ByteCode and ABI (The bytecode being searched for is in the list of compiled contract bytecode outputs)

What's strange is the Bytecode the be searched for is right under the main .sol file... I added in the correct code, recompiled on remix worked just fine. Inserted the correct compiler version, ...
3
votes
3answers
3k views

compilerMetadata is modifying/artifacts/NAME_OF_CONTRACT.json

I have been getting a compiler warning in the online remix IDE that is not quite clear to me (the contract compiles and deploys without any errors): compilerMetadata is modifying/artifacts/...
2
votes
1answer
38 views

searching for an elegant solc compiler solution

I firstly had a problem with import statement inside my contracts, I figured out that the solc compiler didn't handle import statement, and that we needed to make out own. With the help of some nice ...
0
votes
0answers
20 views

CONTRACT in Solidity Compiler does not stay in Price Consumer, it reverts back to Aggregator

CONTRACT in Solidity Compiler does not stay in Price Consumer, it reverts back to Aggregator? Please assist with this question.
1
vote
2answers
407 views

Solc Compiler : File import callback not supported

As a context I am trying to fork uniswap v2 contracts using my own compiler and deploy files. I am not using truffle, as I want to deeply understand before using a framework. When I run my compiler, I ...
0
votes
0answers
20 views

Is it typical for something to compile in solidity, and then suddenly stop compiling without any changes having been made?

I am being pestered by ParseError: Source failures non-stop. Curious if this is language dependent Github: https://github.com/aportno/project-koffie.git ParserError is being generated for every import ...
1
vote
2answers
33 views

Getting an error even using the same compiler version (Visual Code)

I made a contract using Remix and it's working perfectly. When I create a project in Visual Code (in order to make a DApp) I'm getting this error when I import a source of Chainlink: If I compile ...
0
votes
2answers
653 views

Set specific compiler version in truffle but still get "Source file requires different compiler version" error

I get the "Source file requires different compiler version (current compiler is 0.8.6+commit.11564f7e.Emscripten.clang)" at the first line: pragma solidity ^0.7.0; In truffle-config.js, I ...
0
votes
0answers
30 views

solidity compiler hashing function

What hashing function or encoding scheme does solidity default compiler use to encode or hash the data of smart contracts in remix ide?
1
vote
1answer
93 views

Solidity compiler 0.8.5 "Unreachable code." Warning on certain parts of code that worked before

Now that I'm using the 0.8.5 compiler, I'm getting a warning that says "Unreachable code." for parts of my functions that didn't have any issues until 0.8.5 (works on any below that). Does ...
1
vote
1answer
37 views

Different bytecodes using solcjs and remix

Using solcjs in any contract ends up producing significantly longer bytecode that using remix For instance this simple smart contract pragma solidity >=0.8.0; contract test { uint256 public c; ...
1
vote
2answers
100 views

Using SafeMath with older Solidity compiler

I've been told SafeMath doesn't matter. Does SafeMath slow things down, cost more ETH, or does it add an extra level of stability? Will SafeMath be unsupported one day? contract SafeMath { function ...
1
vote
2answers
58 views

Compile Solidity to assembly keeping a correspondence with the source code

I would like to compile a contract written in Solidity (or even just the part relating to a single method) to study it and understand if I can optimize it. I already managed to get the bytecode as ...
0
votes
1answer
33 views

1INCH Version error

I got error importing and using 1INCH. The problem is in the versions. In IOneSplit.sol version is 0.5.0 (pragma solidity ^0.5.0). And IOneSplit imports IERC20 which is in 0.8.0 (pragma solidity ^0.8....
0
votes
1answer
701 views

How to import and compile contracts of different versions solidity

How to import and compile contracts of different versions using solidity in remix? When I import a contract I get this error: ParserError: Source file requires different compiler version (current ...
1
vote
2answers
242 views

What is a nightly build in solidity? [closed]

I have received an error that says so: ParserError: Source file requires different compiler version (current compiler is 0.8.3+commit.8d00100c.Emscripten.clang) - note that nightly builds are ...
0
votes
0answers
74 views

Silence visibility warning, state mutability can be restricted to pure

Suppose I have an interface: pragma solidity 0.7.6; interface Foo { function foo() public view returns(bool); } And a simplistic implementation like a mock: contract Bar is Foo { function foo() ...
0
votes
1answer
186 views

Remix IDE Waring for "Required Compiler Version"

I am well versed with solidity and often use Remix IDE. Quite recently, despite adding a compiler version in my code. I am still getting this warning Warning: Source file does not specify required ...
1
vote
1answer
226 views

Remix Solidity Smart Contract Stuck On Compiling State

The 1inch Smart Contract is unable to compile in Remix as it appears to be stuck in the Solidity compiling phase. Expected Create a new 1inch_38211317.sol smart contract file in Remix. Compile the ...
3
votes
1answer
652 views

How do I determine the most recommended (safest to use) version of Solidity?

I've seen this question pop-up a bunch of times: "is version 0.x.x safe to use in production?" Therefore, I'm wondering if there is a clear way to tell which versions are recommended for ...
0
votes
0answers
102 views

Solidity compiler,error:not found browser IERC20.sol

Who can halp me with error and codig fleshloan? I try use for my contract http://remix.etherium.org and i have a promlem with compiller,i use code from official docs aave https://www.docs.aave.com/...
0
votes
1answer
18 views

Stack too deep error [duplicate]

Not sure what the best approach is to get around this. New to solidity. I've read the complicated 'answers' to this that suggest using structs, arrays, etc. but I can't figure out how to address this. ...
0
votes
0answers
26 views

Different compile version solidity

Is there an automated tool to convert old smart contracts to the newest one? There are many breaking changes in different versions and it is hard to keep up with them all. I want to use my old ...
1
vote
1answer
109 views

Solidity Compiler and EVM relationship

When I compile the below code in 0.6.6 it doesn't compile (requires public) but in 0.7.3 it does compile. If I make the below code compilable (adding public) in 0.6.6 I can successfully deploy on ...
0
votes
1answer
64 views

faucet = (new Faucet).value(0.5 ether)(); Doesn't compile

I am practicing with the code examples from Andreas' Mastering Ethereum book Chapter 7. I don't understand why this does not compile when I made the Faucet constructor Payable. See images below. ...
0
votes
0answers
387 views

Remix Compiler Errors - Transferred GitHub .SOL Codes to Remix

I transferred all 23 Sol extension files (smart contracts for Syscoin and Ether) from GitHub to Remix but only 3 of them can be compiled and deployed. The rest of them show errors. [Here is the link ...
1
vote
1answer
27 views

Library calls fail depending on compiler version?

I'm trying to deploy my library and call it afterwards with the specific address. While testing this I encountered that the behavior changed over the course of compilers. I tried to follow How to call ...
1
vote
0answers
101 views

How to separately optimize bytecode?

This question is regarding the bytecode-optimizer of the solidity-compiler, not the yul-optimizer: Is there any way to separately optimize bytecode? Normally the solidity-compiler optimizes the ...
0
votes
1answer
43 views

How to detect compiler version given only Solidity Source Code

I've collected some random smart contracts from the internet, many of them do not specify compiler version using pragma in their source code. Is there any way or any tool that can help me identify the ...
1
vote
1answer
390 views

Compiler version incompatibility nightmare

I'm new to Solidity and Truffle. I'm trying to compile my Solidity code within Truffle to create an ERC-20 token. I have @truffle/hdwallet-provider and @openzeppelin/contracts as my dependencies. Now,...
1
vote
4answers
813 views

Trying to compile running: 'node compile.js', but get error: "assert.js:350 throw err;" [Udemy 'Complete Developers Guide' Course]

This is the first contract with this Udemy course. Trying to compile by running: "node compile.js" but get the following error: iii@iii:~/inbox$ node compile.js assert.js:350 throw err; ^ ...
0
votes
1answer
26 views

How do I update compiler for embark?

I am rewriting an old contract I had. I am using the latest version of OZ contracts.. but they require: pragma solidity ^0.6.2 I am using embark 5.2.3 and current compiler is 0.6.1+commit.e6f7d5a4....
0
votes
1answer
649 views

Contract import from GitHub gives an error "Unable to import "undefined": TypeError: Failed to fetch"

This would be an old issue, but the solutions I have seen on this site aren't working. I'm trying to import a contract of OpenZeppelin to my Remix IDE. import "https://github.com/OpenZeppelin/...
1
vote
2answers
90 views

How to publish in ethereum with "imports" ? or how to do?

Hello i have this question in my mind now : How to publish in ethereum with "imports" ? or how to do ? why i say this ? answer : when i wanna "verify and publish Contract Source Code" with a ...
0
votes
2answers
3k views

Function, variable, struct or modifier declaration expected [duplicate]

I am using the following code structure; pragma solidity ^0.5.0; contract TtdmToken { uint256 public totalSupply; function TtdmToken () public { totalSupply = 1000000; } } ...
1
vote
1answer
118 views

Are there any risks of undefined behavior when calling a function which doesn't return anything using a prototype of it which returns bool?

According to the ERC-20 Token Standard, functions transfer and transferFrom should return a boolean value indicating success or failure: interface IERC20Token { function transfer(address _to, ...
2
votes
2answers
473 views

Function overriding versus Solidity Compiler Warning: Function state mutability can be restricted to pure

I have a function in a base contract that could have the state mutability modifier "pure" because it always returns true: BaseContract { function x(bytes memory) public ...
0
votes
1answer
37 views

Error While Compiling In Remix During Tutorial

During a tutorial on my first compile I received this error: :1:1: Parser error: Expected import directive or contract definition. pragma solidity ^0.5.12; ^ What's that about? How do I fix it? I'...
1
vote
0answers
271 views

Contract can't import remote repository locally

I made a compiler script that takes all contracts in folder ./contracts/ and produces a .json for each contract, containing an ABI and Bytecode. This worked fine for a while. However, I added some ...
4
votes
1answer
394 views

VS code Expected identifier, got 'LParen'solc

I keep getting this error/warning on my vscode when I emit events and build constructors. or After a bit of googling I understand it is something about my compiler, since solc <0.4.18 does not ...
3
votes
2answers
785 views

Setting Remix default Compiler Version

Is it possible to set the default Compiler version in Remix? Each time I open Remix, the compiler defaults to version 0.5.0+commit.1d4f565a. However, there is currently up to version 0.5.10 available ...
2
votes
4answers
2k views

How to deploy Library contract separate from the main contract and link it

For deployment I am using remix. When I deploy Hello.sol the compiler typically merges SafeMath.sol as a part of the main contract (Hello.sol) and deploys. This adds up library and main contract's ...