Function: exitToToken(ExitQuoteData quoteData, address recipient)
Allows to sell oTokens and receive one of the accepted ERC-20 tokens in return. Firstly, the oToken will be transferred to the _manager account from the caller's account. Then, _manager will process these tokens and determine the amount of quoteData.toToken to be received in exchange and send to the recipient. Finally, this calculated amount of quoteData.toToken will be burned from the manager's account.
Inputs
quoteData.investmentTokenAmountConstraints: Cannot be zero, and the caller must own a sufficient amount.
Impact: The amount of oTokens 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 no verification, but the
manager.exitToToken()function verifies thatquoteData.toTokenis equal to theassetaddress; otherwise, it reverts.Impact: The
recipientwill receive these tokens in return —toTokenshould be an accepted ERC-20 token.
recipientConstraints: Cannot be zero address.
Impact: The receiver of the
toToken.
Branches and code coverage
Intended branches
Successful
exitToTokenexecution
Negative behavior
toTokenis not approved.quoteData.investmentTokenAmountis zero.The caller owns fewer than the
quoteData.investmentTokenAmountofoToken.