How to withdraw BNBs in Token Balance?

40 Views Asked by At

I have created Token. I sent BNB to the token contract address. Can you suggest a code that I can run on the remix and withdraw the bnb balance?

These are my withdrawal codes on my contract address: 0xF66eDB5bc556143263babbd232F5A124d24Ec15b This address does not belong to me. I forgot to change this address in the codes. The token holder is my own wallet.

contract TokensFactory {

  TOKEN newToken;
  uint256 private _fee = 10000000000000000;
  address public theOwner = 0xF66eDB5bc556143263babbd232F5A124d24Ec15b;

  constructor() public {

  }

  function createToken(address cOwner, address marketingWallet, string memory name, string memory symbol, uint256 totalSupply, uint256 taxFee) public payable returns(bool) {

    require(msg.value >= _fee, "Not enough cash");
    newToken = new TOKEN(cOwner, marketingWallet, name, symbol, totalSupply, taxFee);

    return true;
  }

  function withdrawEther(address payable beneficiary) public {
    require(msg.sender == theOwner, "Only owner can withdraw");
    beneficiary.transfer(address(this).balance);
  }

}

0

There are 0 best solutions below