Function: exitToToken(ExitQuoteData quoteData, address recipient)
Allows users to exit from lovToken investing and receive an approved ERC-20 token in exchange.
Inputs
quoteData.investmentTokenAmountConstraints: Cannot be zero, and the caller must own a sufficient amount.
Impact: The amount of lovTokens to sell. Tokens will be transferred from the caller to the manager contract. At the end of transactions, tokens will be burned from the manager account.
quoteData.toTokenConstraints: There is verification inside the
manager._redeemFromReserves()function thattoTokencan be equal to thedepositAssetor_reserveToken; otherwise, the transaction will revert.Impact: The
recipientwill receive these tokens in return —toTokenshould be an accepted ERC-20 token.
quoteData.maxSlippageBpsConstraints: Is not used and is not validated.
Impact: The maximum allowed slippage of the
expectedToTokenAmount.
quoteData.deadlineConstraints: Is not used and is not validated.
Impact: N/A.
quoteData.expectedToTokenAmountConstraints: Is not used and is not validated.
Impact: N/A.
quoteData.minToTokenAmountConstraints: There is a check inside
_manager.exitToToken(msg.sender, quoteData, recipient)thattoTokenAmountis not less thanquoteData.minToTokenAmount.Impact: The minimum amount of
toTokento receive.
quoteData.underlyingInvestmentQuoteDataConstraints: Is not used and is not validated.
Impact: N/A.
recipientConstraints: Cannot be zero address.
Impact: The receiver of the
toToken.
Branches and code coverage
Intended branches
recipientreceives expected amount oftoToken.The caller spent
investmentTokenAmountof lovTokens.
Negative behavior
The caller does not have enough lovTokens.
The
toTokenAmountis less thanminToTokenAmount.toTokenis not supported.recipientis zero address.quoteData.investmentTokenAmountis zero.
Function call analysis
_manager.exitToToken(msg.sender, quoteData, recipient)What is controllable?
quoteDataandrecipient.If the return value is controllable, how is it used and how can it go wrong? If
lovTokenToBurnis less thaninvestmentTokenAmount, part of lovTokens will not be burned; otherwise, iflovTokenToBurnis more thaninvestmentTokenAmount, more lovTokens will be burned.What happens if it reverts, reenters or does other unusual control flow? Can revert if
toTokenAmountis less thanminToTokenAmountor iftoTokenis not supported.