'Can't verify ERC20/BEP20 token on BSCScan
I deployed an ERC20/BEP20 token on binance smart chain using truffle
and openzepplin
. Now I want to verify this smart contract but I have some issues.
$ truffle run verify MyToken --network bsc
Verifying MyToken
Unable to process the standard-input-json you uploaded
Failed to verify 1 contract(s): MyToken
Let's try another way:
$ npx truffle-flattener ./contracts/MyToken.sol > ./contracts/token/FlatMyToken.sol
After copy/paste the output code into the bscscan I receive this error:
ParserError: Multiple SPDX license identifiers found in source file. Use "AND" or "OR" to combine multiple licenses. Please see https://spdx.org for more information.
--> myc
Using the second method, when I delete the relevant lines, the bytecode changes!
These methods do not work for me.
Solution 1:[1]
I would recommend using https://github.com/hjubb/solt
Run:
solt write ./contracts/MyToken.sol
Then, once you've gotten the solc-input-MyToken.json file, you can upload it to BscScan directly.
The first method doesn't work because there's some weird issue with truffle verification, in that it doesn't submit valid JSON. The second method doesn't work because of the different SPDX identifiers. I have no idea why removing the spdx identifiers results in different bytecode, however.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Pandapip1 |