How to use the @nomiclabs/ethereumjs-vm/dist/exceptions.ERROR.REVERT function in @nomiclabs/ethereumjs-vm

To help you get started, we’ve selected a few @nomiclabs/ethereumjs-vm examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nomiclabs / buidler / packages / buidler-core / src / internal / buidler-evm / provider / node.ts View on Github external
} catch (error) {
        this._failedStackTraces += 1;
        log(
          "Could not generate stack trace. Please report this to help us improve Buidler.\n",
          error
        );
      }
    }

    const error = vmResult.exceptionError;

    if (error.error === ERROR.OUT_OF_GAS) {
      return new TransactionExecutionError("Transaction run out of gas");
    }

    if (error.error === ERROR.REVERT) {
      if (vmResult.returnValue.length === 0) {
        if (stackTrace !== undefined) {
          return encodeSolidityStackTrace(
            "Transaction reverted without a reason",
            stackTrace
          );
        }

        return new TransactionExecutionError(
          "Transaction reverted without a reason"
        );
      }

      if (stackTrace !== undefined) {
        return encodeSolidityStackTrace(
          `VM Exception while processing transaction: revert ${decodeRevertReason(