Verifucation of contract address in BSC

:1234: Code to reproduce


:computer: Environment

Hello. I deploy my smart contract in Remix. Compiling done without issue.
I deploy on BSC. Then when i go to verify my address in BSC it gives me the following error:
*Error! Unable to generate Contract Bytecode and ABI *(General Exception, unable to get compiled [bytecode])
Can anybody helps me? Her is the code of smart contract:
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.7;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Address.sol";

contract EBERRON is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;

// Tracking status of wallets
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) public _isExcludedFromFee; 

// Blacklist: If 'noBlackList' is true wallets on this list can not buy - used for known bots
mapping (address => bool) public _isBlacklisted;
mapping (address => bool) public _isWhitelisted;
// Set contract so that blacklisted wallets cannot buy (default is false)
bool public noBlackList;
bool public enableTrade;



/*

TOKEN DETAILS

*/


string private _name = "EBERRON"; 
string private _symbol = "EBR13";  
uint8 private _decimals = 18;
uint256 private _tTotal = 1313131313 * 10 ** 18;   // 1313131313

// Setting the transaction fees
uint256 private _TotalFee = 2;
uint256 public _buyFee = 1;
uint256 public _sellFee = 1;


// 'Previous fees' are used to keep track of fee settings when removing and restoring fees
uint256 private _previousTotalFee = _TotalFee; 
uint256 private _previousBuyFee = _buyFee; 
uint256 private _previousSellFee = _sellFee; 



/*

DEPLOY TOKENS TO OWNER

Constructor functions are only called once. This happens during contract deployment.
This function deploys the total token supply to the owner wallet and creates the PCS pairing

*/
constructor () {
    _tOwned[owner()] = _tTotal;

    _isExcludedFromFee[owner()] = true;
    _isExcludedFromFee[address(this)] = true;
    _isWhitelisted[owner()] = true;
    _isWhitelisted[address(this)] = true;
    enableTrade = false;

    emit Transfer(address(0), owner(), _tTotal);
}


/*

STANDARD ERC20 COMPLIANCE FUNCTIONS

*/

function name() public view returns (string memory) {
    return _name;
}

function symbol() public view returns (string memory) {
    return _symbol;
}

function decimals() public view returns (uint8) {
    return _decimals;
}

function totalSupply() public view override returns (uint256) {
    return _tTotal;
}

function balanceOf(address account) public view override returns (uint256) {
    return _tOwned[account];
}

function transfer(address recipient, uint256 amount) public override returns (bool) {
    _transfer(_msgSender(), recipient, amount);
    return true;
}

function allowance(address owner, address spender) public view override returns (uint256) {
    return _allowances[owner][spender];
}

function approve(address spender, uint256 amount) public override returns (bool) {
    _approve(_msgSender(), spender, amount);
    return true;
}

function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
    _transfer(sender, recipient, amount);
    _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
    return true;
}

function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
    _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
    return true;
}

function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
    _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
    return true;
}

/*

END OF STANDARD ERC20 COMPLIANCE FUNCTIONS

*/



// Set a wallet address so that it does not have to pay transaction fees
function excludeFromFee(address account) public onlyOwner {
    _isExcludedFromFee[account] = true;
}

// Set a wallet address so that it has to pay transaction fees
function includeInFee(address account) public onlyOwner {
    _isExcludedFromFee[account] = false;
}









// This function is required so that the contract can receive BNB from pancakeswap
receive() external payable {}



/*

BLACKLIST 

This feature is used to block a person from buying - known bot users are added to this
list prior to launch. We also check for people using snipe bots on the contract before we
add liquidity and block these wallets. We like all of our buys to be natural and fair.

*/

// Blacklist - block wallets (ADD - COMMA SEPARATE MULTIPLE WALLETS)
function blacklist_Add_Wallets(address[] calldata addresses) external onlyOwner {
   
    uint256 startGas;
    uint256 gasUsed;

    for (uint256 i; i < addresses.length; ++i) {
        if(gasUsed < gasleft()) {
            startGas = gasleft();
            if(!_isBlacklisted[addresses[i]]){
            _isBlacklisted[addresses[i]] = true;}
            gasUsed = startGas - gasleft();
        }
    }
}



// Blacklist - block wallets (REMOVE - COMMA SEPARATE MULTIPLE WALLETS)
function blacklist_Remove_Wallets(address[] calldata addresses) external onlyOwner {
   
    uint256 startGas;
    uint256 gasUsed;

    for (uint256 i; i < addresses.length; ++i) {
        if(gasUsed < gasleft()) {
        startGas = gasleft();
        if(_isBlacklisted[addresses[i]]) {
            _isBlacklisted[addresses[i]] = false;}
            gasUsed = startGas - gasleft();
        }
    }
}


