Skip to content

[BUG] execution reverted: ERC20: transfer to the zero address on Hubble Withdrawal  #1194

@dutterbutter

Description

@dutterbutter

Overview

The dApp is facing issues withdrawing without a relayer. The issue is as follows:

MetaMask - RPC Error: Internal JSON-RPC error. Objectcode: -32603data: code: 3data: "0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002345524332303a207472616e7366657220746f20746865207a65726f20616464726573730000000000000000000000000000000000000000000000000000000000"message: "execution reverted: ERC20: transfer to the zero address"

To reproduce:

  1. Visit app.webb.tools
  2. Make deposit
  3. Withdraw that deposit without a relayer selected
  4. Upon sending transaction status the error will be prompted

The ERC20.sol file in protocol solidity outlines the reason for the issue, however we need to distinguish why its being propagated to the dApp on withdrawals.

     * @dev Moves `amount` of tokens from `from` to `to`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     */
    function _transfer(address from, address to, uint256 amount) internal virtual {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
            // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
            // decrementing then incrementing.
            _balances[to] += amount;
        }

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

Areas in the dApp where zeroAddress is mentioned:

Metadata

Metadata

Assignees

Labels

priority: critical 🔥Critical issues that need to be resolved immediately

Type

No type
No fields configured for issues without a type.

Projects

Status

Completed ✅

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions