Lending and borrowing on FreeTON - Essay contest

Contest period

  • Submission period: 1 week after the acceptance of this proposal
  • Voting period: 1 week after the end of the submission period

Motivation

Lending/borrowing protocols are one of the essential elements of any financial ecosystem. It is especially true for the DeFi segment: thanks to AAVE, Compound, Maker, and other protocols, Ethereum’s DeFi world has exploded over a recent couple of years.

However, you cannot easily replicate everything possible in Ethereum (e.g., flash loans) in FreeTON.

This contest aims to find lending/borrowing mechanics that can benefit from FreeTON’s peculiarities, including its distributed nature and scalability.

General requirements

  • Write an essay about the lending/borrowing mechanics you believe will be the most suitable for FreeTON, considering all of its peculiarities and clearly stressing the difference with existing Ethereum protocols.
  • Ground your thoughts with arguments and think about future use of such mechanics in existing and expected ecosystem products (e.g., DeXes, oracles, bridges, etc.).
  • Don’t be a graphomaniac: 3-5 pages are more than enough.

Fair play

As per Procedural remarks on contests.

Evaluation criteria and winning conditions

Hard criteria

  • Provide a brief analysis of existing Ethereum lending/borrowing protocols: what features can be reused in FreeTON, and which ones cannot (explain why)?
  • What unique features can be introduced in a native FreeTON lending/borrowing protocol that will benefit from its architecture?
  • How can existing FreeTON DeFi products benefit from such protocol and vice versa?
  • The proposed solutions must be implementable on FreeTON.

Soft criteria

  • Detailed and easily understandable charts explaining the proposed architecture and business processes;
  • Readiness to participate in the implementation phase;
  • Brevity;
  • Mostly everyday English to facilitate understanding.

Rewards

Rewards regulation as per Procedural remarks on contests.

Place Prize, TON
1 10,000
2 8,500
3 7,000
4 5,500
5 4,000
6 - 10 1,000

Procedural remarks to jurors

As per Procedural remarks on contests.

Jury rewards

As per Procedural remarks on contests.

Governance rewards

As per Procedural remarks on contests.

Procedural reminders to all contestants

As per Procedural remarks on contests.

6 Likes

Decentralized finance or “Defi” is an ecosystem of financial applications based on blockchain technology that operates without any third-party or central administration intervention. It uses a P2P network to establish decentralized applications that would enable everyone to connect and manage their assets regardless of their status and location. It aims to provide an open-source, transparent and permissionless financial service environment.

Smart contracts are the foundation layer for decentralized finance as they are self-executing and do not require intermediary oversight. Since Ethereum introduced the Defi concept, most of the Defi applications are built on Ethereum blockchain. The most widely used Defi lending applications involve peer-to-peer lending and borrowing protocols. Aave, Compound and Maker are a few of the most popular Defi platforms.

Maker is a unique Defi crypto lending platform that allows borrowing only DAI tokens. DAI is a stable coin whose value is pegged to US dollars. Anyone can use the Maker to open a vault, lock in collateral like ETH or BAT, and generate DAI as a debt against that collateral. It encourages users to participate in operational earnings through governance fees, which act as interest rates for the network. DAI can be borrowed up to 66% of the user’s collateral value. If the vault falls below the fixed-rate, it becomes subject to a 13% penalty and liquidation to bring the vault out of default. At a 3% discount, liquidated collateral is sold in an open market.

Maker’s other token is MKR; holders of MKR act as the last line of defense in case of a black swan event. If the collateral value starts to fall, MKR is minted and sold in an open market to raise more collateral, diluting MKR holders.

Aave is an open-source and one of the most popular Defi lending protocols launched in 2020. It is a non-custodial liquidity protocol for earning interests on deposit and borrowing assets. This platform allows lenders to deposit cryptocurrencies in a pool and receive an equivalent amount of tokens Aave algorithmically adjusts interest rates depending on demand and supply. It indicates that the more the user holds tokens, the better the interest amount.

Finally, Compound is an algorithmic and autonomous money market protocol intended to unlock a universe of open financial applications. It allows users to deposit cryptocurrencies, earn interest and borrow other crypto assets against them. The use of Smart contracts automates the management and storage of capital on the platform. Metamask (and other web wallets) allow users to connect to Compound and earn interest. It is a permissionless protocol meaning anyone with a crypto wallet and an internet connection can freely interact.

Uncollateralized instant loans in decentralized finance, called lash loans, came into lime light very recently. A part of the popularity was becuase of the risks it brought with it due to its uncollateralized nature and exposure to hacks. But it always dropped quite a few jaws with the potential it had for DeFi.

Today, flash loans have become a key part of DeFi, and many major decentralized lending protocols have integrated flash lending services. However, there’s still no dedicated flash lending platform that has solutions and services tailored specifically for users looking for flash loans. In simple terms, a flash loan is an uncollateralized loan option that is to be borrowed and returned within the same transaction on a blockchain. Flash loans enable anyone to instantly and easily borrow any amount, with no collateral needed. But that is only possible if the user can return the borrowed amount to the vault within the same block of transaction. If that fails, the whole transaction is reversed, and any transaction made during that time is nullified as if it never happened. This guarantees the safety of the funds in the vaults. But throughout the process, there are no middlemen involved. The whole transaction is taken care of by a self-executing smart contract. These flash loans are not easily replicated on other blockchains like Free Ton.

Free Ton is unique in that transactions using the TON Crystal eradicate many of the problems of using cryptocurrency for everyday payments, such as extended transaction times and hefty fees. Currently, Bitcoin and Ethereum can process around 7 and 15 transactions per second (TPS) respectively, while TON is capable of processing millions of TPS, making it faster than VISA and MasterCard. TON users will be able to make transactions for less than $0.01 in fees, and pay less than $0.05 per coin exchange transaction (swaps). The DeFi market has shown exponential growth in one year with the major part of projects being built on the Ethereum blockchain. However, the quickly expanding user base started to create network overloads and drove the ETH gas price to the sky. This is now a huge turn-off for retail users. This is where the partnership idea has come up – the underlying technology of Free TON can decrease fees and enable several mechanics like cashback for liquidity transferring from Ethereum to TON Blockchain.

