LayerZeroV2BridgeAdapter
Inherits: BridgeAdapter, ILayerZeroComposer
Constants
LAYER_ZERO_V2_BRIDGE_ID
uint16 private constant LAYER_ZERO_V2_BRIDGE_ID = 2;Functions
constructor
constructor(address _registry, address _layerZeroV2Endpoint)
BridgeAdapter(_registry, address(0), address(0), _layerZeroV2Endpoint);Parameters
| Name | Type | Description |
|---|---|---|
| _registry | address | |
| _layerZeroV2Endpoint | address |
initialize
Initializer of the contract.
function initialize(address _controller, bytes calldata) external override initializer;Parameters
| Name | Type | Description |
|---|---|---|
| _controller | address | The bridge controller contract. |
| _ | bytes | The optional initialization data. |
receive
Allows the contract to receive Ether.
receive() external payable;lzCompose
Composes a LayerZero message from an OApp.
function lzCompose(
address _from,
bytes32, /*_guid*/
bytes calldata _message,
address, /*_executor*/
bytes calldata /*_extraData*/
)
external
payable
override;Parameters
| Name | Type | Description |
|---|---|---|
| _from | address | The address initiating the composition, typically the OApp where the lzReceive was called. |
| _ | bytes32 | The unique identifier for the corresponding LayerZero src/dst tx. |
| _message | bytes | The composed message payload in bytes. NOT necessarily the same payload passed via lzReceive. |
| _ | address | The address of the executor for the composed message. |
| _ | bytes | Additional arbitrary data in bytes passed by the entity who executes the lzCompose. |
_outBridgeTransferCancelDefault
Internal logic for outgoing bridge transfer cancellation default.
function _outBridgeTransferCancelDefault(uint256 transferId) internal view override returns (uint256);Parameters
| Name | Type | Description |
|---|---|---|
| transferId | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
_checkOutBridgeTransferIsCancellable
Checks if an outgoing bridge transfer is in a cancellable state.
function _checkOutBridgeTransferIsCancellable(uint256 transferId) internal override;Parameters
| Name | Type | Description |
|---|---|---|
| transferId | uint256 |
_sendOutBridgeTransfer
Handles logic specific to the external bridge protocol for sending out a bridge transfer.
function _sendOutBridgeTransfer(uint256 transferId, bytes calldata data) internal override;Parameters
| Name | Type | Description |
|---|---|---|
| transferId | uint256 | |
| data | bytes |
Events
LzGuidCreated
event LzGuidCreated(bytes32 indexed guid, uint256 indexed transferId);Parameters
| Name | Type | Description |
|---|---|---|
| guid | bytes32 | |
| transferId | uint256 |