/*

You can turn the blacklist restrictions on and off.

During launch, it's a good idea to block known bot users from buying. But these are real people, so 
when the contract is safe (and the price has increased) you can allow these wallets to buy/sell by setting
noBlackList to false

*/

// Blacklist Switch - Turn on/off blacklisted wallet restrictions 
function blacklist_Switch(bool true_or_false) public onlyOwner {
    noBlackList = true_or_false;
} 


/*

When sending tokens to another wallet (not buying or selling) if noFeeToTransfer is true there will be no fee

*/

bool public noFeeToTransfer = true;

// Option to set fee or no fee for transfer (just in case the no fee transfer option is exploited in future!)
// True = there will be no fees when moving tokens around or giving them to friends! (There will only be a fee to buy or sell)
// False = there will be a fee when buying/selling/tranfering tokens
// Default is true
function set_Transfers_Without_Fees(bool true_or_false) external onlyOwner {
    noFeeToTransfer = true_or_false;
}

// Remove all fees
function removeAllFee() private {
    if(_TotalFee == 0 && _buyFee == 0 && _sellFee == 0) return;


    _previousBuyFee = _buyFee; 
    _previousSellFee = _sellFee; 
    _previousTotalFee = _TotalFee;
    _buyFee = 0;
    _sellFee = 0;
    _TotalFee = 0;

}

// Restore all fees
function restoreAllFee() private {

_TotalFee = _previousTotalFee;
_buyFee = _previousBuyFee; 
_sellFee = _previousSellFee; 

}


// Approve a wallet to sell tokens
function _approve(address owner, address spender, uint256 amount) private {

    require(owner != address(0) && spender != address(0), "ERR: zero address");
    _allowances[owner][spender] = amount;
    emit Approval(owner, spender, amount);

}

function _transfer(
    address from,
    address to,
    uint256 amount
) private {
    
    
    if(!_isWhitelisted[from] && !_isWhitelisted[to] )
        require(enableTrade, "Transfers disabled before launch!");


    /*

    BLACKLIST RESTRICTIONS

    */
    
    if (noBlackList){
        require(!_isBlacklisted[from] && !_isBlacklisted[to], "This address is blacklisted. Transaction reverted.");}

        require(from != address(0) && to != address(0), "ERR: Using 0 address!");
        require(amount > 0, "Token value must be higher than zero.");



    /*

    REMOVE FEES IF REQUIRED

    Fee removed if the to or from address is excluded from fee.
    Fee removed if the transfer is NOT a buy or sell.
    Change fee amount for buy or sell.

    */

    
    bool takeFee = true;
     
    if(_isExcludedFromFee[from] || _isExcludedFromFee[to] || (noFeeToTransfer)){
        takeFee = false;
    } else {}
    
    _tokenTransfer(from,to,amount,takeFee);
}


/*

TOKEN TRANSFERS

*/

// Check if token transfer needs to process fees
function _tokenTransfer(address sender, address recipient, uint256 amount,bool takeFee) private {
    
    
    if(!takeFee){
        removeAllFee();
        } 
        _transferTokens(sender, recipient, amount);
    
    if(!takeFee)
        restoreAllFee();
}

// Redistributing tokens and adding the fee to the contract address
function _transferTokens(address sender, address recipient, uint256 tAmount) private {
    (uint256 tTransferAmount, uint256 tDev) = _getValues(tAmount);
    _tOwned[sender] = _tOwned[sender].sub(tAmount);
    _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
    _tOwned[address(this)] = _tOwned[address(this)].add(tDev);   
    emit Transfer(sender, recipient, tTransferAmount); 
}


// Calculating the fee in tokens
function _getValues(uint256 tAmount) private view returns (uint256, uint256) {
    uint256 tDev = tAmount*_TotalFee/100;
    uint256 tTransferAmount = tAmount.sub(tDev);
    return (tTransferAmount, tDev);
}


function isEnableTrade(bool _isEnable) external onlyOwner {
    enableTrade = _isEnable;
}

function addWhiteList(address _account) external onlyOwner {
    _isWhitelisted[_account] = true;
}

}

This is by far the most common question asked in this forum.

Suggestion for the forum's admin - add a bold notification at the top of this website:

In order to verify a contract, you must flatten the source code

I flatten it and i receive this message:


You are trying to verify your contract under compiler version 0.8.7:
image

But it was compiled with the latest compiler version (0.8.21):
image

We have a huge guide for people about this topic. I don't understand why they can't find it.

1 Like