(Draft) A better yield farming design for algo stable coin Basis Cash
Basis is growing fast, BAC price is quite stable but not yet reaches the level of its predecessors (usdt/usdc/dai etc), its supply size is also small.
To make BAC successful the growth of BAC supply is critical, currently incentives of holding BAC is to mine BAS, the fundamental minging pool is working quite well. But it is still not so attractive to the people who don’t favor risks that much, especially those traditional stable coin holders/investors.
The current BAC minging design offers only same risk and same return, and this risk level is not widely acceptable by the majority of DAI holders, we can have a better design on top of current BAC mining pool to address this problem. The design will divide risks/profits to different levels for DAI holders and BAC holders. In such a way both parties will be satisfied with their own level of risks and profits.
The key concept is to offer farming for DAI investors without exchange any DAI to BAC to avoid impermanent loss from unfamilier algo stable coin. The BAC and DAI from both token investors will be put together to mine BAS. However the underlying is a AMM pool which means impermanent loss will exist and we need a way to eliminate it under a certain level of volatility.
If both sides of the AMM pair are standard ERC20 (not rebase coin like AMPL), when IL happens, one side of the pairs will increase and the other side will decrease. The BAC defi contract will use the increased amount of one coin to buy back the decreased amount of the other coin. However this will result in total loss for sure, and we have a model for this loss when price changes.
Let’s take an example both sides(BAC & DAI) deposit 1000 its own token and the price starts with 1:1. Lets assume price of DAI rises from 1 BAC per DAI to (1+x) BAC per DAI, where x is also the percentage of DAI price rises. The equation of overall net percentage of DAI loss after we recover with BAC gained from price changes is as below.
where x is the percentage (0.3 means 30%) of DAI price rises and y is the percentage (0.3 means 30%) of DAI loss from the original 1000 DAIs. The loss curve is as below:
As BAC is designed to be a stable coin the price volatility is very unlikely to be at the scale of above curve shows, we can zoom in to see how it would be like.
Even when the price of DAI rises 50%, which means BAC drop 33%, the overall net loss of DAI is just over 3%. And in the case where DAI price rises 25%, which means BAC drop 20%, the overall net loss of DAI is just slightly over 1%.
We can further simplify the equation for the example above.
And with this we can simulate with some data.
Now we have a loss model in mind we can see how we design some key functions for BAC defi contract.
The investors’ token will be in one of the following places, token reward pool awaiting to invest or as withdraw reserves, in BAC defi contract as token reserves, in BAC/DAI UNI pool.
The BAC defi contract is responsible for all money operatations including add liquidity, stake LP for BAS, swap BAS for token reserves, split BAS between token reward pools. It provides a harvest function and a withdraw function.
The harvest function will be executed periodically by a whitelisted operater , the function will finish the following tasks.
- claim BAS reward from BAC/DAI reward pool.
- reserve a portion of BAS and swap it to token has temperary loss.
- add liquidity if both token reward pools have new investments
- remove liquidity from BAC/DAI reward pool if cash level of any token reward pool drops below a threshold
- reserve the token for the amount more than debt balances in each token reward pool
- transfer the rest amount of both tokens back to its reward pool
- split remaining BAS rewards by a percentage parameter and transfer to both token reward pools
- notify reward for each token reward pool
The withdraw function will be executed by both token reward pools. When any token reward pool is lack of cash in case the investors unstake their stable coins then this withdraw function will be invoked. It will finish the following tasks.
- remove liquidity from BAC/DAI reward pool
- keep the BAS reward
- reserve the increased token for the amount more than debt balances in each token reward pool
- transfer the rest amount of both tokens back to its reward pool
The token reward pool is responsible for interactions from DAI and BAC investors/contracts. It approve BAC defi contract to spend its token. It incluedes functions like stake, unstake and claim reward.
The stake function allows investors to stake their token into token reward pool, the just staked token won’t be put into BAC/DAI lp mining pool right away, it will be sharing the reward in pool immediately though. The function will finish following tasks.
- Transfer token from investor’s address
- mark debt balance for investor
- update reward per share data for investor
The unstake function allows investors to exit their investments. It will finish following tasks.
- check debt balance for investor
- transfer token to investor if token reserves are adequate
- ask BAC defi contract to withdraw if token reserves are not adequate
- update debt balance for investor
- check rewards for investor
- transfer reward to investor
- update reward per share data for investor
The claim function allow investors to claim their rewards but investment stays in the pool. The function will finish following tasks.
- check rewards for investor
- transfer reward to investor
- update reward per share data for investor
We can have some further functions in the design in the future.
The split percentage parameters can be changed by a DAO contract which accepts votes from BAS holders to update mining reward splits.
Another role of betting against price volatility can also be included, the stake from such a role can be served as the cover reserve when price volatile too much, and as a return the BAS reward can be split a small percentage to staker. As the loss model shows the net loss for extra cover would be small, so the daily yield of this type of stake could be very high for just adequate bets.
To summarize, AMM and liquidity farming is very powerful, but the risk/profit preference offered is just one choice for all investors, and that would restrict the potential investors into a very narrow band. By adding this design on top of AMM liquidity farming, we can provide more risk preference choices to different risk-favour investors while maintaining the same liquidity providing power. DAI investors can have a better yield than the market compare to other DAI-only yield farming, and spare some reward to higher risk taker the BAC investors. The BAC investors can have even higher yield than as BAC/DAI lp provider thanks to the reward spared by DAI investor, in such a way the investment utilization can be more optimal.