IAssetHandler

Git Source

Author: Matter Labs

Used for any asset handler and called by the AssetRouter

Note: security-contact: security@matterlabs.dev

Functions

bridgeMint

Note, that while payable, this function will only receive base token on L2 chains, while L1 the provided msg.value is always 0. However, this may change in the future, so if your AssetHandler implementation relies on it, it is better to explicitly check it.

function bridgeMint(uint256 _chainId, bytes32 _assetId, bytes calldata _data)
  external
  payable;

Parameters

NameTypeDescription
_chainIduint256the chainId that the message is from
_assetIdbytes32the assetId of the asset being bridged
_databytesthe actual data specified for the function

bridgeBurn

Burns bridged tokens and returns the calldata for L2 <-> L1 message.

In case of native token vault _data is the tuple of _depositAmount and _l2Receiver.

function bridgeBurn(
  uint256 _chainId,
  uint256 _msgValue,
  bytes32 _assetId,
  address _originalCaller,
  bytes calldata _data
) external payable returns (bytes memory _bridgeMintData);

Parameters

NameTypeDescription
_chainIduint256the chainId that the message will be sent to
_msgValueuint256the msg.value of the L2 transaction. For now it is always 0.
_assetIdbytes32the assetId of the asset being bridged
_originalCalleraddressthe original caller of the
_databytesthe actual data specified for the function

Returns

NameTypeDescription
_bridgeMintDatabytesThe calldata used by counterpart asset handler to unlock tokens for recipient.

Events

BridgeMint

Emitted when a token is minted

event BridgeMint(
  uint256 indexed chainId,
  bytes32 indexed assetId,
  address receiver,
  uint256 amount
);

BridgeBurn

Emitted when a token is burned

event BridgeBurn(
  uint256 indexed chainId,
  bytes32 indexed assetId,
  address indexed sender,
  address receiver,
  uint256 amount
);