Trait vvm::Ext[][src]

pub trait Ext {
    pub fn initial_storage_at(&self, key: &H256) -> Result<H256, Error>;
pub fn storage_at(&self, key: &H256) -> Result<H256, Error>;
pub fn set_storage(&mut self, key: H256, value: H256) -> Result<(), Error>;
pub fn exists(&self, address: &H160) -> Result<bool, Error>;
pub fn exists_and_not_null(&self, address: &H160) -> Result<bool, Error>;
pub fn origin_balance(&self) -> Result<U256, Error>;
pub fn balance(&self, address: &H160) -> Result<U256, Error>;
pub fn blockhash(&mut self, number: &U256) -> H256;
pub fn create(
        &mut self,
        gas: &U256,
        value: &U256,
        code: &[u8],
        parent_version: &U256,
        address: CreateContractAddress,
        trap: bool
    ) -> Result<ContractCreateResult, TrapKind>;
pub fn call(
        &mut self,
        gas: &U256,
        sender_address: &H160,
        receive_address: &H160,
        value: Option<U256>,
        data: &[u8],
        code_address: &H160,
        call_type: ActionType,
        trap: bool
    ) -> Result<MessageCallResult, TrapKind>;
pub fn extcode(
        &self,
        address: &H160
    ) -> Result<Option<Arc<Vec<u8, Global>>>, Error>;
pub fn extcodehash(&self, address: &H160) -> Result<Option<H256>, Error>;
pub fn extcodesize(&self, address: &H160) -> Result<Option<usize>, Error>;
pub fn log(
        &mut self,
        topics: Vec<H256, Global>,
        data: &[u8]
    ) -> Result<(), Error>;
pub fn ret(
        self,
        gas: &U256,
        data: &ReturnData,
        apply_state: bool
    ) -> Result<U256, Error>;
pub fn suicide(&mut self, refund_address: &H160) -> Result<(), Error>;
pub fn schedule(&self) -> &Schedule;
pub fn env_info(&self) -> &EnvInfo;
pub fn chain_id(&self) -> u64;
pub fn depth(&self) -> usize;
pub fn add_sstore_refund(&mut self, value: usize);
pub fn sub_sstore_refund(&mut self, value: usize);
pub fn is_static(&self) -> bool; pub fn trace_next_instruction(
        &mut self,
        _pc: usize,
        _instruction: u8,
        _current_gas: U256
    ) -> bool { ... }
pub fn trace_prepare_execute(
        &mut self,
        _pc: usize,
        _instruction: u8,
        _gas_cost: U256,
        _mem_written: Option<(usize, usize)>,
        _store_written: Option<(U256, U256)>
    ) { ... }
pub fn trace_failed(&mut self) { ... }
pub fn trace_executed(
        &mut self,
        _gas_used: U256,
        _stack_push: &[U256],
        _mem: &[u8]
    ) { ... } }

Externalities interface for VVMs

Required methods

pub fn initial_storage_at(&self, key: &H256) -> Result<H256, Error>[src]

Returns the storage value for a given key if reversion happens on the current transaction.

pub fn storage_at(&self, key: &H256) -> Result<H256, Error>[src]

Returns a value for given key.

pub fn set_storage(&mut self, key: H256, value: H256) -> Result<(), Error>[src]

Stores a value for given key.

pub fn exists(&self, address: &H160) -> Result<bool, Error>[src]

Determine whether an account exists.

pub fn exists_and_not_null(&self, address: &H160) -> Result<bool, Error>[src]

Determine whether an account exists and is not null (zero balance/nonce, no code).

pub fn origin_balance(&self) -> Result<U256, Error>[src]

Balance of the origin account.

pub fn balance(&self, address: &H160) -> Result<U256, Error>[src]

Returns address balance.

pub fn blockhash(&mut self, number: &U256) -> H256[src]

Returns the hash of one of the 256 most recent complete blocks.

pub fn create(
    &mut self,
    gas: &U256,
    value: &U256,
    code: &[u8],
    parent_version: &U256,
    address: CreateContractAddress,
    trap: bool
) -> Result<ContractCreateResult, TrapKind>
[src]

Creates new contract.

Returns gas_left and contract address if contract creation was successful.

pub fn call(
    &mut self,
    gas: &U256,
    sender_address: &H160,
    receive_address: &H160,
    value: Option<U256>,
    data: &[u8],
    code_address: &H160,
    call_type: ActionType,
    trap: bool
) -> Result<MessageCallResult, TrapKind>
[src]

Message call.

Returns Err, if we run out of gas. Otherwise returns call_result which contains gas left and true if subcall was successfull.

pub fn extcode(
    &self,
    address: &H160
) -> Result<Option<Arc<Vec<u8, Global>>>, Error>
[src]

Returns code at given address

pub fn extcodehash(&self, address: &H160) -> Result<Option<H256>, Error>[src]

Returns code hash at given address

pub fn extcodesize(&self, address: &H160) -> Result<Option<usize>, Error>[src]

Returns code size at given address

pub fn log(
    &mut self,
    topics: Vec<H256, Global>,
    data: &[u8]
) -> Result<(), Error>
[src]

Creates log entry with given topics and data

pub fn ret(
    self,
    gas: &U256,
    data: &ReturnData,
    apply_state: bool
) -> Result<U256, Error>
[src]

Should be called when transaction calls RETURN opcode. Returns gas_left if cost of returning the data is not too high.

pub fn suicide(&mut self, refund_address: &H160) -> Result<(), Error>[src]

Should be called when contract commits suicide. Address to which funds should be refunded.

pub fn schedule(&self) -> &Schedule[src]

Returns schedule.

pub fn env_info(&self) -> &EnvInfo[src]

Returns environment info.

pub fn chain_id(&self) -> u64[src]

Returns the chain ID of the blockchain

pub fn depth(&self) -> usize[src]

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.

pub fn add_sstore_refund(&mut self, value: usize)[src]

Increments sstore refunds counter.

pub fn sub_sstore_refund(&mut self, value: usize)[src]

Decrements sstore refunds counter.

pub fn is_static(&self) -> bool[src]

Check if running in static context.

Loading content...

Provided methods

pub fn trace_next_instruction(
    &mut self,
    _pc: usize,
    _instruction: u8,
    _current_gas: U256
) -> bool
[src]

Decide if any more operations should be traced. Passthrough for the VM trace.

pub fn trace_prepare_execute(
    &mut self,
    _pc: usize,
    _instruction: u8,
    _gas_cost: U256,
    _mem_written: Option<(usize, usize)>,
    _store_written: Option<(U256, U256)>
)
[src]

Prepare to trace an operation. Passthrough for the VM trace. For each call of trace_prepare_execute either trace_failed or trace_executed MUST be called.

pub fn trace_failed(&mut self)[src]

Trace the execution failure of a single instruction.

pub fn trace_executed(
    &mut self,
    _gas_used: U256,
    _stack_push: &[U256],
    _mem: &[u8]
)
[src]

Trace the finalised execution of a single instruction.

Loading content...

Implementations on Foreign Types

impl Ext for FakeExt[src]

Loading content...

Implementors

Loading content...