2022 Developer Survey is open! Take survey.

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
0 answers
6 views

Why Is My Smart Contract Not Able To Be Optimized?

I have a smart contract that is barely below the limits of the solidity compiler. When I try to enable optimization at 200 runs I get this error: CompilerError: Stack too deep when compiling inline ...
user avatar
  • 113
0 votes
0 answers
8 views

How to configure EVM in IntelliJ with Solidity plugin

There is a related question/answer from 5 years ago but back then the plugin only provided syntax highlighting. Now, I know I can compile from the solidity file opened in IntelliJ, clicking on a play/...
user avatar
0 votes
1 answer
18 views

hardhat beginner "Nothing to compile" error

following hardhat beginner tutorial. This is how I did it, first run "npx hardhat " command and created basic sample project. After that run following command npm install --save-dev @...
user avatar
0 votes
3 answers
26 views

Which compiler version should I use?

// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.9.0; import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol"; import "@chainlink/contracts/src/v0....
user avatar
  • 1
1 vote
0 answers
12 views

Truffle compiles different binary than RemixIde, even with same compiler version and evm version

The code: pragma solidity <0.9.0; contract Callee { address public a; address public b; function test(uint256 i) public returns(uint256){ a=address(this); b=msg....
user avatar
  • 183
0 votes
1 answer
22 views

Any document for the layout of the smart contract binary?

I'm trying to write a disassembler to disassemble the binary code of smart contract. There are trailing bytes at the end, which causes disassemble problem. For example, the last few lines of this ...
user avatar
  • 183
0 votes
1 answer
109 views

How to complie smart contract in node.js [solc version: ^0.8.13]

I would like to complie my smart contract code at node.js. Although solc version at package.json and solidity version at smart contract code are same, it doesn't work. complie.js const path= require('...
user avatar
  • 3
0 votes
1 answer
34 views

Learn how to use Solidity ( Error encoding arguments: Error: invalid BigNumber)

Good afternoon folks! I thank the attention ! I'm taking a Solidity course that Microsoft made available on the link https://aka.ms/SolidityHowTo-11 pragma solidity >0.7.0 <0.8.0; contract ...
user avatar
0 votes
1 answer
21 views

ParserError: Expected '{' but got '}' I keep getting this error when I try to compile my code

I get this error every time that I try to compile my code. These curly brackets run from the beginning of my contract to the very end. I'm new to smart contracts, and this does not make much sense to ...
user avatar
0 votes
0 answers
30 views

different imported contracts require different version of comipiler and they are not compatitble

Mac mini (M1, 2020) Monterey Brownie v1.17.2 nodejs v16.13.4 I am learning solidity according to reference(https://www.youtube.com/watch?v=M576WGiDBdQ&t=25510s). Inproject Lottery。 The issue is ...
user avatar
0 votes
1 answer
84 views

Type Error: Keyword Argument 'solc_version'

I received the following error while trying to execute a custom built web3.py install_solc("0.6.0") complied_sol = compile_standard( { "language": "Solidity", ...
user avatar
  • 103
0 votes
0 answers
15 views

Compiling Solidity Code

I am just starting my journey with Solidity and I used this 16h course on YouTube. Now I came to the point, where we compiled our first Code in VS Code and I asked myself, what exactly the following ...
user avatar
0 votes
1 answer
96 views

How do I tell which solidity version eth-brownie is using to compile my contracts?

I'm not specifying a solidity version so I'm not sure which solidity version brownie is using to compile my contract. I'm using pragma solidity ^0.8.0; so I'm not sure which version above 0.8.0 ...
user avatar
1 vote
1 answer
142 views

Uniswap V2: TypeError: Explicit type conversion not allowed from "int_const -1" to "uint256"

I was trying to fork Uniswap V2 with another protocole and ran into this error while compiling the contracts: TypeError: Explicit type conversion not allowed from "int_const -1" to "...
user avatar
  • 103
0 votes
1 answer
258 views

How can i deploy a smart contract with Multiple files

I am kinda new to this space. I just deployed my first smart contract to the BSC using Remix IDE. Now I used the very simple contract templates most online tutorials have always used. It is just a ...
user avatar
  • 1
0 votes
0 answers
47 views

I am trying to print out the variable (compiled_sol), so I can deploy my smart contract, but I keep running at this error

INFO: Could not find files for the given pattern(s). Traceback (most recent call last): File "C:\Users\jethr\demos\web3_py_simple_storage\deploy.py", line 8, in <module> ...
user avatar
0 votes
0 answers
116 views

Solidity compile error 6275 with openzeppelin

I'm using solc 8.0.0 with node.js 16.13.1 my project dependencies are the following: "dependencies": { "@openzeppelin/contracts": "^4.4.2", "@truffle/...
user avatar
0 votes
1 answer
372 views

ParserError: Source file requires different compiler version

I am a beginner working on brownie using vscode related to a lottery smart contract. Please don't mind if I am doing any rookie mistakes I am still trying my best to understand it as much as I can :) ...
user avatar
0 votes
0 answers
68 views

Getting a weird compilation error in Hardhat (Possible Glitch)

Error: contracts/DappTest.sol:9:2: DeclarationError: Identifier already declared. import '@uniswap/v2-periphery/contracts/UniswapV2Router02.sol'; ^----------------------------------------------------...
user avatar
1 vote
0 answers
70 views

Solidity array has no SLOAD optimization

Suppose a function writes to storage, and then reads from the same storage location before it has been overwritten. In solidity 0.8.11 in these cases the SLOAD gets optimized away (there is 1 SSTORE ...
user avatar
  • 8,927
1 vote
0 answers
86 views

TRYING TO VERIFY MY SOURCE CODE ON ETHERSCAN ErrorUnable to generate Contract ByteCode and ABI (General Exception, unable to get compiled [bytecode])

Compiler Warning(s): ParserError: Expected pragma, import directive or contract/interface/library/struct/enum/constant/function definition. --> myc:1:1: | 1 | "accounts": { | ^^^^^^^^^^ ...
user avatar
  • 11
2 votes
1 answer
33 views

Is there an EVM compiler that supports coroutines? (e.g. generator functions)

With coroutine I mean a subroutine that can be paused and resumed from another subroutine; preserving its internal state across pauses and resumes. For example, a feature similar to: Javascript's ...
user avatar
  • 8,927
1 vote
1 answer
80 views

Solc_version="0.6.0" - compile_Standard isnt found

I have a problem with my code. I have seen similiar threats in this group and I have applied all of the steps unfortunately without any luck... Could anyone pls help...: from solcx import ...
user avatar
0 votes
1 answer
146 views

Solidity safeTransferFrom compile error

I am getting the following Solidity error in my contract and I'm not sure what the problem is: Expected identifier but got '(' Here is my contract stripped down to the problem. // SPDX-License-...
user avatar
0 votes
0 answers
193 views

Brownie Compile can't resolve solidity relative imports

This was working for me earlier, and now it's failing and I don't know why. I'm able to reproduce with this simple test case. I run brownie init in a clean directory, put the following two files in ./...
user avatar
1 vote
1 answer
69 views

Cannot compile code with inline assembly using solc linux binaries

The code with inline assembly fails to compile with the solc binaries from soliditylang.org. The same code compiles without issue using Remix or solcjs. Because of this issue I cannot even compile the ...
user avatar
1 vote
1 answer
103 views

Why is solidity asking me to restrict state modifier function to view?

Version 0.8.7 Solidity is complaining that several state modifier functions can be restricted to view, such as: function updateStruct( uint256 dummyParam ) public onlyOwner { DummyStruct ...
user avatar
  • 315
0 votes
0 answers
56 views

Generating a new web3j erc20 projects fails

I've tried to generate a new web3j project with the cli using web3j new erc20. However the generation fails and the log provides the following error: "Source file requires different compiler ...
user avatar
  • 21
0 votes
1 answer
20 views

Is the bytecode that was generated by the compiler will be interepreted by EVM into a machine code?

I am relatively new to Ethereum. After the compiler generate the bytecode, the EVM will interpret this code and convert it to machine code that will run on my CPU or it will transfer this machine code ...
user avatar
  • 227
0 votes
3 answers
427 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 &...
user avatar
1 vote
0 answers
48 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 ...
user avatar
3 votes
3 answers
4k views

Error HH8: There's one or more errors in your config file, 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":&...
user avatar
0 votes
1 answer
139 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 ...
user avatar
0 votes
1 answer
233 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 ...
user avatar
  • 103
0 votes
1 answer
78 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 = ...
user avatar
  • 1
1 vote
2 answers
379 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 ...
user avatar
  • 11
1 vote
1 answer
580 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 ...
user avatar
  • 147
0 votes
0 answers
56 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, ...
user avatar
3 votes
3 answers
5k 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/...
user avatar
2 votes
1 answer
71 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 ...
user avatar
  • 103
0 votes
0 answers
25 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.
user avatar
1 vote
2 answers
2k 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 ...
user avatar
  • 103
0 votes
0 answers
24 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 ...
user avatar
  • 31
1 vote
2 answers
142 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 ...
user avatar
  • 141
0 votes
2 answers
2k 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 ...
user avatar
0 votes
0 answers
66 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?
user avatar
  • 1
2 votes
1 answer
365 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 ...
user avatar
  • 342
1 vote
1 answer
124 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; ...
user avatar
  • 7,735
1 vote
3 answers
507 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 ...
user avatar
1 vote
2 answers
205 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 ...
user avatar