One of the newest ways to make profits on farming is found in the Ethereum network using the Free TON Ethereum bridge. Users can provide tokens to the DEX (decentralized exchange) or bridge liquidity pool. Liquidity pools are smart contracts that have tokens locked in their accounts. Liquidity pools are used by a DEX (decentralized exchange) to maintain trading activity and token liquidity. When placed in the decentralized exchange they temporarily freeze the tokens in place. While frozen, the tokens are available for exchange with other users in the system, which allows these tokens to be constantly performing operations, without waiting for a specific currency to make an appearance.

Currently most of Defi activities take place on Ethereum or Binance smart chain. There are many benefits to using the Free TON Ethereum bridge. It is open, you don’t need to apply for any form of service. You never have to provide your name, or any sort of personal information. The speed is incredible, thanks to dynamic sharding built into Free TON. This provides not only speed but incredible performance that is more than sufficient to support any kind of transaction. Free TON has its entire system designed in Smart Contracts. This means that almost any logic can freely be implemented, no matter its complexity. The first bridge has been developed between Free TON and Ethereum by Broxus. Even more bridges are currently in development between Bitcoin, Polkadot and more.

When comparing the lending and borrowing protocols of Ethereum and Free Ton one thing stands out: layer 2 solutions. The launch of Vitalik’s v2.0 blockchain is scheduled for 2022, so we can only guess what features it will have. The other projects are under heavy development and it is said that some problems may only be solved in the future. The problem of scaling is probably the biggest of all when comparing onchain and offchain solutions – the number of transactions made in a given time frame. This problem is crucial for large companies that need many transactions without any latency. The design and architecture Ethereum cannot provide the necessary bandwidth. In May 2020, thenext-generation blockchain was launched Free TON. The architecture of this blockchain allowed it to execute such a number of transactions per second that it comes close to off-chain solutions. Free TON holds the record, as its architecture allows it to reach around 100,000 transactions per second, a feat made possible by dynamic sharding mechanisms used within the network.

When sharding is used, the workload is distributed among separate nodes in the network. Each node doesn’t process all the operations of the blockchain but only a selected part of them so that other nodes can perform different operations. In simple words, dynamic sharding can be compared to a shop: while the previous generation of blockchains consisted of small shops with only one till, the next generation blockchains are huge shops that can open new tills on the fly and as needed depending on the amount of visitors/transactions. Free TON‘s architecture also allows transactions to be split into fragments when the workload is intense and the number of transactions endless. Recent tests have shown the possibility of having more than 200 shards under load in Free TON, while the NEAR network, which always uses shards, supports a maximum of 8. Blockchain technologies have been presented to the world as open and decentralized, but at the same time autonomous networks are also realities in their own right – communication with the outside world is difficult. The transaction type, consensus and hash algorithms of a particular blockchain are configured to solve particular tasks. If we add regulation, governance models and fundamental design differences to this soup, the dish becomes very complex and many of the ingredients simply cannot match up. The cost of a single transaction on the Bitcoin and Ethereum networks is closely linked to both the price of ETH and the workload of the network – the higher these indicators are, the higher the cost.

Bridges can be used to transfer one’s tokens from a slow and expensive network to a fast and cheap one. The tokens never actually leave their native network, but are sent to a smart-contract, if this particular network supports them, and their mirror copy is minted in the destination network. When the user wants to return to the original network, the mirror copies of the token are burned and the native tokens are sent back to their wallet.

This detailed discussion shows that Defi lending has a high potential to reshape the entire financial system. It attempts to decentralize the core traditional finance services like payments, trading, investments, insurance, lending and borrowing. Defi lending being involved with the intriguing technology truly has vast opportunities to revolutionize the global financial landscape and Free Ton is leading the way.

2 Likes

Lending and borrowing on FreeTON

Introduction

DeFi was born as a competitive vehicle for decentralized financial applications that act as various financial incentives: transactions and payment solutions, borrowing, lending, and real asset tokenization. DeFi solves the problems with centralized control, limited access, low efficiency, lack of interconnectivity and transparency now and can do more in the future. In this paper, I’ll try to describe the current status and actors of the DeFi market and propose a vision of the future opportunities that DeFi unlocks for the FreeTON ecosystem.

FreeTON is probably one of the most promising platforms for lending and borrowing development, due to its open-source nature, focus on cooperation within the community and solid expertise not only among the developers but ecosystem members as well.

Thus, in this submission I’ll try to present my vision on how financial instruments, as well as borrower and lenders, can gain the values from FreeTON incentives, what are the risks and opportunities as well as propose several conceptual ideas on how to proceed.

I’m Sergey Kalinin, Head of Product of UAX - a first gasless dual-layer stablecoin with delegated transfer infrastructure, fully developed on FreeTON by Kuna Exchange. Previously I was working in Dfinance, a project of Wings Foundation, dedicated to natural-language programming financial instruments on Cosmos. As well as a management executive in several financial and blockchain companies.

Market conditions

In the first place, it is necessary to accept that despite the fact that DeFi is perceived as a hammer for the traditional financial system, many of the approaches and tools are based on ideas that have already existed for many years in finance. In particular, the topic of this work is lending, and many of the principles of DeFi came from the banking sector. These operations are based on the principles of ABL - asset-based lending, where loans are issued on the basis of asset’ over-collateral.

Although DeFi aspires to create an independent, parallel financial system based on code rather than legal enforcement, the key component of the DeFi system is actually based on traditional financial market infrastructure. The most critical link between the two systems can be found in stablecoins. These include US Dollar-denominated stable tokens circulating on public blockchains, which are in principle backed by commercial banks tied to financial institutions dealing with US Dollars.

