BridgeComponent
Inherits: IBridgeComponent
Constants
MAX_BPS
Full scale value in basis points
uint256 private constant MAX_BPS = 10_000;State Variables
_maxBridgeLossBps
mapping(uint16 bridgeId => uint256 maxBridgeLossBps) private _maxBridgeLossBps;_isWhitelistedRecipient
mapping(uint256 foreignChainId => mapping(address recipient => bool isWhitelisted)) private _isWhitelistedRecipient;_lastGuardedBridgeOutTimestamps
mapping(uint16 bridgeId => uint256 timestamp) private _lastGuardedBridgeOutTimestamps;bridgeCooldownDuration
Cooldown duration (in seconds) for bridge transfers while in FENCED or WALLED mode.
uint256 public bridgeCooldownDuration;Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
Functions
getMaxBridgeLossBps
Bridge ID => Max allowed value loss in basis points for transfers via this bridge while in FENCED or WALLED mode.
function getMaxBridgeLossBps(uint16 bridgeId) external view returns (uint256);Parameters
| Name | Type | Description |
|---|---|---|
| bridgeId | uint16 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
isWhitelistedRecipient
Foreign Chain ID => Recipient => Whitelisting status while in FENCED or WALLED mode.
function isWhitelistedRecipient(uint256 foreignChainId, address recipient) external view returns (bool);Parameters
| Name | Type | Description |
|---|---|---|
| foreignChainId | uint256 | |
| recipient | address |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bool |
_sendOutBridgeTransfer
function _sendOutBridgeTransfer(IBridgeComponent.BridgeOrder calldata order, address encoder, bool guarded)
internal;Parameters
| Name | Type | Description |
|---|---|---|
| order | IBridgeComponent.BridgeOrder | |
| encoder | address | |
| guarded | bool |
_setMaxBridgeLossBps
Internal logic to set the maximum allowed relative value loss for transfers via a given bridge.
function _setMaxBridgeLossBps(uint16 bridgeId, uint256 newMaxBridgeLossBps) internal;Parameters
| Name | Type | Description |
|---|---|---|
| bridgeId | uint16 | |
| newMaxBridgeLossBps | uint256 |
_setBridgeCooldownDuration
Internal logic to set the cooldown duration for bridge transfers.
function _setBridgeCooldownDuration(uint256 newBridgeCooldownDuration) internal;Parameters
| Name | Type | Description |
|---|---|---|
| newBridgeCooldownDuration | uint256 |
_addRecipient
Internal logic to add a whitelisted recipient for bridge transfer to a given foreign chain.
function _addRecipient(uint256 foreignChainId, address recipient) internal;Parameters
| Name | Type | Description |
|---|---|---|
| foreignChainId | uint256 | |
| recipient | address |
_removeRecipient
Internal logic to remove a whitelisted recipient for bridge transfer to a given foreign chain.
function _removeRecipient(uint256 foreignChainId, address recipient) internal;Parameters
| Name | Type | Description |
|---|---|---|
| foreignChainId | uint256 | |
| recipient | address |
_checkAndSetCooldown
Checks cooldown for a given bridge and updates its last guarded outgoing transfer timestamp.
function _checkAndSetCooldown(uint16 bridgeId) internal;Parameters
| Name | Type | Description |
|---|---|---|
| bridgeId | uint16 |