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:
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
If we try to simulate losses for longer time, graph looks like this:
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
And zoomed in
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
- Link to the market
- Gauge address: 0x82195f78C313540E0363736b8320A256A019F7DD
Vote
- Curve: https://dao.curve.fi/vote/ownership/669
- Convex: Snapshot
- StakeDAO: Stake DAO | Governance
- Curvemonitor voting: Curve Monitor