TempleGold

TempleDAO
Foundry
25,000 USDC
View results
Submission Details
Severity: low
Invalid

Missing Definition of `_buildMsgAndOptions` Function in `TempleGold` Contract

Summary

The TempleGold contract references a _buildMsgAndOptions function within its send function but does not define or import it from any accessible library or contract. This oversight prevents the contract from compiling or executing correctly when attempting to handle LayerZero send operations.

Vulnerability Details

The _buildMsgAndOptions function is crucial for constructing the necessary message and options payloads required by LayerZero for cross-chain send operations. Without its implementation or import, any attempt to call _buildMsgAndOptions within the send function will result in a compilation error or runtime failure. This effectively disables the contract's ability to perform cross-chain transfers as intended.

See the following code:

function send(
SendParam calldata _sendParam,
MessagingFee calldata _fee,
address _refundAddress
) external payable virtual override(IOFT, OFTCore) returns (MessagingReceipt memory msgReceipt, OFTReceipt memory oftReceipt) {
if (_sendParam.composeMsg.length > 0) { revert CannotCompose(); }
/// cast bytes32 to address
address _to = _sendParam.to.bytes32ToAddress();
/// @dev user can cross-chain transfer to self
if (msg.sender != _to) { revert ITempleGold.NonTransferrable(msg.sender, _to); }
// @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.
(uint256 amountSentLD, uint256 amountReceivedLD) = _debit(
msg.sender,
_sendParam.amountLD,
_sendParam.minAmountLD,
_sendParam.dstEid
);
// @dev Builds the options and OFT message to quote in the endpoint.
(bytes memory message, bytes memory options) = _buildMsgAndOptions(_sendParam, amountReceivedLD);
// @dev Sends the message to the LayerZero endpoint and returns the LayerZero msg receipt.
msgReceipt = _lzSend(_sendParam.dstEid, message, options, _fee, _refundAddress);
// @dev Formulate the OFT receipt.
oftReceipt = OFTReceipt(amountSentLD, amountReceivedLD);
emit OFTSent(msgReceipt.guid, _sendParam.dstEid, msg.sender, amountSentLD, amountReceivedLD);
}

Impact

Inability to execute cross-chain transfers. Contracts depending on TempleGold for token transfer functionalities may face operational disruptions or failures. Disturbs interoperability with LayerZero and potentially impacts user transactions relying on cross-chain functionalities.

Tools Used

Manual Review

Recommendations

Implement the _buildMsgAndOptions function within the TempleGold contract or ensure it is correctly imported from a relevant library or contract.

Updates

Lead Judging Commences

inallhonesty Lead Judge
12 months ago
inallhonesty Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.