Ultraswap on Folks Finance

Ronanljherry
Folks Finance Community
3 min readOct 27, 2023

Ultraswap is a new feature offered by Folks Finance to efficiently enter and manage leverage trading positions. Here I thoroughly review the process of leverage trading in decentralized finance, and how Ultraswap allows you to optimize it.

Ultraswap Interface on Folks Finance

Traditional leverage trading

Leverage trading allows one to bet on the change in price of a first asset, say ALGO, relative to a second asset, say USDc. If one believes that the dollar price of ALGO will go up, a common procedure is as follows:

  1. Borrow some USDc and sell them for ALGO.
  2. Wait for the ALGO price to increase to the desired level, and sell them back to USDc.
  3. Reimburse the loan and pocket the difference.

Of course, if one believes that the price will go down, they would do the same but swap the role of the assets: borrow some ALGO, and so on.

Decentralized leverage trading

The key in the previous process is the ability to borrow. In decentralized finance, everything is trustless and permisionless so there is no way to guarantee one will repay its debt. That’s why all the loans in Folks Finance are collateralized by some other assets. Consequently, the previous process needs an additional step.

  1. Deposit ALGO.
  2. Borrow USDc against ALGO, and sell them for ALGO.
  3. Wait for the ALGO price to increase to the desired level, and sell them back to USDc.
  4. Reimburse the loan, unfold your position, and pocket the difference.

In particular, the amount you can borrow and thus the amount you can leverage directly depends on the size of your initial portfolio.

Borrow loops

One way to (partially) overcome this obvious limitation is to loop the procedure. Instead of sitting on the borrowed ALGO, one could put them to good use and also borrow against them. In this case, this is what the process looks like

  1. Deposit ALGO.
  2. Borrow USDc against ALGO, and sell them for ALGO.
  3. Repeat step 1 with the borrowed ALGO until one cannot borrow more ALGO.
  4. Wait for the ALGO price to increase to the desired level, and sell them back to USDc.
  5. Reimburse the loan, unfold your position, and pocket the difference.

Since the amount one can borrow is strictly less than the value of the collateral, the amount of borrowed ALGO in Step 2 will decrease and eventually be very small. However, it still allows it to increase its position. Here is a summary of what you could get on Folks with maximal borrow (65% LTV), assuming 1 ALGO = 0.1 USDc, and rounding numbers for simplicity.


+-----------+------------+-------------+------------------+
| Initial | 1 borrow | 2 borrows | Theoritical max |
+-----------+------------+-------------+------------------+
| 1000 ALGO | 1650 ALG0 | 2072 ALGOs | 2857 ALGOs |
| | -650USDc | -1072 USDc | -1857 USDc |
+-----------+------------+-------------+------------------+

With this strategy, we can almost triple our initial portfolio. Of course, the more we borrow the more our position will accrue interest with the risk of being liquidated so such a strategy must be actively managed.

Ultraswap

The process described above can be long and tedious (interacting with the UI and signing transactions for every loop) and difficult to manage (if one wants to unfold they might need to do it in small steps). Enter Ultraswap which not only provides an interface to bundle all these loops in one go but also a better LTV rate for the loans, as well as an easy way to swap your position if you want to cash in.

When depositing and borrowing the bundle of transactions would typically look like this:

  1. Flash loan the desired amount of ALGO.
  2. Add ALGO to collateral.
  3. Borrow USDc.
  4. Swap USDc to ALGO via Folks Router.
  5. Repay the flash loan.

All the user has to do is specify how much they want to collateralize, and how much they want to leverage (x2, x3, etc), sign the transactions, and enjoy. All of this was made in less than 4 seconds.

On top of that, in the Ultraswap interface a user can decide to swap their ALGO collateral to USDc in one go when the price has reached their target. All the swaps go through Folks Router ensuring the best price.

Before you try it, I encourage you to read the docs, understand the advantages and the risks, and try your strategy with small amounts.

--

--