Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/executor/stack/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1582,6 +1582,11 @@ impl<'config, S: StackState<'config>, P: PrecompileSet> PrecompileHandle
self.context
}

/// Retreive the address of the EOA that originated the transaction.
fn origin(&self) -> H160 {
self.executor.state.origin()
}

/// Is the precompile call is done statically.
fn is_static(&self) -> bool {
self.is_static
Expand All @@ -1591,4 +1596,9 @@ impl<'config, S: StackState<'config>, P: PrecompileSet> PrecompileHandle
fn gas_limit(&self) -> Option<u64> {
self.gas_limit
}

/// Check if a given address is a contract being constructed
fn is_contract_being_constructed(&self, address: H160) -> bool {
self.executor.state.created(address)
}
}
6 changes: 6 additions & 0 deletions src/executor/stack/precompile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,17 @@ pub trait PrecompileHandle {
/// Retreive the context in which the precompile is executed.
fn context(&self) -> &Context;

/// Retreive the address of the EOA that originated the transaction.
fn origin(&self) -> H160;

/// Is the precompile call is done statically.
fn is_static(&self) -> bool;

/// Retreive the gas limit of this call.
fn gas_limit(&self) -> Option<u64>;

/// Check if a given address is a contract being constructed
fn is_contract_being_constructed(&self, address: H160) -> bool;
}

/// A set of precompiles.
Expand Down