CaliberMailbox
Inherits: MakinaGovernable, ReentrancyGuard, BridgeController, ICaliberMailbox
Constants
hubChainId
Chain ID of the hub.
uint256 public immutable hubChainId;Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
CaliberMailboxStorageLocation
bytes32 private constant CaliberMailboxStorageLocation =
0xc8f2c10c9147366283b13eb82b7eca93d88636f13eec15d81ed4c6aa5006aa00;Functions
_getCaliberMailboxStorage
function _getCaliberMailboxStorage() private pure returns (CaliberMailboxStorage storage $);Returns
| Name | Type | Description |
|---|---|---|
| $ | CaliberMailboxStorage |
constructor
constructor(address _registry, uint256 _hubChainId) MakinaContext(_registry);Parameters
| Name | Type | Description |
|---|---|---|
| _registry | address | |
| _hubChainId | uint256 |
initialize
Initializer of the contract.
function initialize(IMakinaGovernable.MakinaGovernableInitParams calldata mgParams, uint256 initialCooldownDuration)
external
override
initializer;Parameters
| Name | Type | Description |
|---|---|---|
| mgParams | IMakinaGovernable.MakinaGovernableInitParams | The makina governable initialization parameters. |
| initialCooldownDuration | uint256 | The duration of the cooldown period for outgoing bridge transfers. |
caliber
Address of the associated caliber.
function caliber() external view override returns (address);Returns
| Name | Type | Description |
|---|---|---|
| <none> | address |
cooldownDuration
Duration of the cooldown period for outgoing bridge transfers.
function cooldownDuration() external view override returns (uint256);Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
getHubBridgeAdapter
Returns the address of the hub bridge adapter for a given bridge ID.
function getHubBridgeAdapter(uint16 bridgeId) external view override returns (address);Parameters
| Name | Type | Description |
|---|---|---|
| bridgeId | uint16 | The ID of the bridge. |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | address |
getSpokeCaliberAccountingData
Returns the accounting data of the associated caliber.
function getSpokeCaliberAccountingData() external view override returns (SpokeCaliberAccountingData memory data);Returns
| Name | Type | Description |
|---|---|---|
| data | SpokeCaliberAccountingData | data The accounting data. |
manageTransfer
Manages the transfer of tokens between a machine and a caliber. The transfer direction depends on the caller.
function manageTransfer(address token, uint256 amount, bytes calldata data) external override nonReentrant;Parameters
| Name | Type | Description |
|---|---|---|
| token | address | The address of the token. |
| amount | uint256 | The amount of tokens to transfer. |
| data | bytes | ABI-encoded parameters required for bridge-related transfers. Ignored for transfers between a machine and its hub caliber. |
sendOutBridgeTransfer
Executes a scheduled outgoing bridge transfer.
function sendOutBridgeTransfer(uint16 bridgeId, uint256 transferId, bytes calldata data)
external
override
onlyOperator;Parameters
| Name | Type | Description |
|---|---|---|
| bridgeId | uint16 | The ID of the bridge. |
| transferId | uint256 | The ID of the transfer to execute. |
| data | bytes | The optional data needed to execute the transfer. |
authorizeInBridgeTransfer
Registers a message hash as authorized for an incoming bridge transfer.
function authorizeInBridgeTransfer(uint16 bridgeId, bytes32 messageHash)
external
override
notRecoveryMode
onlyMechanic;Parameters
| Name | Type | Description |
|---|---|---|
| bridgeId | uint16 | The ID of the bridge. |
| messageHash | bytes32 | The hash of the message to authorize. |
claimInBridgeTransfer
Transfers a received bridge transfer out of the corresponding bridge adapter.
function claimInBridgeTransfer(uint16 bridgeId, uint256 transferId) external override onlyOperator;Parameters
| Name | Type | Description |
|---|---|---|
| bridgeId | uint16 | The ID of the bridge. |
| transferId | uint256 | The ID of the transfer to claim. |
cancelOutBridgeTransfer
Cancels an outgoing bridge transfer.
function cancelOutBridgeTransfer(uint16 bridgeId, uint256 transferId) external override onlyOperator;Parameters
| Name | Type | Description |
|---|---|---|
| bridgeId | uint16 | The ID of the bridge. |
| transferId | uint256 | The ID of the transfer to cancel. |
setCaliber
Sets the associated caliber address.
function setCaliber(address _caliber) external override onlyFactory;Parameters
| Name | Type | Description |
|---|---|---|
| _caliber | address | The address of the associated caliber. |
setHubBridgeAdapter
Registers a hub bridge adapter.
function setHubBridgeAdapter(uint16 bridgeId, address adapter) external override restricted;Parameters
| Name | Type | Description |
|---|---|---|
| bridgeId | uint16 | The ID of the bridge. |
| adapter | address | The address of the hub bridge adapter. |
setCooldownDuration
Sets the duration of the cooldown period for outgoing bridge transfers.
function setCooldownDuration(uint256 newCooldownDuration) external override onlyRiskManagerTimelock;Parameters
| Name | Type | Description |
|---|---|---|
| newCooldownDuration | uint256 | The new duration in seconds. |
disableOutTransfer
Disables outgoing transfers for a bridge.
function disableOutTransfer(uint16 bridgeId) external override onlyRiskManagerTimelock;Parameters
| Name | Type | Description |
|---|---|---|
| bridgeId | uint16 | The ID of the bridge. |
enableOutTransfer
Enables outgoing transfers for a bridge.
function enableOutTransfer(uint16 bridgeId) external override onlyRiskManagerTimelock;Parameters
| Name | Type | Description |
|---|---|---|
| bridgeId | uint16 | The ID of the bridge. |
setMaxBridgeLossBps
Sets the maximum allowed value loss in basis points for transfers via this bridge.
function setMaxBridgeLossBps(uint16 bridgeId, uint256 maxBridgeLossBps) external override onlyRiskManagerTimelock;Parameters
| Name | Type | Description |
|---|---|---|
| bridgeId | uint16 | The ID of the bridge. |
| maxBridgeLossBps | uint256 | The maximum allowed value loss in basis points. |
resetBridgingState
Resets internal bridge counters for a given token, and withdraws token balances held by all bridge adapters.
This function is intended to be used by the DAO to realign bridge accounting state and maintain protocol consistency, typically in response to operator deviations, external bridge discrepancies, or unbounded counter growth.
function resetBridgingState(address token) external override onlySecurityCouncil;Parameters
| Name | Type | Description |
|---|---|---|
| token | address | The address of the token. |
_getBridgeCounters
Returns the current bridge counters for both incoming and outgoing transfers.
function _getBridgeCounters() internal view returns (bytes[] memory bridgesIn, bytes[] memory bridgesOut);Returns
| Name | Type | Description |
|---|---|---|
| bridgesIn | bytes[] | |
| bridgesOut | bytes[] |
_getSnapshotContext
Constructs the snapshot context for the current state.
function _getSnapshotContext() internal view returns (SpokeSnapshotContext memory);Returns
| Name | Type | Description |
|---|---|---|
| <none> | SpokeSnapshotContext |
Structs
CaliberMailboxStorage
Note:
- storage-location: erc7201:makina.storage.CaliberMailbox
struct CaliberMailboxStorage {
address _deprecated_0;
address _caliber;
mapping(uint16 bridgeId => address adapter) _hubBridgeAdapters;
EnumerableMap.AddressToUintMap _bridgesIn;
EnumerableMap.AddressToUintMap _bridgesOut;
uint256 _cooldownDuration;
mapping(uint16 bridgeId => uint256 timestamp) _lastBridgeOutTimestamp;
}Properties
| Name | Type | Description |
|---|---|---|
| _deprecated_0 | address | |
| _caliber | address | |
| _hubBridgeAdapters | mapping(uint16 bridgeId => address adapter) | |
| _bridgesIn | EnumerableMap.AddressToUintMap | |
| _bridgesOut | EnumerableMap.AddressToUintMap | |
| _cooldownDuration | uint256 | |
| _lastBridgeOutTimestamp | mapping(uint16 bridgeId => uint256 timestamp) |