revm_handler/
execution.rs

1use context_interface::Transaction;
2use interpreter::{
3    CallInput, CallInputs, CallScheme, CallValue, CreateInputs, CreateScheme, FrameInput,
4};
5use primitives::TxKind;
6use std::boxed::Box;
7
8/// Creates the first [`FrameInput`] from the transaction, spec and gas limit.
9pub fn create_init_frame(tx: &impl Transaction, gas_limit: u64) -> FrameInput {
10    let input = tx.input().clone();
11
12    match tx.kind() {
13        TxKind::Call(target_address) => FrameInput::Call(Box::new(CallInputs {
14            input: CallInput::Bytes(input),
15            gas_limit,
16            target_address,
17            bytecode_address: target_address,
18            caller: tx.caller(),
19            value: CallValue::Transfer(tx.value()),
20            scheme: CallScheme::Call,
21            is_static: false,
22            return_memory_offset: 0..0,
23        })),
24        TxKind::Create => FrameInput::Create(Box::new(CreateInputs {
25            caller: tx.caller(),
26            scheme: CreateScheme::Create,
27            value: tx.value(),
28            init_code: input,
29            gas_limit,
30        })),
31    }
32}