← All posts

Collecting fees you have already earned requires borrowing money

On a leveraged Uniswap position, taking the fees you are owed needs a flash loan first. That follows from what collateral means; it is not a quirk of ours.

Architecture2 min readDeFiLoops

In short: your Uniswap position has earned fees, but you borrowed against it, and the vault holds the fees back while the loan is open. The fees are part of the collateral backing your loan, so the loan has to be cleared first, which here is done with a flash loan, money borrowed and paid back within one transaction, from Morpho at no fee. It costs more gas than a normal collect, so collecting every day is unlikely to be worth it; collecting on a schedule, or when the amount is big enough, is.

Your liquidity position has earned three hundred dollars in fees, and nobody disputes that they are yours. If the position has been borrowed against, you still cannot simply take them.

Why not

The position is collateral. Every part of it backs the loan, and the accrued fees are part of it. Withdrawing them makes the collateral smaller, and a protocol that let you shrink what secures its loan would not stay in business for long.

So the vault will not release the fees while the debt stands, and the debt cannot be cleared without money, part of which is the fees.

How it is done anyway

Borrow the repayment for the length of one transaction, clear the debt, take the fees, restore the borrowing, repay the loan. One press, and the fees arrive.

The borrowed money comes from Morpho, which lends flash for nothing while Aave charges a premium. Morpho lends it to the adapter, not to your account. The borrowed sum never touches the account at any point in the transaction, so there is no instant at which it is yours and no instant at which it could go anywhere else.

Leverage limits what you can do

People tend to think of leverage as something that affects your returns: bigger gains, bigger losses, a liquidation price to watch. It also changes what you are permitted to do with your own position, and that second cost is the one nobody prices in.

Under leverage, routine maintenance stops being routine:

Collecting fees
Needs the debt cleared first
Adding liquidity
Needs the debt cleared first
Moving the range
Needs the position burned, which needs the debt cleared first
Splitting the position
Same

Every one of those is a flash loan in this system, which is why there are fourteen flash-funded operations instead of two.