Stablecoins are a vital instrument for DeFi transactions because they introduce collateral denominated in fiat while keeping the open transaction environment of the public blockchain. However, the vast majority of stablecoins derive value from the underlying US Dollar instrument and therefore rely on the issuer of the underlying instrument and the financial institution that deposits US dollars. But I have to admit that these “fiat-backed” stablecoins are an important part of the fast and effective expansion of financial instruments, laying on the “proof-of reserve” concept, which is the core feature of UAX - stablecoin on FreeTON blockchain. That’s how we can revert fiat reserves into algorithmic stablecoins.

This principle was developed in UAX whitepaper. In short: fiat-backed stablecoin emission becomes the fuel for using this stablecoin in smart contracts which gain more credibility and solvency due to the fact of real-world collateral.

By the way. Ethereum-based stablecoins backed with fiat and circulate on public blockchains, in April 2021 were worth at least 20 times more of non-redeemable stablecoins issued against crypto-native collateral. Even some of the most decentralized stablecoins, like MakerDAO have introduced points of compromise where dollar-denominated assets like USDC can be used against the crypto collateral within a smart contract.

The top five DeFi protocols by USD-equivalent amount of collateral supplied – MakerDAO, Curve, Uniswap, Aave, and Compound – collectively host $3.818 billion in USDC and $1.06 billion in Tether (USDT) in deposits (April 2021) These figures represent 42% of outstanding USDC and 5.2% of USDT respectively circulating on Ethereum.

Risks

Despite the decentralized nature of the smart contacts and DeFi itself, humans are still in the game. It is impossible for now to eliminate the offline interactions and relations between people and this is the place where risks arise. The DeFi core protocol tends to retain a certain degree of human participation of the controlling entity. This is a means of mitigating risks when they arise, but if the administrator himself is threatened, maliciously or in some way compromised, it can also pose a potential threat to such systems. This paper is not intended to give the answers on how Free TON will deal with such risks and threats, but we have to understand that effective and proven solutions across those topics will gain a lot of attention and market appreciation in the blockchain space.

Miner extractable value (MEV) - is made possible due to the innate transparency of blockchain and the possibility of gaining priority by outbidding other users. With the increase in transaction complexity, there are more opportunities for risk-free arbitrage and unfair execution, like front-running.

Oracles - the vulnerability category is related to the problem caused by the blockchain data provider. In DeFi, the oracle provides external information to the smart contract execution. For example, a lending agreement that uses tokens as collateral should know the value of the given tokens (in standard terms such as US Dollars) and use smart contracts that use market information provided by oracle and its data feed. Some DeFi protocols are based on oracles, and price input is essential for triggering liquidation, deleveraging, margin calls, and other forms of automatic collateral management. Therefore, for these protocols, the oracle failure in any form can be catastrophic.

Admin keys - there are many risks associated with keys management in most active and high-profile DeFi projects. Like the keys loss, the theft of deposits by insiders, theft through extortion or third-party hack, and regulatory pressure. It means that the assets held in the contract with the administrator key as the intermediary should be understood as custody, rather than a fully sovereign interaction between the users and blockchain. Adding more signers to the multi-signature key setup just means that user deposits are kept by a consortium of insiders, rather than by a single entity.

Law enforcement - in many cases, DeFi entities are financed by issuing pseudo-capital (or equity) tokens, which represent claims for certain cash flows generated by the protocol. These tokens have proven to be an important financing tool for the DeFi protocols’ development. Many of these tokens grant token holders some basic governance rights, as well as implicit or direct claims to the cash flows generated through the lending protocols. These pseudo-equity tokens supporting DeFi are not registered as securities but are circulated in a decentralized financial infrastructure. If such pseudo-equity tokens are identified as unregistered securities by securities regulators, the financing and governance models of these DeFi projects will be significantly affected. In addition, many DeFi agreements subsidize liquidity by issuing new units (known as LP-token) to end-users. If these tokens are removed from the listing, their liquidity and value will suffer, and the utility of these protocols will be reduced.

We know that blockchain technologies bring many benefits so far. But the tools or processes used to disintermediate or gain efficiency also have costs in recourse, reversibility and risk management.

Solutions

Loans are an essential part of the DeFi ecosystem within FreeTON. Everyone has access to the platform and can potentially borrow money or provide liquidity to earn interest. As such, DeFi loans are completely permissionless and not reliant on trusted relationships.

My assumptions are based on the fact that for a full-fledged operation, convenient and fast interaction with liquidity providers, wide opportunities for liquidations and deleveraging should exist, as well as oracles and price discovery mechanisms are necessary.

I guess that initial steps should be realized in the form of collateralized lending/borrowing where loans can be fully secured with collateral. The collateral is locked in a smart contract and only released once the debt is repaid. Collateralized loan platforms exist in three variations: Collateralized debt positions, pooled collateralized debt markets, and P2P collateralized debt markets. Collateralized debt positions (CDP) are loans that use newly created tokens, while debt markets use existing tokens and require a match between borrowing and a lending party.

In Free TON we can realize all of them, but with a different timeline and pace. Also, I see a proper perspective for a combined approach between the fiat-backed and crypto-collateralized assets, where traditional finance is dealing as the provider of backed liquidity. While this liquidity is the main source for CDP contracts, when existing tokens, secured by liquidity can be lent/borrowed against the crypto.

Let’s try to outline the mechanics which we can apply at FreeTON. The main assumption will be that credit is not only a product that provides access to liquidity and the possibility of income on it, but also is the underlying asset for more advanced credit derivatives that can be freely issued and used within the TON ecosystem. For example, Debt Risk Options (DRO) allow the borrower to sell credit obligations, and the buyer of such obligations is getting the property right to the underlying collateral.

