revm_interpreter/instructions/
tx_info.rs1use crate::{
2 gas,
3 interpreter_types::{InterpreterTypes, RuntimeFlag, StackTr},
4 Host,
5};
6use primitives::U256;
7
8use crate::InstructionContext;
9
10pub fn gasprice<WIRE: InterpreterTypes, H: Host + ?Sized>(
14 context: InstructionContext<'_, H, WIRE>,
15) {
16 gas!(context.interpreter, gas::BASE);
17 push!(
18 context.interpreter,
19 U256::from(context.host.effective_gas_price())
20 );
21}
22
23pub fn origin<WIRE: InterpreterTypes, H: Host + ?Sized>(context: InstructionContext<'_, H, WIRE>) {
27 gas!(context.interpreter, gas::BASE);
28 push!(
29 context.interpreter,
30 context.host.caller().into_word().into()
31 );
32}
33
34pub fn blob_hash<WIRE: InterpreterTypes, H: Host + ?Sized>(
38 context: InstructionContext<'_, H, WIRE>,
39) {
40 check!(context.interpreter, CANCUN);
41 gas!(context.interpreter, gas::VERYLOW);
42 popn_top!([], index, context.interpreter);
43 let i = as_usize_saturated!(index);
44 *index = context.host.blob_hash(i).unwrap_or_default();
45}