pub enum TokenBalance {
Erc20,
External,
Internal,
}Expand description
The ERC-20 balance source/destination for sellToken and buyToken.
Controls whether the CoW settlement contract transfers tokens via
standard ERC-20 transferFrom or via the Balancer Vault’s internal
balance system.
§Example
use cow_rs::TokenBalance;
let balance = TokenBalance::Erc20;
assert_eq!(balance.as_str(), "erc20");
assert!(balance.is_erc20());Variants§
Erc20
Standard ERC-20 transfer (default).
External
Balancer Vault internal balance (sell side only).
Internal
Balancer Vault internal balance (buy side only).
Implementations§
Source§impl TokenBalance
impl TokenBalance
Sourcepub const fn as_str(self) -> &'static str
pub const fn as_str(self) -> &'static str
Returns the lowercase string used by the CoW Protocol API.
§Returns
"erc20", "external", or "internal".
Sourcepub fn eip712_hash(self) -> B256
pub fn eip712_hash(self) -> B256
Sourcepub const fn is_erc20(self) -> bool
pub const fn is_erc20(self) -> bool
Returns true if the standard ERC-20 transfer mode is used.
This is the default for most orders.
Sourcepub const fn is_external(self) -> bool
pub const fn is_external(self) -> bool
Returns true if the Balancer Vault external balance is used
(sell side only).
Sourcepub const fn is_internal(self) -> bool
pub const fn is_internal(self) -> bool
Returns true if the Balancer Vault internal balance is used
(buy side only).
Trait Implementations§
Source§impl Clone for TokenBalance
impl Clone for TokenBalance
Source§fn clone(&self) -> TokenBalance
fn clone(&self) -> TokenBalance
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TokenBalance
impl Debug for TokenBalance
Source§impl Default for TokenBalance
impl Default for TokenBalance
Source§fn default() -> TokenBalance
fn default() -> TokenBalance
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for TokenBalance
impl<'de> Deserialize<'de> for TokenBalance
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for TokenBalance
impl Display for TokenBalance
Source§impl PartialEq for TokenBalance
impl PartialEq for TokenBalance
Source§impl Serialize for TokenBalance
impl Serialize for TokenBalance
Source§impl TryFrom<&str> for TokenBalance
impl TryFrom<&str> for TokenBalance
impl Copy for TokenBalance
impl Eq for TokenBalance
impl StructuralPartialEq for TokenBalance
Auto Trait Implementations§
impl Freeze for TokenBalance
impl RefUnwindSafe for TokenBalance
impl Send for TokenBalance
impl Sync for TokenBalance
impl Unpin for TokenBalance
impl UnsafeUnpin for TokenBalance
impl UnwindSafe for TokenBalance
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<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>
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 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.