Any market participant can become a part of the Free TON financial system. This can be as through a CDP contract when a new stable coin is issued by DAO in exchange for a pledge in TON Crystal. In the future, other blockchain assets can and should become full-fledged collateral instruments. The second option is the principle of a two-layer stablecoin, which was adopted during creating UAX, where liquidity appears in the system through “proof-of-reserve” and legal entity or market player, based on a legally confirmed scheme of interconnection with the local banking system. This principle can be implemented in other jurisdictions with certain changes.

The legal entity issues the “proof-of-reserve” stablecoin with reserves that are held in the financial institution as collateral. This is the easiest way to put liquidity into the Free TON system. There is a UAX proof-of-concept, where the stablecoins are minted against the fiat-denominated derivatives with normal circulation.
Stablecoin is marketed across the Free TON ecosystem as a mean of exchange and the base layer for various financial applications and borrow/lending mechanisms.
New financial specifications and applications are developing as ready-to-use solutions for the market. It means that independent developers are involved in the process development of credit, lending/borrowing and other financial use-case tools. The community is responsible for providing proper financial tools as the products.
Any eligible person can buy stablecoins from a trusted source of “proof-of-reserve” funds, implement some kinds of smart contracts as SaaS and “open” his own decentralized financial institution like a “private bank”
“Private bank” independently deals with lending/borrowing operations according to the smart-contract logic, sets the level of loan-to-value (LTV), chooses the type of collateral, loan repayment terms and liquidation of collateral, or sells the debt.
The ecosystem should provide trusted infrastructure for borrowing/lending activities - liquidation auctions through the DEX; price discovery through the oracles; bridges and fiat gateways through the commercial protocols and market participants.
“Banks” deal independently, compete with each other for the users. In this situation we have the system where functions are divided as there are liquidity providers who mint the backed stablecoin; market intermediaries which buy the liquidity to provide it for the lending with interest; users who use their crypto-assets as collateral to borrow the stablecoin and use it within the Free TON ecosystem.
There is a secondary debt market where “bank” can sell the credit via DRO, where new market players are in Free TON ecosystem - risk sellers/risk buyers in form of credit derivatives

Future development ideas

I see significant perspectives in negotiable bilateral contracts (a reciprocal arrangement between two parties to perform an action in exchange for the other party’s action) that help the users to manage their exposure to credit risks. The buyer pays a fee (premium) to the seller (who is taking a specific risk in return for the premium).

DROs refer to various instruments and techniques designed to provide the option holder with the right, but not the obligation, to perform some predefined action - such as buy or sell an underlying asset at a preset liquidation price. The next step of development could be a simplified debt risk option, focused on use within the DeFi ecosystem.

Debt Risk Option transfers the credit risk (or the risk of a default event) of a borrower, also known as CDP creator in the Free TON ecosystem. CDP creator (“Risk Seller”) can issue a Debt Risk Option where he wants to sell the risk of the loan taken and get additional revenue if he believes that the risk event will not happen in the future. In exchange, someone on the market may think that a given risk can happen in the future and the loan is not well secured or the premium is low. Therefore he wants to buy this risk (“Risk Buyer’’) of the event and pay a non-refundable premium as the price of the given option, to acquire the underlying leveraged collateral at the liquidation price, and a swap deal with the upfront premium fee occurs.

As a CDP creator (or “borrower”) you can create an option and sell the risk of default on your loan. You can set up the price of this financial instrument on your own. There is no pricing discovery in classical, the Risk Seller estimates the price as effective for his collateral. But if you do not estimate your option and maturity date and price it fairly, no one will buy it. It is a double-sided contract and a fair price is crucial. IMPORTANT - if you sold the debt risk option, you cannot change the CDP or the collateral and its assets.

Whatever loan you take, you have to deposit collateral no less than 150% of the loan, which is a minimal 66% loan-to-value and a margin call at the same level. Note that it is highly recommended to use a lower LTV to avoid instant liquidation.

Now the Risk Seller can sell the token either OTC or using the DEX. If no one wants to buy it, there is no deal and the option token just gets burned at the maturity date. But if someone on the market thinks your loan is on fire, is ready to pay the premium (and thus gets the right to purchase your collateral at a discount in case of default), there is a deal.

If the loan underlying collateral value drops to 150% and a margin call occurs, the Risk Seller has the right but not the obligation to buy back the TONs (or other collateral) with the current price within the emergency zone which is 130% of the loan value. If the loan value drops to 130% collateral and the Risk Buyer does not buy the collateral, then the CDP will be liquidated and the CDP loan amount in UAX will be returned to the liquidity pool and the rest (if any) will be sent to the Borrower (Risk Seller). The Risk Seller retains the option premium and loan because the Risk Buyer already bought the collateral.

But if there is no default event and the Risk Seller pays back the loan thus releases the collateral and gets the option premium. The Risk Buyer had no opportunity for the option to be realized and lost the option premium.

Conclusion

Within Free TON it is possible to build up an integrated system for borrowing/lending against the native TON Crystals as well as via a new type of dual-layer stablecoins, relying on interconnection with traditional finance systems. But, for the given financial activities DEX as a tool for collateral liquidation, deleveraging and auctioning are crucial. As well as trusted oracles is an important part of price discovery and collateral management. Then we can provide financial infrastructure and Free TON scalability as a vital part of the financial environment where almost anyone can be your own financial institution.

I have a much more detailed vision on how to proceed and what are the next steps and would be happy to become a part of the Free TON financial revolution. Also, there is some initial work already done. I would be happy to join as an active member of Free TON DeFi subgove to develop lending and borrowing solutions.

Sergey Kalinin, Telegram: @s_kalinin

7 Likes

Hello guys!

I spent some time analyzing the mathematics and contracts architecture behind the leading Ethereum lending protocols and would like to share with you my thoughts and findings.

