/**
 * # EVM Contract Slot
 * Information regarding EVM storage "slot"s for the
 * Hedera Smart Contract service.
 *
 * ### 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.state.contract">>> This comment is special code for setting PBJ Compiler java package
option java_multiple_files = true;

import "services_basic_types.proto";

/**
 * The key of a storage slot. A slot is scoped to a specific contract ID.
 *
 * For each contract, its EVM storage is a mapping of 256-bit keys (or "words")
 * to 256-bit values.
 */
message SlotKey {
    /**
     * The Contract ID of the contract that owns (and pays for) this slot.
     */
    ContractID contractID = 1;

    /**
     * The EVM key of this slot, left-padded with zeros to form a 256-bit word.
     */
    bytes key = 2;
}

/**
 * The value of a contract storage slot. For the EVM, this is a single "word".
 *
 * Because we iterate through all the storage slots for an expired contract
 * when purging it from state, our slot values also include the words of the
 * previous and next keys in this contract's storage "virtual linked list".
 */
message SlotValue {
    /**
     * The EVM value in this slot, left-padded with zeros to form a 256-bit word.
     */
    bytes value = 1;

    /**
     * The word of the previous key in this contract's storage list (if any).
     */
    bytes previous_key = 2;

    /**
     * The word of the next key in this contract's storage list (if any).
     */
    bytes next_key = 3;
}
