Open EndOfMaster opened 4 years ago
Hi @EndOfMaster ! I’m sorry that you had this issue. We would need more information so that we can reproduce it.
Can you provide the Solidity and EVM versions you are using and a link to your contract or repository?
I also noticed that you included an Etherscan API key in the text of the issue. I recommend disabling this API key to prevent any misuse.
Hi @abcoathup .
// Configure your compilers
compilers: {
solc: {
version: "0.6.8", // Fetch exact version from solc-bin (default: truffle's version)
// docker: true, // Use "0.5.1" you've installed locally with docker (default: false)
settings: { // See the solidity docs for advice about optimization and evmVersion
optimizer: {
enabled: true,
runs: 200
},
evmVersion: "byzantium"
}
}
}
Hi @EndOfMaster ,
We have been able to reproduce this issue by following these steps:
Using the Box.sol contract
Compile with solc 0.6.8 and target EVM istanbul
$ npx oz compile --solc-version 0.6.8 --evm-version istanbul
✓ Compiled contracts with solc 0.6.8 (commit.0bbfe453)
Deploy to a public testnet
$ npx oz deploy
Nothing to compile, all contracts are up to date.
? Choose the kind of deployment upgradeable
? Pick a network rinkeby
? Pick a contract to deploy Box
✓ Added contract Box
✓ Contract Box deployed
All implementations have been deployed
? Call a function to initialize the instance after creating it? No
✓ Setting everything up to create contract instances
✓ Instance created at 0x17d4CD1D87e38FcFd79d69fb5AFdCA61888D03C4
To upgrade this instance run 'oz upgrade'
0x17d4CD1D87e38FcFd79d69fb5AFdCA61888D03C4
Verify on Etherscan fails
$ npx oz verify
? Pick a network rinkeby
? Was your contract compiled with optimizations enabled? No
? Choose a remote endpoint etherscan
? Enter your Etherscan API key (get one at https://etherscan.io/myapikey) ZZZ_APIKEY_ZZZ
? Pick a contract to verify Box
✖ Verifying and publishing contract source code of Box on etherscan (this usually takes under 30 seconds)
Error while trying to verify contract: Fail - Unable to verify
The project owner will review and triage this issue as soon as they can. In the meantime, you can try the following workaround:
You are currently using the non-default EVM version of byzantium
.
The default for 0.6.8 is istanbul
See the Solidity documentation for details:
https://solidity.readthedocs.io/en/v0.6.8/using-the-compiler.html#target-options
My understanding is that the EVM version wasn't originally part of the Etherscan API.
If you can recompile using istanbul
then you can verify using the CLI.
Alternatively you can manually verify using Etherscan website.
$ npx oz compile --solc-version 0.6.8 --evm-version istanbul
✓ Compiled contracts with solc 0.6.8 (commit.0bbfe453)
$ npx oz deploy
Nothing to compile, all contracts are up to date.
? Choose the kind of deployment upgradeable
? Pick a network rinkeby
? Pick a contract to deploy Box
✓ Contract Box deployed
All implementations have been deployed
? Call a function to initialize the instance after creating it? No
✓ Setting everything up to create contract instances
✓ Instance created at 0x7B9d5E4B4d43721c267623Cb5c391CDA3837e415
To upgrade this instance run 'oz upgrade'
0x7B9d5E4B4d43721c267623Cb5c391CDA3837e415
? Pick a network rinkeby
? Was your contract compiled with optimizations enabled? No
? Choose a remote endpoint etherscan
? Enter your Etherscan API key (get one at https://etherscan.io/myapikey) ZZZ_APIKEY_ZZZ
? Pick a contract to verify Box
✓ Contract source code of Box verified and published successfully. You can check it here: https://rinkeby.etherscan.io/address/0x0F9DBFc64c29bc006a5f2F747DCeD8AF9498EC8f#code
Another potential issue is if there is a mix of SPDX license identifiers: https://forum.openzeppelin.com/t/solidity-0-6-8-introduces-spdx-license-identifiers/2859
Hi @abcoathup ,I modified the evmVersion , but it doesn't work. It's the same mistake.
{
"manifestVersion": "2.2",
"contracts": {
"Agic": "Agic"
},
"dependencies": {},
"name": "Agic",
"version": "1.0.0",
"compiler": {
"compilerSettings": {
"evmVersion": "istanbul",
"optimizer": {
"enabled": false,
"runs": "200"
}
},
"typechain": {
"enabled": false
},
"manager": "openzeppelin",
"solcVersion": "0.6.8",
"artifactsDir": "build/contracts",
"contractsDir": "contracts"
},
"telemetryOptIn": true
}
about SPDX, all the files I import have // SPDX-License-Identifier: MIT
, the truff-flattener seemed to produce a lot of // SPDX-license-Identifier: MIT
I had two MIT SPDX had to remove one then manual verification passed. shouldn't openzeppelin account for that?
Unable to verify using OpenZeppelin SDK.
npx oz verify
results in the following error:OpenZeppelin CLI Version 2.5.2
Verify to Etherscan on Ropsten
ropsten.json
project.json