How does AliceFi’s lending work?

Trustless and reliable crypto finance

Yoonjae Yoo
AliceFi
11 min readAug 5, 2019

--

AliceFi is a DeFi app. It is a platform that anyone can trust, participate and benefit from it. There’s no centralized entity who benefits from it.

Here is a brief summary of this article:

1. Staking ALICE tokens for a particular token, that token is enabled as a collateral.
2. Operators (who staked) should perform two tasks: a) liquidate loans b) provide price feeds.
3. Operators (who staked) are distributed the profit of the loan arising from the collateral.

Before we talk about lending, let’s start with a brief overview of savings.

Crypto savings

Crypto savings are working on DAI stable coins. DAI is a cryptocurrency designed to have a value of $1 USD. It operates in a completely decentralized way, without having to trust anyone. Users can save as much DAI as they want and there is no limit to this amount. You can save 1 DAI or 10,000 DAI or whatever you want.

DAI is a cryptocurrency designed to have a value of $1.

What’s different in AliceFi Savings

There are already several savings protocols in the Ethereum network similar to AliceFi. Compound, Dharma are famous ones, and what distinguishes them from AliceFi is that our savings start immediately and provide fixed interest.

Other protocols require you to wait for a match with the borrower who would pay for interest. If you want to save crypto in protocols such as Dharma, it takes time until your crypto generates interest because you need to wait for the match. However, in AliceFi, you don’t have to wait for any match and interest accrues immediately after saving!

Also, in protocols which provide a unique, common interest rate, all users share the same savings interest, and this interest rate changes dynamically depending on market conditions. In other words, a user with a savings rate of 8% today cannot expect the interest rate to be maintained throughout a year. In fact, the savings rate of a protocol such as Compound fluctuated from a minimum of 4% to a maximum of 16% this year.

Instead in AliceFi, if you started savings at 8%, then 8% interest is applied constantly until all the amount is withdrawn. This will give users a much more pleasant experience.

Crypto loan backed by collateral

AliceFi’s interest rate was designed to give back maximum benefit for users. The question would be, how does AliceFi pay interest? It’s made possible by crypto loans backed by collateral.

In AliceFi, you can borrow DAI stablecoins, leaving one crypto as collateral that you expect to rise in value, such as ETH, WBTC, MKR, and OMG.

The history of the blockchain and cryptocurrency industry is quite short. Up until now, cryptocurrencies have been mainly used for trading purposes. When someone owns a crypto asset, they wait for the price to go up and then sells back to the market. AliceFi wants to offer one more usage to cryptocurrency: as a collateral for loans.

Let’s take an example. If you believe that the value of ETH in a year will be 100% higher than it is now, it would be wiser to borrow money using it rather than simply hold it. If its value actually rises 100%, it is obvious that you will get profit if you pay loan interest of lower than 100% and repay it before one year passes. Unlike a credit loan, after you repay interest, you will get back the collateral that you pledged. And the loan interest rate at AliceFi is 10% ~ 20%. It would be wise to lend if you expect higher rises!

In reality, cars and houses are pledged as collateral, but in Alice crypto is.

Savings and loan interest rates

AliceFi’s savings and loans are closely linked. DAI provided by users in savings is managed in the fund smart contract. And DAI which is piled up in this fund contract is used for loans.

If we were a centralized bank, our staff would manage this fund. The policy might be managed inside the bank and as a result only interest rates will be notified to the customers. There is no way of knowing by what kind of process the interest rate has been determined. It can be predicted that it will be regulated by demand and supply, but there is no way to know what additional factors are being considered. If the bank has set a high interest rate for short-term profits, you still have to follow.

At AliceFi, however, all this process is transparently and efficiently managed by smart contracts. And the only factor that determines the interest rate is the demand and supply of the fund. AliceFi uses smart contracts that dynamically increase/decreases your savings/loan interest rate depending on the size of the fund. Because of the nature of the blockchain, that is publicly viewable and can not be modified by anyone. Interest rate calculation in savings/loans is so transparent that you can use trustless financial services.

Collateral ratio & liquidation of collateral

In order for AliceFi’s savings/loan system to be sustainable, the interest accrued from the loan must be greater than the amount of interest to be paid for savings. In other words, borrowers can pay interest on savings to pay the full amount of interest. But what if borrowers do not pay back?

