As of May 31, 2023, we have updated our Code of Conduct.

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
15 views

Compiler version error in Visual Studio Code

I started getting this error... Source file requires different compiler version (current compiler is 0.7.3+commit.9bfce1f6.Emscripten.clang) - note that nightly builds are considered to be strictly ...
Falcon Stakepool's user avatar
0 votes
0 answers
8 views

Why do I have two versions of Truffle compiler on my computer?

I am using VS Code to compile Solidity code. When I do truffle -v in Mac terminal, it shows Solidity v0.5.16 (solc-js). When I do truffle -v in my firstProject folder, though, it shows Solidity - 0.8....
Beata's user avatar
  • 1
0 votes
0 answers
21 views

Having trouble finding and uninstalling local solc versions to enable solc-select

Years ago, I used Homebrew to install ethereum and solidity. Lately, I've been trying to use solc-select, but as its documentation states, it doesn't work when there's a local copy of solc already ...
StuckInThePast's user avatar
1 vote
1 answer
14 views

Compiler doesn't show a warning if empty function is not marked as pure

When compiling a function without marking its state mutability as pure, the compiler shows the following warning: Warning: Function state mutability can be restricted to pure For example: contract ...
BonisTech's user avatar
  • 451
1 vote
1 answer
31 views

How to disable log that when compile?

I using script "yarn hardhat compile" alway log like image. I want to disable that.
sea.dev's user avatar
  • 13
1 vote
1 answer
18 views

developing a contract that distributes tokens

I am developing a contract that distributes tokens and has already implemented the main functionality. The contract accepts tokens from the owner and distributes them by 1KK to each address from the ...
Lll Cilician's user avatar
1 vote
1 answer
49 views

Get bytecode offset(entrypoint) for the function in solidity contract

Suppose, I have the following source code: contract Test { function add(uint a, uint b) public returns(uint) { return a + b; } } And bytecode after compilation: ...
shermike's user avatar
1 vote
1 answer
41 views

I do not understand how to fix the error: "req.add"

// SPDX-License-Identifier: MIT pragma solidity 0.8.19; import "@chainlink/contracts/src/v0.8/ChainlinkClient.sol"; contract RealEstateDataConsumer is ChainlinkClient { uint256 ...
Vidhan Mangla's user avatar
1 vote
1 answer
45 views

Compilation is successful but getting bytecode = "0x"

I am trying to compile this very simple smart contract but I am getting its bytecode = "0x": // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; import "@openzeppelin/...
Falcon Stakepool's user avatar
2 votes
1 answer
147 views

Adding viaIR: true option Brownie

I'm getting CompilerError: Stack too deep. Try compiling with `--via-ir` (cli) or the equivalent `viaIR: true` (standard JSON) while enabling the optimizer. Otherwise, try removing local variables. ...
aliercanozgokce's user avatar
1 vote
1 answer
23 views

Solc: Source file requires different compiler version

in my brownie project i have imported LinkTokenReceiver.sol contract which its pragma solidity is pragma solidity ^0.7.0;, which means that it requires compiler version equal or greater than 0.7.0, ...
noro meb's user avatar
  • 298
1 vote
2 answers
236 views

Operator == not compatible with types string memory and string memory [duplicate]

