pub struct SimulationResult {
pub success: bool,
pub gas_used: u64,
pub return_data: Vec<u8>,
}Expand description
Result of simulating a settlement transaction via eth_call.
Contains the success status, estimated gas usage, and raw return data from the simulated call.
§Example
use cow_settlement::simulator::SimulationResult;
let result = SimulationResult::new(true, 150_000, vec![]);
assert!(result.is_success());
assert!(!result.is_revert());
assert_eq!(result.gas_used, 150_000);Fields§
§success: boolWhether the simulation completed without reverting.
gas_used: u64Estimated gas consumed by the simulated transaction.
return_data: Vec<u8>Raw bytes returned by the simulated call.
Implementations§
Source§impl SimulationResult
impl SimulationResult
Sourcepub const fn new(
success: bool,
gas_used: u64,
return_data: Vec<u8>,
) -> SimulationResult
pub const fn new( success: bool, gas_used: u64, return_data: Vec<u8>, ) -> SimulationResult
Create a new simulation result.
§Arguments
success- Whether the simulation succeeded.gas_used- Estimated gas consumed.return_data- Raw return bytes from the call.
§Returns
A new SimulationResult.
Sourcepub const fn is_success(&self) -> bool
pub const fn is_success(&self) -> bool
Check whether the simulation succeeded (did not revert).
§Returns
true if the simulated transaction completed without reverting.
Trait Implementations§
Source§impl Clone for SimulationResult
impl Clone for SimulationResult
Source§fn clone(&self) -> SimulationResult
fn clone(&self) -> SimulationResult
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SimulationResult
impl Debug for SimulationResult
Auto Trait Implementations§
impl Freeze for SimulationResult
impl RefUnwindSafe for SimulationResult
impl Send for SimulationResult
impl Sync for SimulationResult
impl Unpin for SimulationResult
impl UnsafeUnpin for SimulationResult
impl UnwindSafe for SimulationResult
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.