Error! Unable to generate Contract ByteCode and ABI in eth scan

i have compiler my code through remix… but when i try to verify it on eth scan it gives me following errors

Error! Unable to generate Contract ByteCode and ABI

here is my code

     pragma solidity ^0.5.0;


    contract IBEP20 {
    function totalSupply() public view returns (uint);
    function balanceOf(address tokenOwner) public view returns (uint balance);
    function allowance(address tokenOwner, address spender) public view returns (uint remaining);
    function transfer(address to, uint tokens) public returns (bool success);
    function approve(address spender, uint tokens) public returns (bool success);
    function transferFrom(address from, address to, uint tokens) public returns (bool success);

    event Transfer(address indexed from, address indexed to, uint tokens);
    event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
    }


     contract SafeMath {
     function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
    if (a == 0) {
      return 0;
    }
    c = a * b;
    assert(c / a == b);
    return c;
  }

     function div(uint256 a, uint256 b) internal pure returns (uint256) {
    return a / b;
  }

     function sub(uint256 a, uint256 b) internal pure returns (uint256) {
    assert(b <= a);
    return a - b;
  }

     function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
    c = a + b;
    assert(c >= a);
    return c;
  }
}


    contract MONK is IBEP20, SafeMath {
    string public name;
    string public symbol;
    uint8 public decimals; // 18 decimals is the strongly suggested default, avoid changing it

    uint256 public _totalSupply;

    mapping(address => uint) balances;
    mapping(address => mapping(address => uint)) allowed;

    /**
     * Constrctor function
     *
     * Initializes contract with initial supply tokens to the creator of the contract
     */
    constructor() public {
        name = "MONK";
        symbol = "My";
        decimals = 18;
        _totalSupply = 1000000000;

        balances[msg.sender] = _totalSupply;
        emit Transfer(address(0), msg.sender, _totalSupply);
    }

    function totalSupply() public view returns (uint) {
        return _totalSupply  - balances[address(0)];
    }

    function balanceOf(address tokenOwner) public view returns (uint balance) {
        return balances[tokenOwner];
    }

    function allowance(address tokenOwner, address spender) public view returns (uint remaining) {
        return allowed[tokenOwner][spender];
    }

    function approve(address spender, uint tokens) public returns (bool success) {
        allowed[msg.sender][spender] = tokens;
        emit Approval(msg.sender, spender, tokens);
        return true;
    }

    function transfer(address to, uint tokens) public returns (bool success) {
        balances[msg.sender] = sub(balances[msg.sender], tokens);
        balances[to] = add(balances[to], tokens);
        emit Transfer(msg.sender, to, tokens);
        return true;
    }

    function transferFrom(address from, address to, uint tokens) public returns (bool success) {
        balances[from] = sub(balances[from], tokens);
        allowed[from][msg.sender] = sub(allowed[from][msg.sender], tokens);
        balances[to] = add(balances[to], tokens);
        emit Transfer(from, to, tokens);
        return true;
    }
    
    function _mint(address account, uint256 amount) public returns (uint256) {
      require(amount != 0);
      balances[account] = add(balances[account], amount);
      emit Transfer(address(0), account, amount);
    }

     function burn(uint256 amount) external {
    _burn(msg.sender, amount);
  }

     function _burn(address account, uint256 amount) internal {
    require(amount != 0);
    require(amount <= balances[account]);
    _totalSupply = sub(_totalSupply, amount);
    balances[account] = sub(balances[account], amount);
    emit Transfer(account, address(0), amount);
  }

     function burnFrom(address account, uint256 amount) external {
    require(amount <= allowed[account][msg.sender]);
    allowed[account][msg.sender] = sub(allowed[account][msg.sender], amount);
    _burn(account, amount);
  }
}
1 Like

Hi @coderbang1,

Check that you are using the same Solidity compiler version and optimization. You have a flattened contract, so if it deploys via Remix then you should be able to verify.

thank you… it worked

1 Like