Case study
How a Cozy protection market might have protected investors in the Pickle Finance DAI pool.
In November of 2020, an exploit drained nearly $20M in funds from the Pickle Finance DAI pool. Investors who had deposited funds in the Pickle DAI pool had no protection from the exploit and lost all of the funds they had deposited. If a Cozy protection market had been available, investors who chose to participate in the protection market would have been protected against the exploit. Instead of losing all of their funds, participants in the protection market would have limited their exposure and retained their original investment.
Let's use the Pickle Finance DAI pool as a concrete example to illustrate how a Cozy protection market would have protected investors.

Create a protection market

Before investors can participate in the protection market, someone needs to design, develop, and deploy a contract that protects an asset from an exploit. For this example, someone familiar with Pickle Finance decides to create a protection market for the Pickle Finance DAI pool.
The developer of the protection market must identity the condition that would trigger protection for deposited funds. In this example, the developer has decided that a 25%+ loss of funds in the pool would indicate a serious problem and should trigger protection. She expresses this condition by writing a getPricePerFullShare() function. If this function in the Pickle DAI pool contract returns a value less than 0.75, the result would indicate a 25%+ loss of funds and trigger protection for the DAI pool.
In this example, there is only one trigger condition, but a protection market developer could add multiple trigger events to a trigger contract to make the protection it provides more robust or sophisticated. If any event occurs, protection is enabled. It is up to the protection market developer to identify the condition or set of conditions for which to offer protection in the trigger contract.
To learn more about creating trigger contracts and protection markets, visit this guide.

Provide protection by supplying assets

People who want to bet against the condition—in this case, the Pickle DAI pool losing 25% of its value—supply capital to the protection market to earn an interest rate from users seeking protection. In this example, participants supply DAI. The protection market developer wants to earn interest by making the protection market available to borrowers and protection-seekers, so she supplies DAI assets to the pool.

Get protection by paying interest

People who want protection for the Pickle DAI pool borrow DAI from the protection market and invest those assets into the Pickle DAI that offers protection. As protection-seekers, borrowers pay an interest rate for borrowing DAI from the pool. If the condition is met—in this example, the Pickle DAI pool losing 25% of its value—their debts are forgiven and their principal deposit remains safe.

Receive protection if an exploit occurs

If an exploit like the one in November 2020 were to occur with the protection market in place, the getPricePerFullShare() function would return ~0 because all of the funds in the pool were drained in an attack. However, this change satisfies the condition that the protection market is in place to guard against and triggers the cancellation of all debts in the protected Pickle DAI pool.
If you had borrowed DAI from that protection market and invested that DAI into Pickle, you would have lost all of your DAI on Pickle, but would owe zero DAI back to Cozy. Your principal would be preserved.

Summary

Cozy allows anybody to create and use protection markets. By using protection markets, you can provide and receive protection against any condition that can be defined on chain. This case study illustrates how a protection market could have protected investors against the insolvency of the Pickle DAI pool. Instead of losing all of their deposits in the exploit, Cozy users would have kept all of their principal.
Last modified 3mo ago