2022 Developer Survey is open! Take survey.

Questions tagged [compilation]

For questions regarding contracts compilation.

Filter by
Sorted by
Tagged with
0 votes
0 answers
16 views

Brownie unable to compile contracts on Apple M1 Mac

I recently got an M1 mac and I'm trying to compile my brownie project's contracts which compiled fine on my previous machine. I've installed Brownie v1.18.2 and when attempting to run brownie compile ...
user avatar
  • 180
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
0 answers
6 views

What are the trailing bytes before the metadata of a smart contract binary

I understand there is CBOR encoded metadata at the end of contract binary. But for this contract, there seems to be some other trailing data. Here is how I tried to decode it: Get the runtime code, ...
user avatar
  • 183
0 votes
0 answers
18 views

Truffle compile: Compilation error, says could not find .sol file

HP@LAPTOP-PJCIAT1T MINGW64 /d/H/To-do List/eth-todo-list $ truffle compile Error: Could not find D:/H/To-do List/eth-todo-list/contracts/todolist.sol from any sources at C:\Users\HP\AppData\...
user avatar
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
0 answers
22 views

Why is solcjs unable to compile contract that overrides interface?

I have a hardhat project with the following structure and an npm script specified in my package.json to compile Simple.sol(I can build/compile my contracts fine use npx hardhat compile, but I can't ...
user avatar
  • 180
0 votes
0 answers
68 views

Brownie compile error when using import statement

I'm using brownie version 1.17.2. When I do brownie compile, I got this: Here you can see the contract that gives me an error How can I know why is failing? EDIT 1: I already added openzeppeling ...
user avatar
0 votes
1 answer
1k views

Hardhat compile/deploy error

I'm following this tutorial for creating and deploying a smart contract (https://docs.alchemy.com/alchemy/tutorials/how-to-create-an-nft), but instead of deploying it on the ropstein test network I ...
user avatar
0 votes
1 answer
15 views

What am I doing wrong? cannot compile

Hi for some reason i keep getting this error, while trying to compile, im using a code I found in forums, but i seem not to be able to understand why it doesnt compile, what am I missing?. Thanks.
user avatar
  • 1
1 vote
1 answer
24 views

Converting from Version 4 to Version 5: Problem with Compilation

I got the following Solidity code from: https://www.zupzup.org/smart-contract-interaction/ pragma solidity ^0.5.6; contract Caller { function someAction(address addr) returns(uint) { ...
user avatar
  • 1,205
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
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
0 answers
26 views

What pragma version to use? [duplicate]

When I start with a project and have to decide which pragma I want to use, what are the main things I have to consider? For simplicity, lets first assume I start a project from scratch, without ...
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
0 votes
2 answers
307 views

Problem compiling subgraph with graph-ts new version

I'm getting this error: ERROR TS2322: Type '~lib/@graphprotocol/graph-ts/common/value/Value | null' is not assignable to type '~lib/@graphprotocol/graph-ts/common/value/Value'. I know it is for this ...
user avatar
0 votes
1 answer
19 views

Does solidity language optimizes code or is it dependent on Compiler for gas/machine cycles?

Take the following case uint256 x = z * 100/1000;//1st statement uint256 y = z * 1/10;// 2nd statement Now in terms of Gas and Machinecyles as well as will solidity spend more computational ...
user avatar
1 vote
2 answers
498 views

Can`t fix: AssertionError [ERR_ASSERTION]: Invalid callback object specified

I´m doing my first smart contract, these errors are probably no npm but versioning problems. Though intensive research I could not find a proper way to fix it. Thank you for your help! const assert = ...
user avatar
  • 11
0 votes
0 answers
48 views

Error testing call function

I am trying to test the call function using the contracts provided in this link. Attempting on Truffle running Solidity 0.6.12 (I think this is the most recent version) I get the following errors For ...
user avatar
0 votes
0 answers
32 views

Is it possible to compile Yul with truffle?

I have a contract written in Yul that I want to compile. It is not clear to me if this is possible with truffle. Alternatively I tried compiling it in remix and then migrating the artifact file, but ...
user avatar
  • 101
0 votes
2 answers
199 views

DeclarationError: Undeclared identifier. Did you mean "balances" or "balanceOf"?

I have gone through the similar questions and weirdly, none of them seem to solve this problem. I am creating a simple token contract contract Token { mapping(address => uint) public balances; ...
user avatar
  • 117
1 vote
1 answer
741 views

How to override when inherited contracts have same method name but slightly different signatures?

I'm inheriting 2 abstract contracts having the same function name but slightly different signature. These are the 2 base contracts: abstract contract Base1 { function foo() internal view virtual ...
user avatar
  • 246
0 votes
0 answers
25 views

Stack too deep, try removing local variables when using remix [duplicate]

while compiling in remix i get the above error: CompilerError: Stack too deep, try removing local variables. --> work/youkie.sol:1015:80: | 1015 | (uint256 rAmount, uint256 ...
user avatar
  • 21
0 votes
0 answers
80 views

Build with Library IterableMapping

I'm trying to compile my contract, which uses the IterableMapping library. IterableMapping is being created in the file itself, but even so, apparently an error is being raised, saying that I should ...
user avatar
0 votes
2 answers
314 views

How to generate Natspec docs using version 0.6.x of the Solidity compiler

I'm trying to run solc --userdoc --devdoc myContract.sol to generate natspec. However, the compiler complains that the contract has a different pragma-version. In fact the contract pragma is at ^0.6....
user avatar
  • 147
0 votes
0 answers
41 views

Unable to get campaign.json and campaignFactory.json

const path = require('path'); const solc = require('solc'); const fs = require('fs-extra'); const buildPath = path.resolve(__dirname, 'build'); fs.removeSync(buildPath); const campaignPath = path....
user avatar
0 votes
1 answer
180 views

Truffle Compile Fails with Error " Expected pragma, import directive or contract/interface/library/struct/enum/constant/function definition"

When running truffle compile in the root directory of my project I get the following error: ParserError: Expected pragma, import directive or contract/interface/library/struct/enum/constant/function ...
user avatar
0 votes
1 answer
356 views

Is it possible to import smart contracts with different compiler versions?

I'm using hardhat to compile my contracts. I am aware that hardhat is good at compiling contracts with different pragma versions, however, the contracts can't compile because they're importing ...
user avatar
2 votes
0 answers
1k views

Stack too deep when compiling inline assembly: Variable headStart is 1 slot(s) too deep inside the stack [duplicate]

I tried to add another parameter to my constructor and I get the following error when compiling with hardtest to test. If I remove one parameter it compiles again, so clearly it's related to the ...
user avatar
  • 123
0 votes
1 answer
1k views

JSON-RPC Error - Exection Reverted (-32000) / Empty ABI

I am attempting to deploy a BEP20 contract on BSC testnet via Remix. I am using compiler v6.12 and am successfully compiling my Solidity. However, when I deploy the contract, I am receiving the ...
user avatar
  • 1
0 votes
0 answers
47 views

Error while compiling with nodejs

Im trying to set up the compiler for my project. sol: pragma solidity ^0.4.25; contract Inbox { string public message; function Inbox(string initialMessage) public{ message = ...
user avatar
  • 41
0 votes
0 answers
16 views

How to locate the source codes by PC for smart contracts

Similar to the debugger module in remix https://remix.ethereum.org/, it can locate the source codes of each PC. Now, I want a tool that can locate the source codes given a PC for large-scale smart ...
user avatar
  • 73
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
0 votes
2 answers
107 views

i am very confused on what's wrong on line 16. balances[msg.sender] = totalSupply;

pragma solidity ^0.8.2; contract Token { mapping(address => uint)public balances; mapping(address => mapping(address => uint))public allowance; int public totalSupply = 10000 * ...
user avatar
  • 1
0 votes
1 answer
2k 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 ...
user avatar
  • 1,243
2 votes
2 answers
494 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 ...
user avatar
  • 1,243
1 vote
1 answer
209 views

Compilation Error while using ChainLink

I am using Remix IDE for my smart contract development. I am using the following import line import "https://github.com/smartcontractkit/chainlink/blob/develop/evm-contracts/src/v0.6/...
user avatar
1 vote
1 answer
585 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 ...
user avatar
0 votes
1 answer
18 views

How to be sure a bytecode is conform to a source code

Let's suppose a company shows me a contract's code source. This code source has been audited and looks fine. I trust this source code and i want to send Ether to this contract. The company tells me ...
user avatar
  • 1,049
0 votes
0 answers
539 views

How can I compile multiple smart contracts in a single compile.js file?

There is another post on this question but I don't find it useful enough so I thought I should ask again. In my compile.js file, I'm taking each smart contract's complied code and put it in a ...
user avatar
  • 11
1 vote
1 answer
522 views

73: TypeError: "send" and "transfer" are only available for objects of type "address payable" [duplicate]

This is my simple code for following along a tutorial. We are building a Lottery Smart Contract. However, I am failing to transfer the contract's balance to the winner. (see the last line inside of ...
user avatar
0 votes
2 answers
757 views

Resolve solidity compiler error

I am trying to create a smart contract and I am using ganache, visual studio code and truffle for that purpose. The versions installed in my windows system are: Truffle v5.1.49, Solidity v0.5.16 (solc-...
user avatar
  • 760
2 votes
1 answer
438 views

How to test your smart contract against currently existing ones on mainnet locally using Truffle?

Background I am fairly new to smart contracts and am currently experimenting using Ganache and Truffle to test on my local machine. My goal would be to have the smart contract interacting with other ...
user avatar
1 vote
1 answer
262 views

Events declared in library are missed in contract ABI

DYDX contract SoloMargin is firing events like LogTrade, LogSell but they are not provided in ABI. SoloMargin contract: https://etherscan.io/address/0x1e0447b19bb6ecfdae1e4ae1694b0c3659614e4e#code ...
user avatar
  • 21
2 votes
1 answer
133 views

How can I use "@" (at sign) syntax with Remix?

I've seen multiple times Solidity contracts, which are using import "@somename/.../SomeContract.sol" syntax. Here's the example: pragma solidity ^0.5.0; pragma experimental ABIEncoderV2; ...
user avatar
0 votes
1 answer
2k views

ParserError: Expected ',' but got ';'

I`m trying compilate this code and getting Parse error pragma solidity ^0.6.0; contract ZooFactory { event NewZoo(uint zooId, string name, uint dna); uint dnaDigits = 24; uint ...
user avatar
  • 11
0 votes
1 answer
112 views

Does reentrancy attack happens as soon as the balance in storage is modified after the withdrawal?

I just saw something like this: function sub( uint a, uint b ) internal pure returns (uint) { require(b <= a, "SUB_UNDERFLOW"); return a - b; } function withdraw(...
user avatar
0 votes
1 answer
521 views

Why my contract binary does not set?

My project is in Truffle. I programmed a smart contract and want to deploy it with JavaScript. But the following error occurs: Error: Contract error: contract binary not set. Can't deploy new instance....
user avatar
  • 365
0 votes
1 answer
241 views

How to include constructor arguments in bytecode for smart contract deployment in genesis block?

Please excuse if the title is not perfectly accurate but I had a hard time fitting my problem into 1 question. If you have a better title please feel free to suggest it and i will edit it. I want to "...
user avatar