Verifying Contract. Etherscan Testnet. Remix with import links from OpenZeppelin. Can't get to work

First post so I’m sure I’m formatting this wrong. apologies. Was looking for a simple ERC20 with some burning options by owner.

Can deploy contract for testnet. (have tried about 5 different “test” contracts all with similar code) but always having issues verifying. Have looked through most of the past articles on OpenZeppelin but can’t seem to find the right combination.

:computer: Environment

Remix… simple code with some imports of 4.1 OpenZeppelin contracts mostly. I’ve tried linking, release, rc, and importing and navigating code to the internal folder structure of remix as well.

Will be working with Truffle soon if I can’t remedy. . truffle-flatten next. But it seems as if the etherscan verification is failing to find the inherited links. which seems odd… In remix the links compile fine. the closest I’ve had after deployment in verifying was 2 out of the 5 .sol files not coming up with errors. But it’s usually all 5 (multi-part solidity verifier)

I’ve been through a few of the past topics and some seem to have gotten their inherited code to verify with remix. I’ve tested importing the Github with the master link, release, and release candidates.
all the .sol files that are in the code.

:memo:Details

((i’ve tried both single file (deployed .sol file) and multi-file (all of the .sol files called on) for verifying))

Thanks for any help.
^0.8.0 solidity compile, optimization on, 200.
Etherscan Ropsten Testnet
Contracts all with the same ParserErrors

0x502d3aae017fdf4f7c0190fe5a6c753e9c4c45bd
Below was one of the single file attempts.

:1234: Code to reproduce

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import “https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v4.1/contracts/token/ERC20/ERC20.sol”;

contract Fozzi is ERC20 {
constructor(uint256 initialSupply) public ERC20 (“Fozzi”, “FOZZI”){
_mint(msg.sender, initialSupply);
}
}

1 Like

If you are using Remix you can try the plugin “Flattener”.

image

1 Like

I will try these suggestions thanks!

The Remix flattener plugin worked! I was able to verify contracts in both Etherscan Ropsten and bscscan testnet…

It did come with some issues. the compiler warned for the multiple instances of MIT Licenses. It did actually create an error on verification. (which would make sense since the compiler warned of it)… Interestingly enough when deleting all the “// SPDX-License-Identifier: MIT” from the ERC20_flat.sol (this is the file the Remix flattener creates.)

import “ERC20_flat.sol”;

which worked for that warning. A new serious warning was created from within the ERC20_flat.sol, (I’ll assume was due to how the flattener Remix organizes the .sol files) but I had to rearrange this block of code.

// File: .deps/github/OpenZeppelin/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol

above

// File: .deps/github/OpenZeppelin/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol

because of the structure of

contract ERC20 is Context, IERC20, IERC20Metadata {

I’ll assume truffle somehow ignores or applies this structure correctly.

I still have a couple of issues, but I’ll create a separate thread after some tests. (basically no burn functions in the “write contract” areas. Should be included with the ERC20.sol file from OpenZeppelin?.. or do I need to use the [ERC20Burnable.sol] from OpenZeppelin as an extension in my original code.)

Thanks again.! First Contract verified!..
0x491d29009e3656b1cd4a30fe58caa8f9c646d8bc

1 Like

I wanted to add, for contract verification,

Etherscan, I used the options, multi-file, constructor arguments left alone (it applied a long string of #s which I didn’t touch) optimization was on when deployed,

the Parent.sol (file that asks for the inheritances from ERC20.sol from OpenZeppelin) and the ERC20_flat.sol ((file Remix flattener created (edited some see above))

A reminder I had all of the Github OpenZeppelin release files needed imported into Remix.