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
impl CrosschainTokenManager
Sourcepub fn new(tnzo_token: Arc<TnzoToken>, registry: Arc<TokenRegistry>) -> Self
pub fn new(tnzo_token: Arc<TnzoToken>, registry: Arc<TokenRegistry>) -> Self
Creates a new manager backed by the given token and registry instances.
Authorizes a bridge to call crosschainMint/crosschainBurn.
Sourcepub fn revoke_bridge(&self, bridge_address: &[u8; 20]) -> Result<()>
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.
Sourcepub 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<()>
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.
Returns true if the bridge is authorized and enabled.
Sourcepub fn get_bridge_info(&self, bridge_address: &[u8; 20]) -> Option<BridgeInfo>
pub fn get_bridge_info(&self, bridge_address: &[u8; 20]) -> Option<BridgeInfo>
Returns a serializable snapshot of the bridge’s authorization record.
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.
Lists all currently authorized bridges.
Sourcepub fn crosschain_mint(
&self,
bridge: [u8; 20],
to: Address,
amount: u128,
sender: Vec<u8>,
) -> Result<CrosschainMintEvent>
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.
Sourcepub fn crosschain_burn(
&self,
bridge: [u8; 20],
from: Address,
amount: u128,
sender: Vec<u8>,
) -> Result<CrosschainBurnEvent>
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.
Sourcepub fn get_mint_events(&self) -> Vec<CrosschainMintEvent>
pub fn get_mint_events(&self) -> Vec<CrosschainMintEvent>
Returns all recorded mint events, newest first.
Sourcepub fn get_burn_events(&self) -> Vec<CrosschainBurnEvent>
pub fn get_burn_events(&self) -> Vec<CrosschainBurnEvent>
Returns all recorded burn events, newest first.
Sourcepub fn get_mint_event(&self, nonce: u64) -> Option<CrosschainMintEvent>
pub fn get_mint_event(&self, nonce: u64) -> Option<CrosschainMintEvent>
Returns a specific mint event by nonce.
Sourcepub fn get_burn_event(&self, nonce: u64) -> Option<CrosschainBurnEvent>
pub fn get_burn_event(&self, nonce: u64) -> Option<CrosschainBurnEvent>
Returns a specific burn event by nonce.