Bridge Facet
The Bridge Facet handles the transfer of collateral to and from registered bridge addresses. Users send funds to a bridge for cross-chain movement and 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.
Overview
The Bridge Facet provides:
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

