Problem with Flattening

Hello guys! I had an issue with trying to compile a smart contract for my token which I created like 100 days ago. I have come to a point where I realized I should have verified the ownership of the token right away for a better project development, and here I am trying to accomplish it 100 days later.

I am lucky that I found an actual screenshot of the code that I compiled for my project, here it is:

I compiled it on Remix Ethereum in September, and when I checked for the compiler version of that time it should be version v0.8.22+commit.4fc1097e.

the code compiled, all good, then I tried to flatten it and it came with a little error, a missing SPDX

When you check the initial code for the contract, it says it is using a MIT licence, so therefor I put it at the top as it suggested me to

Now it appears there are no errors and so.

Now, when I get to Polygonscan for verifying the ownership this is what I set up

Next up I copy paste the flattened version of the code into the Enter the Solidity Contract Code below section and I still get this error:

What else I could try to solve this?

Some of the things that you haven't mentioned:

  • Compiler optimization (enabled / disabled)
  • Number of optimization runs (typically 200)

Your flattened code should look EXACTLY like this:

With the ONLY difference being the import statement replaced with a large chunk of source code.

1 Like

In addition to the compiler, one think you have to check is which version of OpenZeppelin you used at the time, and do you still have that in your remix cache.

The current latest is 5.0.1, but before october, the latest was 4.x.

If you try to verify contract that were deployed using 4.x using 5.x as a reference, it will fail.

1 Like