How to use the @nomiclabs/ethereumjs-vm/dist/exceptions.VmError 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 ethereum-optimism / optimism / packages / smock / src / smockit / binding.ts View on Github external
const mock: MockContract = vm._smockState.mocks[target]
    const {
      resolve,
      functionName,
      rawReturnValue,
      returnValue,
      gasUsed,
    } = await mock._smockit(message.data)

    // Set the mock return data, potentially set the `exceptionError` field if the user requested
    // a revert.
    result.gasUsed = new BN(gasUsed)
    result.execResult.returnValue = returnValue
    result.execResult.gasUsed = new BN(gasUsed)
    result.execResult.exceptionError =
      resolve === 'revert' ? new VmError('smocked revert' as any) : undefined
  })