Unable publish source code with solidity version >= 0.8.0
See original GitHub issueEnvironment information
brownie
Version: 1.14.6ganache-cli
Version: 0.8.4solc
Version: 0.8.4- Python Version: 3.6.9
- OS: linux
What was wrong?
Every time when I try publish multifile source on Etherscan with sol version more then 0.8.0 error is occur.
Verification complete. Result: Fail - Unable to verify
But when i just change solidity version in pragma - all is ok.
I have check in console
First.get_verification_info()
- So in case sol >= 0.8.0 function return only
first file in sources.
At the same time, the deployment goes well in both cases.
Example sources are below.
pragma solidity ^0.7.4;
File 1 (First.sol)
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.4;
import "./Second.sol";
contract First is Second {
function name() public view returns (address) {
return address(this);
}
function symbol() public view returns (string memory) {
return "SYM";
}
}
File 2 (Second.sol)
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.4;
contract Second {
function totalSupply() external view returns (uint256) {
return 7777777777;
}
}
First.get_verification_info() output
>>> First.get_verification_info()
{
'bytecode_len': 770,
'compiler_version': "0.7.4+commit.3f05b770",
'contract_name': "First",
'flattened_source': "// SPDX-License-Identifier: MIT
pragma solidity 0.7.4;
// Part: Second
contract Second {
function totalSupply() external view returns (uint256) {
return 7777777777;
}
}
// File: First.sol
contract First is Second {
function name() public view returns (address) {
return address(this);
}
function symbol() public view returns (string memory) {
return "SYM";
}
}
",
'license_identifier': "MIT",
'optimizer_enabled': True,
'optimizer_runs': 200
}
pragma solidity ^0.8.4;
File 1 (First.sol)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "./Second.sol";
contract First is Second {
function name() public view returns (address) {
return address(this);
}
function symbol() public view returns (string memory) {
return "SYM";
}
}
File 2 (Second.sol)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Second {
function totalSupply() external view returns (uint256) {
return 7777777777;
}
}
First.get_verification_info() output
Brownie environment is ready.
>>> First.get_verification_info()
{
'bytecode_len': 602,
'compiler_version': "0.8.4+commit.c7e474f2",
'contract_name': "First",
'flattened_source': "// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
// File: First.sol
contract First is Second {
function name() public view returns (address) {
return address(this);
}
function symbol() public view returns (string memory) {
return "SYM";
}
}
",
'license_identifier': "MIT",
'optimizer_enabled': True,
'optimizer_runs': 200
}
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Unable publish source code with solidity version >= 0.8.0 with ...
So I can compile and deploy this contract and it's work well. But I can't publish source. When I use olidity >=0.6.0 <0.8.0;...
Read more >Solidity pragama not allowing for anything lower then 0.8.9
You need to change the compiler version as expected 0.5.0 but you are set 0.8.9, That's the main reason for these errors.
Read more >Solidity version error - visual studio code
Simply Right-click in your .sol file in (vs code) and click on "Solidity: Change workspace compiler version (Remote)", then select your solidity ......
Read more >Using the Compiler — Solidity 0.8.17 documentation
When you compile your contract code you can specify the Ethereum virtual machine version to compile for to avoid particular features or behaviours....
Read more >solc - npm
Solidity compiler. Latest version: 0.8.17, last published: 3 months ago. Start using solc in your project by running `npm i solc`.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
is this fixed in
v1.15.2
?I think the issue is present from 0.8.4 onward. Not sure what changed in that version, but something happened that broke everything.