ChorusOne/solido

[Anchor] Exchange rate for deposit/withdraw

Closed this issue · 1 comments

ruuda commented

Problem

Currently we use the inverse of Solido’s exchange rate for deposits and withdrawals. This enforces that 1 bSOL = 1 SOL at all times.

  • If the price of stSOL in SOL goes up, the reserve may contain more stSOL than what is needed to back the bSOL, and then we can sell some of the stSOL (and the proceeds go to the Anchor Protocol on Terra, where they are distributed among bSOL holders).
  • However, if the price of stSOL in SOL goes down, then the reserve may no longer contain enough stSOL to back the bSOL, and if we allow withdrawals at Solido’s exchange rate, we might end up with an empty reserve.

Now, at the moment the stSOL price can only go up; slashing does not exist on Solana yet, and as far as I am aware, there are no concrete plans to implement it. However, should it happen that the stSOL price goes down, that would be a very bad scenario.

Solution

There are various things we could do:

  1. Disable withdrawals if the reserve does not contain sufficient stSOL to back the supply of bSOL. This is the safest thing to do for Anker, but it locks user’s funds, who will not be happy.
  2. Enable withdrawals, but use a bSOL price of 1 bSOL = reserve_balance / b_sol_supply stSOL. The full reserve can be withdrawn, and the loss is socialized over all bSOL holders.
  3. Same as above, but charge an additional withdrawal fee (only when the reserve contains too little stSOL). This means that the users who want to withdraw can still withdraw, but they pay a larger share of the loss than users who hold. The reserve would be back to full backing faster this way (if users withdraw).
  4. Hold more stSOL in the reserve than what is needed to back the bSOL (don’t distribute rewards if the ratio is below a certain value > 1), to be able to absorb a potential future loss.
  5. Same as above, but instead of making it a binary rewards/no rewards, we can scale this based on how close we are to the target. For example, if the target ratio is 1.1, and we are at 1.0, we could send say 50% of the stSOL value increase to Anchor rewards, and 50% to growing the reserve, but when we are at 1.1, we send 100% of the stSOL value increase to Anchor rewards, and nothing to growing the reserve. Above 1.1, we could send even more than that epoch’s rewards to bring the ratio down to 1.1 again.

We can also combine these.

This all feels pretty complex for a hypothetical scenario that will not happen any time soon, but I feel we should implement some safeguard. This program might be around for a very long time, and who knows what will happen in the future, we might not be in a position to upgrade it. So it should be safe by default.

Option 1 would be easiest to implement, but it will also make people angry, so I think option 2 is the simplest thing that is also realistic.

ruuda commented

Option 2 has been implemented in #460.