Cant verify SmartContract on bscscan nor on remix

I have just copied and pasted the sample erc20 token from openzeppelin and i can deploy the contract but not verify it

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract MyToken is ERC20 {
    constructor() ERC20("MyToken", "MTK") {
        _mint(msg.sender, 100000 * 10 ** decimals());
    }
}

This is the error I get

ParserError: Source "@openzeppelin/contracts/token/ERC20/ERC20.sol" not found: File import callback not supported
 --> myc:4:1:
  |
4 | import "@openzeppelin/contracts/token/ERC20/ERC20.sol"
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

All I did was copy and paste, so I dont know why i get this compiler errors

Do you have openzeppelin installed? Can you also share your package.json file?

I have neither of that:

I pasted the sample contract from openzeppelin into remix and deployed it, now i cant verify it

Hey @flyingsockwithsugar

If you have imported another smart contract to your code you should flattern all the contracts into a single file or upload smart conract files like different files(you should to download Code of openzeppelin contract too)

If you have parameters in the constructor, I think you need to encode constructor parameters and paste them.

Hope this will help you :man_mechanic:

can i flatten the code in remix?

and where do i download it, i only work in the browser

can i flatten the code in remix?

Yes, you can do it in remix.

You can find OpenZeppelin smarcontracts in their Github Repo

ok but where do i download them too, i told you i only work in the browser, so i dont understnd why and what i need to download in order to verify a smart contract on bscscan

Send me please your smat contract address

There is a problem with verification of smart contracts deployed from Remix.

You need to select the “multi flies” option. (don’t remember the right naming) and upload all imported libraries as independent files. Or you can use Single File option, but you need to flatten all contracts in one

I dont need anyone else to verify my contract
i want to do it myself
and also flattening didnt do anything, it gives me errors when i try to compile the flattened contract

and dependencies as well

import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";

It’s easier to use truffle with “auto verify” plugin

flattening didnt work

I just wanted to take a look. You will do it by yourself :man_mechanic:

you just verified it, didnt you?

No, I didn’t

You can take a look at how it looks in exmaple token:

All imported libraries end up as one file

what am i looking at here

That may be, but flattening didnt work for my contract
Also the code was written in 0.8.2 and after flattening it was 0.8.0 version

If you would jsut make a video it would also help more than 100s of messages

Besides after flattening i had after every contract isntance pragma solidity 0.8.0 and the spdf identifier

Why do you tell me to use those imports aswell when i obviously dont need them, the contract works without those imports and as you see my contract was verified aswell without those imports, so why are you telling me i need to use them?