Trait evm::Ext [−][src]
pub trait Ext { fn storage_at(&self, key: &H256) -> Result<H256, Error>; fn set_storage(&mut self, key: H256, value: H256) -> Result<(), Error>; fn exists(&self, address: &H160) -> Result<bool, Error>; fn exists_and_not_null(&self, address: &H160) -> Result<bool, Error>; fn origin_balance(&self) -> Result<U256, Error>; fn balance(&self, address: &H160) -> Result<U256, Error>; fn blockhash(&mut self, number: &U256) -> H256; fn create(
&mut self,
gas: &U256,
value: &U256,
code: &[u8],
address: CreateContractAddress
) -> ContractCreateResult; fn call(
&mut self,
gas: &U256,
sender_address: &H160,
receive_address: &H160,
value: Option<U256>,
data: &[u8],
code_address: &H160,
output: &mut [u8],
call_type: CallType
) -> MessageCallResult; fn extcode(&self, address: &H160) -> Result<Arc<Vec<u8>>, Error>; fn extcodesize(&self, address: &H160) -> Result<usize, Error>; fn log(&mut self, topics: Vec<H256>, data: &[u8]) -> Result<(), Error>; fn ret(
self,
gas: &U256,
data: &ReturnData,
apply_state: bool
) -> Result<U256, Error>; fn suicide(&mut self, refund_address: &H160) -> Result<(), Error>; fn schedule(&self) -> &Schedule; fn env_info(&self) -> &EnvInfo; fn depth(&self) -> usize; fn inc_sstore_clears(&mut self); fn is_static(&self) -> bool; fn trace_next_instruction(
&mut self,
_pc: usize,
_instruction: u8,
_current_gas: U256
) -> bool { ... } fn trace_prepare_execute(
&mut self,
_pc: usize,
_instruction: u8,
_gas_cost: U256
) { ... } fn trace_executed(
&mut self,
_gas_used: U256,
_stack_push: &[U256],
_mem_diff: Option<(usize, &[u8])>,
_store_diff: Option<(U256, U256)>
) { ... } }
Externalities interface for EVMs
Required Methods
fn storage_at(&self, key: &H256) -> Result<H256, Error>
Returns a value for given key.
fn set_storage(&mut self, key: H256, value: H256) -> Result<(), Error>
Stores a value for given key.
fn exists(&self, address: &H160) -> Result<bool, Error>
Determine whether an account exists.
fn exists_and_not_null(&self, address: &H160) -> Result<bool, Error>
Determine whether an account exists and is not null (zero balance/nonce, no code).
fn origin_balance(&self) -> Result<U256, Error>
Balance of the origin account.
fn balance(&self, address: &H160) -> Result<U256, Error>
Returns address balance.
fn blockhash(&mut self, number: &U256) -> H256
Returns the hash of one of the 256 most recent complete blocks.
fn create(
&mut self,
gas: &U256,
value: &U256,
code: &[u8],
address: CreateContractAddress
) -> ContractCreateResult
&mut self,
gas: &U256,
value: &U256,
code: &[u8],
address: CreateContractAddress
) -> ContractCreateResult
Creates new contract.
Returns gas_left and contract address if contract creation was succesfull.
fn call(
&mut self,
gas: &U256,
sender_address: &H160,
receive_address: &H160,
value: Option<U256>,
data: &[u8],
code_address: &H160,
output: &mut [u8],
call_type: CallType
) -> MessageCallResult
&mut self,
gas: &U256,
sender_address: &H160,
receive_address: &H160,
value: Option<U256>,
data: &[u8],
code_address: &H160,
output: &mut [u8],
call_type: CallType
) -> MessageCallResult
Message call.
Returns Err, if we run out of gas. Otherwise returns call_result which contains gas left and true if subcall was successfull.
fn extcode(&self, address: &H160) -> Result<Arc<Vec<u8>>, Error>
Returns code at given address
fn extcodesize(&self, address: &H160) -> Result<usize, Error>
Returns code size at given address
fn log(&mut self, topics: Vec<H256>, data: &[u8]) -> Result<(), Error>
Creates log entry with given topics and data
fn ret(
self,
gas: &U256,
data: &ReturnData,
apply_state: bool
) -> Result<U256, Error>
self,
gas: &U256,
data: &ReturnData,
apply_state: bool
) -> Result<U256, Error>
Should be called when transaction calls RETURN
opcode.
Returns gas_left if cost of returning the data is not too high.
fn suicide(&mut self, refund_address: &H160) -> Result<(), Error>
Should be called when contract commits suicide. Address to which funds should be refunded.
fn schedule(&self) -> &Schedule
Returns schedule.
fn env_info(&self) -> &EnvInfo
Returns environment info.
fn depth(&self) -> usize
Returns current depth of execution.
If contract A calls contract B, and contract B calls C, then A depth is 0, B is 1, C is 2 and so on.
fn inc_sstore_clears(&mut self)
Increments sstore refunds count by 1.
fn is_static(&self) -> bool
Check if running in static context.
Provided Methods
fn trace_next_instruction(
&mut self,
_pc: usize,
_instruction: u8,
_current_gas: U256
) -> bool
&mut self,
_pc: usize,
_instruction: u8,
_current_gas: U256
) -> bool
Decide if any more operations should be traced. Passthrough for the VM trace.
fn trace_prepare_execute(
&mut self,
_pc: usize,
_instruction: u8,
_gas_cost: U256
)
&mut self,
_pc: usize,
_instruction: u8,
_gas_cost: U256
)
Prepare to trace an operation. Passthrough for the VM trace.
fn trace_executed(
&mut self,
_gas_used: U256,
_stack_push: &[U256],
_mem_diff: Option<(usize, &[u8])>,
_store_diff: Option<(U256, U256)>
)
&mut self,
_gas_used: U256,
_stack_push: &[U256],
_mem_diff: Option<(usize, &[u8])>,
_store_diff: Option<(U256, U256)>
)
Trace the finalised execution of a single instruction.
Implementations on Foreign Types
impl Ext for FakeExt
[src]
impl Ext for FakeExt
fn storage_at(&self, key: &H256) -> Result<H256, Error>
[src]
fn storage_at(&self, key: &H256) -> Result<H256, Error>
fn set_storage(&mut self, key: H256, value: H256) -> Result<(), Error>
[src]
fn set_storage(&mut self, key: H256, value: H256) -> Result<(), Error>
fn exists(&self, address: &H160) -> Result<bool, Error>
[src]
fn exists(&self, address: &H160) -> Result<bool, Error>
fn exists_and_not_null(&self, address: &H160) -> Result<bool, Error>
[src]
fn exists_and_not_null(&self, address: &H160) -> Result<bool, Error>
fn origin_balance(&self) -> Result<U256, Error>
[src]
fn origin_balance(&self) -> Result<U256, Error>
fn balance(&self, address: &H160) -> Result<U256, Error>
[src]
fn balance(&self, address: &H160) -> Result<U256, Error>
fn blockhash(&mut self, number: &U256) -> H256
[src]
fn blockhash(&mut self, number: &U256) -> H256
fn create(
&mut self,
gas: &U256,
value: &U256,
code: &[u8],
_address: CreateContractAddress
) -> ContractCreateResult
[src]
fn create(
&mut self,
gas: &U256,
value: &U256,
code: &[u8],
_address: CreateContractAddress
) -> ContractCreateResult
fn call(
&mut self,
gas: &U256,
sender_address: &H160,
receive_address: &H160,
value: Option<U256>,
data: &[u8],
code_address: &H160,
_output: &mut [u8],
_call_type: CallType
) -> MessageCallResult
[src]
fn call(
&mut self,
gas: &U256,
sender_address: &H160,
receive_address: &H160,
value: Option<U256>,
data: &[u8],
code_address: &H160,
_output: &mut [u8],
_call_type: CallType
) -> MessageCallResult
fn extcode(&self, address: &H160) -> Result<Arc<Vec<u8>>, Error>
[src]
fn extcode(&self, address: &H160) -> Result<Arc<Vec<u8>>, Error>
fn extcodesize(&self, address: &H160) -> Result<usize, Error>
[src]
fn extcodesize(&self, address: &H160) -> Result<usize, Error>
fn log(&mut self, topics: Vec<H256>, data: &[u8]) -> Result<(), Error>
[src]
fn log(&mut self, topics: Vec<H256>, data: &[u8]) -> Result<(), Error>
fn ret(
self,
_gas: &U256,
_data: &ReturnData,
_apply_state: bool
) -> Result<U256, Error>
[src]
fn ret(
self,
_gas: &U256,
_data: &ReturnData,
_apply_state: bool
) -> Result<U256, Error>
fn suicide(&mut self, refund_address: &H160) -> Result<(), Error>
[src]
fn suicide(&mut self, refund_address: &H160) -> Result<(), Error>
fn schedule(&self) -> &Schedule
[src]
fn schedule(&self) -> &Schedule
fn env_info(&self) -> &EnvInfo
[src]
fn env_info(&self) -> &EnvInfo
fn depth(&self) -> usize
[src]
fn depth(&self) -> usize
fn is_static(&self) -> bool
[src]
fn is_static(&self) -> bool
fn inc_sstore_clears(&mut self)
[src]
fn inc_sstore_clears(&mut self)
fn trace_next_instruction(
&mut self,
_pc: usize,
_instruction: u8,
_gas: U256
) -> bool
[src]
fn trace_next_instruction(
&mut self,
_pc: usize,
_instruction: u8,
_gas: U256
) -> bool
fn trace_prepare_execute(
&mut self,
_pc: usize,
_instruction: u8,
_gas_cost: U256
)
[src]
fn trace_prepare_execute(
&mut self,
_pc: usize,
_instruction: u8,
_gas_cost: U256
)
fn trace_executed(
&mut self,
_gas_used: U256,
_stack_push: &[U256],
_mem_diff: Option<(usize, &[u8])>,
_store_diff: Option<(U256, U256)>
)
[src]
fn trace_executed(
&mut self,
_gas_used: U256,
_stack_push: &[U256],
_mem_diff: Option<(usize, &[u8])>,
_store_diff: Option<(U256, U256)>
)