openethereum/src/evm/executive.rs

48 lines
1.1 KiB
Rust
Raw Normal View History

2016-01-07 21:29:36 +01:00
use util::hash::*;
use util::uint::*;
2016-01-07 19:05:44 +01:00
use state::*;
use env_info::*;
use engine::*;
use transaction::*;
pub enum ExecutiveResult {
Ok
}
pub struct Executive<'a> {
state: &'a mut State,
info: &'a EnvInfo,
engine: &'a Engine,
level: usize
}
impl<'a> Executive<'a> {
pub fn new(state: &'a mut State, info: &'a EnvInfo, engine: &'a Engine, level: usize) -> Self {
Executive {
state: state,
info: info,
engine: engine,
level: level
}
}
pub fn exec(&mut self, transaction: &Transaction) -> ExecutiveResult {
// TODO: validate that we have enough funds
2016-01-07 21:29:36 +01:00
self.state.inc_nonce(&transaction.sender());
2016-01-07 19:05:44 +01:00
match transaction.kind() {
TransactionKind::MessageCall => self.call(transaction),
2016-01-07 21:29:36 +01:00
TransactionKind::ContractCreation => { unimplemented!(); }// self.create(&self.sender(), )
2016-01-07 19:05:44 +01:00
}
}
fn call(&mut self, transaction: &Transaction) -> ExecutiveResult {
ExecutiveResult::Ok
}
2016-01-07 21:29:36 +01:00
fn create(&mut self, address: &Address, endowment: &U256, gas_price: &U256, gas: &U256, init: &[u8], origin: &Address) -> ExecutiveResult {
2016-01-07 19:05:44 +01:00
ExecutiveResult::Ok
}
}