Lending and borrowing in FreeTON

Lending/borrowing is one of the core protocols that is needed to build a sustainable financial ecosystem. It plays a crucial role in Ethereum DeFi: AAVE, Compound, Maker, and a couple of dozens of other products are bringing a low-risk investment opportunity for lenders and low-cost liquidity for borrowers.

Most of these protocols are similar to each other, and we believe it’s of no sense to perform a comparison and make a review of each one specifically. Instead, we will have a closer look at AAVE, which is the current market leader, according to the DeFi Pulse [1].

Economics of AAVE

AAVE has a well-documented economic model that seriously facilitates the analysis [2]. It is a complex financial product that has lots of math behind it.

However, in its basis lays a simple curve equation that controls the interest both for lender and borrower. This equation makes the loan the more expensive the more liquidity utilization comes to 100%. In a typical scenario, the rate grows slowly, whereas it may become costly as a defensive measure at peaks.

Each coin in AAVE’s portfolio has its risk profile based on several factors. This profile directly affects the required collateral from the borrower, the rate, and the pace at which the rate grows in peak situations.

After a closer lookup of the economic model, it seems implementable in FreeTON to the extent of certain FreeTON’s specificities discussed below.

The greatness and the misery of Ethereum credit protocols

Ethereum is great. It made the concept of smart contracts widely accepted and encouraged other blockchains like FreeTON to take it and develop further.

However, Ethereum has certain peculiarities, both positive and negative.

The positive one is, without a doubt, flash loans. Despite how controversial they are, we shall acknowledge that this AAVE’s invention created a new financial toolset granting access to faster liquidity.

Negative ones are, however, outweigh positive by number.

The first to name is a notorious gas price. In Ethereum, gas price is highly volatile due to many factors, starting from the network workload to miners’ conspiracy [3]. AAVE’s users can quickly deposit money at the cost of ~$120. The introduction of layer-two solutions like Polygon slightly helped, but compared to FreeTON, it still has high fees to operate.

Next, we should point at the possibility of EVM-specific attacks, e.g., sandwich attacks or front-running. As recent research shows, up to “12.7% […] liquidations back-run the price oracle update transaction, while 87.29% attempt to front-run competing liquidators” [4].

Last but not least, the speed of the blockchain. With FreeTON issuing five blocks per second on average, Ethereum’s ratio is significantly worse: 13.23 sec on average, 66 times slower.

Time is money, one says.

Architecture differences

FreeTON is different. First of all, it is decentralized in most senses, and each of its components can benefit from such decentralization, starting from TIP-3 tokens to modern AMM DEXes.

However, this decentralization has its cost: due to its asynchronous nature, smart-contracts logics may be more complex than in the case of Ethereum.

We will not discuss the low-level differences between Ethereum and FreeTON but rather attempt to understand how they will affect the potential “AAVE on FreeTON”. To do this, let’s try to imaginary “port” AAVE and see how it will go.

Credits: Consensys

Deposits/withdrawals

After the deposit, the user receives a-tokens in return for those they provided. All funds then transfer to dedicated vaults, separate for each primary asset. The withdrawal is made in reverse order.

In FreeTON, taken that the TIP3 token already has a distributed fashion, it would have a single vault contract that owns various implementations of TIP3 tokens.

Loans/Repayments

When someone borrows funds from AAVE, it mints special non-transferrable a-debt tokens that facilitate accounting and interest calculations, especially for stable- and variable-rate loans. [5] At debt return, the system burns them.

In FreeTON, you can also do it with dedicated TIP3 tokens issued for the specific borrower.

Flash loans

Flash loans allow borrowing liquidity for a short period via building a specific block in Ethereum that should contain both borrow and return transactions. It is possible due to quite a considerable time needed to mine a block.

In FreeTON, although theoretically, it is possible to construct such a block, you would need to control a significant share of validators to do this. Thus we consider it impossible to implement.

Swap borrow rate mode

The borrower can choose between stable and variable interest rates in this mode after taking the loan.

It is definitely possible by a simple swap of the corresponding a-debt tokens.

Credit delegation

Credit delegation is a new advanced lending mechanics that allows a borrower to enjoy the non-collateralized loan, keeping the lender protected at the same time by signing the legal agreement via the OpenLaw.

This option is not readily available as the OpenLaw system strongly relies on Ethereum. However, there is a way to interact with it by creating the adapters for the Ethereum bridge (tonbridge.io). We would recommend postponing this functionality when the underlying infrastructure is ready.

Liquidation

A liquidation event happens when the lending position’s health ratio falls below 1. In this case, anyone can trigger the liquidation method and cover up to 50% of the borrower’s position at a discounted rate (defined by AAVE’s risk policies). [6] The liquidator can choose to receive either collateral a-tokens or the underlying asset directly.

This mechanics seems feasible to implement at FreeTON but needs to be tackled with care keeping in mind its asynchronous nature: the first served request should block this possibility for further requests from other liquidators.

Oracles

AAVE uses two sets of oracles to fetch market prices and rebuild indices: primary (Chainlink) and secondary (backup). [7]

In FreeTON, the contest for a native prices oracle based on the NOT(-a-validator) architecture is currently in progress that the protocol can use to fetch prices. However, as an alternative, the Chainlink adapter can be created to grab the price feed from Ethereum through tonbridge.io.

Thanks to FreeTON’s speed, there will be no delay in receiving the data and thus minimizing the opportunity for front-running and price manipulations.

Gas price

As a particular remark, we would like to address the gas fees required to perform FreeTON’s lending protocol operations. Based on existing solutions and the complex-to-calculate FreeTON’s gas price, the user will always need more gas than is required by the network. This excessive gas should be attached to the first call in the chain, and the user will receive the change after the last one completes to guarantee the entire execution of the business logic.

Tokens

AAVE operates ERC20/EIP20 tokens, which are primarily homogenous and are widely used across the market.

