ERC20 dividend token verify failed

Hi All,
Im having issues with verifying this smart contract on bscscan.

Even though I setup all verify parameters like optimization, compiler version same with my remix ethereum settings produced bytecodes are different.

If you try to deploy it and share with me if it is successful I will be glad.

1 Like

Not really related to the solution, but I am currently trying to verify my own contract (but it failed too). I've had a quick glance at your token.sol and I guess that you did use some tools to flatten your file (as I see multiple pragma version lines).

Can I ask you what did you do to flatten your file? Like, what kind of tool? As when I was trying to flatten my file, there was the "multiple license" problem.

  1. First, I try to flatten my file using "yarn hardhat flatten", everything seems pretty fine.

  2. Then, I check my flattened file and it shows this warning:

I can keep the very first SPDX-License line and delete all others. It works. But I don't really think it's a good way to flatten a file.

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:

You have flattened your contracts, maybe you can have a look at this tutorial: Verify erc20 token on etherscan that was deployed through remix:step by step guide

And if your original contracts are multi-files, I think you can have a look at this tutorial: Verify smart contract inheriting from OpenZeppelin Contracts

Hello,
To be honest I did not flattened the contract all I did was copying from this address

but as you said maybe this contract dev flattened it and uploaded it.
But do you think using multiple SPDX-License lines can cause a deployed contract byte code differ from compiled contract byte code?
My issue is this since verify failed because of different bytecodes.

1 Like

I'm not really sure about the multiple license problem. I just know that, when you have multiple license in your contract, and these licenses are not all in the header, you wont be able to compile the contract.

This is an accepted file with multiple license:

// SPDX-License-Identifier: MIT


// SPDX-License-Identifier: Something Else

pragma solidity ^0.6.8;

contract MyContract {
}

But you can not do this:

// SPDX-License-Identifier: MIT

pragma solidity ^0.6.8;

contract MyContract {
}

// SPDX-License-Identifier: Something Else

I read about it in this topic: Solidity 0.6.8 introduces SPDX license identifiers

I also see that your contract is using the SPDX-License-Identifier: UNLICENSED, pretty tricky cause I though it was MIT (as this contract did use some code from openzeppelin contract), but it still works :grinning:

So I was able to solve the issue after the help of @Renaiss
The thing is I was not adding the IterableMapping library while verifying the contract.

2 Likes

how do I add the Iterable Mapping library when verifying the contract?

1 Like