All Downloads are FREE. Search and download functionalities are using the official Maven repository.

shgraph.hapi.0.54.2.source-code.contract_action.proto Maven / Gradle / Ivy

There is a newer version: 0.54.0
Show newest version
syntax = "proto3";

package proto;

/*-
 * ‌
 * Hedera Network Services Protobuf
 * ​
 * Copyright (C) 2018 - 2022 Hedera Hashgraph, LLC
 * ​
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ‍
 */

option java_package = "com.hedera.services.stream.proto";
// <<>> This comment is special code for setting PBJ Compiler java package
option java_multiple_files = true;

import "basic_types.proto";


message ContractActions {
  repeated ContractAction contract_actions = 1;
}

/**
 * The type of action described by the action proto.
 */
enum ContractActionType {
  /**
   * default non-value.
   */
  NO_ACTION = 0;

  /**
   * Most CALL, CALLCODE, DELEGATECALL, and STATICCALL, and first action of ContractCall/ContractCallLocal to deployed
   * contracts. This does not include calls to system or precompiled contracts.
   */
  CALL = 1;

  /**
   * CREATE, CREATE2, and first action of ContractCreate.
   */

  CREATE = 2;

  /**
   * like Call, but to precompiled contracts (0x1 to 0x9 as of Berlin)
   */
  PRECOMPILE = 3;

  /**
   * Call, but to system contract like HTS or ERC20 facades over Token accounts
   */
  SYSTEM = 4;
}

/**
 * The specific operation type of a call. The OP prefix has been added to avoid name collisions for
 * the CALL and CREATE operation types since both ContractActionType and CallOperationType enums are
 * used in ContractAction
 */
enum CallOperationType {
  /**
   * default operation type is UNKNOWN
   */
  OP_UNKNOWN = 0;

  /**
   * CALL operation type.
   */
  OP_CALL = 1;

  /**
   * CALLCODE operation type
   */
  OP_CALLCODE = 2;

  /**
   * DELEGATECALL operation type
   */
  OP_DELEGATECALL = 3;

  /**
   * STATICCALL operation type
   */
  OP_STATICCALL = 4;

  /**
   * CREATE operation type
   */
  OP_CREATE = 5;

  /**
   * CREATE2 operation type
   */
  OP_CREATE2 = 6;
}

/**
 * A finer grained action with a function result. Sometimes called "internal transactions." The function call itself
 * will be the first action in a list, followed by sub-action in the order they were executed.
 */
message ContractAction {

  /**
   * The type of this action.
   */
  ContractActionType call_type = 1;

  /**
   * Only the first action can come from an account, the rest will come from contracts.  Because of DELEGATECALL
   * and CALLCODE the caller of actions whose parent is an account may also be an account.
   */
  oneof caller {
    /**
     * If the caller was a regular account, the AccountID.
     */
    AccountID calling_account = 2;

    /**
     * If the caller was a smart contract account, the ContractID.
     */
    ContractID calling_contract = 3;
  }

  /**
   * The upper limit of gas this action can spend.
   */
  int64 gas = 4;

  /**
   * Bytes passed in as input data to this action.
   */
  bytes input = 5;

  /**
   * Who this action is directed to.
   */
  oneof recipient {
    /**
     * The AccountID of the recipient if the recipient is an account. Only HBars will be transferred, no other side
     * effects should be expected.
     */
    AccountID recipient_account = 6;

    /**
     * The ContractID of the recipient if the recipient is a smart contract.
     */
    ContractID recipient_contract = 7;

    /**
     * The bytes of the targeted by the action address.
     * Only set on failed executions. If set, denotes that the address did not
     * correspond to any account or contract at the time of finalization of
     * this action.
     * An example would be a failed lazy create as per HIP-583.
     */
    bytes targeted_address = 8;
  }

  /**
   * The value (in tinybars) that is associated with this action.
   */
  int64 value = 9;

  /**
   * The actual gas spent by this action.
   */
  int64 gas_used = 10;

  /**
   * The result data of the action.
   */
  oneof result_data {

    /**
     * If successful, the output bytes of the action.
     */
    bytes output = 11;

    /**
     * The contract itself caused the transaction to fail via the `REVERT` operation
     */
    bytes revert_reason = 12;

    /**
     * The transaction itself failed without an explicit `REVERT`
     */
    bytes error = 13;
  }

  /**
   * The nesting depth of this call. The original action is at depth=0.
   */
  int32 call_depth = 14;

  /**
   * The call operation type
   */
  CallOperationType call_operation_type = 15;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy