Looking for input on collateral/incentives for Anchor integrated Defi app - Advias Protocol

For anyone unfamiliar with what I’m building, check our post about it here: Introduction to Anchor Integration Protocol - Advias

We have an issue…

There is one exploitative issue we are working on and that is the ability to infinitely loop your assets from collateral to debt → swap to collateral asset → collateral to debt, repeat.

Currently, we have the following measurements in place:

  • Max CTD

    • This stop same wallet looping
  • Repay debt 100% or failed transaction

    • This stops a borrowing account from partially repaying debt in order to loop the released collateral to repay the debt. This is just like looping a borrowing position, but instead to repay debt.

There are still issues…

The issue now resides in accounts (this can be a user or a defi protocol) using multiple wallets to bypass the max CTD by doing the following:

The following will assume UST as collateral with USDC as debt at a 90% LTV ratio.

Here’s what this looks like:

As you see, the borrowing account simply takes the collateral earned from the lowest of the loop positions to repay the next highest position. Essentially allowing anyone to turn a dollar into a trillion.

Starting at wallet C, the lowest debt position by value, they repay the debt, release the collateral, and use that released collateral to repay the next highest position, and repeat.

What they did was:

  • Create a risk free debt position to create a 37.1% APY income strategy.

  • As you see, there is zero risk for the user as long as they can pay back the lowest debt position, remove collateral, and repay the next.

  • You can even continue the loop one more time to achieve a 55% APY, so on and so forth!

comabatting this took a bit of creativity and we have a few ways to stop this but here’s our best; we think…

Here is one way we are combatting this:

  • Locking appreciation yield as value - (scaled_balance/initial_exchange_rate). In short, the lock_total = value - yield. The rest, the yield, is then locked in a savings account that receives interest for 3 months (while receiving yield).

Why 3 months lock?

  • Because the max CTD (max_ctd = collateral value/debt value) is aimed to force borrowers to repay their loans per 3 month periods, therefor the yield can only be used to repay the loan on their next borrowing position. Making time the enemy.

For example, a max CTD of 1.1382 with collateral appreciating at 20% and debt at 10% would force a borrowing account to repay in about 3 months or face liquidation risk.

Let’s take a look at the same info graph above but with the lock:

Here’s a look at what this does:

What locking did was:

  • Make it so the borrower could not use their collateral as the way to repay the debt on the next position.

  • Now, the user must account for all positions total value, for example:

    • If a user did the above loop (2 time loop strat - open position and loop 2 times following into 3 wallets), they would create a 33.5% (33.45679) yield requirement on the 72,900 USDC they receives as debt.

    • 1:

      • Get yield from debt: 72,900 + 33.5% yield = 97,290 (borrower has this amount to repay with)
      • Pay off the lowest debt position of 80,190 to release the 81,000 UST collateral principal
      • Now they have 98,100.00 in (97,290 - 80,190 + 81,000) USD value to repay the next debt valued at 89,100
    • 2

      • Repay next lowest debt position of the 89,100 to release the 90,000 UST in collateral, resulting in 99,000.00 (98,100 - 89,100 + 90,000)
    • 3

      • Repay next lowest debt position (last one to repay, this is the highest one and first position opened) of the 99,000 to release the 100,000 UST in collateral, resulting in 99,000.00 (98,100 - 89,100 + 90,000)

Locked away is 54,000 UST in a yielding savings account locked for 3 months. This happens by on the repay, we lock value - (scaled_balance/initial_index) (scaled_balance/initial_index is the math behind getting a users principal)

Of course, the risk here is that if they cannot repay the first debt down, everything gets liquidated.

Now, the question I have now is, what do you think of this strategy and do you have any ideas?