I need help to verify and publish my smart contract on binance smart chain

Hello, I need help to verify and publish my smart contract on BSC. It always throw me an error that says: " Error! Unable to generate Contract ByteCode and ABI (General Exception, unable to get compiled [bytecode]) " below is the screen shot. I tried to revised it but it sometimes throw me a constructor error again.

Here is the code of my constructor:

// SPDX-License-Identifier: MIT

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

pragma solidity ^0.8.0;

contract casinoDapp {
    //global dynamic array for playerlist.
    uint public nowPlaying;
    uint public maxPlayer;
    uint public minBet;
    uint public currentBet;
    uint public totalPayin;
    uint public totalPayout;
    uint public totalRefund;
    uint public managementFee;
    address payable public manager;
    address payable[] private playerList;
    address payable[] private refundedPlayers;
    address payable[] private winnerList; 
    uint []private payinList;
    uint []private payoutList;
    uint []private refundList;
    event ownershipTransferred(address indexed manager, address indexed newManager);
   
    constructor() {
    //msg.sender is a global variable used to store contract address to manager.
    manager = payable(msg.sender); 
    maxPlayer =2; 
    minBet = 0.01 ether; //default is 0.01 ether.
    managementFee = 1; //fixed fees.
    totalPayin = getCasinoVolume();
    totalPayout = getTotalPayout();
    totalRefund = getTotalRefund();
    emit ownershipTransferred(address(0), msg.sender);
    }

To verify it you can have to flatten the code. There is a plugin on Remix IDE.

have tried flatten the code and this is what I got as error below on the file photo.

The bytecode and Abi that Bscscan is looking for isn't exactly the same as what they've got on my code.

1 Like

My contract ABI code is different from bscscan is looking for. Need help to fix it?

Hi, please have a look at this tutorial:

And for the next time, please search at the forum at first.

after flattening copy paste the first line - // SPDX-License-Identifier: MIT