pub trait BlockHandler {
// Required methods
fn get_block_number(&self, snapshot_id: usize) -> Result<DynSolValue>;
fn get_block_timestamp(&self, snapshot_id: usize) -> Result<DynSolValue>;
}Expand description
Handler trait for block global variables.
Provides access to blockchain context like block number and timestamp.
Required Methods§
Sourcefn get_block_number(&self, snapshot_id: usize) -> Result<DynSolValue>
fn get_block_number(&self, snapshot_id: usize) -> Result<DynSolValue>
Get the current block number (block.number).
§Arguments
snapshot_id- The execution context identifier
§Returns
The block number as a DynSolValue::Uint
Sourcefn get_block_timestamp(&self, snapshot_id: usize) -> Result<DynSolValue>
fn get_block_timestamp(&self, snapshot_id: usize) -> Result<DynSolValue>
Get the current block timestamp (block.timestamp).
§Arguments
snapshot_id- The execution context identifier
§Returns
The block timestamp as a DynSolValue::Uint