In order to avoid the risk of not repaying these loans, AliceFi has a collateral ratio and a collateral liquidation process. First of all, the collateral rate is the value of the crypto assets users need to provide as collateral against the value of the DAI they are going to borrow. If the mortgage rate of ETH is 150%, you must provide $100 * 1.5 = $150 ETH to borrow 100 DAI. The reason for this ratio is to prevent loss risk due to the sudden drop in the value of the secured crypto funds.

Collateral liquidation begins when the principal + interest exceeds the value of the collateral and under the liquidation phase, collateral is being sold until the value of the collateral is higher than the value of the principal plus interest. Therefore, the borrower must be careful that the value of the collateral is always greater than the principal + interest. If one of your loans is close to liquidation conditions, you may be able to provide additional collateral or provide some DAI to pay off your debt.

Collateral liquidation begins when the principal + interest exceeds the value of the collateral

Staking for collateral tokens

How would a token be used as a collateral? Does the AliceFi team decide which tokens to use, such as ETH, WBTC, MKR, and OMG mentioned above?

No. The listed tokens that can be used as collateral are only activated by staking ALICE tokens. ALICE tokens are used within the AliceFi ecosystem and will have a variety of uses, the first of which is to be used for staking purposes for collateral.

The reason that the ETH, WBTC, MKR, and OMG tokens are initially listed in AliceFi as collateral is because the AliceFi team has staked ALICE tokens for each token. This staking is available for anyone with a minimum of 25,000,000 ALICE tokens at the AliceFi dashboard. Users who stake this way are called operators. Operators do things that the smart contract cannot for the AliceFi system and are compensated for it. Compensation is in DAIs that arise from the difference in interest between savings and loans.

Anyone with a minimum number of ALICE tokens can become an operator through staking for any ERC20. You can stake on already listed tokens, or even on new ERC20 tokens. And from the moment starting staking, operators have duties and rights.

Duty of operators I: Performing liquidation

For AliceFi’s lending system to work well, liquidation must be done efficiently. There are two scenarios for entering the liquidation phase: a) when the borrower does not repay interest thus the principal + interest exceeds the value of the collateral; b) when the value of the collateral declines and is lower than the principal + interest. Both scenarios have a negative impact on the system, so the operator must intervene and perform the liquidation.

The liquidation means that the operator takes the collateralized tokens and fits the corresponding DAI into the fund smart contract. If this process does not happen quickly, the loan may become riskier as time goes by, as it’s possible that the loan interest accumulates further or the value of the collateral gets further depreciated.

Operators will be given a day to perform the liquidation. If the loan is cleared within one day, there is no problem. If, however, the liquidation happens after one day has passed, then a joint penalty is imposed on the operators of the collateral token. For each loan, each time the liquidation process exceeds one day, 1% penalty applies. For example, a 1% * 10 = 10% penalty will be imposed on all operators if a loan goes into effect after 11 days, despite the fact that the loan went into liquidation.

Duty of operators II: Providing price feeds

Operators should inject AliceFi with real-time market prices for collateral tokens. Because AliceFi is a decentralized app that works on a blockchain, there is no way of knowing what the price of that token is outside the blockchain. Someone has to take the role of oracles to provide price feeds, and only operators are allowed to do it in AliceFi.

Then the question is, how does AliceFi’s smart contracts know that operators are providing the correct price feed? An operator who intentionally reports higher or lower than the market price in order to break the system with malicious intent should be prevented. How can alleged illegal activities be monitored in AliceFi without any central manager?

First, let’s define the term price of a collateral token. The price of a collateral is how many DAIs you can borrow when you submit that token. (Note that the collateral rate should be considered.) In other words, real time price in decimal point is not important, but the prices of the collaterals are variables that operators can adjust with flexibility.

Let’s think about whether the operator reported higher or lower amounts than the market price. First of all, if he reported a too-low price, there is no reason for users to make a loan from AliceFi. There are other protocols that offer more DAIs for the same collateral. Operators are aware of this and thereby will not report low prices.

The problem, however, occurs when they reported a price that are similar to those of the market first and then the price is reported at a very low level. For example, suppose ETH is reported as $200 and the operator sharply lowers to $100. Since the ETH price has dropped to $100, some loans will go into liquidation and the liquidation must be handled by the operator.

