In the Cozy V2 protocol, a market’s cost model sets the costs for purchasing protection and refunds for cancelling protection. Costs paid by protection purchasers are set aside in a fee pool and slowly accrue to protection suppliers as yield.
Each cost model is a contract required to implement a minimal interface, which includes:
A cost factor function, which outputs a cost as a percentage of the purchase amount.
A refund factor function, which outputs a refund as a percentage of the market’s fee pool (assets which are still pending accrual to suppliers).
Both of these functions take the market utilization before and after the purchase/cancellation as inputs. So, much like DeFi lending markets where interest rates depend on the pool utilization, cost/refund factors can depend on market utilization.
Exactly how cost/refund factors should depend on utilization is up to set creators using the Cozy V2 protocol. They have flexibility in specifying the cost models used in their sets.
A common interest rate model for lending markets, popularized by Compound and Aave, is the jump rate model. A similar model can be used in the Cozy V2 protocol as a cost model.
A jump rate model defines the cost factor as a piecewise, increasing, linear function of utilization. The kink defines a target utilization, after which costs increase rapidly to help keep utilization less than 100%. This ensures that suppliers are able to withdraw assets whenever they want.
Importantly, the jump rate model is static: its parameters are fixed.
Static cost models can sometimes lead to inefficient price discovery and sub-optimal capital efficiency.
As a simple example, consider a jump rate model where the cost factor for the first 10% of protection is 5%. In case the demand-side of the market deems this cost factor too expensive, the market will sit at 0% utilization indefinitely. Suppliers are also unhappy since they are earning no yield from this market. In an ideal world, as time passes and no one purchases protection, the cost factor should come down from 5% to 4%, 3% and so on, until the market clears.
Dynamic cost models can support exactly this type of behavior, automatically adjusting parameters over time in response to supply/demand. Two clear advantages from these adjustments are:
As the market’s risk perception evolves over time, they obviate the need for lengthy governance processes to modify parameters or manual configuration updates.
Cost models become more resilient in the case of misspecification. When set creators using the Cozy V2 protocol do not have a clear sense of what the fair price of protection should be, they can use a rough approximation and expect the model to eventually move towards the market-clearing price.
One solution for set creators using the Cozy V2 protocol is to use the dynamic level cost model, which is a simple extension of the jump rate model.
Here there is an optimal utilization zone,[uLow, uHigh]
, and uOpt = (uLow + uHigh) / 2
. What makes this model dynamic is that when market utilization is above uOpt
, the cost factor in the optimal zone automatically increases to make protection more expensive. When market utilization is below uOpt
, the cost factor in the optimal zone automatically decreases to make protection less expensive. Visually, the curve between uLow
and uHigh
(colored in green) can move up or down.
The amount that the curve moves up or down on a given purchase/cancellation is dictated by how long the utilization as deviated from uOpt
and the size of the deviation. The more that utilization has exceeded uOpt
and the longer it has exceeded uOpt
, the more the curve moves up. Similarly, when the curve moves down.
For more details on the inner workings of the dynamic level cost model, check here.
The dynamic level cost model above is just one of many possible ways to make cost models more responsive to supply and demand over time. It is broadly inspired by the idea that many DeFi mechanisms boil down to some form of PID controller.
Many DeFi lending protocols have explored much more complex, PID controller-type interest rate models, including Silo Finance, Euler Finance and Mars Protocol. As mentioned previously, set creators using the Cozy V2 protocol are free to experiment with similar designs in their own cost models.
It is important to point out that dynamic models are not a panacea.
First, dynamic models will tend to be more computationally intensive and consume more gas. In the Cozy V2 protocol, the dynamic level implementation requires updating storage variables on each purchase/cancellation, while the jump rate implementation does not.
Second, in some scenarios, dynamic models can reduce capital efficiency. Chitra, Erins, Kulkarni 2022 analyze lending markets and show that if supply/demand is very inelastic, dynamic interest rate models may permit someone to move rates such that they earn an outsized share of the pool’s yield. Mitigating this outcome would require targeting low pool utilization or implementing supply caps, which makes suppliers worse off. An analogous strategy will tend to be prohibitively expensive in the Cozy V2 protocol given time-locks on protection purchases and set shares.
One question that may be of interest to set creators when setting their cost models is:
Should I expect dynamic level cost models to outperform jump rate models when I do no know the market’s fair price of protection?
In a vacuum, it is difficult to quantitatively predict the effects of a particular cost model. A market’s utilization and the yield earned by suppliers is a complex function of the optimizations made by heterogeneous actors interacting with the Cozy V2 protocol.
A useful approach in such cases is agent-based simulation. Cozy’s simulation framework, Agent Buttercup, allows DeFi researchers/engineers to answer exactly these types of questions. Below, the framework is leveraged to extract some insights.
The simulation consists of a single market in the Cozy V2 protocol and does a side-by-side comparison of the jump rate and dynamic level models.
For the exact simulation set-up, please check here.
In each side-by-side comparison, the cost models:
Have a target utilization of 75%
Jump rate model is set so that kink = 75%
.
Dynamic level model is set so that uLow = uHigh = 75%
.
Have a minimum cost factor of 0.50%
Have a maximum cost factor of 10%
Begin with a cost factor at target utilization of x, where x varies from 0.5% to 8.5%.
Notice that with this set-up the dynamic level and jump rate model start off looking exactly the same, but the optimal zone (which happens to just be a kink since uLow = uHigh
) in the dynamic model will move over time.
There are three types of agents interacting with the market:
Passive suppliers, who are price-insensitive and always willing to underwrite protection.
Passive buyers, who are price-insensitive, have a target protection amount and are always willing to buy protection to reach that target.
Active buyers, who hold the view that the fair price of protection is 4.5%. They will purchase protection when the cost factor is less than 4.5%. They will sell protection when the refund factor is greater than 4.5%.
Agents are initiated with a random budget of the market’s asset and take actions with random waiting times governed by a Poisson process. Passive buyers are initiated with random target protection amounts.
The results below show the median utilization and supply APY over the 75-day simulation. The table on the left indicates that the dynamic model always gets the market closer to target utilization, 75%. The table on the right indicates that the dynamic level model usually tends to get suppliers higher yield.
The time series plots below show the simulated cost factors and utilizations for the case where the kink cost factor starts at 8.5%. The dynamic cost factor trends downward, as the model slowly adjust to the fact that active buyers view an 8.5% as too expensive. As a result, dynamic utilization trends upwards. The jump rate model gets stuck with utilization hovering around 40%, as active buyers are unwilling to make purchases which push the price over 4.5%.
Overall, these results support the hypothesis that dynamic level models can outperform jump rate models when set creators do not have a precise estimate of the market’s fair price of protection.
DISCLAIMER: This article is for informational purposes only and is not financial advice. Please do your own research and consult a financial advisor before making any investment decisions.