Turn a long into a short without closing it
A leveraged position's direction is a setting you can change without rebuilding the position: long, short or delta-neutral, inside one transaction.
In short: You are long ETH on borrowed money and want to switch to short without closing the position. By hand that takes seven steps and leaves you with no position while the price moves. One operation changes the direction inside a single transaction, using a flash loan, money borrowed and paid back in that same transaction. You pick long, short or neutral, which means no price exposure, and both ends must be markets on the curated list.
You are long ETH: wstETH posted as collateral, USDC borrowed against it. You have changed your mind and you want to be short.
The ordinary way is to take the whole thing apart. Repay the USDC, withdraw the wstETH, sell it, buy USDC, post that as collateral, borrow ETH, sell the ETH. Seven steps, seven fees, and the market moves under you the entire time.
Worse, the first step is already blocked. To repay the loan you need your collateral back. To get your collateral back you must repay the loan. So the manual route cannot even start.
Direction is a setting
One operation carries a required choice of what the position should be when it finishes.
- long
- An ordinary leveraged long. Collateral one asset, debt another, exposure to the difference
- short
- A true reversal of the market being left. The position ends up facing the other way, without an unwind and a re-entry
- neutral
- The same asset is lent and borrowed, so there is no price exposure at all
Delta-neutral is a mode here, not a strategy you assemble. The position keeps its structure and stops having a view, in one press, and the same operation gives the view back later.
Why it can be one transaction
The chicken-and-egg problem is solved with borrowed money you never touch.
Money is borrowed for the length of the transaction, the old debt is cleared, the position is rebuilt facing the other way, and the borrowing is repaid out of what the new side borrows. The mechanics are the same ones a migration uses, set out step by step there.
What matters for a reversal specifically is the seven-step manual version it replaces. In that one there is a long middle where you hold a large pile of cash and no position at all (no long, no short, no view) while the price you have just formed an opinion about carries on moving. That window is a position you did not choose to have, held at the worst possible moment, and doing it atomically removes it.
What it will not do
- Both ends must be a curated market. It reaches only listed pairs, named at both ends. It cannot take you to any pair you like.
- You cannot take the flash loan yourself. There is no
flash.borrowoperation. The flash loan is used inside 14 of the 67 operations, never as a step of its own. Arbitrage and liquidating other people’s positions, the two things flash loans are famous for, are not available here. - A Safe cannot do it, for the reason set out in the migration post: the callback.
One practical detail: clear the debt exactly. A fixed repayment leaves the interest accrued since the plan was written, and dust debt blocks the withdrawal that follows.