The _debit
function is designed to accept three parameters, but in TempleGold
, it is incorrectly passing four parameters, which causes an error.
_debit Function Definition
* @dev Burns tokens from the sender's specified balance.
* @param _amountLD The amount of tokens to send in local decimals.
* @param _minAmountLD The minimum amount to send in local decimals.
* @param _dstEid The destination chain ID.
* @return amountSentLD The amount sent in local decimals.
* @return amountReceivedLD The amount received in local decimals on the remote.
*/
function _debit(
uint256 _amountLD,
uint256 _minAmountLD,
uint32 _dstEid
) internal virtual override returns (uint256 amountSentLD, uint256 amountReceivedLD) {
(amountSentLD, amountReceivedLD) = _debitView(_amountLD, _minAmountLD, _dstEid);
_burn(msg.sender, amountSentLD);
}
Incorrect Invocation in TempleGold.sol
(uint256 amountSentLD, uint256 amountReceivedLD) = _debit(
msg.sender,
_sendParam.amountLD,
_sendParam.minAmountLD,
_sendParam.dstEid
);
Impact
The _debit
function will throw an error when called because it is defined to accept only three parameters, but four parameters are being passed in the invocation. This discrepancy will result in a function call failure, disrupting the intended token burning process.
Recommendation
Remove the msg.sender
parameter from the function call to match the expected three parameters of the _debit
function.
Corrected Invocation
(uint256 amountSentLD, uint256 amountReceivedLD) = _debit(
_sendParam.amountLD,
_sendParam.minAmountLD,
_sendParam.dstEid
);