Questions tagged [solc]
Questions related to the compiler for Solidity: solc
364 questions
2
votes
0
answers
16
views
Optimizer ExpressionJoiner Help
Hi im a newbie learning about Optimizer and Im trying to Join a function like this
function fun_trigger_61() -> vloc
{
let ret := vloc
ret := vloc
...
1
vote
2
answers
42
views
Attempting to install slither
When following these Instructions I get an Python error that I don't how to deal with.
I have the following installed on my Ubuntu 24.04.1 LTS.
$ python3 --version
Python 3.12.3
p$ pip3 --version
pip ...
0
votes
0
answers
23
views
I can't get solc to work on vs code
I am trying to use "compile_source" and it doesn't work, solcx is installed and is the latest version:
this is the error:
Traceback (most recent call last):
File "c:\Users\Matteo\...
0
votes
0
answers
8
views
How to get the documentation for all the methods in the smart contract when using solc --devdoc
I am running the following command to generate Developer Documentation for a smart contract in JSON format:
solc --devdoc Contract.sol > doc.json
The problem I am having is that some of the methods ...
0
votes
0
answers
27
views
Error: processing response error
Solidity
const ethers=require("ethers");
const fs=require("fs-extra");
async function main(){
//http://127.0.0.1:7545
const provider=new ethers.providers.JsonRpcProvider("...
0
votes
0
answers
15
views
solc: import defaults to cwd?
Would appreciate an explanation why the first solc call doesn't fail.
# downloaded from https://github.com/OpenZeppelin/openzeppelin-contracts
$ ls *.sol
IERC20.sol IERC20Metadata.sol
# metadata ...
0
votes
1
answer
62
views
Understanding discrepancies between Etherscan deployed bytecode and locally compiled bytecode for smart contracts
I’m experiencing an issue when examining the bytecode of this smart contract 0x7c21C4Bbd63D05Fa9F788e38d14e18FC52E9557B.
After locating the contract on Etherscan and viewing the contract code in the “...
0
votes
1
answer
39
views
Call to view function, which returns a bytes value, got error: VM Exception while processing transaction: invalid opcode
I have this test smart contract
// SPDX-License-Identifier: SEE LICENSE IN LICENSE
pragma solidity 0.8.26;
contract TestSomething {
bytes state;
bytes32 state32;
constructor() {}
...
0
votes
0
answers
37
views
Transaction 0x6a19aa91361ce2b93b7515962821540af2aab0ebff0fcdcb90ee252fbe64c107 is pending: true
Any insight into this?
I am attempting to deploy a smart contract using Go-Ethereum but it is pending forever until my context timeout.
In order to minimize the complexity I use a worthless contract.
/...
0
votes
0
answers
138
views
Solc too slow compiling
The solc compiler that I'm using (0.8.21) is taking too much time to compile. It's compiling 20 files for a foundry test campaign in ~90 seconds when it should be milliseconds.
Any ideas on what I ...
0
votes
1
answer
44
views
ABI and BIN Files generated by solc and Etherscan verified code are not identical
I have a file that is composed of multiple imports, too much code to drop here so I will illustrate my question with a very simplified example.
My compilers:
$ abigen --version
abigen version 1.11.7-...
1
vote
1
answer
79
views
Abigen from flattened contract files
I have a file that is composed of 5 imports, too much code to drop here so I will illustrate my question with a very simplified example.
My Test.sol file:
// SPDX-License-Identifier: MIT
pragma ...
0
votes
0
answers
84
views
Solidity smart contract not compiling in python
I am trying to use the following to compile and deploy a smart contract.
The last line comes with the error mentioned below.
from web3 import Web3, HTTPProvider
from solcx import compile_files, ...
1
vote
1
answer
17
views
Accidentally removed "/usr/bin/solc" after installation, now no command work
Unfortunatly, meanwhile I was trying to get the latest solidity version, i deleted the /usr/bin/solc folder, and now I can non longer run any script (i.e. solc --version or --help)
Can someone help ...
0
votes
1
answer
68
views
Getting different binary for the same Solidity source code compiling with solc and Remix
I'm noticing a difference in the binary generated using the same solc compiler in local and with Remix.
Here's the source code:
pragma solidity 0.8.20;
contract HelloWorld {}
I compiled it in local ...
1
vote
0
answers
132
views
incompatible Solidity versions
I am trying to compile the code with multiple solidity versions e.g. =0.7.6, =0.8.15 etc in foundry with the configuration of auto_detect_solc but still getting this error
Here's my foundry.toml file
[...
0
votes
1
answer
2k
views
How to know the default evm version of a specific version of solc
I have multiple versions of solc installed
❯ asdf list solidity
0.4.24
*0.8.23
latest solc includes the default evm version in the help output:
❯ solc --version && solc --help|grep evm
...
0
votes
1
answer
87
views
Why is contract deploying, but giving an error on console
So I'm using ganache client and deploying the contract. I can see the contract on ganache and also the transaction. But on the console I'm getting following error:
...
code: 'UNKNOWN_ERROR',
...
0
votes
2
answers
1k
views
Error: missing revert data when deploying Solidity contract with ethers.js and Ganache
I'm having an issue deploying a Solidity smart contract using ethers.js and Ganache. I have a simple contract called SimpleStorage.sol:
// SPDX-License-Identifier: MIT
pragma solidity 0.8.21;
...
2
votes
1
answer
233
views
Determine compiler used to create a given bytecode
Context
The method that the solc compiler uses to set storage slots for a mapping is slightly different from how the Vyper compiler does so. In Vyper, it's keccak256(slotMapping, key), while in ...
0
votes
2
answers
95
views
Runtime error: code size to deposit exceeds maximum code size
I'm using solc_version version 0.8.16, which i checked is installed, but when i'm trying to deploy the contract getting error Runtime error: code size to deposit exceeds maximum code size. While using ...
0
votes
0
answers
207
views
How to import code into a contract
I have a contract that needs to be compiled with solc so I can get Go bindings.
$ tree
.
├── openzeppelin
├── Swap.sol
└── @uniswap
pragma solidity >0.7.0 < 0.9.0;
import { IUniswapV2Pair } ...
2
votes
2
answers
71
views
Abigen reuses nonce when deploying a contract
We have a contract called C1 that uses another contract called RoleLib:
using RoleLib for uint8;
We compile it with solc:
solc --combined-json abi,bin ./solidity/c1/C1.sol -o deploy/c1 --base-...
1
vote
1
answer
48
views
Why does deploying programatically through nodejs cost more than deploying through remix?
I've written code to deploy contracts programatically. However when I set the same settings as remix ("gas price, gas limit, etc). The transaction mines but I get the error:
Warning! Error ...
2
votes
1
answer
196
views
--solc --userdoc --devdoc File not found. Searched the following locations: ""
When trying to generate user documentation and developer documentation from the NatSpec of a smart contract with solc --userdoc --devdoc MarketPlaceCustodial.sol by following the official ...
1
vote
1
answer
118
views
State variable not returning value when the contract is deployed into sepolia test network
The manager state variable captures the value of account that deploys the contract on the network. When deploying the contract on Ganache and calling ContractName.methods.manager().call(), it returns ...
0
votes
1
answer
149
views
Select solc version
I am exploring the best way to switch solc versions on Ubuntu and I looked at the Docker solution. The Docker --help command is of no help, it does not show an option for listing possible solc ...
0
votes
1
answer
333
views
How to compile smart contract in react app with solc?
I used solc compiler in react app but browser is not compatible with it and gives an error after using that code;
const createContract = async () => {
const contract = erc1155.print();
...
2
votes
1
answer
118
views
Brownie <> SolcInstallationError, I've tried everything I can find -- nothing has worked!
Everytime I try brownie compile I see this:
SolcInstallationError: Downloaded binary would not execute, or returned unexpected output. If this issue persists, you can try to compile from source code ...
0
votes
1
answer
110
views
asking funding while installing solc?
asking for funding while installing solc cant we insatll by skiping it
npm install -g solc
changed 9 packages in 9s
1 package is looking for funding
run npm fund for details
0
votes
0
answers
43
views
VSCode Emmet Extension Failing in .sol Files
Has anyone experienced the emmet extension terminate on them when in a Solidity file and then try and press tab and receive "command 'emmet.expandAbbreviation' not found"
I have no idea what ...
1
vote
1
answer
661
views
Compiler error: Stack too deep
I am getting this error when trying to deploy my smart contract using zkSync but on a different chain (Polygon Mumbai):
CompilerError: Stack too deep. Try compiling with `--via-ir` (cli) or the ...
1
vote
1
answer
122
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/...
1
vote
1
answer
337
views
How to compile with --bin option in solcjs?
I want to compile using --bin option because I want to get to see the bytecode of the compilation.
Using solc I know it is something like this: solc --bin
How can I achieve this using solcjs?
1
vote
1
answer
183
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, ...
1
vote
1
answer
99
views
How is `soljson.js` created from Solidity repository
In the official Solidity GitHub repo, under the releases section you can download the source code, binaries and the soljson.js file. How is the file generated and is it able to be generated by ...
1
vote
2
answers
872
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 {...
0
votes
1
answer
365
views
zsh: command not found: solc (macOS Monterey)
Installed solc with this command:
% pip3 install solc-select
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: solc-select in /Users/test2/...
0
votes
1
answer
250
views
How to Verify smart Contracts Using Web3.js and Solc?
everyone, I am new to web 3,I deployed smart contract successfuly and get back contract address but now I am trying to verify that the smart contract with web3 and solc .
https://www.shawntabrizi.com/...
0
votes
1
answer
147
views
how to check if a uri is already existing in a contract?
I have written a smart contract for ERC1155. Everytime I mint a NFT, a new token is created and assigned to that URI. issue is if I use the same URI, it mints with a new token. How to stop it from ...
1
vote
1
answer
1k
views
What is AST in solidity
I really often meet the abbreviation AST but don't really get what it means. I suppose it is a kind of output file that the compiler generates but what exactly is in it?
1
vote
1
answer
629
views
Could not find files for the given pattern(s)
from solcx import compile_standard, install_solc
import json
install_solc("0.8.0")
with open("./SimpleStorage.sol", "r") as file:
simple_storage_file = file.read()
...
1
vote
0
answers
68
views
Parse Error with npm workspaces
I am getting a false error with the solc language server (running on neovim with nvim-lsp). I often use npm workspaces and the language server fails to understand that the dependencies are two ...
1
vote
0
answers
78
views
Setting runs in solc options at brownie-config.yaml
My goal is to set the runs key of solc to the value of 100 inside the brownie-config.yaml file. I have found two different solutions and I would like to know what is the difference between the two in ...
0
votes
1
answer
450
views
Solidity: Error encoding arguments: Error: invalid BigNumber string
I am using this code:
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;
contract Wallet {
address owner;
struct Data {
string userEmail;
uint256 ...
3
votes
0
answers
84
views
Why the bytecodes for the same smart contract in testnet explorer and Remix/solcjs are different?
I am using Remix to compile and deploy my smart contract to the Rinkeby test network.
I don't understand why the bytecode of my contract on Rinkeby explorer is different from the metadata.data....
1
vote
1
answer
377
views
solc compiler --allow-paths fails
I'm trying to compile a contract using standard JSON through a script via the solc compiler CLI. I have a folder structure for storing the .sol files, the input JSON, and the compiled JSON output. No ...
2
votes
1
answer
107
views
solc --userdoc --devdoc NFTMarketplace.sol "NFTMarketplace.sol" is not found
When I tried to generate Documentation with solc --userdoc --devdoc NFTMarketplace.sol I get the error "NFTMarketplace.sol". It seems like solc cant find the path to my smart contract. I ...
1
vote
2
answers
1k
views
Facing an error while running "truffle compile"
I'm facing an error while running truffle compile-
Error: Failed to fetch the Solidity compiler from the following locations: https://relay.trufflesuite.com/solc/bin/,https://solc-bin.ethereum.org/bin/...
1
vote
1
answer
310
views
Compilation Error with Solc - Solc Error: dyld[30112]: Library not loaded: '/opt/homebrew/opt/z3/lib/libz3.dylib'
I recently updated my solc to the latest version for foundry testing and contract compilation. I have an M1 mac and I am using Mac OS Monteray 12.5
Suddenly I am getting an error when trying to use ...