What is looping?

Looping has always been the DeFi-native way of longing or shorting assets on-chain.

Since the early days of DeFi, users have been manually borrowing, swapping, lending multiple times on money markets to achieve a leverage exposure to an asset or farm rewards.

In a nutshell, looping involves lending or depositing some capital (e.g. ETH into Aave), borrowing another currency (e.g. DAI) against it, swapping the borrowed amount for the original asset (ETH), and repeating these steps through several loops to gain more exposure to the initial asset — or simply to farm more rewards or rates differentials.

Money markets normally require you to be overcollateralized, meaning that you can only borrow less than the value of what you deposit. For instance, if ETH on Aave has a maximum loan-to-value (LTV) ratio of 82.5%, you can only borrow 82.5% of the $ value of the ETH you’ve deposited.

That’s why, after 12–15 loops normally you get diminishing returns on the effort you’re putting into looping: the exposure you get to the asset you’re lending increases by smaller and smaller amounts (kudos to Stephen from Defi Dojo for his brilliant explainer and calculator).

Let’s see an example with spot ETH = 1000 DAI, and max LTV = 82.5% on the money market.

1st loop:

  • Deposit 1 ETH

  • Borrow 825 DAI

  • Swap 825 DAI for 0.825 ETH

  • Lend 0.825 ETH

  • Total ETH exposure: 1.825 ETH

2nd loop:

  • Borrow 681 DAI

  • Swap 681 DAI for 0.681 ETH

  • Lend 0.681 ETH

  • Total ETH exposure: 2.506 ETH

[…]

14th loop:

  • Borrow 56 DAI

  • Swap 56 DAI for 0.056 ETH

  • Lend 0.056 ETH

  • Total ETH exposure: 5.45 ETH

15th loop:

  • Borrow 46 DAI

  • Swap 46 DAI for 0.046 ETH

  • Lend 0.046 ETH

  • Total ETH exposure: 4.97 ETH

As you can see, at the 15th loop, the total net ETH exposure (which is already around 5.45 ETH) doesn’t increase by that much anymore (just 0.046 ETH, not even 1%). And gas fees might make the following loop not worth it.

Indeed, manual looping is pretty expensive, especially on L1.

That’s why manual loops were soon automated via flash loans by popular dapps.

The next section explains this mechanism in details.

Last updated