pub struct GpV2OrderStruct {
pub sell_token: Address,
pub buy_token: Address,
pub receiver: Address,
pub sell_amount: U256,
pub buy_amount: U256,
pub valid_to: u32,
pub app_data: B256,
pub fee_amount: U256,
pub kind: B256,
pub partially_fillable: bool,
pub sell_token_balance: B256,
pub buy_token_balance: B256,
}Expand description
Raw on-chain GPv2Order.DataStruct as emitted by the GPv2Settlement contract.
Unlike UnsignedOrder, the
kind, sell_token_balance, and buy_token_balance fields are stored as
keccak256 hashes rather than typed enums.
Use from_struct_to_order to
decode them into a fully typed
UnsignedOrder.
Mirrors GPv2Order.DataStruct from the @cowprotocol/composable SDK.
Fields§
§sell_token: AddressToken to sell.
buy_token: AddressToken to buy.
receiver: AddressAddress that receives the bought tokens.
sell_amount: U256Amount of sell_token to sell (in atoms).
buy_amount: U256Minimum amount of buy_token to receive (in atoms).
valid_to: u32Order expiry as a Unix timestamp.
app_data: B256App-data hash (bytes32).
fee_amount: U256Protocol fee included in sell_amount (in atoms).
kind: B256keccak256("sell") or keccak256("buy").
partially_fillable: boolWhether the order may be partially filled.
sell_token_balance: B256keccak256("erc20"), keccak256("external"), or keccak256("internal").
buy_token_balance: B256keccak256("erc20"), keccak256("external"), or keccak256("internal").
Implementations§
Source§impl GpV2OrderStruct
impl GpV2OrderStruct
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 is_partially_fillable(&self) -> bool
pub const fn is_partially_fillable(&self) -> bool
Returns true if this order allows partial fills.
§Returns
true if partially_fillable is set, false for fill-or-kill orders.
Trait Implementations§
Source§impl Clone for GpV2OrderStruct
impl Clone for GpV2OrderStruct
Source§fn clone(&self) -> GpV2OrderStruct
fn clone(&self) -> GpV2OrderStruct
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GpV2OrderStruct
impl Debug for GpV2OrderStruct
Source§impl Display for GpV2OrderStruct
impl Display for GpV2OrderStruct
Source§impl TryFrom<&GpV2OrderStruct> for UnsignedOrder
impl TryFrom<&GpV2OrderStruct> for UnsignedOrder
Source§fn try_from(s: &GpV2OrderStruct) -> Result<Self, Self::Error>
fn try_from(s: &GpV2OrderStruct) -> Result<Self, Self::Error>
Decode a raw GpV2OrderStruct into a fully typed UnsignedOrder.
Resolves the hashed kind, sell_token_balance, and buy_token_balance
fields back into their enum representations via
crate::composable::from_struct_to_order.
Auto Trait Implementations§
impl Freeze for GpV2OrderStruct
impl RefUnwindSafe for GpV2OrderStruct
impl Send for GpV2OrderStruct
impl Sync for GpV2OrderStruct
impl Unpin for GpV2OrderStruct
impl UnsafeUnpin for GpV2OrderStruct
impl UnwindSafe for GpV2OrderStruct
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.