Comments (7)
Hey @mrwillis, I must have completely missed the notification for this issue, apologies!
One thing I noticed is that the flattened code contains two SPDX license identifiers, which is currently not working (see comments in #27). After removing it, the code still doesn't seem to be verifying correctly. After updating the Solidity version to v0.6.11 like you mentioned before and moving the experimental pragma one line up, it now verifies correctly. I'm not sure what the cause of the failure is for v0.5.16, but if it is working correctly for v0.6, then that I'd say that is good enough.
So the main cause of this failure was probably the duplicate SPDX identifiers. I still need to come up with a good fix for that. Something I'm thinking might be to detect whether there are multiple identifiers, and if so, we strip out all of them and require the user to provide a license manually e.g. --license MIT
.
from truffle-plugin-verify.
Hey @Enigmatic331 I have been working on allowing the user to provide their license manually (--license MIT
). And using @mrwillis' example repo I ran into the issue that the source code is failing the verification through truffle-plugin-verify and through the Api demo page, but succeeding the verification on the web form.
This is the data sent to the API:
{
"apikey": "<redacted>",
"module": "contract",
"action": "verifysourcecode",
"contractaddress": "0xF177FF5d7D91381cDDcF79cC73DbFfDa8D471383",
"sourceCode": "// SPDX-License-Identifier: MIT\n\npragma experimental ABIEncoderV2;\npragma solidity 0.6.11;\n\n\n// \nlibrary ConvertLib {\n\n\tstruct TestStruct {\n\t\tuint256 name;\n\t}\n\n\tfunction convert(uint amount,uint conversionRate) internal pure returns (uint convertedAmount)\n\t{\n\t\treturn amount * conversionRate;\n\t}\n}\n\n// \n// This is just a simple example of a coin-like contract.\n// It is not standards compatible and cannot be expected to talk to other\n// coin/token contracts. If you want to create a standards-compliant\n// token, see: https://github.com/ConsenSys/Tokens. Cheers!\ncontract MetaCoin {\n\tmapping (address => uint) balances;\n\n\tevent Transfer(address indexed _from, address indexed _to, uint256 _value);\n\n\tconstructor() public {\n\t\tbalances[tx.origin] = 10000;\n\t}\n\n\tfunction sendCoin(address receiver, uint amount) public returns(bool sufficient) {\n\t\tif (balances[msg.sender] < amount) return false;\n\t\tbalances[msg.sender] -= amount;\n\t\tbalances[receiver] += amount;\n\t\temit Transfer(msg.sender, receiver, amount);\n\t\treturn true;\n\t}\n\n\tfunction getBalanceInEth(address addr) public view returns(uint){\n\t\treturn ConvertLib.convert(getBalance(addr),2);\n\t}\n\n\tfunction getBalance(address addr) public view returns(uint) {\n\t\treturn balances[addr];\n\t}\n\n\tfunction test(ConvertLib.TestStruct memory testObj) public pure {\n\t\trequire(testObj.name > 10);\n\t}\n}",
"codeformat": "solidity-single-file",
"contractname": "MetaCoin",
"compilerversion": "v0.6.11+commit.5ef660b1",
"optimizationUsed": 0,
"runs": 200,
"constructorArguements": "",
"licenseType": 3
}
The address above is not verified yet, so you can use it in testing. Since the --license
stuff is currently just WIP, it's not published anywhere it might be difficult to test for you guys. Let me know if you want me to publish a "beta" tag to NPM or something.
from truffle-plugin-verify.
Hey @mrwillis - Reckon you should be sorted by now, but just in case:
Due to some limitations in the Etherscan verification engine, if you want to use pragma experimental ABIEncoderV2;, this statement should be the first line in your contract file (even above the pragma solidity ^0.6.0; statement).
And yea I've been meaning to look into this on Etherscan's side since forever, need to get an off-day to do this. :)
from truffle-plugin-verify.
Hey @Enigmatic331, did you have time to look into this API issue yet?
from truffle-plugin-verify.
Hey @rkalis super sorry that I missed this - Let me have a look and ping back shortly.
from truffle-plugin-verify.
@rkalis - We've pushed a fix over to the API servers - Could you take a look if this sorts it out please?
(e.g. https://rinkeby.etherscan.io/address/0xF177FF5d7D91381cDDcF79cC73DbFfDa8D471383#code)
Much appreciated as always!
from truffle-plugin-verify.
Thanks @Enigmatic331 it's working now! @mrwillis I just published a new release that allows you to specify an SPDX license identifier using the --license
parameter.
from truffle-plugin-verify.
Related Issues (20)
- Proxy handling working well only for initial deployment, not for update case HOT 1
- Unable to verify since 0.8.16 HOT 2
- verifying smart contract fails when using viaIR is true in truffle config HOT 8
- Etherscan has no support for network arbitrum_goerli with chain id 421613 HOT 2
- Zcore 3331 HOT 1
- support for sepolia HOT 2
- Add support for Subscan based verification HOT 2
- TypeError: (intermediate value).hostname.split(...).at is not a function HOT 4
- Fail with TypeError: (intermediate value).hostname.split(...).at at Goerli HOT 1
- Couldn't verify Contracts on Etherscan using truffle-plugin-verify HOT 4
- I cannot verify an updateable contract on the poligon testnet. HOT 2
- KAVA verification HOT 3
- Fail - Unable to verify. HOT 10
- Verification fails when contracts import "truffle/console.sol", etc. HOT 1
- sourcify fails with 500 error code HOT 9
- Failed to connect to Etherscan API at url - tunneling socket could not be established, cause=socket hang up
- Cannot read properties of undefined (reading "address") during verification HOT 2
- Cannot read properties of undefined (reading "address") during verification HOT 8
- Cannot read properties of undefined (reading 'includes') on verification HOT 3
- celo testnet explorer is not correct HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from truffle-plugin-verify.