pub fn execute_custom_code(
        &mut self,
        caller_address: H160,
        contract_address: H160,
        code: Vec<u8>,
        data: Vec<u8>,
    ) -> ExecuteResult {
        self.transact(|exec| {
            let context = Context {
                address: contract_address,
                caller: caller_address,
                apparent_value: U256::zero(), // TODO: figure out what this is.
            };
            let mut runtime = Runtime::new(Rc::new(code), Rc::new(data), context, exec.config());

            // REVIEW: are we handling gas metering correctly?
            let exit_reason = exec.execute(&mut runtime);
            let return_value = runtime.machine().return_value();
            let used_gas = exec.used_gas();
            ExecuteResult {
                exit_reason,
                return_value,
                used_gas,
            }
        })
    }
/// Execute custom EVM opecodes.
/// You are still required to specify a caller address and a contract address, even though a contract may not exist
/// at the specified address.
Execute custom EVM opecodes.
You are still required to specify a caller address and a contract address, even though a contract may not exist
at the specified address.
Execute custom EVM opecodes . You are still required to specify a caller address and a contract address even though a contract may not exist at the specified address .
pub fn execute_custom_code(
        &mut self,
        caller_address: H160,
        contract_address: H160,
        code: Vec<u8>,
        data: Vec<u8>,
    ) -> ExecuteResult {
        self.transact(|exec| {
            let context = Context {
                address: contract_address,
                caller: caller_address,
                apparent_value: U256::zero(), // TODO: figure out what this is.
            };
            let mut runtime = Runtime::new(Rc::new(code), Rc::new(data), context, exec.config());
            // REVIEW: are we handling gas metering correctly?
            let exit_reason = exec.execute(&mut runtime);
            let return_value = runtime.machine().return_value();
            let used_gas = exec.used_gas();
            ExecuteResult {
                exit_reason,
                return_value,
                used_gas,
            }
        })
    }
pub fn execute_custom_code ( & mut self , caller_address : H160 , contract_address : H160 , code : Vec < u8 > , data : Vec < u8 > , ) -> ExecuteResult { self . transact ( | exec | { let context = Context { address : contract_address , caller : caller_address , apparent_value : U256 :: zero ( ) , // TODO: figure out what this is. } ; let mut runtime = Runtime :: new ( Rc :: new ( code ) , Rc :: new ( data ) , context , exec . config ( ) ) ; // REVIEW: are we handling gas metering correctly? let exit_reason = exec . execute ( & mut runtime ) ; let return_value = runtime . machine ( ) . return_value ( ) ; let used_gas = exec . used_gas ( ) ; ExecuteResult { exit_reason , return_value , used_gas , } } ) }
Execute custom EVM opecodes.
Execute custom EVM opecodes .
&mut self
caller_address
H160
contract_address
H160
code
Vec<u8>
data
Vec<u8>