OriginProtocol / origin-dollar

OUSD and OETH are stablecoins that passively accrue yield while you are holding it
https://originprotocol.com
MIT License
116 stars 80 forks source link

Decentralized rebase incentives #1229

Open micahalcorn opened 1 year ago

micahalcorn commented 1 year ago

In https://github.com/OriginProtocol/origin-dollar/pull/869, we made it possible for anyone to trigger a harvest and receive an incentive in exchange. The idea was that we would eventually do the same for rebases. Anyone can already call the function, but there's no incentive to do so. We have a Chainlink keeper triggering it every morning, and redeems already include a call to rebase.

DanielVF commented 1 year ago

We've proven out incentivized decentralized "maintenance" actions with the incentivized harvesting. It's worked very well since launching.

It would be great to cut the dependency on funding chainlink keeper for daily rebases.

We could do this on OETH by adding incentivized rebasing to the current dripper contract. This would ensure that user principal is never touched, and only pre rebased funds are used. The worst case then is no automatic rebase, not insolvency.

The disadvantage of using the dripper is that OUSD is currently getting none / barely any reward tokens, and thus isn't really using the dripper. We'd have to move this more into the core code.

Two possible approaches:

Fixed intervals

The dripper would have a method that could only be called once a day (just like our current keeper code). This method would run the drip, then rebase, then pay the caller.

The code would total up the gas used, multiply by the current block base gas price to get a gas cost, then add an incentive. This incentive would be a fixed ETH amount, ramping up over the course of the 15 minutes window that we would prefer our rebases to happen in. If no rebase happened in the window, then the incentive would remain at 75% of peak for the rest of the day.

This is basically a Dutch auction on calling the rebasing code, and would prioritize the time window over cheapness.

Cheap gas and higher APY.

There is a blanking period after each harvest the incentivized rebasing reverts (say 20 hours). After this, the incentive gradually ramps up, taking no account of current gas costs. This is very similar to what our current harvesting is doing, minus the blanking period. This incentives calling during low gas periods.

We would have a simple controller in the code, like the old block difficultly in ethereal, when we are called more frequently than our desired target time, we would slow down the incentive price increase rate, and when we are less often, we would speed it up. This would mean that changes in the price of ETH, or other long term gas changes do not require manual adjusting.

joshfraser commented 1 year ago

How much would it change things if we routed 100% of funds via the dripper and switched to rebasing with every block?

If we had a constant drip of yield, the rebases could be based on the amount of value accrued instead of being strictly time-based. Sometimes, we'll want multiple rebases a day. In other cases, once every few days is enough. I like the idea of using a dynamically adjusting reward based on how badly we need people to poke the contract.

Right now, OETH is often rebasing multiple times a day with large mints, so the Chainlink Keeper ends up being an unnecessary waste of money. This is not the case for OUSD, however.

No matter what, the goal should be to make the protocol self-sustaining and not dependent on the generosity of any centralized parties to keep funding maintenance.

DanielVF commented 1 year ago

The rebasing every block ends up being fairly orthogonal to actually needing to call rebase, because the big gas cost to figure out how much assets we have has to happen some time, and we don't want happening every time someone transfers OUSD. So instead there's still the big rebase math that sets the rate, and then those funds get dripped out at the calculated rate out into TLV and balance increases block by block.

But in the end, we still need to run that expensive code run that does all the work.

We could certainly do it off of a percentage of new value accrued. This would work well with an incentivized system, since calculating it takes a lot of gas, and that can just happen off chain. Having per block rebases would also work well with this, since with OUSD for example people would still see their balances going up, even though the it might be multiple days between rebases.

joshfraser commented 1 year ago

I like the per-block rebasing because it demonstrates how the protocol works within your first minute as an OToken holder. Per-block rebasing is also nice because it keeps things ticking up so we can rebase when it makes sense economically vs. some arbitrary schedule.

A simple solution might be to keep rebases on large mints & redeems and then offer something like a 2% commission to whoever calls the rebase function. Thinking about it some more, I'm not sure we want to keep increasing the commission if the gas costs are spiking. Maybe it's best to just sit and wait? 🤷‍♂️