Questions tagged [compilation]

For questions regarding contracts compilation.

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

"An existing connection was forcibly closed by the remote host" during processTestResources - Error while generating code using gradle Solidity java

I am using web3j-gradle-plugin to generate the java wrappers for my smart contract which is a simple one named, simple-storage provided by the community. Facing this weird error while running the ...
0 votes
1 answer
5 views

Large Size Disparity Between Contract and Its Library Wrapper

I have this contract called Pool.sol, and an external library for deploying it: pragma solidity ^0.8.0; // Contracts import "../Pool.sol"; library DeployerOfPools { function deployPool(...
0 votes
0 answers
20 views

Find metadata URL from EVM bytecode

Currently, I am looking for a way to extract the metadata.json file URL from the ethereum bytecode. I have referred to this doc and figured out that metadata mapping is stored CBOR-encoded manner. ...
0 votes
1 answer
18 views

Different bytecode when compiling from both solc-js and Remix IDE

Currently, I'm trying to get the bytecode from this contract code for example: // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract GetSet { uint256 private total; mapping(address =&...
0 votes
1 answer
58 views

DeclarationError: Undeclared identifier on mapping

I recently upgraded from solidity v0.4.25 to 0.8.6. I noticed that expectedly required some code modifications, all of which we easy to debug resulting in a changed contract code. The final error on ...
  • 1
1 vote
1 answer
238 views

Hardhat coverage tests failure - Stack too deep

I got my smart contracts ready over Hardhat and once I'm running hh test all the tests are passing successfully but while running hh coverage I'm getting the below error. Any idea why the regular ...
  • 543
0 votes
1 answer
117 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 ...
  • 349
0 votes
2 answers
168 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 @...
0 votes
0 answers
14 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, ...
  • 213
0 votes
0 answers
43 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\...
0 votes
1 answer
24 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 ...
  • 213
0 votes
0 answers
55 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 ...
  • 349
0 votes
0 answers
95 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 ...
0 votes
1 answer
2k 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 ...
0 votes
1 answer
18 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.
  • 1
1 vote
1 answer
36 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) { ...
  • 1,285
0 votes
0 answers
96 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'; ^----------------------------------------------------...
2 votes
0 answers
104 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 ...
  • 9,297
2 votes
1 answer
37 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 ...
  • 9,297
1 vote
0 answers
27 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 ...
0 votes
1 answer
188 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-...
0 votes
0 answers
261 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 ./...
1 vote
2 answers
576 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 ...
0 votes
1 answer
24 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 ...
1 vote
2 answers
789 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 = ...
  • 11
0 votes
0 answers
55 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 ...
0 votes
2 answers
274 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; ...
  • 117
1 vote
1 answer
1k 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 ...
  • 327
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 ...
  • 73
0 votes
2 answers
467 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....
  • 219
0 votes
1 answer
235 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 ...
0 votes
2 answers
504 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 ...
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 ...
  • 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 ...
  • 1
0 votes
0 answers
69 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 = ...
  • 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 ...
  • 73
1 vote
2 answers
307 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
2 answers
149 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 * ...
  • 1
0 votes
1 answer
3k 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,483
2 votes
2 answers
620 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 ...
  • 1,483
1 vote
1 answer
221 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/...
1 vote
1 answer
654 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 ...
0 votes
1 answer
27 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 ...
  • 1,159
0 votes
0 answers
612 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 ...
  • 11
1 vote
1 answer
544 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 ...
0 votes
2 answers
900 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-...
  • 842
2 votes
1 answer
506 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 ...
1 vote
1 answer
341 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 ...
  • 21
2 votes
1 answer
148 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; ...
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 ...
  • 11