Skip to content

Simple Staking #2

@zie1ony

Description

@zie1ony

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 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.

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
Loading

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions