Closing a liquidity position into a long, a short, or neither
Exiting a Uniswap position normally leaves you holding two tokens and no view. Four operations let you name the position you become instead.
In short: when you close a Uniswap liquidity position, you end up with a mix of two tokens, like WETH and USDC, and then need three or four more transactions to get the position you really wanted. Four exits let you say what the position should turn into instead: both tokens as collateral, a long (a bet the price goes up), a short (a bet it goes down), or one collateral, all landing on Aave v3. Three settings, including the least each side of the close must return, are refused when left at zero, because a zero would let someone push the pool price and have your close settle there.
Closing a liquidity position is the easy half. You burn the NFT and two tokens land in your account: some WETH, some USDC, in whatever ratio the pool happened to be at.
Then you hold a pile of both, with no position and an opinion you have not acted on. The usual next move is three or four more transactions to get the position you actually wanted.
Four operations skip that. You name what the position should become, and the exit builds it.
The four exits
- Both sides as collateral
- Repay the vault, burn the LP, supply both tokens to Aave, borrow back the flash asset. You end holding both assets as collateral with a USDC debt
- Into a long
- Supply both tokens, borrow USDC against them, sell WETH if the ratio needs it. You end long the asset, financed
- Into a short
- Supply the USDC side as collateral, borrow WETH against it, sell that WETH for USDC. You end short the asset you were just providing liquidity in
- Into a single collateral
- Swap one side into the other first, then supply only that. You choose which side is sold; the unsold one is the whole collateral
The short is the unusual one. You were providing liquidity in a WETH/USDC pool, a position with no directional view, and in one transaction you leave it facing the other way, financed, without ever holding the proceeds in between.
Three places a zero is refused
In all four, three parameters that you might expect to have a sensible default instead refuse to run when you leave them empty.
- The loan-to-value ceiling
- The LTV your position may have after the Aave borrow. Zero is refused outright instead of being treated as "no ceiling"
- The sale floor
- The least you will accept on the inner swap. Zero is refused as having no floor, and a 0.25% default that exists elsewhere in the system is deliberately not carried over
- The unwind minimums
- The least each side of the burn must return
The third one protects you from an attack, which is why it cannot be skipped.
The attack the unwind minimums stop
When a liquidity position is burned, it settles at the pool’s current price, whatever that price happens to be at that instant. The minimums are the only bound on it.
So a zero there means any ratio at all, which hands an attacker a straightforward round trip: push the pool price with borrowed money, let your unwind settle at the price they chose, push it back, keep the difference.
The same reasoning covers all three. A default is a decision somebody else made on your behalf, and these three decide how much money you keep. Refusing to pick a value for you is safer, even though it means more required fields.
Three things it cannot do
- These land on Aave v3. There is no Aave v4 equivalent of them: the v4 operations here are supply, borrow, repay and withdraw, and none of them is an LP exit. The pair also has to be one the system already curates.
- Nothing is produced for a later step. These operations return nothing a following step can refer to, so a plan cannot chain something onto the position they create by reference. It has to name it.
- A Safe cannot run them, because every one is flash-funded and the callback needs a module.