Bridge Facet

The Bridge Facet handles the transfer of collateral to and from registered bridge addresses. It allows users to send funds to a bridge for cross-chain movement and to claim funds received from a bridge on the destination chain. Administrators can suspend and restore bridge transactions for dispute resolution. The underlying logic is implemented in the BridgeFacetImpl library.

circle-info

In v0.8.5, the Bridge Facet is retained alongside the new Withdraw System (see WithdrawFacet). The new withdraw system introduces a multi-provider architecture with express and virtual providers for cross-chain withdrawals and instant payouts. The Bridge Facet serves as the direct bridge transfer mechanism, while the WithdrawFacet handles the broader cooldown-based withdrawal flows with provider integration.

Overview

The Bridge Facet provides the following key functionalities:

  • Transfer to Bridge: Users send collateral from their protocol balance to a registered bridge address, initiating a cross-chain transfer.

  • Withdraw Received Bridge Value: Users claim funds that have arrived via a bridge transaction on the destination chain.

  • Transaction Suspension: A suspender role can freeze suspicious bridge transactions pending investigation.

  • Transaction Restoration: A dispute role can restore suspended transactions with a validated amount, resolving disputes.


transferToBridge()

Transfers a specified amount of collateral from the caller's balance to a registered bridge address.

Function Signature:

function transferToBridge(uint256 amount, address bridgeAddress) external whenNotAccountingPaused notSuspended(signer);

Parameters:

  • amount: The amount to transfer (in collateral decimals).

  • bridgeAddress: The address of the registered bridge to receive the funds.

Example:

Events Emitted:

  • TransferToBridge(address sender, uint256 amount, address bridgeAddress, uint256 transactionId)


withdrawReceivedBridgeValue()

Claims the funds associated with a specific bridge transaction that has been received on this chain.

Function Signature:

Parameters:

  • transactionId: The ID of the bridge transaction to claim.

Example:

Events Emitted:

  • WithdrawReceivedBridgeValue(uint256 transactionId)


withdrawReceivedBridgeValues()

Claims funds from multiple bridge transactions in a single call.

Function Signature:

Parameters:

  • transactionIds: An array of bridge transaction IDs to claim.

Events Emitted:

  • WithdrawReceivedBridgeValues(uint256[] transactionIds)


suspendBridgeTransaction()

Suspends a specific bridge transaction, freezing it pending investigation. Only callable by the suspender role.

Function Signature:

Parameters:

  • transactionId: The ID of the bridge transaction to suspend.

Access: Requires SUSPENDER_ROLE.

Events Emitted:

  • SuspendBridgeTransaction(uint256 transactionId)


restoreBridgeTransaction()

Restores a previously suspended bridge transaction with a validated amount. This resolves a dispute by confirming the correct transfer amount, which may differ from the originally reported amount.

Function Signature:

Parameters:

  • transactionId: The ID of the suspended bridge transaction to restore.

  • validAmount: The validated amount to associate with the restored transaction.

Access: Requires DISPUTE_ROLE.

Events Emitted:

  • RestoreBridgeTransaction(uint256 transactionId, uint256 validAmount)

Last updated