/**
 * # Contract Call
 * Transaction body for calls to a Smart Contract.
 *
 * ### Keywords
 * The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
 * "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
 * document are to be interpreted as described in
 * [RFC2119](https://www.ietf.org/rfc/rfc2119) and clarified in
 * [RFC8174](https://www.ietf.org/rfc/rfc8174).
 */
syntax = "proto3";

package proto;

// SPDX-License-Identifier: Apache-2.0
option java_package = "com.hederahashgraph.api.proto.java";
// <<<pbj.java_package = "com.hedera.hapi.node.contract">>> This comment is special code for setting PBJ Compiler java package
option java_multiple_files = true;

import "services_basic_types.proto";

/**
 * Call a function of a given smart contract, providing function parameter
 * inputs as needed.
 *
 * Resource ("gas") charges SHALL include all relevant fees incurred by the
 * contract execution, including any storage required.<br/>
 * The total transaction fee SHALL incorporate all of the "gas" actually
 * consumed as well as the standard fees for transaction handling, data
 * transfers, signature verification, etc...<br/>
 * The response SHALL contain the output returned by the function call.
 *
 * ### Block Stream Effects
 * A `CallContractOutput` message SHALL be emitted for each transaction.
 */
message ContractCallTransactionBody {
    /**
     * The ID of a smart contract to call.
     */
    ContractID contractID = 1;

    /**
     * A maximum limit to the amount of gas to use for this call.
     * <p>
     * The network SHALL charge the greater of the following, but
     * SHALL NOT charge more than the value of this field.
     * <ol>
     *   <li>The actual gas consumed by the smart contract call.</li>
     *   <li>`80%` of this value.</li>
     * </ol>
     * The `80%` factor encourages reasonable estimation, while allowing for
     * some overage to ensure successful execution.
     */
    int64 gas = 2;

    /**
     * An amount of tinybar sent via this contract call.
     * <p>
     * If this is non-zero, the function MUST be `payable`.
     */
    int64 amount = 3;

    /**
     * The smart contract function to call.
     * <p>
     * This MUST contain The application binary interface (ABI) encoding of the
     * function call per the Ethereum contract ABI standard, giving the
     * function signature and arguments being passed to the function.
     */
    bytes functionParameters = 4;
}
