Ethena (sUSDe) market on LlamaLend and price oracle for it

Summary

Objective is creating a LlamaLend (lend.curve.fi) market for Ethena sUSDe to be able to farm Ethena with leverage. At the time of writing, sUSDe offers 60% APY (47% APR). This market would allow to farm that with up to 20x leverage.

Here I:

  • Create a custom oracle for sUSDe which combines 3 Curve pools to get sUSDe price;
  • Propose a parameter change for sUSDe/sDAI pool to be more resilient to possible sUSDe peg price fluctuations, if they ever occur: T_half to 30000 seconds (T_exp to 43280 seconds);
  • Propose a gauge for the market; details about parameter simulations described.

Specification

Price oracle

LlamaLend uses Curve pool oracles. But there is no sUSDe/crvUSD pool. I propose to combine price oracles for 3 pools: sUSDe/sDAI + sDAI/FRAX + FRAX/crvUSD.

To make that possible, I wrote a smart contract which can combine price oracles of any number of pools, and also is aware of redemption rates if they are present. Redemption rates can be potentially manipulated by donation attacks, so the oracle has limits on how fast the redemption rate can change in its code.

Simulations

Simulations of optimal parameters are performed here. We had to take a different stablecoin (not sUSDe) as an example. It had to be sufficiently volatile and have a long history.

Calculating Thalf / Texp:

0_T

Optimal Thalf for minimal loss seems to be 30’000 seconds which corresponds to T_exp = 43280 s. Note that graph mislabels the axis as Texp - it’s actually Thalf.

We have to make a vote to increase Texp of a sUSDe pool to that value.

Calculating fee

1_fee

If we try to simulate losses for longer time, graph looks like this:
3_fee_long

Noise is high, but it is clear that the fee can be in quite a wide range (from 0.1% to 0.6%). I propose fee = 0.2%.

Calculating amplification A

4_A_wide

And zoomed in

4_A

This suggests that best liquidation ratios would be achieved at A = 130.

Deriving market parameters

At A=130, calculated pool loss is 1.5% (blue graph), however there could be a significant uncertainty. Let’s make liquidation_discount = 2.5% for a safety margin. Loan discount should be even slightly larger, so let’s make it loan_discount = 3.5%.

Maximum LTV possible should be approximately:

ltv = (1 - loan_discount) * ((A - 1) / A)**(4/2) = 0.95

Which makes maximum leverage possible of 20x

Deployment parameters for the script

borrowed_token = CRVUSD
collateral_token = "0x9D39A5DE30e57443BfF2A8307A4256c8797A3497"
A = 130
fee = int(0.002 * 1e18)
loan_discount = int(0.035 * 1e18)
liquidation_discount = int(0.025 * 1e18)
price_oracle = "0x50c39EA8f3D72310C8B56A56B333994266e9b477"
name = "methena"
min_borrow_rate = 5 * 10**15 // (365 * 86400)  # 0.5%
max_borrow_rate = 60 * 10**16 // (365 * 86400)  # 60%

factory.create(borrowed_token, collateral_token, A, fee, loan_discount, liquidation_discount, price_oracle, name, min_borrow_rate, max_borrow_rate)

Market

Vote

4 Likes

This is unsafe. I will publish why in 2 weeks, but I will not give details before that.

sUSDe is unsafe or borrowing against it is? Please elaborate

Just looking at the plot, is this sawtooth pattern on the relationship between A and Loss expected? It seems to be some sort of a noise artefact for A values below 800?

4_A

1 Like

Yes, of course there is noise, no single doubt about it!

Where does this noise come from?

Stablecoins are not very volatile, so they hardly have any losses except for few times of stress. Due to that, you don’t really get much of statistics, hence noise

1 Like

Simulations use multiple random paths (say, 100000 per point), it’s not just one simulation which calculates loss. Also we seek for maximum loss, not average loss (average is way way less and almost has no noise)

I see that around A=800, the noise seems to go away. Is there something specific about this value? Should we instead consider values that are not from the noise region (so, A > 800)?

sUSDe has a 7 day unstaking period. This means it’s quite likely to lose the peg in a liquidation scenario. And you’ll be reliant on outside capital who are willing to take a 7 day arb.

It recently dropped to a 2% discount. The current sDAI/sUSDe doesn’t exactly have optimal parameters with an A of 800 and a fee of 0.02%.