#[non_exhaustive]pub enum TransferMode {
Standard,
Fast {
max_fee: U256,
},
StandardWithHook {
hook_data: Bytes,
},
FastWithHook {
max_fee: U256,
hook_data: Bytes,
},
}Expand description
Selects which CCTP v2 burn variant the bridge sends.
Replaces the legacy independent fast_transfer / hook_data / max_fee
fields. The enum captures the exact wire shape of the four valid
configurations and makes the relationship between fee, finality, and hook
data unambiguous at the type level.
§Examples
use cctp_rs::{FinalityThreshold, TransferMode};
use alloy_primitives::{Bytes, U256};
let standard = TransferMode::Standard;
assert_eq!(standard.finality_threshold(), FinalityThreshold::Standard);
assert!(standard.hook_data().is_none());
let fast = TransferMode::Fast { max_fee: U256::from(500) };
assert_eq!(fast.finality_threshold(), FinalityThreshold::Fast);
assert_eq!(fast.max_fee(), U256::from(500));
let fast_with_hook = TransferMode::FastWithHook {
max_fee: U256::from(500),
hook_data: Bytes::from(vec![0xde, 0xad]),
};
assert!(fast_with_hook.is_fast());
assert_eq!(fast_with_hook.hook_data().map(|b| b.len()), Some(2));Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Standard
Plain burn at finalized finality (threshold 2000), no hooks.
Settlement matches v1 timing (13–19 min). No fast-transfer fee.
Fast
Fast burn at confirmed finality (threshold 1000), no hooks.
max_fee caps the fast-transfer fee Circle’s relayers may deduct
from the minted amount. A fee below the chain’s minimum will leave
the burn pending until enough finality accrues for the standard
path.
StandardWithHook
Burn carrying hook data at finalized finality.
The hook data is opaque to CCTP and runs on the destination chain after the mint.
FastWithHook
Burn carrying hook data at confirmed (fast) finality.
Combines a fast-finality attestation with a post-mint hook. Both
maxFee and hookData are passed through to
depositForBurnWithHook on-chain.
Implementations§
Source§impl TransferMode
impl TransferMode
Sourcepub const fn finality_threshold(&self) -> FinalityThreshold
pub const fn finality_threshold(&self) -> FinalityThreshold
Returns the finality threshold this mode requests from Circle.
Sourcepub const fn is_fast(&self) -> bool
pub const fn is_fast(&self) -> bool
Returns true when the mode requests fast (confirmed) finality.
Trait Implementations§
Source§impl Clone for TransferMode
impl Clone for TransferMode
Source§fn clone(&self) -> TransferMode
fn clone(&self) -> TransferMode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TransferMode
impl Debug for TransferMode
Source§impl Default for TransferMode
impl Default for TransferMode
Source§fn default() -> TransferMode
fn default() -> TransferMode
impl Eq for TransferMode
Source§impl PartialEq for TransferMode
impl PartialEq for TransferMode
Source§fn eq(&self, other: &TransferMode) -> bool
fn eq(&self, other: &TransferMode) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for TransferMode
Auto Trait Implementations§
impl !Freeze for TransferMode
impl RefUnwindSafe for TransferMode
impl Send for TransferMode
impl Sync for TransferMode
impl Unpin for TransferMode
impl UnsafeUnpin for TransferMode
impl UnwindSafe for TransferMode
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<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
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>
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 more