Function: enter(uint256 flashloanAmount, SwapPayload swapPayload, uint256 maxLTV)
This enters a position by swapping the deposited coins for the staked coin, putting it down as collateral, then repaying the flash loan by borrowing using the collateral.
Inputs
flashloanAmount
Constraints: Must be signed by Definitive.
Impact: The size of the flash loan taken from Balancer.
swapPayload
Constraints: Must be signed by Definitive.
Impact: Determines which coins to swap into the staked coin.
maxLTV
Constraints: Must be signed by Definitive.
Impact: Limits the loan-to-value ratio after the transaction.
Branches and code coverage
Intended branches
If
flashloanAmount
is zero, enter directly without flashloan.Get a flash loan and call enter.
Negative behaviour
Reverts if caller is not whitelisted.
Reverts if maximum LTV is exceeded after entering.