Unlike Ethereum, in FreeTON, there is no widely accepted TIP3 token standard yet. It means that to support different types of tokens, the lending protocol should have converter contracts that will transform one kind to another.

Browser extensions

AAVE supports many wallet connectors: Metamask, Trust Wallet, Enjin, Wallet Connect, and others - to interact with the blockchain.

Thanks to the recently finished first stage of the Chrome Extension Contest [8], the native FreeTON protocol may already enjoy several solutions providing the Web3-like transport, e.g., the contest winner Crystal Wallet [9].

The future

A lending protocol is one of the essential pieces that make the market liquidity fluid. It can be used in many ways and for different purposes, starting from the savings account earning an interest up to marginal trading. [10]

Keeping in mind the existing and planned products in the FreeTON ecosystem, we believe such a protocol will be synergetic for:

  • Building leverages at DeXes for marginal trading
  • Serving as a low-risk protocol for bridges money-management
  • Building different dApps that may require access to a quick liquidity
  • Creating derivatives and indexes market
  • Extending the functionality of different wallets

Also, as some native stablecoins appear, the lending protocol can be used in a close junction with them to provide fiat loans.

Conclusion

Existing Ethereum lending protocols are complex financial machines that enable users to lend and borrow in a censorship-free manner.

Some of functionality peculiar to Ethereum (e.g., flash loans) cannot be implemented or may require building the underlying architecture and integrations first (e.g., OpenLaw).

However, despite all of its complexity, the crucial functionality can be implemented in FreeTON. It will require building it more decentralized, but the differences are not that big to make porting, e.g., AAVE, impossible.

Table of references

[1] https://defipulse.com
[2] Aave V3 - Risk
[3] Gas cost discussion - #3 by ashwathbk - Governance - Aave
[4] https://arxiv.org/pdf/2101.05511.pdf
[5] https://docs.aave.com/developers/the-core-protocol/debt-tokens
[6] Liquidations in DeFi — how they happen and how to prevent them | by Nikola J. | DeFi Saver | Medium
[7] Price Oracle - Developers
[8] Contest proposal: Free TON wallet as a Chrome extension - #46 by cryonyx
[9] EVER Wallet - Chrome Web Store
[10] DeFi Explained: Aave. Aave is a decentralized lending… | by Multi.io Research | Multi.io | Medium

Contact information

Telegram: @xestrum
Wallet: 0:893d27bb9717bfdff7c5b31ca3c7e9338f6d23d05b3adac14b726bb4281f5e59

5 Likes

Our Submission 4 “Practical BFT Lending protocol”:

Authors:
Aleksandr Vat
Free TON Wallet address 0:418d17406d0b6cf306e2f2b7bcc55578fecde7a42804fcbe19966b5209b8b91e Telegram: Contact @Vatic

Sergey
Wallet Address: 0:91dc4ad407c8b6dc24f5d86a0a8cce45ca7da6aa41ed73ab99eeffe65c8eb4cd

2 Likes

Submitted our doc in pdf.
Russian version is presented in pdf as well.
Thank you for your attention.

FreeTON Landing Page Implementation Essay

and creating tonlend.io

Good afternoon everyone!

It’s SVOI.dev Team.

And presented document is an essay that we compiled as part of contest # 29 Lending and borrowing on FreeTON - Essay DeFi SG, containing subjective judgments as part of the task of finding lending / borrowing mechanisms that can benefit from the features of FreeTON, including its distribution nature and scalability.

The essay examines lending with crypto-currency assets secured by loans of foreign currency assets. Based on the data of the protocols: Justlend, AAVE, Compound, Maker.

Having accumulated experience of deep study of FreeTON, as well as taking into account the many serious and promising developments created by our team, we would like to thank you for the opportunity provided by this competition.

Collateral value providing mechanisms

In the considered protocols JustLend, AAVE, Compound, Maker, there is a mechanism for providing collateral value in tokens preselected by the developers of the protocol or by the protocol community (Compound supports 12 tokens, AAVE supports 26 tokens). As a result of providing collateral value in a certain asset, the depositor receives intermediate tokens (JustLend - jToken, AAVE - aToken, Compound - cToken), which can be used to obtain a loan or to gain interest from freezing provided collateral value, depending on the profitability of the asset in which a contribution was made.

Loan obtaining mechanisms

In JustLend, AAVE, Compound, Maker protocols, in order to receive a loan (not by using FlashLoan in AAVE), the borrower must first deposit some collateral value in tokens that were previously approved by the protocol developers or the community (AAVE, MakerDAO). This fact is important, since for each token, the parameters of the risk model associated with this token are assessed (for example, the model in the MakerDAO protocol, Whitepaper, section “Risk Parameters Controlled by Maker Governance”). As a result of the assessment, the Collateral Factor is obtained, which determines the value of the loan that can be issued to a specific user, taking into account the collateral provided. The value of a possible loan is determined using intermediate tokens (aTokens - AAVE, jToken - JustLend).

There are two main schemes for providing loans - split collateral and unified collateral. The considered protocols (JustLend, AAVE, Compound, Maker) use a unified collateral scheme.

Debt repayment mechanisms

To repay a debt, several main options are used - repayment using an asset that was obtained as a result of lending (JustLend, Compound, MakerDAO), and a mixed option, which allows you to choose how exactly the debt will be repaid (AAVE - allows you to automatically exchange one asset for the asset that needs to be paid off and repay the loan with tokens received as a result of the exchange).

Debt liquidation mechanisms

If the borrower exceeds his borrowing capacity (for example, if the price of the asset has increased, as a result of which the borrowing capacity has been exceeded), it launches the debt liquidation mechanism. In the MakerDAO protocol, liquidation is triggered automatically using the auction mechanism, JustLend automatically liquidates an account that has exceeded the limit, without creating an auction.

