Skip to content

Commit

Permalink
implemented internal _send (#877)
Browse files Browse the repository at this point in the history
  • Loading branch information
ravinagill15 committed Sep 12, 2024
1 parent 5dfb565 commit dfd62f8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/oft-evm/contracts/NativeOFTAdapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ abstract contract NativeOFTAdapter is OFTCore {
revert IncorrectMessageValue(msg.value, requiredMsgValue);
}

return super.send(_sendParam, _fee, _refundAddress);
return _send(_sendParam, _fee, _refundAddress);
}

/**
Expand Down
25 changes: 24 additions & 1 deletion packages/oft-evm/contracts/OFTCore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,30 @@ abstract contract OFTCore is IOFT, OApp, OAppPreCrimeSimulator, OAppOptionsType3
SendParam calldata _sendParam,
MessagingFee calldata _fee,
address _refundAddress
) public payable virtual returns (MessagingReceipt memory msgReceipt, OFTReceipt memory oftReceipt) {
) external payable virtual returns (MessagingReceipt memory msgReceipt, OFTReceipt memory oftReceipt) {
return _send(_sendParam, _fee, _refundAddress);
}

/**
* @dev Internal function to execute the send operation.
* @param _sendParam The parameters for the send operation.
* @param _fee The calculated fee for the send() operation.
* - nativeFee: The native fee.
* - lzTokenFee: The lzToken fee.
* @param _refundAddress The address to receive any excess funds.
* @return msgReceipt The receipt for the send operation.
* @return oftReceipt The OFT receipt information.
*
* @dev MessagingReceipt: LayerZero msg receipt
* - guid: The unique identifier for the sent message.
* - nonce: The nonce of the sent message.
* - fee: The LayerZero fee incurred for the message.
*/
function _send(
SendParam calldata _sendParam,
MessagingFee calldata _fee,
address _refundAddress
) internal virtual returns (MessagingReceipt memory msgReceipt, OFTReceipt memory oftReceipt) {
// @dev Applies the token transfers regarding this send() operation.
// - amountSentLD is the amount in local decimals that was ACTUALLY sent/debited from the sender.
// - amountReceivedLD is the amount in local decimals that will be received/credited to the recipient on the remote OFT instance.
Expand Down

0 comments on commit dfd62f8

Please sign in to comment.