BridgeController
Inherits: MakinaContext, IBridgeController
Constants
MAX_BPS
Full scale value in basis points
uint256 private constant MAX_BPS = 10_000;BridgeControllerStorageLocation
bytes32 private constant BridgeControllerStorageLocation =
0x7363d524082cdf545f1ac33985598b84d2470b8b4fbcc6cb47698cc1b2a03500;Functions
_getBridgeControllerStorage
function _getBridgeControllerStorage() internal pure returns (BridgeControllerStorage storage $);Returns
| Name | Type | Description |
|---|---|---|
| $ | BridgeControllerStorage |
onlyFactory
modifier onlyFactory();isBridgeSupported
Bridge ID => Is bridge adapter deployed.
function isBridgeSupported(uint16 bridgeId) external view override returns (bool);Parameters
| Name | Type | Description |
|---|---|---|
| bridgeId | uint16 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bool |
isOutTransferEnabled
Bridge ID => Is outgoing transfer enabled.
function isOutTransferEnabled(uint16 bridgeId) external view override returns (bool);Parameters
| Name | Type | Description |
|---|---|---|
| bridgeId | uint16 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bool |
getBridgeAdapter
Bridge ID => Address of the associated bridge adapter.
function getBridgeAdapter(uint16 bridgeId) public view override returns (address);Parameters
| Name | Type | Description |
|---|---|---|
| bridgeId | uint16 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | address |
getMaxBridgeLossBps
Bridge ID => Max allowed value loss in basis points for transfers via this bridge.
function getMaxBridgeLossBps(uint16 bridgeId) external view override returns (uint256);Parameters
| Name | Type | Description |
|---|---|---|
| bridgeId | uint16 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
setBridgeAdapter
Sets a bridge adapter instance for a given bridge ID.
function setBridgeAdapter(uint16 bridgeId, address bridgeAdapter, uint256 initialMaxBridgeLossBps)
external
override
onlyFactory;Parameters
| Name | Type | Description |
|---|---|---|
| bridgeId | uint16 | The ID of the bridge. |
| bridgeAdapter | address | The address of the new bridge adapter instance. |
| initialMaxBridgeLossBps | uint256 | The initial maximum allowed value loss in basis points for transfers via this bridge. |
_disableOutTransfer
Internal logic to disable outgoing transfers for a given bridge.
function _disableOutTransfer(uint16 bridgeId) internal;Parameters
| Name | Type | Description |
|---|---|---|
| bridgeId | uint16 |
_enableOutTransfer
Internal logic to enable outgoing transfers for a given bridge.
function _enableOutTransfer(uint16 bridgeId) internal;Parameters
| Name | Type | Description |
|---|---|---|
| bridgeId | uint16 |
_setMaxBridgeLossBps
Internal logic to set the max allowed value loss in basis points for transfers via a given bridge.
function _setMaxBridgeLossBps(uint16 bridgeId, uint256 maxBridgeLossBps) internal;Parameters
| Name | Type | Description |
|---|---|---|
| bridgeId | uint16 | |
| maxBridgeLossBps | uint256 |
_isBridgeAdapter
Returns whether the given address is a registered bridge adapter.
function _isBridgeAdapter(address adapter) internal view returns (bool);Parameters
| Name | Type | Description |
|---|---|---|
| adapter | address |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bool |
_scheduleOutBridgeTransfer
Internal logic to schedule an outgoing bridge transfer.
function _scheduleOutBridgeTransfer(
uint16 bridgeId,
uint256 destinationChainId,
address recipient,
address inputToken,
uint256 inputAmount,
uint256 minOutputAmount
) internal;Parameters
| Name | Type | Description |
|---|---|---|
| bridgeId | uint16 | |
| destinationChainId | uint256 | |
| recipient | address | |
| inputToken | address | |
| inputAmount | uint256 | |
| minOutputAmount | uint256 |
_sendOutBridgeTransfer
Internal logic to execute a scheduled outgoing bridge transfer.
function _sendOutBridgeTransfer(uint16 bridgeId, uint256 transferId, bytes calldata data) internal;Parameters
| Name | Type | Description |
|---|---|---|
| bridgeId | uint16 | |
| transferId | uint256 | |
| data | bytes |
_authorizeInBridgeTransfer
Internal logic to register a message hash as authorized for an incoming bridge transfer.
function _authorizeInBridgeTransfer(uint16 bridgeId, bytes32 messageHash) internal;Parameters
| Name | Type | Description |
|---|---|---|
| bridgeId | uint16 | |
| messageHash | bytes32 |
_claimInBridgeTransfer
Internal logic to transfer a received bridge transfer out of the corresponding bridge adapter.
function _claimInBridgeTransfer(uint16 bridgeId, uint256 transferId) internal;Parameters
| Name | Type | Description |
|---|---|---|
| bridgeId | uint16 | |
| transferId | uint256 |
_cancelOutBridgeTransfer
Internal logic to cancel an outgoing bridge transfer.
function _cancelOutBridgeTransfer(uint16 bridgeId, uint256 transferId) internal;Parameters
| Name | Type | Description |
|---|---|---|
| bridgeId | uint16 | |
| transferId | uint256 |
Structs
BridgeControllerStorage
Note:
- storage-location: erc7201:makina.storage.BridgeController
struct BridgeControllerStorage {
uint16[] _supportedBridges;
mapping(uint16 bridgeId => address adapter) _bridgeAdapters;
mapping(uint16 bridgeId => uint256 maxBridgeLossBps) _maxBridgeLossBps;
mapping(uint16 bridgeId => bool isOutTransferEnabled) _isOutTransferEnabled;
mapping(address addr => bool isAdapter) _isBridgeAdapter;
}Properties
| Name | Type | Description |
|---|---|---|
| _supportedBridges | uint16[] | |
| _bridgeAdapters | mapping(uint16 bridgeId => address adapter) | |
| _maxBridgeLossBps | mapping(uint16 bridgeId => uint256 maxBridgeLossBps) | |
| _isOutTransferEnabled | mapping(uint16 bridgeId => bool isOutTransferEnabled) | |
| _isBridgeAdapter | mapping(address addr => bool isAdapter) |