IBridgehub
Inherits: IAssetHandler, IL1AssetHandler
Author: Matter Labs
Note: security-contact: security@matterlabs.dev
Functions
setPendingAdmin
Starts the transfer of admin rights. Only the current admin or owner can propose a new pending one.
New admin can accept admin rights by calling acceptAdmin
function.
function setPendingAdmin(address _newPendingAdmin) external;
Parameters
Name | Type | Description |
---|---|---|
_newPendingAdmin | address | Address of the new admin |
acceptAdmin
Accepts transfer of admin rights. Only pending admin can accept the role.
function acceptAdmin() external;
chainTypeManagerIsRegistered
Getters
function chainTypeManagerIsRegistered(address _chainTypeManager)
external
view
returns (bool);
chainTypeManager
function chainTypeManager(uint256 _chainId) external view returns (address);
assetIdIsRegistered
function assetIdIsRegistered(bytes32 _baseTokenAssetId)
external
view
returns (bool);
baseToken
function baseToken(uint256 _chainId) external view returns (address);
baseTokenAssetId
function baseTokenAssetId(uint256 _chainId) external view returns (bytes32);
sharedBridge
function sharedBridge() external view returns (address);
messageRoot
function messageRoot() external view returns (IMessageRoot);
getZKChain
function getZKChain(uint256 _chainId) external view returns (address);
getAllZKChains
function getAllZKChains() external view returns (address[] memory);
getAllZKChainChainIDs
function getAllZKChainChainIDs() external view returns (uint256[] memory);
migrationPaused
function migrationPaused() external view returns (bool);
admin
function admin() external view returns (address);
assetRouter
function assetRouter() external view returns (address);
proveL2MessageInclusion
Mailbox forwarder
function proveL2MessageInclusion(
uint256 _chainId,
uint256 _batchNumber,
uint256 _index,
L2Message calldata _message,
bytes32[] calldata _proof
) external view returns (bool);
proveL2LogInclusion
function proveL2LogInclusion(
uint256 _chainId,
uint256 _batchNumber,
uint256 _index,
L2Log memory _log,
bytes32[] calldata _proof
) external view returns (bool);
proveL1ToL2TransactionStatus
function proveL1ToL2TransactionStatus(
uint256 _chainId,
bytes32 _l2TxHash,
uint256 _l2BatchNumber,
uint256 _l2MessageIndex,
uint16 _l2TxNumberInBatch,
bytes32[] calldata _merkleProof,
TxStatus _status
) external view returns (bool);
requestL2TransactionDirect
function requestL2TransactionDirect(
L2TransactionRequestDirect calldata _request
) external payable returns (bytes32 canonicalTxHash);
requestL2TransactionTwoBridges
function requestL2TransactionTwoBridges(
L2TransactionRequestTwoBridgesOuter calldata _request
) external payable returns (bytes32 canonicalTxHash);
l2TransactionBaseCost
function l2TransactionBaseCost(
uint256 _chainId,
uint256 _gasPrice,
uint256 _l2GasLimit,
uint256 _l2GasPerPubdataByteLimit
) external view returns (uint256);
createNewChain
function createNewChain(
uint256 _chainId,
address _chainTypeManager,
bytes32 _baseTokenAssetId,
uint256 _salt,
address _admin,
bytes calldata _initData,
bytes[] calldata _factoryDeps
) external returns (uint256 chainId);
addChainTypeManager
function addChainTypeManager(address _chainTypeManager) external;
removeChainTypeManager
function removeChainTypeManager(address _chainTypeManager) external;
addTokenAssetId
function addTokenAssetId(bytes32 _baseTokenAssetId) external;
setAddresses
function setAddresses(
address _sharedBridge,
ICTMDeploymentTracker _l1CtmDeployer,
IMessageRoot _messageRoot
) external;
whitelistedSettlementLayers
function whitelistedSettlementLayers(uint256 _chainId)
external
view
returns (bool);
registerSettlementLayer
function registerSettlementLayer(
uint256 _newSettlementLayerChainId,
bool _isWhitelisted
) external;
settlementLayer
function settlementLayer(uint256 _chainId) external view returns (uint256);
forwardTransactionOnGateway
function forwardTransactionOnGateway(
uint256 _chainId,
bytes32 _canonicalTxHash,
uint64 _expirationTimestamp
) external;
ctmAssetIdFromChainId
function ctmAssetIdFromChainId(uint256 _chainId)
external
view
returns (bytes32);
ctmAssetIdFromAddress
function ctmAssetIdFromAddress(address _ctmAddress)
external
view
returns (bytes32);
l1CtmDeployer
function l1CtmDeployer() external view returns (ICTMDeploymentTracker);
ctmAssetIdToAddress
function ctmAssetIdToAddress(bytes32 _assetInfo)
external
view
returns (address);
setCTMAssetAddress
function setCTMAssetAddress(bytes32 _additionalData, address _assetAddress)
external;
L1_CHAIN_ID
function L1_CHAIN_ID() external view returns (uint256);
registerAlreadyDeployedZKChain
function registerAlreadyDeployedZKChain(uint256 _chainId, address _hyperchain)
external;
getHyperchain
return the ZK chain contract for a chainId
It is a legacy method. Do not use!
function getHyperchain(uint256 _chainId) external view returns (address);
registerLegacyChain
function registerLegacyChain(uint256 _chainId) external;
pauseMigration
function pauseMigration() external;
unpauseMigration
function unpauseMigration() external;
Events
NewPendingAdmin
pendingAdmin is changed
Also emitted when new admin is accepted and in this case, newPendingAdmin
would be zero address
event NewPendingAdmin(
address indexed oldPendingAdmin, address indexed newPendingAdmin
);
NewAdmin
Admin changed
event NewAdmin(address indexed oldAdmin, address indexed newAdmin);
AssetRegistered
CTM asset registered
event AssetRegistered(
bytes32 indexed assetInfo,
address indexed _assetAddress,
bytes32 indexed additionalData,
address sender
);
SettlementLayerRegistered
event SettlementLayerRegistered(
uint256 indexed chainId, bool indexed isWhitelisted
);
MigrationStarted
Emitted when the bridging to the chain is started.
event MigrationStarted(
uint256 indexed chainId,
bytes32 indexed assetId,
uint256 indexed settlementLayerChainId
);
Parameters
Name | Type | Description |
---|---|---|
chainId | uint256 | Chain ID of the ZK chain |
assetId | bytes32 | Asset ID of the token for the zkChain's CTM |
settlementLayerChainId | uint256 | The chain id of the settlement layer the chain migrates to. |
MigrationFinalized
Emitted when the bridging to the chain is complete.
event MigrationFinalized(
uint256 indexed chainId, bytes32 indexed assetId, address indexed zkChain
);
Parameters
Name | Type | Description |
---|---|---|
chainId | uint256 | Chain ID of the ZK chain |
assetId | bytes32 | Asset ID of the token for the zkChain's CTM |
zkChain | address | The address of the ZK chain on the chain where it is migrated to. |
NewChain
event NewChain(
uint256 indexed chainId,
address chainTypeManager,
address indexed chainGovernance
);
ChainTypeManagerAdded
event ChainTypeManagerAdded(address indexed chainTypeManager);
ChainTypeManagerRemoved
event ChainTypeManagerRemoved(address indexed chainTypeManager);
BaseTokenAssetIdRegistered
event BaseTokenAssetIdRegistered(bytes32 indexed assetId);