It is also important to note that debt liquidation comes with some liquidation discount, which can vary depending on the asset.

FlashLoan mechanism

This mechanism is unique to the AAVE protocol and appeared relatively recently. This mechanism allows you to take loans without providing any collateral value, provided that the loan will be repaid within the same block. If the loan is not repaid, the transaction and the subsequent call chain are canceled.

Oracles for obtaining an estimate of the price of tokens

These protocols also contain oracles - mechanisms used to obtain the current price of assets for an intermediate token or for some stablecoin (for example, USDT on the Ethereum network). This mechanism allows you to estimate how much of an asset a user can borrow, provided that he has provided a certain collateral value. Also, this mechanism allows you to track the prices of tokens and determine which accounts need to be liquidated due to the fact that they have exceeded their borrowing capacity (for example, the user borrowed ASSET-1, but it went up in price, as a result of which the borrowing capacity was exceeded).

Reuse of existing protocols functions in the FreeTON network

The following protocol functions are subject to reuse:

  1. Collateral value providing (JustLend, AAVE, Compound, MakerDAO);
  2. Collateral value withdrawal mechanism, in whole or in parts (MakerDAO);
  3. Borrowing (JustLend, AAVE, Compound, MakerDAO);
  4. Debt repayment mechanism (a mechanism with the ability to repay a loan both in the asset in which the loan was taken, or in another available collateral asset - AAVE);
  5. Debt liquidation (automatic liquidation mechanism with the creation of auctions - MakerDAO);
  6. FlashLoan mechanism (AAVE);
  7. The mechanism for obtaining interest on the provided collateral value(JustLend, AAVE, Compound, MakerDAO).

Which existing protocol functions cannot be reused in FreeTON

The mechanism that cannot be reused as it currently exists is the FlashLoan mechanism. This mechanism assumes the cancellation of already completed chains of transactions, which is not possible in the FreeTON network. To implement this mechanism, it is required to change the mechanism or refuse to use it as such.

Unique features

The following can be proposed as unique functions that can be implemented in the future protocol:

the ability to automatically exchange some part of the collateral of one asset for another using existing DEXs and then deposit the tokens obtained as a result of the exchange as collateral to receive an increased interest on the collateral. This function will be useful for the ability to quickly close the deficit of assets and balance the protocol.

What positive sides does FreeTON have compared to the Ethereum network?

The following problems are currently resolved in the FreeTON network regarding the Ethereum network:

  1. Network speed.

The block generation speed in the network is much higher than that in the Ethereum network, which allows performing the functions of smart contracts (for example, exchanges in DEX) and transfers (TONs and user assets) faster - for example, when choosing the cheapest gas payment option, the execution time is ~ 10 minutes, while the FreeTON network has a transfer execution time of ~ 1-5 seconds.

  1. The cost of executing smart contracts.

At the moment, the execution of smart contracts in the Ethereum network is expensive, due to its increased popularity and the fact that the system was not ready for quick increase in the number of users, which is why the cost of the “gas” used to execute smart contracts has increased significantly. The cost of transferring user assets (such as ERC-20) is 4$-6$, for an exchange operation in DEX - 12$-18$ (if the network load is too high the price can go up to 150$), in the FreeTON network similar operations will cost: for transferring assets - ~ 1-2 ¢, the cost of exchanging assets in DEX (TonSwap by SVOI.dev) - ~ 5-10 ¢.

These aspects make it possible to resort to the following scheme: transfer tokens from the Ethereum network to the FreeTON network, perform the necessary operations - transfer, exchange and others, after which, if needed, to transfer the tokens back to the Ethereum network.

Implementation of the protocol in the FreeTON network

Consider the proposed mechanisms for implementation in the FreeTON network:

  1. The mechanism for providing collateral value - assumes the presence of oracles (does not exist yet, can be implemented within the competition or during implementation of the protocol) and data sources (implemented - TonSwap by SVOI.dev) to estimate the price of tokens, it also requires the creation of a user account, this contract is implemented in the process of implementing the protocol;
  2. Collateral value withdrawing mechanism - the same requirements as the collateral value providing mechanism;
  3. Borrowing assets - in addition to the requirements of the collateral value providing mechanism, an assessment of the risks of the selected tokens and the implementation of a risk model to assess the user’s borrowing capacity are required, as well as a mechanism for recording the excess of his borrowing capacity;
  4. Debt repayment mechanism - implemented if the first three points are implemented, the implementation with debt repayment in the asset, a different one from the borrowed DEX-platform is required (implemented - TonSwap by SVOI.dev);
  5. Debt liquidation mechanism - requirements as to a mechanism for borrowing assets, however, an auction mechanism (as in MakerDAO) is also required, this mechanism was implemented within the contest #15 Implementation of the auction, but requires improvements that can be implemented during development of the protocol or within a dedicated contest;
  6. The mechanism for obtaining interest on the provided collateral is implemented when the implementation of the first four points is completed.

As a result, the protocol can be implemented in the FreeTON network.

Functional to increase profitability due to constant reinvestment

Automatic reinvestment of the received profit, which in turn gives a complex % and an increase in the profitability of the deposit. those. transition from APR to APY in automatic mode.

APR is the annual percentage rate paid on an investment, excluding interest accrued during that year. Alternatively, APY takes into account the frequency with which the interest is calculated - the effects of the intra-annual interest calculation.

Problems of lending protocol implementation in the FreeTON network.

Problems of lending protocol implementation in the FreeTON network:

  1. Lack of an accepted standard for user assets. TIP-3 does not offer well-defined interfaces for interaction, as a result of which there are several implementations of tokens (including different versions of the same implementation), often without backward compatibility or without compatibility between different implementations;
  2. Lack of active use of DEX in the FreeTON network and ongoing development of solutions (TonSwap by SVOI.dev).

