You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To get us of the ground with staking, here is the simplest staking implementation we can think of.
I think it also is a good starting point if we want to make it more complex later on.
It follows the model from #1.
Staking
Staking is done as-you-go. It means there is no pooling of funds before staking.
When user wants to stake, its funds are delegated right away.
sequenceDiagram
participant User
participant Contract as sCSPR Contract
participant Host as Auction Contract
User ->> Contract: Send CSPR
Contract ->> Host: Delegate CSPR
Contract ->> User: Mint sCSPR
Loading
Unstaking
Unstaking is more complex, becasue user needs to wait for the unstaked funds to be released.
So this flow requires user to interact with the contract twice.
sequenceDiagram
participant User
participant Contract as sCSPR Contract
participant Host as Auction Contract
User ->> Contract: Unstake sCSPR
Note over Contract: Burn sCSPR
Contract ->> Host: Undelegate CSPR
Contract ->> User: Reciept
%% some time passes
Note over User,Host: Time passes
Host ->> Contract: CSPR is released
User ->> Contract: Request CSPR using the Reciept
Contract ->> User: Recieve CSPR
Simple Staking
To get us of the ground with staking, here is the simplest staking implementation we can think of.
I think it also is a good starting point if we want to make it more complex later on.
It follows the model from #1.
Staking
Staking is done as-you-go. It means there is no pooling of funds before staking.
When user wants to stake, its funds are delegated right away.
sequenceDiagram participant User participant Contract as sCSPR Contract participant Host as Auction Contract User ->> Contract: Send CSPR Contract ->> Host: Delegate CSPR Contract ->> User: Mint sCSPRUnstaking
Unstaking is more complex, becasue user needs to wait for the unstaked funds to be released.
So this flow requires user to interact with the contract twice.
Lido does it the same way: How do I unstake my stETH?
sequenceDiagram participant User participant Contract as sCSPR Contract participant Host as Auction Contract User ->> Contract: Unstake sCSPR Note over Contract: Burn sCSPR Contract ->> Host: Undelegate CSPR Contract ->> User: Reciept %% some time passes Note over User,Host: Time passes Host ->> Contract: CSPR is released User ->> Contract: Request CSPR using the Reciept Contract ->> User: Recieve CSPR