use crate::{Gas, InstructionResult, InterpreterResult};
use primitives::{Address, Bytes};
#[derive(Debug, Clone, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct CreateOutcome {
pub result: InterpreterResult,
pub address: Option<Address>,
}
impl CreateOutcome {
pub fn new(result: InterpreterResult, address: Option<Address>) -> Self {
Self { result, address }
}
pub fn new_oog(gas_limit: u64) -> Self {
Self::new(InterpreterResult::new_oog(gas_limit), None)
}
pub fn instruction_result(&self) -> &InstructionResult {
&self.result.result
}
pub fn output(&self) -> &Bytes {
&self.result.output
}
pub fn gas(&self) -> &Gas {
&self.result.gas
}
}