casper_executor_wasm_host/
context.rs

1use std::sync::Arc;
2
3use bytes::Bytes;
4use casper_executor_wasm_interface::executor::Executor;
5use casper_storage::{global_state::GlobalStateReader, AddressGenerator, TrackingCopy};
6use casper_types::{
7    account::AccountHash, BlockTime, Key, MessageLimits, StorageCosts, TransactionHash,
8    WasmV2Config,
9};
10use parking_lot::RwLock;
11
12/// Container that holds all relevant modules necessary to process an execution request.
13pub struct Context<S: GlobalStateReader, E: Executor> {
14    /// The address of the account that initiated the contract or session code.
15    pub initiator: AccountHash,
16    /// The address of the addressable entity that is currently executing the contract or session
17    /// code.
18    pub caller: Key,
19    /// The address of the addressable entity that is being called.
20    pub callee: Key,
21    /// The state of the global state at the time of the call based on the currently executing
22    /// contract or session address.
23    // pub state_address: Address,
24    /// The amount of tokens that were send to the contract's purse at the time of the call.
25    pub transferred_value: u64,
26    pub config: WasmV2Config,
27    pub storage_costs: StorageCosts,
28    pub message_limits: MessageLimits,
29    pub tracking_copy: TrackingCopy<S>,
30    pub executor: E, // TODO: This could be part of the caller
31    pub transaction_hash: TransactionHash,
32    pub address_generator: Arc<RwLock<AddressGenerator>>,
33    pub chain_name: Arc<str>,
34    pub input: Bytes,
35    pub block_time: BlockTime,
36}