I'm working on a simple Bridge. Whenever I try to deposit on the foreign chain to the foreign bridge contract, it works well. But whenever I tried to deposit token to the native chain bridge contract. I get this error:

Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending?
Internal JSON-RPC error.
"code": 3,
"message": "execution reverted: BEP20: burn amount exceeds balance",
"data": "0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002242455032303a206275726e20616d6f756e7420657863656564732062616c616e6365000000000000000000000000000000000000000000000000000000000000"

My bridge Deposit function:

function _deposit(
        address token,      // token that user send (if token address < 32, then send native coin)
        uint256 value,      // tokens value
        uint256 toChainId   // destination chain Id where will be claimed tokens
        returns (address pair_token) 
        Token memory pair = tokenPair[toChainId][token];
        require(pair.token != address(0), "There is no pair");
        pair_token = pair.token;
        uint256 fee = msg.value;
        if (token <= MAX_NATIVE_COINS) {
            require(value <= msg.value, "Wrong value");
            fee -= value;
        } else {
            if(pair.isWrapped) {
                IBEP20TokenCloned(token).burnFrom(msg.sender, value);
            } else {
                tokenDeposits[token] += value;
                token.safeTransferFrom(msg.sender, address(this), value);
        if (fee != 0) {
            emit Fee(msg.sender, fee);

My BEP20Cloned Contract for mint.

  // initialize contract. Used instead of constructor in cloned contract
  function initialize(address newOwner, string calldata name, string calldata symbol, uint8 decimals) external {
    require(!_isInitialized, "Already Initialized");
    _isInitialized = true;
    minter = _msgSender();  // set bridge as minter
    emit SetMinter(address(0), minter);
    _name = name;
    _symbol = symbol;
    _decimals = decimals;
    _owner = newOwner;
    emit OwnershipTransferred(address(0), newOwner);

1 Answer 1


You should check the balance of the account. It seems there is not enough tokens in that wallet (thats what it usually means when it throws that message). You should put a check there to see if the balance is enough to cover the fees and revert if not. That would give you a hint and help you debug.

  • Yes, the balance is zero and I can't mint tokens, only the bridge can mint tokens to claim.
    – PerfDev.
    Commented Dec 6, 2022 at 13:02
  • I understand that. However that part here : IBEP20TokenCloned(token).burnFrom(msg.sender, value); the msg.sender needs to have the right qty of tokens to burn if not it will revert like that. Its what I mean. Is there a github repository or a gist I can look at to see the full context of the call? It might help.
    – Nick AKX
    Commented Dec 6, 2022 at 13:04
  • I edited my post and added the BEP20Cloned contract.
    – PerfDev.
    Commented Dec 6, 2022 at 13:18
  • well to me its clear that it is throwing the message because your bridge does not have the qty of token you want to burn. Or the token is having 0 token which also means your bridge is having 0... you need to mint tokens and assign them to your bridge contract before you can burn them. Is there a testnet address for the contract that gives the error? Without the full context thats all I can say with the code you provide.
    – Nick AKX
    Commented Dec 6, 2022 at 13:22
  • I got it working now.
    – PerfDev.
    Commented Dec 6, 2022 at 15:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.