pub struct ZenithCallBundle {
pub bundle: EthCallBundle,
pub host_fills: BTreeMap<Address, BTreeMap<Address, U256>>,
}Expand description
Bundle of transactions for zenith_callBundle
Fields§
§bundle: EthCallBundleThe bundle of transactions to simulate. Same structure as a Flashbots EthCallBundle bundle. see https://github.com/alloy-rs/alloy/blob/main/crates/rpc-types-mev/src/eth_calls.rs#L13-L33
host_fills: BTreeMap<Address, BTreeMap<Address, U256>>Host fills to be applied to the bundle for simulation. The mapping corresponds to asset => user => amount.
Implementations§
Source§impl ZenithCallBundle
impl ZenithCallBundle
Sourcepub const fn host_fills(&self) -> &BTreeMap<Address, BTreeMap<Address, U256>>
pub const fn host_fills(&self) -> &BTreeMap<Address, BTreeMap<Address, U256>>
Returns the host fills for this bundle.
Sourcepub const fn block_number(&self) -> u64
pub const fn block_number(&self) -> u64
Returns the block number for this bundle.
Sourcepub const fn state_block_number(&self) -> BlockNumberOrTag
pub const fn state_block_number(&self) -> BlockNumberOrTag
Returns the state block number for this bundle.
Sourcepub const fn difficulty(&self) -> Option<U256>
pub const fn difficulty(&self) -> Option<U256>
Returns the difficulty for this bundle.
Sourcepub fn from_2718_and_host_fills<I, T>(
txs: I,
host_fills: BTreeMap<Address, BTreeMap<Address, U256>>,
) -> Selfwhere
I: IntoIterator<Item = T>,
T: Encodable2718,
pub fn from_2718_and_host_fills<I, T>(
txs: I,
host_fills: BTreeMap<Address, BTreeMap<Address, U256>>,
) -> Selfwhere
I: IntoIterator<Item = T>,
T: Encodable2718,
Creates a new bundle from the given Encodable2718 transactions.
Sourcepub fn from_raw_txs_and_host_fills<I, T>(
txs: I,
host_fills: BTreeMap<Address, BTreeMap<Address, U256>>,
) -> Self
pub fn from_raw_txs_and_host_fills<I, T>( txs: I, host_fills: BTreeMap<Address, BTreeMap<Address, U256>>, ) -> Self
Creates a new bundle with the given transactions and host fills.
Sourcepub fn append_2718_tx(self, tx: impl Encodable2718) -> Self
pub fn append_2718_tx(self, tx: impl Encodable2718) -> Self
Adds an Encodable2718 transaction to the bundle.
Sourcepub fn append_raw_tx(self, tx: impl Into<Bytes>) -> Self
pub fn append_raw_tx(self, tx: impl Into<Bytes>) -> Self
Adds an EIP-2718 envelope to the bundle.
Sourcepub fn extend_2718_txs<I, T>(self, tx: I) -> Selfwhere
I: IntoIterator<Item = T>,
T: Encodable2718,
pub fn extend_2718_txs<I, T>(self, tx: I) -> Selfwhere
I: IntoIterator<Item = T>,
T: Encodable2718,
Adds multiple Encodable2718 transactions to the bundle.
Sourcepub fn extend_raw_txs<I, T>(self, txs: I) -> Self
pub fn extend_raw_txs<I, T>(self, txs: I) -> Self
Adds multiple calls to the block.
Sourcepub const fn with_block_number(self, block_number: u64) -> Self
pub const fn with_block_number(self, block_number: u64) -> Self
Sets the block number for the bundle.
Sourcepub fn with_state_block_number(
self,
state_block_number: impl Into<BlockNumberOrTag>,
) -> Self
pub fn with_state_block_number( self, state_block_number: impl Into<BlockNumberOrTag>, ) -> Self
Sets the state block number for the bundle.
Sourcepub const fn with_timestamp(self, timestamp: u64) -> Self
pub const fn with_timestamp(self, timestamp: u64) -> Self
Sets the timestamp for the bundle.
Sourcepub const fn with_gas_limit(self, gas_limit: u64) -> Self
pub const fn with_gas_limit(self, gas_limit: u64) -> Self
Sets the gas limit for the bundle.
Sourcepub const fn with_difficulty(self, difficulty: U256) -> Self
pub const fn with_difficulty(self, difficulty: U256) -> Self
Sets the difficulty for the bundle.
Sourcepub const fn with_base_fee(self, base_fee: u128) -> Self
pub const fn with_base_fee(self, base_fee: u128) -> Self
Sets the base fee for the bundle.
Sourcepub fn bundle_hash(&self) -> B256
pub fn bundle_hash(&self) -> B256
Make a bundle hash from the given deserialized transaction array and host fills from this bundle.
The hash is calculated as keccak256(tx_preimage + host_preimage).
The tx_preimage is calculated as keccak(tx_hash1 + tx_hash2 + ... + tx_hashn).
The host_preimage is calculated as
keccak(NUM_OF_ASSETS_LE + asset1 + NUM_OF_FILLS_LE + asset1_user1 + user1_amount2 + ... + asset1_usern + asset1_amountn + ...).
For the number of users/fills and amounts in the host_preimage, the amounts are serialized as little-endian U256 slice.
Trait Implementations§
Source§impl Clone for ZenithCallBundle
impl Clone for ZenithCallBundle
Source§fn clone(&self) -> ZenithCallBundle
fn clone(&self) -> ZenithCallBundle
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ZenithCallBundle
impl Debug for ZenithCallBundle
Source§impl<'de> Deserialize<'de> for ZenithCallBundle
impl<'de> Deserialize<'de> for ZenithCallBundle
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for ZenithCallBundle
impl PartialEq for ZenithCallBundle
Source§impl Serialize for ZenithCallBundle
impl Serialize for ZenithCallBundle
impl Eq for ZenithCallBundle
impl StructuralPartialEq for ZenithCallBundle
Auto Trait Implementations§
impl Freeze for ZenithCallBundle
impl RefUnwindSafe for ZenithCallBundle
impl Send for ZenithCallBundle
impl Sync for ZenithCallBundle
impl Unpin for ZenithCallBundle
impl UnwindSafe for ZenithCallBundle
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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>
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>
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