Skip to content
LogoLogo

LayerZeroV2BridgeEncoder

Git Source

Inherits: AccessManagedUpgradeable, ILayerZeroV2BridgeEncoder

Constants

EXECUTOR_LZRECEIVE_PREFIX

bytes6 internal constant EXECUTOR_LZRECEIVE_PREFIX = 0x000301001101;

State Variables

isOftRegistered

OFT => Whether the OFT is registered

mapping(address oft => bool isRegistered) public isOftRegistered;

Parameters

NameTypeDescription
oftaddress

Returns

NameTypeDescription
isRegisteredbool

_evmToLzId

mapping(uint256 evmChainId => uint32 lzEndpointId) private _evmToLzId;

_lzToEvmId

mapping(uint32 lzEndpointId => uint256 evmChainId) private _lzToEvmId;

Functions

constructor

constructor();

initialize

function initialize(address initialAuthority) external initializer;

Parameters

NameTypeDescription
initialAuthorityaddress

getLzEndpointId

EVM chain ID => LayerZero endpoint ID

function getLzEndpointId(uint256 evmChainId) public view override returns (uint32);

Parameters

NameTypeDescription
evmChainIduint256

Returns

NameTypeDescription
<none>uint32

getBridgeTransferData

Returns targets, value, and calldata to execute a bridge transfer.

Intended to be called only by a MakinaXModule instance, from which implementations may read caller state via msg.sender.

function getBridgeTransferData(IBridgeComponent.BridgeOrder calldata order)
        external
        view
        override
        returns (address, address, uint256, bytes memory);

Parameters

NameTypeDescription
orderIBridgeComponent.BridgeOrderThe bridge transfer params.

Returns

NameTypeDescription
<none>addressThe address of the approval target.
<none>addressThe address of the execution target.
<none>uint256The value to pass along with the calldata.
<none>bytesThe calldata to execute.

setLzEndpointId

Associates an EVM chain ID with a LayerZero endpoint ID in the contract storage.

function setLzEndpointId(uint256 evmChainId, uint32 lzEndpointId) external override restricted;

Parameters

NameTypeDescription
evmChainIduint256The EVM chain ID.
lzEndpointIduint32The LayerZero endpoint ID.

addOft

Registers an OFT contract.

function addOft(address oft) external override restricted;

Parameters

NameTypeDescription
oftaddressThe address of the OFT.

removeOft

Unregisters an OFT contract.

function removeOft(address oft) external override restricted;

Parameters

NameTypeDescription
oftaddressThe address of the OFT.

_getLzReceiveOption

Internal logic to craft lzReceive option.

function _getLzReceiveOption(uint128 _lzReceiveGas) internal pure returns (bytes memory);

Parameters

NameTypeDescription
_lzReceiveGasuint128

Returns

NameTypeDescription
<none>bytes