BEP-20 Token Transfer Error – Troubleshooting Guide

bscgo-ethereumsoliditytokenstransfer

I am unable to transfer test tokens from my address (say address A) to another address B. The steps I did were

  1. deploy and verify a rebase contract, all tokens were automatically sent to my address.
  2. Then I made address B the owner.
  3. Afterwards, I am trying to transfer my tokens from A to B using metamask but im unable to do so. Here is the link of the failed transaction. And this is the smart contract.

BSC blockexplorer says

Warning! Error encountered during contract execution [execution
reverted] BEP-20 Token Transfer Error (Unable to locate
corresponding Transfer Event Logs), Check with Sender.

Best Answer

There's an infinite number of ways in which an ERC-20/ BEP-20 contract can be implemented.

In your case, the token contract has two modifiers set on the transfer function:

function transfer(address to, uint256 value)
    external
    override
    validRecipient(to)
    initialDistributionLock
    returns (bool)
{
    _transferFrom(msg.sender, to, value);
    return true;
}

Your contract call passes the first modifier validRecipient because that checks only whether the recipient is not the zero address. But the second modifier initialDistributionLock ...

modifier initialDistributionLock() {
    require(
        initialDistributionFinished ||
        isOwner() ||
        allowTransfer[msg.sender]
    );
    _;
}

initialDistributionFinished is a storage boolean that is currently set to false. And since 0x82a55de9d15b13eb6db1b6526d9e6e2e25397903 is neither the owner of the contract nor it has enabled transfers by being set in the allowTransfer mapping, the contract call is reverted.

Therefore, transfers are disabled during the "initial distribution" phase. If you have access to the owner account, you should be able to set this flag to true and make your transfer.

Related Topic