Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shd stake | rewards distribution #125

Merged
merged 4 commits into from Nov 1, 2021
Merged

Conversation

FloppyDisck
Copy link
Contributor

Added an efficient way to distribute value across stakers by using the staking model found in Cosmos SDK.
There are now separate unbonding queues per users so they can query their values efficiently. The old unbonding now exists for when we implement treasury rewards distribution.
To allow users to query their stake information, a very simple viewing key system was implemented

@FloppyDisck FloppyDisck added the shd-staking Staking contract label Oct 24, 2021
@FloppyDisck FloppyDisck linked an issue Oct 24, 2021 that may be closed by this pull request
@DrPresident
Copy link
Collaborator

We should try to avoid implementing anything with keys/passwords in our contracts. Thats alot of liability and complexity to take on in order to do it right, and anything less would be facade of security that would be detrimental to having none at all. We should be using a snip20 for the staked tokens for this and I believe the permits solve the issue of governance being able to determine voting power.

@FloppyDisck
Copy link
Contributor Author

FloppyDisck commented Oct 27, 2021

We should try to avoid implementing anything with keys/passwords in our contracts. Thats alot of liability and complexity to take on in order to do it right, and anything less would be facade of security that would be detrimental to having none at all. We should be using a snip20 for the staked tokens for this and I believe the permits solve the issue of governance being able to determine voting power.

While having a snip20 does make it a bit easier since you dont have to implement secret_toolkit's permits, it would also increase all around gas costs for the staking contract, plus add a few more failure points (allowed minters + another contract). A much more efficient way would be to directly implement permits into the staking contract.

Furthermore, viewkeys / permits are not the point of this PR and are going to be implemented after this PR

Copy link
Collaborator

@chris-ricketts chris-ricketts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple of nit picks and some Rust tricks you could use if you wanted.
The unbonding mechanics look sound and efficient.

contracts/staking/src/handle.rs Outdated Show resolved Hide resolved
contracts/staking/src/handle.rs Outdated Show resolved Hide resolved
contracts/staking/src/handle.rs Outdated Show resolved Hide resolved
contracts/staking/src/handle.rs Outdated Show resolved Hide resolved
contracts/staking/src/handle.rs Outdated Show resolved Hide resolved
contracts/staking/src/handle.rs Outdated Show resolved Hide resolved
contracts/staking/src/handle.rs Show resolved Hide resolved
contracts/staking/src/handle.rs Outdated Show resolved Hide resolved
contracts/staking/src/handle.rs Outdated Show resolved Hide resolved
contracts/staking/src/query.rs Outdated Show resolved Hide resolved
@FloppyDisck FloppyDisck merged commit 05eabc3 into dev Nov 1, 2021
@FloppyDisck FloppyDisck deleted the shd-stake/rewards-distribution branch November 1, 2021 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
shd-staking Staking contract
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add viewing keys or permits to staking contract
3 participants