S1E5 — Season Finale

Ēnosys
5 min readJun 1, 2022

--

This week brought some big changes to FLR Finance. We introduced three new time-locked Farm pools and…we implemented the technical and economic fix for FLR Loans!

Time-Locked Farm Pools

Three new time-locked pools were introduced to FLR Farm: two EXFI pools with 90 and 180 day lockups, and one EXFI/SFIN LP pool with a 90 day lockup. SFIN reward rates for these pools are boosted by 1.5x (90 days) and 1.75x (180 days) compared to the corresponding unlocked pools. These rewards accumulate in the same manner as for regular FLR Farm pools and will be directly claimable at any time.

Adoption of these new pools has been quick, with over 2.4M EXFI being locked so far between the two EXFI pools and 60% of the EXFI/SFIN LP tokens being locked as well.

EXFI Loans

On January 21, 2022, the FLR Finance EXFI Loans platform, which mints the Canary Dollar stablecoin (CAND) from overcollateralized asset positions, experienced a price feed attack. Due to the low external market liquidity, fast on chain transaction speeds, and low transaction fees, attackers were able to purchase a relatively small amount of EXFI on the MEXC exchange to pump the EXFI price to $15 during the window in which the Loans price feed took a price snapshot. This allowed EXFI Loans to mint CAND at a highly inflated rate. When the price of EXFI on the exchanges immediately corrected back to the real price these loans were left in a very undercollateralized state, leading to their liquidation at a sub 100% Individual Collateral Ratio (ICR). These sub 100% ICR liquidations caused a loss to the Stability Pool stakers, as they were not compensated at the normal ~110% rate for their CAND burned in the liquidations.

The impact of this attack was not immediately apparent, as the Loans system was healthy enough to absorb the attack with little noticeable impact. Over the following days, FLR Finance analyzed the attack and began to develop a price feed system which would help prevent future attempts at price feed manipulation. Unfortunately, before this new system could be implemented, there were two separate follow up attacks.

On January 26, 2022 and January 27, 2022, there were two separate price manipulations on the external exchanges. This time, the impact to the system was not small. Combined, the two attacks allowed for the minting of ~3.5M undercollateralized CAND. When these undercollateralized loans were liquidated, the Stability Pool was fully drained at a below 100% reward rate with the remainder of bad debt being distributed across the remaining healthy loans. This began a liquidation spiral where the Stability Pool stakers then sold their EXFI reward into the EXFI/CAND liquidity pool in an attempt to recover their CAND, causing the price of EXFI on FLRX to drop precipitously. At the same time, those who had exploited the price feed attack to mint undercollateralized CAND took their illicit gains to the central exchanges to sell into USDT, causing a mirrored drop in the external market price of EXFI.

This series of events caused a rapid cascade of liquidations which redistributed over remaining loans as the SP was empty. Eventually, all existing loans on the EXFI Loans platform consolidated into one remaining loan with over 8M CAND debt collateralized by only ~4.4M EXFI. At this point, the EXFI Loans system encountered a situation which had never been encountered by the Liquity protocol from which it was forked resulting in the large EXFI loan becoming bugged and unable to be liquidated or redeemed against.

As a result of the peg mechanisms inherent in the FLR Loans protocol being unable to interact with the vast majority of debt and collateral in the system, CAND was unable to retain its peg. These systems have shown themselves to be robust for maintaining stablecoin pegs, but obviously cannot do so if they are not able to be used. In order for redemptions to interact with the debt held by the large loan, this debt would have to be re-collateralized in some manner. This left us with an economic crisis as well as a technical problem. We could not implement a fix for one without implementing a fix for the other at the same time.

A technical explanation of what occurred and the fix we have implemented can be found in this report from our auditor Common Prefix(linked here).

Additionally, we implemented a new EMA price algorithm which drastically reduces the ability for a pump and dump scheme to impact the Loans platform. This algorithm was outlined in Community Update S1E3 : https://flrfinance.medium.com/community-update-s1e3-d06347195d34

As to the economic fix, below is an outline of what has been implemented.

  1. The Loans platform Minimum Collateral Ratio (MCR) was set to 150%.

A. This change will help stabilize the Loans system through any immediate volatility. Should the system struggle to maintain peg in the upward direction, the MCR may be lowered again.

2. Liquidations were temporarily disabled.

3. Redemptions were temporarily disabled.

4. The Stability pool was temporarily detached.

5. 5.8M EXFI was added directly to the bugged loan in order to bring it to 100% ICR.

A. Getting the ICR to 100% allows for debt/collateral redistribution to occur without causing a net loss to the amount of EXFI overcollateralization in existing loans.

6. 8 new nests were created with minimum debt, but carrying a total of 7.6M new EXFI collateral.

7. The technical “total stakes” fix audited by commonprefix was implemented.

8. Liquidations were re-enabled.

9. The big loan was liquidated, redistributing the 100% ICR debt/collateral across all existing loans.

10. The Stability Pool was re-attached.

11. Redemptions were re-enabled.

12. A portion of the redistributed debt in the new loans was paid off using stores of CAND to further boost the TCR of the system.

13. The SGB Stability Pool SFIN rewards pool has been refilled.

This process was designed and implemented in a way that minimized the impact to platform users and to the overall market. Although it would have been more economical from our side to allow the Stability Pool and the existing loans to absorb the large loan, we were committed to finding the solution that did the least harm to our community. As a result, the FLR Finance Foundation had an outlay of 6.3M EXFI. The other 7.1M EXFI was graciously donated by the Flare Network in order to be used to help collateralize the system.

With the technical and economic fix fully implemented, the FLR Loans system is back to full functionality. Please note that the inherent risks of opening a collateralized debt position still exist and that these risks are somewhat heightened by the lower market liquidity of both collateral assets. Mass improper usage of the platform, such as highly leveraged nests, can still threaten system stability, especially if the Stability Pools remain below 40% of system CAND. The economic fix applied by the Foundation is unlikely to be repeated should the system become undercollateralized again due to irresponsible use of the platform.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Ēnosys
Ēnosys

Written by Ēnosys

Formerly FLR Finance. Decentralized Finance Platform on the Flare Network.

No responses yet

Write a response