@@ -19,24 +19,17 @@ contract MyOApp is OApp, OAppOptionsType3 {
1919 * @notice Sends a message from the source chain to a destination chain.
2020 * @param _dstEid The endpoint ID of the destination chain.
2121 * @param _message The message string to be sent.
22- * @param _composeMsg Extra “compose” bytes appended after the string.
2322 * @param _options Additional options for message execution.
2423 * @dev Encodes the message as bytes and sends it using the `_lzSend` internal function.
2524 * @return receipt A `MessagingReceipt` struct containing details of the message sent.
2625 */
2726 function send (
2827 uint32 _dstEid ,
2928 string calldata _message ,
30- bytes calldata _composeMsg ,
3129 bytes calldata _options
3230 ) external payable returns (MessagingReceipt memory receipt ) {
33- bytes memory _payload = abi.encodePacked (
34- abi.encode (uint256 (bytes (_message).length )),
35- bytes (_message),
36- _composeMsg
37- );
38- uint8 msgType = _composeMsg.length > 0 ? StringMsgCodec.COMPOSED_TYPE : StringMsgCodec.VANILLA_TYPE;
39- bytes memory options = combineOptions (_dstEid, msgType, _options);
31+ bytes memory _payload = abi.encodePacked (abi.encode (uint256 (bytes (_message).length )), bytes (_message));
32+ bytes memory options = combineOptions (_dstEid, StringMsgCodec.VANILLA_TYPE, _options);
4033 receipt = _lzSend (_dstEid, _payload, options, MessagingFee (msg .value , 0 ), payable (msg .sender ));
4134 }
4235
@@ -51,17 +44,11 @@ contract MyOApp is OApp, OAppOptionsType3 {
5144 function quote (
5245 uint32 _dstEid ,
5346 string calldata _message ,
54- bytes calldata _composeMsg ,
5547 bytes calldata _options ,
5648 bool _payInLzToken
5749 ) public view returns (MessagingFee memory fee ) {
58- bytes memory payload = abi.encodePacked (
59- abi.encode (uint256 (bytes (_message).length )),
60- bytes (_message),
61- _composeMsg
62- );
63- uint8 msgType = _composeMsg.length > 0 ? StringMsgCodec.COMPOSED_TYPE : StringMsgCodec.VANILLA_TYPE;
64- bytes memory options = combineOptions (_dstEid, msgType, _options);
50+ bytes memory payload = abi.encodePacked (abi.encode (uint256 (bytes (_message).length )), bytes (_message));
51+ bytes memory options = combineOptions (_dstEid, StringMsgCodec.VANILLA_TYPE, _options);
6552 fee = _quote (_dstEid, payload, options, _payInLzToken);
6653 }
6754
@@ -84,8 +71,7 @@ contract MyOApp is OApp, OAppOptionsType3 {
8471 address /*_executor*/ ,
8572 bytes calldata /*_extraData*/
8673 ) internal override {
87- ( string memory stringValue , ) = StringMsgCodec.decode (payload);
74+ string memory stringValue = StringMsgCodec.decode (payload);
8875 data = stringValue;
89- // TODO: process _composeMsg
9076 }
9177}
0 commit comments