Skip to main content

CrosschainTokenManager

Struct CrosschainTokenManager 

Source
pub struct CrosschainTokenManager { /* private fields */ }
Expand description

Manages ERC-7802 crosschainMint/crosschainBurn operations.

Bridges must be explicitly authorized before they can mint or burn tokens. Per-transaction and daily limits are enforced to bound risk.

Implementations§

Source§

impl CrosschainTokenManager

Source

pub fn new(tnzo_token: Arc<TnzoToken>, registry: Arc<TokenRegistry>) -> Self

Creates a new manager backed by the given token and registry instances.

Source

pub fn authorize_bridge( &self, bridge_address: [u8; 20], name: String, authorized_tokens: Vec<TokenId>, max_mint_per_tx: Option<u128>, max_burn_per_tx: Option<u128>, daily_mint_limit: Option<u128>, daily_burn_limit: Option<u128>, ) -> Result<()>

Authorizes a bridge to call crosschainMint/crosschainBurn.

Source

pub fn revoke_bridge(&self, bridge_address: &[u8; 20]) -> Result<()>

Revokes a bridge’s authorization. In-flight operations that already passed the authorization check will still complete, but new calls will be rejected.

Source

pub fn update_bridge_limits( &self, bridge_address: &[u8; 20], max_mint_per_tx: Option<u128>, max_burn_per_tx: Option<u128>, daily_mint_limit: Option<u128>, daily_burn_limit: Option<u128>, ) -> Result<()>

Updates the per-tx and daily limits for an authorized bridge.

Source

pub fn is_bridge_authorized(&self, bridge_address: &[u8; 20]) -> bool

Returns true if the bridge is authorized and enabled.

Source

pub fn get_bridge_info(&self, bridge_address: &[u8; 20]) -> Option<BridgeInfo>

Returns a serializable snapshot of the bridge’s authorization record.

Source

pub fn resolve_authorized_tokens( &self, bridge_address: &[u8; 20], ) -> Vec<TokenDefinition>

Resolves a bridge’s authorized_tokens set into full [TokenDefinition] records via the unified token registry.

Tokens that no longer exist in the registry are silently skipped, allowing operators to detect orphaned authorizations by length comparison against the bridge’s raw authorized_tokens vector.

Source

pub fn list_authorized_bridges(&self) -> Vec<BridgeInfo>

Lists all currently authorized bridges.

Source

pub fn crosschain_mint( &self, bridge: [u8; 20], to: Address, amount: u128, sender: Vec<u8>, ) -> Result<CrosschainMintEvent>

Mints tokens on this chain as part of a cross-chain transfer.

The bridge must be authorized and within its per-tx and daily limits. Tokens are minted via TnzoToken::mint() using the treasury address as the authorized caller.

§Arguments
  • bridge - 20-byte address of the calling bridge.
  • to - Recipient address on this chain.
  • amount - Amount to mint (smallest unit, 18 decimals).
  • sender - Opaque sender identifier on the source chain.
Source

pub fn crosschain_burn( &self, bridge: [u8; 20], from: Address, amount: u128, sender: Vec<u8>, ) -> Result<CrosschainBurnEvent>

Burns tokens on this chain as part of a cross-chain transfer.

The bridge must be authorized and within its per-tx and daily limits. Tokens are burned via TnzoToken::burn().

§Arguments
  • bridge - 20-byte address of the calling bridge.
  • from - Address whose tokens are burned.
  • amount - Amount to burn (smallest unit, 18 decimals).
  • sender - Opaque destination identifier on the target chain.
Source

pub fn get_mint_events(&self) -> Vec<CrosschainMintEvent>

Returns all recorded mint events, newest first.

Source

pub fn get_burn_events(&self) -> Vec<CrosschainBurnEvent>

Returns all recorded burn events, newest first.

Source

pub fn get_mint_event(&self, nonce: u64) -> Option<CrosschainMintEvent>

Returns a specific mint event by nonce.

Source

pub fn get_burn_event(&self, nonce: u64) -> Option<CrosschainBurnEvent>

Returns a specific burn event by nonce.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more