function hasRole(uint256 tokenId, string memory role) public view returns (bool) { string[] memory userRoles = tokenToRoles[tokenId]; uint256 userRolesLength = userRoles.length; unchecked {...
dd0sxx's user avatar
  • 155
1 vote
0 answers
45 views

How do I use a remapping with solidity compiler?

If my contract is importing for example "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol", how do I make it work? I know import_remappings ...
danisa's user avatar
  • 11
0 votes
0 answers
21 views

Run manticore return 'Stack too deep when compiling inline assembly: Variable headStart is 1 slot(s) too deep inside the stack' error

I compile my project just fine but when I run manticore for my solidity file, it return Stack too deep error. I did some research but none of which I found work. Here is the config I'm setting: ...
marethyu's user avatar
0 votes
1 answer
61 views

Compiler version error

I am following a YouTube tutorial and I have the following contract (in Remix): // SPDX-License-Identifier: MIT pragma solidity >= 0.6.0 < 0.9.0; import "@chainlink/contracts/src/v0.8/...
DJ Quimoso's user avatar
0 votes
3 answers
183 views

Contract is below size limit, but Hardhat says it's not?

When I run npx hardhat compile, Hardhat says one of my contracts is above the size limit. But hardhat-contract-sizer says it's not. See below: Versions: hardhat-contract-sizer version: ^2.5.1 ...
António Gonçalves's user avatar
3 votes
1 answer
1k views

Is it possible to get the "creation bytecode" of an already deployed contract in Solidity?

I am looking to get some already deployed code working for myself. With ethers.js I can get the bytecode in the following way ethers.getCode("CONTRACT ADDRESS") However, this is a ...
zen's user avatar
  • 31
1 vote
1 answer
136 views

Problem with Solidity compiler

recently I started doing solidity tutorial. Everything was going okay on remix but when i switched to VS Code I got compiler error I changed it to: but it doesnt solve the question why 0.8.8 ...
joaszek's user avatar
  • 11
2 votes
0 answers
26 views

Why No Constant Linking?

Similarly to library linking https://docs.soliditylang.org/en/latest/using-the-compiler.html?highlight=compiler%20options#library-linking why is there no constant linking for the compiler? The only ...
mermeladeK's user avatar
1 vote
1 answer
35 views

Hi Everyone. Newbie here in solidity . I am getting the common erro "ParserError: Expected '(' but got identifier" with my code

I am getting the common error "ParserError: Expected '(' but got identifier" with my codeb. I have tried to solve it using the existing solutions but seems my knowledge is limited, hence not ...
Jakku's user avatar
  • 11
1 vote
0 answers
115 views

Trouble with Solidity Compiler Version when combining Aave and Openzeppelin in Foundry

I'm trying to follow this tutorial by Patrick Collins on Flashloans but in Foundry: https://www.youtube.com/watch?v=Aw7yvGFtOvI&t=328s When in try to forge build I get the following error: : src\...
banyan's user avatar
  • 21
2 votes
1 answer
186 views

How to enable multiple compiler versions in solc js?

I'm trying to compile contract A(located in A.sol) that has a dependency on contract B(located in B.sol) using solc-js, where A has solidity version 0.8.0 and B version 0.7.6. The solcjs version that ...
MShakeG's user avatar
  • 573
1 vote
1 answer
57 views

Brownie doesnt compile but says it did

if i run brownie compile i get INFO: Could not find files for the given pattern(s). Brownie v1.19.0 - Python development framework for Ethereum Project has been compiled. Build artifacts saved at C:\...
Toshiro Nakamoto's user avatar
1 vote
1 answer
400 views

Is it possible to compile to YUL?

So the solidity compiler compiles solidity first to YUL and then to machine code. Is it possible to compile it just to YUL and look it over? It would be really helpful to learn how YUL works. Thanks.
Kuly14's user avatar
  • 312
1 vote
1 answer
770 views

I can not import openzeppelin, but get error 'File import callback not supported'

I get 'File import callback not supported' when I try to compile my simple solidity contract, that imports ERC721. Can anybody help? Here is what I have already done: I have installed openzeppelin in ...
utroelski's user avatar
1 vote
1 answer
589 views

TypeError: Invalid URL at new NodeError when typing the command npx hardhat run scripts/deployGoldenFoxNFT.js --network rinkeby

I run into this error when i try to run with Hardhat. Any idea of what it can be the solution? Thanks a lot in advance
LAURA IOANA's user avatar
0 votes
0 answers
38 views

CompilingError: Stack too deep, try removing local variables [duplicate]

I have a function that lists an NFT on a marketplace for sale. In the process, it keeps records by saving data in a struct inside nested maps represented by the NFT address and token ID. I am running ...
Weivy's user avatar
  • 1
0 votes
1 answer
219 views

Variable declaration

I am new to solidity.Below is the snippet of solidity source code which I came across :- pragma solidity ^0.5.1; library SafeMath { function sub(uint256 a, uint256 b) internal pure returns (...
Brijesh's user avatar
  • 43
1 vote
0 answers
56 views

Pure function that reads from storage, compiler bug?

I just came across this while testing around with the Diamond Storage pattern. Here is a 'pure' function that reads from storage. This had me wondering, is there actually any difference between pure ...
phaze's user avatar
  • 1,500
0 votes
2 answers
42 views

Remix compiler error on my last code line 187 - any solution?

My code below still popping one error on line 187 - if.... on remix.ethereum compiler - any solution? pragma solidity ^0.4.4; contract Token { /// @return total amount of tokens function totalSupply()...
SkyPilot's user avatar
1 vote
1 answer
561 views

unexpected revert behaviour using custom errors in pure function

in the code below, if a revert using the custom error inside the pure function it reverts with a different error (below). If I do the same things without pure, it reverts with the custom error as ...
sola24's user avatar
  • 1,128
1 vote
0 answers
32 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 ...
Jim's user avatar
  • 173
3 votes
1 answer
380 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/...
mehrlicht's user avatar
0 votes
2 answers
622 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 @...
yasurid's user avatar
1 vote
3 answers
131 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....
Hitesh's user avatar
  • 21
1 vote
0 answers
102 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....
aj3423's user avatar
  • 241
1 vote
1 answer
34 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 ...
aj3423's user avatar
  • 241
1 vote
1 answer
1k 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('...
jjjoo's user avatar
  • 13
2 votes
0 answers
102 views

ParserError: Expected '{' but got reserved keyword 'override' ) external override returns (bool) { ^------^

Can someone fix the code problem below? I compile in remix.ethereum.org , it show ParserError: Expected ';' but got '}' } external override The code: pragma solidity 0.5.8; /** Ropsten instances:...
funny cartoon's user avatar
0 votes
1 answer
83 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 ...
Marcio Duran's user avatar
0 votes
1 answer
64 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 ...
Gray Blanchard's user avatar
1 vote
1 answer
223 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", ...
Ayush's user avatar
  • 113
1 vote
1 answer
294 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 ...
tythereum's user avatar
1 vote
1 answer
403 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 "...
Cizia's user avatar
  • 233
0 votes
1 answer
1k 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 ...
Kezino's user avatar
  • 1
0 votes
0 answers
123 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> ...
Jebizness's user avatar
0 votes
1 answer
1k 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 :) ...
brownWellick's user avatar
2 votes
0 answers
130 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 ...
Jesbus's user avatar
  • 9,988
1 vote
0 answers
183 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": { | ^^^^^^^^^^ ...
zack's user avatar
  • 11
2 votes
1 answer
39 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 ...
Jesbus's user avatar
  • 9,988