pub struct OrderDomain {
pub name: &'static str,
pub version: &'static str,
pub chain_id: u64,
pub verifying_contract: Address,
}Expand description
The EIP-712 domain for CoW Protocol orders.
Mirrors TypedDataDomain from the TypeScript SDK.
Fields§
§name: &'static strProtocol name ("Gnosis Protocol").
version: &'static strProtocol version ("v2").
chain_id: u64Chain ID where orders are settled.
verifying_contract: AddressGPv2Settlement contract address (the EIP-712 verifying contract).
Implementations§
Source§impl OrderDomain
impl OrderDomain
Sourcepub const fn for_chain(chain_id: u64) -> OrderDomain
pub const fn for_chain(chain_id: u64) -> OrderDomain
Construct the standard CoW Protocol EIP-712 domain for chain_id.
Uses the canonical SETTLEMENT_CONTRACT
address as the verifying contract.
§Arguments
chain_id- The EVM chain ID where orders will be settled.
§Returns
An OrderDomain configured for the given chain.
Sourcepub fn domain_separator(&self) -> FixedBytes<32>
pub fn domain_separator(&self) -> FixedBytes<32>
Compute the EIP-712 domain separator for this domain.
When all fields are at their default values ("Gnosis Protocol",
"v2", canonical settlement contract), this is equivalent to
crate::domain_separator. When any field has been
overridden via the with_* builder methods, the separator is
computed from the custom values.
use cow_signing::types::OrderDomain;
let domain = OrderDomain::for_chain(1);
let sep = domain.domain_separator();
assert_ne!(sep, alloy_primitives::B256::ZERO);Sourcepub const fn with_name(self, name: &'static str) -> OrderDomain
pub const fn with_name(self, name: &'static str) -> OrderDomain
Sourcepub const fn with_version(self, version: &'static str) -> OrderDomain
pub const fn with_version(self, version: &'static str) -> OrderDomain
Sourcepub const fn with_verifying_contract(self, contract: Address) -> OrderDomain
pub const fn with_verifying_contract(self, contract: Address) -> OrderDomain
Sourcepub const fn with_chain_id(self, chain_id: u64) -> OrderDomain
pub const fn with_chain_id(self, chain_id: u64) -> OrderDomain
Trait Implementations§
Source§impl Clone for OrderDomain
impl Clone for OrderDomain
Source§fn clone(&self) -> OrderDomain
fn clone(&self) -> OrderDomain
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OrderDomain
impl Debug for OrderDomain
Auto Trait Implementations§
impl Freeze for OrderDomain
impl RefUnwindSafe for OrderDomain
impl Send for OrderDomain
impl Sync for OrderDomain
impl Unpin for OrderDomain
impl UnsafeUnpin for OrderDomain
impl UnwindSafe for OrderDomain
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.