pub struct StorageOverrides { /* private fields */ }Expand description
Per-account EVM storage slot overrides for dry-run simulations.
Maps 20-byte contract addresses to a set of 32-byte slot → value pairs. Passed via
ExecutionOptions::storage_overrides to override on-chain state during a
FyndClient::execute_swap dry run.
§Example
use fynd_client::StorageOverrides;
use bytes::Bytes;
let mut overrides = StorageOverrides::default();
let contract = Bytes::copy_from_slice(&[0xAA; 20]);
let slot = Bytes::copy_from_slice(&[0x00; 32]);
let value = Bytes::copy_from_slice(&[0x01; 32]);
overrides.insert(contract, slot, value);Implementations§
Source§impl StorageOverrides
impl StorageOverrides
Sourcepub fn insert(&mut self, address: Bytes, slot: Bytes, value: Bytes)
pub fn insert(&mut self, address: Bytes, slot: Bytes, value: Bytes)
Add a storage slot override for a contract.
address: 20-byte contract address.slot: 32-byte storage slot key.value: 32-byte replacement value.
Sourcepub fn set_native_balance(&mut self, address: Bytes, wei: BigUint)
pub fn set_native_balance(&mut self, address: Bytes, wei: BigUint)
Override the native (ETH) balance of an account for dry-run simulation.
Useful when simulating transactions from a synthetic sender that has no real ETH —
many nodes (e.g. reth) reject eth_estimateGas if the sender cannot afford
gas_limit * max_fee_per_gas.
Sourcepub fn merge(&mut self, other: StorageOverrides)
pub fn merge(&mut self, other: StorageOverrides)
Merge all slot and balance overrides from other into self. Balances in other
take precedence on conflict.
Trait Implementations§
Source§impl Clone for StorageOverrides
impl Clone for StorageOverrides
Source§fn clone(&self) -> StorageOverrides
fn clone(&self) -> StorageOverrides
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for StorageOverrides
impl Default for StorageOverrides
Source§fn default() -> StorageOverrides
fn default() -> StorageOverrides
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for StorageOverrides
impl RefUnwindSafe for StorageOverrides
impl Send for StorageOverrides
impl Sync for StorageOverrides
impl Unpin for StorageOverrides
impl UnsafeUnpin for StorageOverrides
impl UnwindSafe for StorageOverrides
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 more