tempo_revm/
instructions.rs1use crate::evm::TempoContext;
2use alloy_evm::Database;
3use revm::{
4 handler::instructions::EthInstructions,
5 interpreter::{Instruction, InstructionContext, interpreter::EthInterpreter, push},
6};
7
8const MILLIS_TIMESTAMP: u8 = 0x4F;
10
11const MILLIS_TIMESTAMP_GAS_COST: u64 = 2;
13
14type TempoInstructionContext<'a, DB> = InstructionContext<'a, TempoContext<DB>, EthInterpreter>;
16
17fn millis_timestamp<DB: Database>(context: TempoInstructionContext<'_, DB>) {
19 push!(context.interpreter, context.host.block.timestamp_millis());
20}
21
22pub(crate) fn tempo_instructions<DB: Database>() -> EthInstructions<EthInterpreter, TempoContext<DB>>
24{
25 let mut instructions = EthInstructions::new_mainnet();
26 instructions.insert_instruction(
27 MILLIS_TIMESTAMP,
28 Instruction::new(millis_timestamp, MILLIS_TIMESTAMP_GAS_COST),
29 );
30 instructions
31}