Function: exit(uint256 flashloanAmount, uint256 repayAmount, uint256 decollateralizeAmount, SwapPayload swapPayload, uint256 maxLTV)
This is an underlying implementation to exit the position by initiating a flash loan then returning the borrowed asset.
Inputs
flashloanAmountControl: Full.
Constraints: None.
Impact: Amount to flash loan.
repayAmountControl: Full.
Constraints: None.
Impact: Amount of borrowed asset to return (remove debt).
decollateralizeAmountControl: Full.
Constraints: None.
Impact: Amount of collateral to remove from the borrow pool.
swapPayloadControl: Full.
Constraints: None.
Impact: The payload for the swap (swap information, in this case probably wstETH <--> WETH/ETH)
maxLTVControl: Full.
Constraints: None.
Impact: Unused.
Branches and code coverage (including function calls)
Intended branches
Initiates a flash loan.
Handles zero
flashloanAmount.
Negative behavior
Cannot be called by nonwhitelist senders.
Reverts in case of LTV being above limit.
Does not execute in case of Stop guard.
Function call analysis
initiateFlashLoan(flashloanAmount, abi.encode(FlashLoanContextType.EXIT, abi.encode(ctx)))What is controllable?
flashLoanAmountandctx.What happens if it reverts, reenters, or does other unusual control flow? Cannot reenter due to reentrancy guard.
If return value is controllable, how is it used and how can it go wrong: Discarded.