Skip to content
LogoLogo

LayerZeroV2BridgeAdapter

Git Source

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

NameTypeDescription
_registryaddress
_layerZeroV2Endpointaddress

initialize

Initializer of the contract.

function initialize(address _controller, bytes calldata) external override initializer;

Parameters

NameTypeDescription
_controlleraddressThe bridge controller contract.
_bytesThe 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

NameTypeDescription
_fromaddressThe address initiating the composition, typically the OApp where the lzReceive was called.
_bytes32The unique identifier for the corresponding LayerZero src/dst tx.
_messagebytesThe composed message payload in bytes. NOT necessarily the same payload passed via lzReceive.
_addressThe address of the executor for the composed message.
_bytesAdditional 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

NameTypeDescription
transferIduint256

Returns

NameTypeDescription
<none>uint256

_checkOutBridgeTransferIsCancellable

Checks if an outgoing bridge transfer is in a cancellable state.

function _checkOutBridgeTransferIsCancellable(uint256 transferId) internal override;

Parameters

NameTypeDescription
transferIduint256

_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

NameTypeDescription
transferIduint256
databytes

Events

LzGuidCreated

event LzGuidCreated(bytes32 indexed guid, uint256 indexed transferId);

Parameters

NameTypeDescription
guidbytes32
transferIduint256