How can existing FreeTON DeFi products benefit from such a protocol and vice versa?First of all, it makes possible to:

  • get liquidity for projects secured by TONs;
  • short the assets by providing TONs;

Protocol governance

There are two main options of protocol governance - by the developers of the protocol and by the community that uses the protocol. The first option is pretty one-sided and is discouraged as the community will have no control over what is happening with the protocol so the second option is preferable.

In the case of the second option, to accept any changes a voting will be held where users can vote with their tokens (for example - to add a new asset or to change risk model parameters). Those tokens would be distributed proportional to user’s activity - if user performs a lot of high-volume operations then the user will receive more tokens than a user that performs less operations with lower volumes.

Used sources:

  1. JustLend
  2. The Maker Protocol
  3. protocol-v2/aave-v2-whitepaper.pdf at master · aave/protocol-v2 · GitHub
  4. The Money Market Protocol
  5. CoinmarketCap
  6. Etherscan
  7. ton.live
  8. Contests on Free TON Forum

On behalf of the SVOI.dev team, we declare that we are ready to subsequently participate in the development of the project (projects), the main aspects of which are preliminary considered within this contest, provided that there are sufficient resources at the time of the application for the creation of each individual project.

1 Like

Here is my submission to essay contest.

My wallet: 0:fd080fb5fc9266226ec59b062f0cdde85c818ef1d4ac4939804ee7616ec352f4

Telegram: @laugan

1 Like

Lending and borrowing on FreeTON - Essay contest submission

russian version below

All main DeFi protocols (AAVE, Compound, Maker, etc.) can be easily implemented on the Free TON blockchain (except for flash loans).

But the Free TON blockchain has two important advantages: speed of block generation and cost of smart contract executing (you can clearly test this at DEX, Liquidity Pools, Farming and Vesting | FlatQube - compare uniswap pool and into any other pool fees).

Thanks to these features, it is possible to build a social lending system for small amounts with a calculation of risks on Free TON blockchain.

Factors affecting loan approval:

  1. Contribution to the Free TON community (number of posts on forum, number of likes received, etc., participation in the role of an initial or a jury in subgovernances).

  1. History of transactions and balance of wallet (you can estimate how regularly and in what volumes user receives rewards for helping community. Accordingly, you can estimate when next replenishment of wallet will be, from which he will be able to pay off the loan).

For example, we have a jury of W&D subgovernance, whose wallet received 1500 TON Crystal for judging contests in 3 months. Also, he worked in SMM subgovernance, earned 1700 TON Crystal in 3 months. It can be assumed that he receives, on average, 1000 TON Crystals per month. Accordingly, if he asks for a loan in the amount of 10,000 TON Crystal, credit analysts will be able to estimate the term, percentage, and the likelihood of a successfully repaid loan based on user data. In addition, it is possible to freeze the future of the user’s remuneration from various subgovernances and enroll them as a loan payment.

Credit analysts and investors in this situation can be the initials of the subgovernaces who have additional information about the users.

Telegram: @andrew_vinter

Wallet address: 0:0ab4b5311b2bfadf881b2937d1aefd883df96a89f6404795c6ba3d844c9a3980

Lending and borrowing on FreeTON - Essay contest submission RU

Все основные DeFi протоколы ( AAVE, Compound, Maker и так далее) могут быть без проблем реализованы в блокчейне Free TON (за исключением flash loan).

Но у блокчейна Free TON есть два важных преимущества: скорость генерации блока и стоимость выполнения смарт контрактов (наглядно это можно протестировать на DEX, Liquidity Pools, Farming and Vesting | FlatQube - вставть в пул юнисвапа и в любой другой пул).

Благодаря этим особенностям на блокчейне Free TON можно построить социальную систему кредитования на маленькие суммы с подсчетом рисков.

Факторы, влияющие на одобрения кредита:

  1. Вклад в коммьюнити Free TON (количество постов на форуме, количество полученных лайков и т.д., участие в роли инишила или жюри в сабгjвах).
  2. История транзакций и баланс кошелька (можно оценить насколько регулярно и в каких объемах пользователь получает вознаграждения за помощь сообществу. Соответственно, можно оценить когда будет следующее пополнение кошелька, с которого он сможет оплатить кредит).

Например, мы имеем жюри W&D сабгова, на кошелек которого за 3 месяца пришло 1500 TON Crystal за судейство конкурсов. Также, он выполнял работы в SMM сабгове, за 3 месяца заработал 1700 TON Crystal. Можно считать, что в месяц он в среднем получает 1000 TON Crystal. Соответственно, если он попросит заем в размере 10000 TON Crystal, кредитные аналитики на основании данных о пользователе смогут оценить срок, процент, и вероятность успешно возвращенного кредита. Кроме того, можно заморозить будущее вознаграждения пользователя от различных subgovernance и зачислять их как оплату кредита.

Кредитными аналитиками и инвесторами в данной ситуации могут выступать инишиалы сабговов, которые располагают дополнительной информацией о пользователи.

Telegram: @andrew_vinter

Wallet address: 0:0ab4b5311b2bfadf881b2937d1aefd883df96a89f6404795c6ba3d844c9a3980

1 Like

LOL, I just discovered that I uploaded not the work itself, but the contest description :grinning_face_with_smiling_eyes:

In any case, let’s discuss the results at the weekly call.

1 Like

As some of you requested, please find the detailed calculation of the contest winners.

https://drive.google.com/file/d/1Cbm7GVMq16wOa3ZyXc4QuuFo9ptwKgIY/view?usp=sharing

Distribution contract: 0:A7EE57F6E0A51AF77D6695558FFEEAD580535FF4F29EAA68FC076BAAD5ADEEBB

Despite the fact, I did not get any reward, I’d like to proceed with the financial instruments topic. Cool features are and I have smth more on the table. Please drop me a line if we can to discuss at least. I have several tools to evaluate. @cryonyx, it seems you can help )