LayerZeroV2BridgeEncoder
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
| Name | Type | Description |
|---|---|---|
| oft | address |
Returns
| Name | Type | Description |
|---|---|---|
| isRegistered | bool |
_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
| Name | Type | Description |
|---|---|---|
| initialAuthority | address |
getLzEndpointId
EVM chain ID => LayerZero endpoint ID
function getLzEndpointId(uint256 evmChainId) public view override returns (uint32);Parameters
| Name | Type | Description |
|---|---|---|
| evmChainId | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| <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
| Name | Type | Description |
|---|---|---|
| order | IBridgeComponent.BridgeOrder | The bridge transfer params. |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | address | The address of the approval target. |
| <none> | address | The address of the execution target. |
| <none> | uint256 | The value to pass along with the calldata. |
| <none> | bytes | The 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
| Name | Type | Description |
|---|---|---|
| evmChainId | uint256 | The EVM chain ID. |
| lzEndpointId | uint32 | The LayerZero endpoint ID. |
addOft
Registers an OFT contract.
function addOft(address oft) external override restricted;Parameters
| Name | Type | Description |
|---|---|---|
| oft | address | The address of the OFT. |
removeOft
Unregisters an OFT contract.
function removeOft(address oft) external override restricted;Parameters
| Name | Type | Description |
|---|---|---|
| oft | address | The address of the OFT. |
_getLzReceiveOption
Internal logic to craft lzReceive option.
function _getLzReceiveOption(uint128 _lzReceiveGas) internal pure returns (bytes memory);Parameters
| Name | Type | Description |
|---|---|---|
| _lzReceiveGas | uint128 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bytes |