ChorusOne / solido

Lido for Solana is a Lido-DAO governed liquid staking protocol for the Solana blockchain.
https://chorusone.github.io/solido/
GNU General Public License v3.0
101 stars 43 forks source link

Anchor integration #438

Closed ruuda closed 2 years ago

ruuda commented 3 years ago

Background

Integration with Anchor is one of the most requested features. After discussion with the Anchor/Terra team, on a high level it should look like this:

Design

Open questions

Next steps

ruuda commented 3 years ago

Orca swap details

ruuda commented 3 years ago

Mercurial swap details

enriquefynn commented 3 years ago

Saber

Raydium

ruuda commented 3 years ago

We need to find the contract data to get the minimum_amount_out

Orca an Mercurial also have this, but I don’t think we need to read the contract data for it. If we set it to a value larger than zero, we should take it as an argument and pass it along. It makes no sense to read the contract state to determine the minimum amount out, because everything will execute in one transaction. No other trades can happen between us reading the state and executing the swap, there can be no slippage. What the minimum_amount_out is useful for, is when you have the webinterface to do a swap, and you are presented with a tentative exchange rate, which might change before your swap executes. The analog in our case would be somebody calling ClaimRewards with some idea of what the exchange rate will be.

ruuda commented 3 years ago

Considerations:

Orca Mercurial Saber Raydium
Liquidity 0 -1 +1 +1
Integration +5 +6 +3 +6
Testing +10 -10 0 -10
Trust +10 -10 +5 -5
Total 25 -15 9 -8

Conclusion: We’ll go with Orca.

ruuda commented 2 years ago

This was a catch-all tracking issue, but we now have a milestone for the Anchor integration (https://github.com/ChorusOne/solido/milestone/4), with all of the follow-up details, so let’s close this issue.