Unable to generate Contract ByteCode and ABI • BSC

1st and foremost excuse my ignorance with this post. After reading through the same topic and comments a few times I still don’t get the “how” to resolve this. I’ve created my first token and getting an error when validating. I have not flattened the code, I don’t know how to. How do i go about this all? Appreciate any help. Below is the information in hopes of some assistance.

Token contract: 0xa6ca6e5dbdcf71bb195d41e82f27dd3eef73b0e6

:computer: Environment* on remix.ethereum.org
Contract: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol

:memo:Details
When I attempt to verify I get:

Compiler debug log:
Error! Unable to generate Contract ByteCode and ABI (General Exception, unable to get compiled [bytecode])

Compiler Warning(s):

ParserError: Source “ERC20.sol” not found: File import callback not supported
→ bep-20.sol:5:1:
|
5 | import “./ERC20.sol”
| ^^^^^^^^^^^^^^^^^^^^^

  • Compiler Version: v0.8.1+commit.df193b15
  • Optimization Enabled: False
  • Runs: 200

ByteCode (what we are looking for) :
Numbers

  • vs what we got -
    Token Name
    Same set of numbers

Ticker Name
Same set of numbers

:1234: Code to reproduce what i created as a bep-20.sol file

pragma solidity ^0.8.0;

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol";

contract DadeCounty is ERC20 {
    constructor(uint256 initialSupply) ERC20 ("Dade County", "DADE"){
        _mint(msg.sender,initialSupply);
    }
}

Hopefully this isn’t a complete disaster and can be salvaged. Thanks again.

1 Like

Sorry, I am not familiar with the BSC-Chain, maybe you should ask for help in their forum: Home | Binance Chain Forum

And they have a documentation about how to verify contracts, maybe you can have a look at it:

1 Like

Hi Skyge, thanks for the response. I’ve seen you in many posts with a lot of great assistance. I went ahead and created an account on bsc and searched for the same issue. This forum has more activity and responses.

I think for OpenZeppelin, not only do they devote themselves to audit contract system to protect products, but build many useful tools, such as:

And for this forum, this is a platform to help developers solves their problems.

If you are using OpenZeppelin Contract in remix, try to replace the outside file location like this, in your case is github : @openzeppelin/contract

1 Like

Hi, Magnus, have you solved your problems?

Hi Skyge, not yet. I got 99 problems and this contracts 1 lol

1 Like

So you still can not verify your contracts, even though following their documentation? Okay, let me have a check.

2 Likes

Hey Skyge, so i was able to flatten the code in remix and upload it. It didn’t work. I’ve downloaded hardhat and giving it a go. Wish me luck. I’ll follow up.

1 Like

Finally got it validated Flattened the code and use a site to generate the abi code. It worked.
Thanks you Skyge for the support. Now that I have the coin validated I have to venture into whats next.

1 Like

hi, what are you using to generate the abi code ? I found one website to generate it but don’t work for me
thanks

1 Like

For Bytecode go to Remix > Recompile the Code > Copy the ABI > Go to https://abi.hashex.org/ and paste it > enter the total token supply and Parse > Copy the code and paste it while scanning for constructor.

Hope this helps!

I have the same problem and I can’t solve it. Even recompiling the API doesn’t appear to me when copying. The code appears empty.

I have same problem here, Error! Unable to generate Contract ByteCode and ABI
how to fix this? thanks