L2CrossDomainMessenger
Blast0x4200000000000000000000000000000000000007
Proxy implementation: 0x5f7b80cbea82dd18852e3e771e6b43e6f3ef8cbf
Solidity v0.8.15+commit.e14f2714
Overview
Read Functions
Returns
| Name | Type | Description |
|---|---|---|
| — | uint16 |
Returns
| Name | Type | Description |
|---|---|---|
| — | uint64 |
Returns
| Name | Type | Description |
|---|---|---|
| — | uint64 |
Returns
| Name | Type | Description |
|---|---|---|
| — | uint64 |
Returns
| Name | Type | Description |
|---|---|---|
| — | address |
Returns
| Name | Type | Description |
|---|---|---|
| — | uint64 |
Returns
| Name | Type | Description |
|---|---|---|
| — | uint64 |
Returns
| Name | Type | Description |
|---|---|---|
| — | uint64 |
Returns
| Name | Type | Description |
|---|---|---|
| — | uint64 |
Computes the amount of gas required to guarantee that a given message will be received on the other chain without running out of gas. Guaranteeing that a message will not run out of gas is important because this ensures that a message can always be replayed on the other chain if it fails to execute completely.
Parameters
| Name | Type | Description |
|---|---|---|
| _message | bytes | Message to compute the amount of required gas for. |
| _minGasLimit | uint32 | Minimum desired gas limit when message goes to target. |
Returns
| Name | Type | Description |
|---|---|---|
| — | uint64 | Amount of gas required to guarantee message receipt. |
Parameters
| Name | Type | Description |
|---|---|---|
| — | bytes32 |
Returns
| Name | Type | Description |
|---|---|---|
| — | bool |
Legacy getter for the remote messenger. Use otherMessenger going forward.
Returns
| Name | Type | Description |
|---|---|---|
| — | address | Address of the L1CrossDomainMessenger contract. |
Retrieves the next message nonce. Message version will be added to the upper two bytes of the message nonce. Message version allows us to treat messages as having different structures.
Returns
| Name | Type | Description |
|---|---|---|
| — | uint256 | Nonce of the next message to be sent, with added message version. |
Parameters
| Name | Type | Description |
|---|---|---|
| — | bytes32 |
Returns
| Name | Type | Description |
|---|---|---|
| — | bool |
Getter for the semantic version of the contract. This is not meant to be used onchain but instead meant to be used by offchain tooling.
Returns
| Name | Type | Description |
|---|---|---|
| — | string | Semver contract version as a string. |
Retrieves the address of the contract or wallet that initiated the currently executing message on the other chain. Will throw an error if there is no message currently being executed. Allows the recipient of a call to see who triggered it.
Returns
| Name | Type | Description |
|---|---|---|
| — | address | Address of the sender of the currently executing message on the other chain. |
Write Functions
Initializer.
Relays a message that was sent by the other CrossDomainMessenger contract. Can only be executed via cross-chain call from the other messenger OR if the message was already received once and is currently being replayed.
Parameters
| Name | Type | Description |
|---|---|---|
| _nonce | uint256 | Nonce of the message being relayed. |
| _sender | address | Address of the user who sent the message. |
| _target | address | Address that the message is targeted at. |
| _value | uint256 | ETH value to send with the message. |
| _minGasLimit | uint256 | Minimum amount of gas that the message can be executed with. |
| _message | bytes | Message to send to the target. |
Sends a message to some target address on the other chain. Note that if the call always reverts, then the message will be unrelayable, and any ETH sent will be permanently locked. The same will occur if the target on the other chain is considered unsafe (see the _isUnsafeTarget() function).
Parameters
| Name | Type | Description |
|---|---|---|
| _target | address | Target contract or wallet address. |
| _message | bytes | Message to trigger the target address with. |
| _minGasLimit | uint32 | Minimum gas limit that the message can be executed with. |
Events
Emitted whenever a message fails to be relayed on this chain.
| Name | Type | Indexed | Description |
|---|---|---|---|
| msgHash | bytes32 | ✓ | Hash of the message that failed to be relayed. |
| Name | Type | Indexed | Description |
|---|---|---|---|
| version | uint8 |
Emitted whenever a message is successfully relayed on this chain.
| Name | Type | Indexed | Description |
|---|---|---|---|
| msgHash | bytes32 | ✓ | Hash of the message that was relayed. |
Emitted whenever a message is sent to the other chain.
| Name | Type | Indexed | Description |
|---|---|---|---|
| target | address | ✓ | Address of the recipient of the message. |
| sender | address | Address of the sender of the message. | |
| message | bytes | Message to trigger the recipient address with. | |
| messageNonce | uint256 | Unique nonce attached to the message. | |
| gasLimit | uint256 | Minimum gas limit that the message can be executed with. |
Additional event data to emit, required as of Bedrock. Cannot be merged with the SentMessage event without breaking the ABI of this contract, this is good enough.
| Name | Type | Indexed | Description |
|---|---|---|---|
| sender | address | ✓ | Address of the sender of the message. |
| value | uint256 | ETH value sent along with the message to the recipient. |