pub struct TransferFee {
pub finality_threshold: u32,
pub minimum_fee: FeeBps,
}Expand description
A single fee entry from Circle’s CCTP v2 transfer-fee API.
The API returns an array of entries shaped like:
{ "finalityThreshold": 1000, "minimumFee": 1.3 }Fields§
§finality_threshold: u32Finality threshold this fee applies to.
minimum_fee: FeeBpsMinimum fee in basis points.
Implementations§
Source§impl TransferFee
impl TransferFee
Sourcepub const fn new(finality_threshold: u32, minimum_fee: FeeBps) -> Self
pub const fn new(finality_threshold: u32, minimum_fee: FeeBps) -> Self
Creates a transfer fee entry.
Sourcepub const fn finality(self) -> Option<FinalityThreshold>
pub const fn finality(self) -> Option<FinalityThreshold>
Returns this entry’s typed finality threshold, if it is one of the thresholds currently recognized by CCTP v2.
Sourcepub const fn is_fast_transfer(self) -> bool
pub const fn is_fast_transfer(self) -> bool
Returns true when this entry applies to fast transfers.
Sourcepub const fn is_standard_transfer(self) -> bool
pub const fn is_standard_transfer(self) -> bool
Returns true when this entry applies to standard transfers.
Sourcepub fn max_fee_with_buffer_percent(
self,
amount: U256,
buffer_percent: u32,
) -> U256
pub fn max_fee_with_buffer_percent( self, amount: U256, buffer_percent: u32, ) -> U256
Calculates a maxFee cap in USDC atomic units with the given buffer.
Trait Implementations§
Source§impl Clone for TransferFee
impl Clone for TransferFee
Source§fn clone(&self) -> TransferFee
fn clone(&self) -> TransferFee
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for TransferFee
Source§impl Debug for TransferFee
impl Debug for TransferFee
Source§impl<'de> Deserialize<'de> for TransferFee
impl<'de> Deserialize<'de> for TransferFee
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
impl Eq for TransferFee
Source§impl PartialEq for TransferFee
impl PartialEq for TransferFee
Source§fn eq(&self, other: &TransferFee) -> bool
fn eq(&self, other: &TransferFee) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for TransferFee
impl Serialize for TransferFee
impl StructuralPartialEq for TransferFee
Auto Trait Implementations§
impl Freeze for TransferFee
impl RefUnwindSafe for TransferFee
impl Send for TransferFee
impl Sync for TransferFee
impl Unpin for TransferFee
impl UnsafeUnpin for TransferFee
impl UnwindSafe for TransferFee
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
impl<'de, T> BorrowedRpcObject<'de> for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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
Compare self to
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>
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 more