Algofi Recursive Borrowing
In this analysis, the recursing borrowing phenomenon in the Algofi ecosystem where users supply the same asset they borrow has been evaluated.
Algofi as one of the main DeFi hubs on the Algorand network is a decentralized exchange (DEX) where users are able, to not only earn interests and rewards by providing liquidity for the pools, but also to lend, borrow, and trade their assets using the platform. When users supply assets to the platform as collateral, their limit to borrow will increase. Recursive borrowing is when a user supplies the same asset he or she borrows.
Below is the diagram depicting the process of interaction of users with the liquidity pools. There is more information available on the supply and borrow pages of the Algofi documentation.
The required data for the analysis of recursive borrowing using the Algofi platform were collected from the application_call_transaction, payment_transaction, asset_transfer_transaction, and account tables of the algorand schema. The start of the year to the current date (YTD) was considered as the timeframe of this analysis.
The following information were used to identify the Algofi's lending protocol.
Each of the above Market Address and Market App ID pairs is where a user (wallet address) sends or receives their assets when providing liquidity, borrowing, repaying borrowing, and withdrawing liquidity. From the liquidity pool's perspective, these four user-pool interactions were categorized into inputs consisting of providing liquidity and repaying borrowing as they deposit assets into the pool, and outputs consisting of borrowing and withdrawing liquidity as they withdraw assets from the pool.
The transactions of ALGO tokens are stored in the payment_transaction table while the transactions of other assets are stored in the asset_transfer_transaction table. The results of these two tables were combined, then join with the application_call_transaction table to be able to filter them using the transaction message.
According to the rewards page of Algofi's documentation, a supplier's reward is calculated based on four parameters of amount of supply, amount of borrow, price, and TVL weight for a given asset. Since the amount of supplied and borrowed assets by recursive borrowers are known, if the TVL weight were known for all of the assets, it was possible to manually calculate the rewards each user gets using the prices_swap table. However, the documentation mentioned that every time the manager contract updates, the rewards are being paid out. Hence, the lending protocol's manager address was considered as the sender of rewards to the recursive borrowers.
>Manager address: 2SGUKZCOBEVGN3HPKSXPS6DTCXZ7LSP6G3BQF6KVUIUREBBY2QTGSON7WQ
The following chart demonstrates the unique number of daily suppliers and borrowers of the same asset through the Algofi platform. The number of borrowers is 2-3 times larger than the number of suppliers on average. This result shows the tendency of users to have their assets in their own control by either borrowing the assets they lend to the pool or by completely withdrawing the liquidity they provided for the pool.
As it is shown in the next graph, USDC and STBL as the only two stablecoins among the assets have the highest average amount of supplies. The two wrapped tokens of BTC and ETH on the Algorand network have had a medium supply which is logical due to the scarcity of these tokens, especially the bitcoin. Surprisingly, ALGO was the least supplied asset with a daily average of fewer than 10 thousand tokens.
The amount of rewards being paid to suppliers is in accordance with the daily supplies and borrows graph. As the volume of supplies increases, the amount of rewards increases too. A huge jump can be seen in the chart between late February and early March. In total, almost 135M ALGOs have been paid to the suppliers in 2022.
The comparison between recursive suppliers and borrowers against the total number of suppliers and borrowers has shown that almost all of the borrowers from the platform are recursive borrowers. On the other hand, Recursive suppliers only have a share of about 25% of the total suppliers.