The processing of the liquidation means that the ETH price is $100 and the corresponding DAI is paid to fill the fund smart contract with DAI. At this time, the operator gets a huge benefit over purchasing from outside AliceFi because the operator has purchased ETH for $100.

How do we avoid malicious behaviour?

Some mechanisms have been devised to prevent such an attack. The price should be reported every hour, and a corresponding timestamp must be entered together. In other words, “ETH price at 00:00 on January 1, 2020 is $1000.” When different price feeds have been reported from several operators, the highest price is accepted for the same timestamp. If there are 10 operators and 9 people report the price of ETH at $1 while the other person reports $1000, it is set to $1000. If there is at least only one honest operator, the rest, even if they are all malicious, cannot make the price lower than the honest one. Therefore, users should be careful if there is only one operator who operates a mortgage.

In the opposite case, let’s say operators reported a higher price than the market price. For example, if the collateral rate is 150% and the price of ETH outside AliceFi is $200, you could have borrowed only 133 DAI if the price was reported honestly. However, if the operator reported $300, you can borrow 200 DAI. In other words, as operators reported higher prices, borrowers were lending more money than they could actually borrow.

What if this loan goes into liquidation? It is the duty of the operator to handle liquidation. So they have to buy ETH for $300 even though it is being traded at $200 in the market. They need to pay 33% more to buy that collateral, which would be a big loss for operators. Operators who know this will not report higher prices than market prices.

But what if the liquidation never happens? If the operator continues to report close to infinity, the liquidation will never occur so borrowers will not have to pay any interest. Approved loan approvals will only continue to increase, never liquidated. In this case, AliceFi funds will go bankrupt because no interest is gathered from loans which needs to be paid to the savings.

To prevent this, operators can only report up to 1% higher than the previous timestamp. Because you have to report every hour, you can only get 1.01²⁴ = 1.26 times the price in 24 hours. Operators can not raise the price of a collateral token sharply, but only increase by up to 126% per day.

Lastly, what if operators do not provide price feeds? The market value of the collateral shall not be reflected. To prevent this from happening, there is a penalty imposed on operators in the absence of a price feed. If the price of a collateral token is not reported for 1 hour, then 0.1% of the staked ALICE tokens will be deducted. For 10 hours, it is 1%; For a day, it is 2.4%. Therefore, operators must work hard to avoid missing price reports on an hourly basis.

Operator Rights: Compensation

Operators should be compensated for doing things that a smart contract cannot do to ensure that the loans are working smoothly. The compensation arises from the difference between the interest on the loan and the interest to be paid on the savings, and it is distributed according to the shares of the operators. There are no central entities that distribute the fee in addition. All loan proceeds are distributed to operators.

For example, suppose you have a loan of 10,000 DAIs when ETH collateral loan is on interest of 20% and a savings interest of 10%. This 10,000 DAI can be expected to be 12,000 DAI a year later, of which 11,000 DAI is expected to be returned to the savings. The difference of 1000 DAIs is distributed to the operators according to their shares. An operator who staked 50% ALICE tokens on ETH collateral gets paid 500 DAIs, while another operator who staked 10% gets 100 DAIs.

Of course, in reality, the 10,000 DAIs do not run throughout the year, so the actual return will be less, and distribution of the compensation does not happen exactly one year later, but when the loan is repaid. However in the big picture, the same mechanism is applied.

The larger the total amount of the loan executed with ETH as collateral, the greater the return to the operators. Since this is transparently written on smart contracts, new operators will stake more ALICE tokens to get paid profits. We can expect a virtuous cycle in which the existing operator gets distributed smaller amount of profit when new operators come in, thus leading to greater amounts of ALICE tokens being staked.

Therefore, it can be expected that the bigger the total amount of loans for a collateral token, the more operators are working for that collateral token with bigger stakes.

Conclusion

AliceFi’s savings/loan operate itself trustless. Demand and supply determine real-time savings/loan interest rates and it is impossible for anybody to intervene and change them.

If you deposit amount for savings in DAI, your interest accrues every day, and you can withdraw all or part of the amount at any time. Loans are conducted with the help of operators who have deposited ALICE tokens, and their duties are to provide price feeds and perform liquidation. And the generated loan income is distributed to the operators.

If you want to explore using AliceFi , download the app now! (Android, iOS)

--

--