@Override
  public OperationResult execute(final MessageFrame frame, final EVM evm) {
    Code callingCode = frame.getCode();
    if (callingCode.getEofVersion() == 0) {
      return InvalidOperation.INVALID_RESULT;
    }

    final Bytes toBytes = frame.getStackItem(STACK_TO).trimLeadingZeros();
    final Wei value = value(frame);
    final boolean zeroValue = value.isZero();
    long inputOffset = inputDataOffset(frame);
    long inputLength = inputDataLength(frame);

    GasCalculator gasCalculator = gasCalculator();
    if (!zeroValue && isStatic(frame)) {
      return new OperationResult(
          gasCalculator.callValueTransferGasCost(), ExceptionalHaltReason.ILLEGAL_STATE_CHANGE);
    }
    if (toBytes.size() > Address.SIZE) {
      return new OperationResult(
          clampedAdd(
              clampedAdd(
                  gasCalculator.memoryExpansionGasCost(frame, inputOffset, inputLength),
                  (zeroValue ? 0 : gasCalculator.callValueTransferGasCost())),
              gasCalculator.getColdAccountAccessCost()),
          ExceptionalHaltReason.ADDRESS_OUT_OF_RANGE);
    }
    Address to = Words.toAddress(toBytes);
    final Account contract = frame.getWorldUpdater().get(to);

    boolean accountCreation = (contract == null || contract.isEmpty()) && !zeroValue;
    long cost =
        clampedAdd(
            clampedAdd(
                clampedAdd(
                    gasCalculator.memoryExpansionGasCost(frame, inputOffset, inputLength),
                    (zeroValue ? 0 : gasCalculator.callValueTransferGasCost())),
                (frame.warmUpAddress(to) || gasCalculator.isPrecompile(to)
                    ? gasCalculator.getWarmStorageReadCost()
                    : gasCalculator.getColdAccountAccessCost())),
            (accountCreation ? gasCalculator.newAccountGasCost() : 0));
    long currentGas = frame.getRemainingGas();
    if (currentGas < cost) {
      return new OperationResult(cost, ExceptionalHaltReason.INSUFFICIENT_GAS);
    }
    cost = clampedAdd(cost, gasCalculator().calculateCodeDelegationResolutionGas(frame, contract));
    if (currentGas < cost) {
      return new OperationResult(cost, ExceptionalHaltReason.INSUFFICIENT_GAS);
    }
    currentGas -= cost;

    frame.expandMemory(inputOffset, inputLength);

    final Code code = getCode(evm, frame, contract);

    // invalid code results in a quick exit
    if (!code.isValid()) {
      return new OperationResult(cost, ExceptionalHaltReason.INVALID_CODE, 0);
    }

    // last exceptional failure, prepare for call or soft failures
    frame.clearReturnData();

    // delegate calls to prior EOF versions are prohibited
    if (isDelegate() && callingCode.getEofVersion() != code.getEofVersion()) {
      return softFailure(frame, cost);
    }

    long retainedGas = Math.max(currentGas / 64, gasCalculator.getMinRetainedGas());
    long childGas = currentGas - retainedGas;

    final Account account = frame.getWorldUpdater().get(frame.getRecipientAddress());
    final Wei balance = (zeroValue || account == null) ? Wei.ZERO : account.getBalance();

    // There myst be a minimum gas for a call to have access to.
    if (childGas < gasCalculator.getMinCalleeGas()) {
      return softFailure(frame, cost);
    }
    // transferring value you don't have is not a halting exception, just a failure
    if (!zeroValue && (value.compareTo(balance) > 0)) {
      return softFailure(frame, cost);
    }

    // stack too deep, for large gas systems.
    if (frame.getDepth() >= 1024) {
      return softFailure(frame, cost);
    }

    // all checks passed, do the call
    final Bytes inputData = frame.readMutableMemory(inputOffset, inputLength);

    MessageFrame.builder()
        .parentMessageFrame(frame)
        .type(MessageFrame.Type.MESSAGE_CALL)
        .initialGas(childGas)
        .address(address(frame))
        .contract(to)
        .inputData(inputData)
        .sender(sender(frame))
        .value(value(frame))
        .apparentValue(apparentValue(frame))
        .code(code)
        .isStatic(isStatic(frame))
        .completer(child -> complete(frame, child))
        .build();

    frame.setState(MessageFrame.State.CODE_SUSPENDED);
    return new OperationResult(clampedAdd(cost, childGas), null, 0);
  }
Instantiates a new Abstract call operation.

@param opcode the opcode
@param name the name
@param stackItemsConsumed the stack items consumed
@param stackItemsProduced the stack items produced
@param gasCalculator the gas calculator
evm/src/main/java/org/hyperledger/besu/evm/operation/AbstractExtCallOperation.java