// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; import "@layerzerolabs/solidity-examples/contracts/lzApp/interfaces/ILayerZeroEndpoint.sol"; contract sender { ILayerZeroEndpoint public endpoint; constructor(address _endpoint) { endpoint = ILayerZeroEndpoint(_endpoint); } // an endpoint is the contract which has the send() function function send(address _remoteAddress, uint16 _dstChainId) external payable { // remote address concated with local address packed into 40 bytes address localAddress = address(this); bytes memory remoteAndLocalAddresses = abi.encodePacked(_remoteAddress, localAddress); // call send() to send a message/payload to another chain endpoint.send{value: msg.value}( _dstChainId, // destination LayerZero chainId remoteAndLocalAddresses, // send to this address on the destination bytes("hello"), // bytes payload payable(msg.sender), // refund address address(0x0), // future parameter bytes("") // adapterParams (see "Advanced Features") ); } }