123456789101112131415161718192021222324252627 |
- // SPDX-License-Identifier: UNLICENSED
- pragma solidity ^0.8.0;
- import "@layerzerolabs/solidity-examples/contracts/lzApp/interfaces/ILayerZeroEndpoint.sol";
- contract fakeSender {
- ILayerZeroEndpoint public endpoint;
- constructor(address _endpoint) {
- endpoint = ILayerZeroEndpoint(_endpoint);
- }
- // an endpoint is the contract which has the send() function
- function send(address _remoteAddress,address _localAddress, uint16 _dstChainId) external payable {
- // remote address concated with local address packed into 40 bytes
- 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")
- );
- }
- }
|