Function: exitToToken(address account, IOrigamiInvestment.ExitQuoteData quoteData, address recipient)
This function is called by the oToken contract when user exits from oToken.
Inputs
accountConstraints: No constraints.
Impact: The account that initiates the exit process.
quoteData.toTokenConstraints: Verify that
toTokenis equal to theassetaddress.Impact: The tokens that
accountexpects to receive as a result of the exit process.
quoteData.investmentTokenAmountConstraints: The new
Utilisationshould not exceed the cap.Impact: The shares amount to exit.
recipientConstraints: No constraints.
Impact: Receiver of
assettokens.
Branches and code coverage
Intended branches
The
exitToTokenwas executed properly
Negative behavior
quoteData.investmentTokenAmountexceeds thecap.The caller is not oToken.
quoteData.toTokenis notasset._paused.exitsPausedis true.
Function call analysis
this.circuitBreakerProxy.preCheck(address(this.oToken), account, quoteData.investmentTokenAmount)What is controllable?
quoteData.investmentTokenAmount.If the return value is controllable, how is it used and how can it go wrong? N/A.
What happens if it reverts, reenters or does other unusual control flow? Will revert if the new
Utilisationexceeds the current capacity.
this.lendingClerk.withdraw(toTokenAmount, recipient)What is controllable?
toTokenAmountandrecipient.If the return value is controllable, how is it used and how can it go wrong? N/A.
What happens if it reverts, reenters or does other unusual control flow? The function will revert if
toTokenAmountis more than the available debt tokens (not borrowed).