Deploying token error

Hi, im trying to deploy a bep-20 token using openzeppelin library. my source code is:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

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

contract Reoks is ERC20 {
    address public constant burnAddress = address(0);
    uint256 public constant MAX_SUPPLY = 1000000000 * 10**18;
    address public constant teamAddress = 0x630B181874BA2e16b03FB32eb67D086c00891418; // Team wallet address
    address public constant marketingAddress = 0x3bD27FABD1ED0623B60a984c1450B8F6baC1B769; // Marketing wallet address
    address public constant rewardsAddress = 0x630B181874BA2e16b03FB32eb67D086c00891418; // Rewards wallet address
    address public constant airdropAddress = 0x5B4CBA0BdafFB8C8A24cEef4e86aF88bC5942255; // Airdrop wallet address
    address public constant liquidityAddress = 0x5B4CBA0BdafFB8C8A24cEef4e86aF88bC5942255; // Liquidity wallet address
    address public constant stakingAddress = 0x5B4CBA0BdafFB8C8A24cEef4e86aF88bC5942255; // Staking wallet address
    address public constant privateSaleAddress = 0x630B181874BA2e16b03FB32eb67D086c00891418; // Private sale wallet address
    address public constant publicSaleAddress = 0x3bD27FABD1ED0623B60a984c1450B8F6baC1B769; // Public sale wallet address

    constructor() ERC20("Reoks", "REOKS") {
        _mint(msg.sender, MAX_SUPPLY);

        uint256 teamAllocation = (MAX_SUPPLY * 17) / 100;
        uint256 marketingAllocation = (MAX_SUPPLY * 10) / 100;
        uint256 rewardsAllocation = (MAX_SUPPLY * 20) / 100;
        uint256 airdropAllocation = (MAX_SUPPLY * 3) / 100;
        uint256 liquidityAllocation = (MAX_SUPPLY * 15) / 100;
        uint256 stakingAllocation = (MAX_SUPPLY * 15) / 100;
        uint256 privateSaleAllocation = (MAX_SUPPLY * 5) / 100;
        uint256 publicSaleAllocation = (MAX_SUPPLY * 15) / 100;

        _transfer(msg.sender, teamAddress, teamAllocation);
        _transfer(msg.sender, marketingAddress, marketingAllocation);
        _transfer(msg.sender, rewardsAddress, rewardsAllocation);
        _transfer(msg.sender, airdropAddress, airdropAllocation);
        _transfer(msg.sender, liquidityAddress, liquidityAllocation);
        _transfer(msg.sender, stakingAddress, stakingAllocation);
        _transfer(msg.sender, privateSaleAddress, privateSaleAllocation);
        _transfer(msg.sender, publicSaleAddress, publicSaleAllocation);
    }

    function transfer(address recipient, uint256 amount) public override returns (bool) {
        uint256 burnAmount = (amount * 1) / 100; // 1% burning
        uint256 transferAmount = amount - burnAmount;

        super.transfer(burnAddress, burnAmount);
        super.transfer(recipient, transferAmount);

        return true;
    }
}```
Im able to deploy it. also i can verify it too on bscscan testnet. but when im trying to do transfer between wallets, i get an error like: transaction failed.


Transferring to the zero-address causes your transaction (contract deployment, in this case) to revert.

You can view this in OpenZeppelin's ERC20 contract:

require(recipient != address(0), "ERC20: transfer to the zero address");

You should use the contract's burn function instead.

1 Like