luna.engine.storage
State Objects
@dataclass
class State()
Represents the state of a contract as persisted in the local database. This class stores various aspects of a contract's state such as variables, parameters, roles, clauses, and events.
Attributes:
parameters
: Dictionary of contract parameters.roles
: Dictionary of contract roles.linked_contracts
: Dictionary of linked contracts.variables
: Dictionary of contract variables with timestamps.evaluated_clauses
: Dictionary of evaluated clauses with timestamps.events
: List of event instance data.tick_count
: Integer representing the count of ticks.tick_datetime
: Datetime of the last tick.terminated
: Boolean indicating if the contract is terminated.contract_created_at
: Datetime of the contracts creation
LocalStateStorage Objects
class LocalStateStorage()
Simulates a database for storing and managing local contract states. This class provides methods to add, remove, and retrieve various aspects of a contract's state.
Key Functionalities:
- Adding and Removing Contracts: Manages adding and removing contracts to the local storage.
- State Retrieval: Provides methods to retrieve different parts of a contract's state, like variables, parameters, roles, etc.
- State Update: Handles updates to the state information.
- Efficient Storage: Maintains state data in a dictionary for efficient local storage and retrieval operations.
Usage:
Used for testing and development purposes in local environments where a full-scale database is not required.