Skip to content
LogoLogo

CaliberMailbox

Git Source

Inherits: MakinaGovernable, ReentrancyGuard, BridgeController, ICaliberMailbox

Constants

hubChainId

Chain ID of the hub.

uint256 public immutable hubChainId;

Returns

NameTypeDescription
<none>uint256

CaliberMailboxStorageLocation

bytes32 private constant CaliberMailboxStorageLocation =
        0xc8f2c10c9147366283b13eb82b7eca93d88636f13eec15d81ed4c6aa5006aa00;

Functions

_getCaliberMailboxStorage

function _getCaliberMailboxStorage() private pure returns (CaliberMailboxStorage storage $);

Returns

NameTypeDescription
$CaliberMailboxStorage

constructor

constructor(address _registry, uint256 _hubChainId) MakinaContext(_registry);

Parameters

NameTypeDescription
_registryaddress
_hubChainIduint256

initialize

Initializer of the contract.

function initialize(IMakinaGovernable.MakinaGovernableInitParams calldata mgParams, uint256 initialCooldownDuration)
        external
        override
        initializer;

Parameters

NameTypeDescription
mgParamsIMakinaGovernable.MakinaGovernableInitParamsThe makina governable initialization parameters.
initialCooldownDurationuint256The duration of the cooldown period for outgoing bridge transfers.

caliber

Address of the associated caliber.

function caliber() external view override returns (address);

Returns

NameTypeDescription
<none>address

cooldownDuration

Duration of the cooldown period for outgoing bridge transfers.

function cooldownDuration() external view override returns (uint256);

Returns

NameTypeDescription
<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

NameTypeDescription
bridgeIduint16The ID of the bridge.

Returns

NameTypeDescription
<none>address

getSpokeCaliberAccountingData

Returns the accounting data of the associated caliber.

function getSpokeCaliberAccountingData() external view override returns (SpokeCaliberAccountingData memory data);

Returns

NameTypeDescription
dataSpokeCaliberAccountingDatadata 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

NameTypeDescription
tokenaddressThe address of the token.
amountuint256The amount of tokens to transfer.
databytesABI-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

NameTypeDescription
bridgeIduint16The ID of the bridge.
transferIduint256The ID of the transfer to execute.
databytesThe 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

NameTypeDescription
bridgeIduint16The ID of the bridge.
messageHashbytes32The 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

NameTypeDescription
bridgeIduint16The ID of the bridge.
transferIduint256The ID of the transfer to claim.

cancelOutBridgeTransfer

Cancels an outgoing bridge transfer.

function cancelOutBridgeTransfer(uint16 bridgeId, uint256 transferId) external override onlyOperator;

Parameters

NameTypeDescription
bridgeIduint16The ID of the bridge.
transferIduint256The ID of the transfer to cancel.

setCaliber

Sets the associated caliber address.

function setCaliber(address _caliber) external override onlyFactory;

Parameters

NameTypeDescription
_caliberaddressThe address of the associated caliber.

setHubBridgeAdapter

Registers a hub bridge adapter.

function setHubBridgeAdapter(uint16 bridgeId, address adapter) external override restricted;

Parameters

NameTypeDescription
bridgeIduint16The ID of the bridge.
adapteraddressThe 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

NameTypeDescription
newCooldownDurationuint256The new duration in seconds.

disableOutTransfer

Disables outgoing transfers for a bridge.

function disableOutTransfer(uint16 bridgeId) external override onlyRiskManagerTimelock;

Parameters

NameTypeDescription
bridgeIduint16The ID of the bridge.

enableOutTransfer

Enables outgoing transfers for a bridge.

function enableOutTransfer(uint16 bridgeId) external override onlyRiskManagerTimelock;

Parameters

NameTypeDescription
bridgeIduint16The 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

NameTypeDescription
bridgeIduint16The ID of the bridge.
maxBridgeLossBpsuint256The 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

NameTypeDescription
tokenaddressThe 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

NameTypeDescription
bridgesInbytes[]
bridgesOutbytes[]

_getSnapshotContext

Constructs the snapshot context for the current state.

function _getSnapshotContext() internal view returns (SpokeSnapshotContext memory);

Returns

NameTypeDescription
<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

NameTypeDescription
_deprecated_0address
_caliberaddress
_hubBridgeAdaptersmapping(uint16 bridgeId => address adapter)
_bridgesInEnumerableMap.AddressToUintMap
_bridgesOutEnumerableMap.AddressToUintMap
_cooldownDurationuint256
_lastBridgeOutTimestampmapping(uint16 bridgeId => uint256 timestamp)