pub fn create_contract(
        &mut self,
        caller_address: H160,
        contract_code: Vec<u8>,
    ) -> Result<H160, ExitReason> {
        self.transact(|exec| {
            let contract_address = exec.create_address(CreateScheme::Legacy {
                caller: caller_address,
            });

            let exit_reason = exec.transact_create(
                caller_address,
                U256::zero(), // TODO: allow the caller to specify this.
                contract_code,
                u64::MAX,
                vec![],
            );

            match &exit_reason {
                ExitReason::Succeed(_) => Ok(contract_address),
                _ => Err(exit_reason),
            }
        })
    }
/// Create a contract and return the contract address if successful.
Create a contract and return the contract address if successful.
Create a contract and return the contract address if successful .
pub fn create_contract(
        &mut self,
        caller_address: H160,
        contract_code: Vec<u8>,
    ) -> Result<H160, ExitReason> {
        self.transact(|exec| {
            let contract_address = exec.create_address(CreateScheme::Legacy {
                caller: caller_address,
            });
            let exit_reason = exec.transact_create(
                caller_address,
                U256::zero(), // TODO: allow the caller to specify this.
                contract_code,
                u64::MAX,
                vec![],
            );
            match &exit_reason {
                ExitReason::Succeed(_) => Ok(contract_address),
                _ => Err(exit_reason),
            }
        })
    }
pub fn create_contract ( & mut self , caller_address : H160 , contract_code : Vec < u8 > , ) -> Result < H160 , ExitReason > { self . transact ( | exec | { let contract_address = exec . create_address ( CreateScheme :: Legacy { caller : caller_address , } ) ; let exit_reason = exec . transact_create ( caller_address , U256 :: zero ( ) , // TODO: allow the caller to specify this. contract_code , u64 :: MAX , vec ! [ ] , ) ; match & exit_reason { ExitReason :: Succeed ( _ ) => Ok ( contract_address ) , _ => Err ( exit_reason ) , } } ) }
Create a contract and return the contract address if successful.
Create a contract and return the contract address if successful .
&mut self
caller_address
H160
contract_code
Vec<u8>