pub struct TwapStruct {
pub sell_token: Address,
pub buy_token: Address,
pub receiver: Address,
pub part_sell_amount: U256,
pub min_part_limit: U256,
pub t0: u32,
pub n: u32,
pub t: u32,
pub span: u32,
pub app_data: B256,
}Expand description
On-chain TwapStruct representation with per-part amounts.
This mirrors the Solidity struct passed to the handler as staticInput.
Use TwapData for the user-facing SDK type; use TwapStruct only when
you need direct access to the ABI-level fields.
Fields§
§sell_token: AddressToken to sell.
buy_token: AddressToken to buy.
receiver: AddressReceiver of bought tokens.
part_sell_amount: U256Amount of sell_token to sell in each part (not total).
min_part_limit: U256Minimum amount of buy_token to buy in each part.
t0: u32Start timestamp (0 = use CurrentBlockTimestampFactory).
n: u32Number of parts.
t: u32Duration of each part in seconds.
span: u32Part validity window in seconds (0 = full window).
app_data: B256App-data hash.
Implementations§
Source§impl TwapStruct
impl TwapStruct
Sourcepub fn has_app_data(&self) -> bool
pub fn has_app_data(&self) -> bool
Returns true if a non-zero app-data hash is set.
The zero hash (B256::ZERO) means no app-data was attached.
§Returns
true if the app_data field is not B256::ZERO, false otherwise.
Sourcepub fn has_custom_receiver(&self) -> bool
pub fn has_custom_receiver(&self) -> bool
Returns true if the receiver is not the zero address.
When receiver == Address::ZERO, the settlement contract uses the order
owner as the effective receiver.
§Returns
true if receiver is not Address::ZERO, false otherwise.
Sourcepub const fn start_is_fixed(&self) -> bool
pub const fn start_is_fixed(&self) -> bool
Returns true if a fixed start timestamp is set (t0 != 0).
When t0 == 0, the order uses CurrentBlockTimestampFactory to
determine the start time at mining time.
§Returns
true if t0 is non-zero, false otherwise.
Trait Implementations§
Source§impl Clone for TwapStruct
impl Clone for TwapStruct
Source§fn clone(&self) -> TwapStruct
fn clone(&self) -> TwapStruct
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TwapStruct
impl Debug for TwapStruct
Source§impl Display for TwapStruct
impl Display for TwapStruct
Source§impl From<&TwapStruct> for TwapData
impl From<&TwapStruct> for TwapData
Source§fn from(s: &TwapStruct) -> Self
fn from(s: &TwapStruct) -> Self
Convert an ABI-level TwapStruct back into a high-level TwapData.
Delegates to crate::struct_to_data.
Auto Trait Implementations§
impl Freeze for TwapStruct
impl RefUnwindSafe for TwapStruct
impl Send for TwapStruct
impl Sync for TwapStruct
impl Unpin for TwapStruct
impl UnsafeUnpin for TwapStruct
impl UnwindSafe for TwapStruct
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<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 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.