OriginProtocol / origin-dollar

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

Uniswap Strategy #252

Open micahalcorn opened 3 years ago

micahalcorn commented 3 years ago

Add a vault strategy that takes stablecoin deposits and supplies them to one or more of the following liquidity pools:

We will need to decide how to allocate deposits and withdrawals since Uniswap liquidity pools necessarily involve dealing with two tokens at a time as opposed to our Compound strategy, which can lend or withdraw any single token.

tomlinton commented 3 years ago

Our current allocate structure will actually work as is for Uniswap. Allocate iterates over all assets and deposits in one strategy to maintain a target weight for that strategy. So adding a Uniswap strategy that supports DAI and USDT will have the result we want, a strategy that fills up with DAI and USDT. The deposit() method of the strategy then provides liquidity in the Uniswap strategy by adding equal amounts of each coin according to the minimum.

In practice this is far from optimal, we will end up with very small amounts of DAI and much higher values of USDT, leaving a lot of uninvested USDT in the strategy. If we are looking at the DAI/USDC pool however, what we have might work fine.

I do think we should figure out a better approach, but I wanted to point out our existing setup would work for certain cases because I think we might be able to get to where we need to be with smaller changes than you might think.

Some ideas I'm tossing around:

It seems like some of what may be required can be based off the calculateRedeemOutputs code.