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

Permissionless staking contract - Staker #24

Merged
merged 66 commits into from
Jul 30, 2024
Merged

Permissionless staking contract - Staker #24

merged 66 commits into from
Jul 30, 2024

Conversation

zomglings
Copy link
Contributor

This pull request introduces a permissionless staking contract called the Staker.

This contract is based on @kellan-simiotics 's design document: https://docs.google.com/document/d/14irHE06QxJDXJcNuXeN7UnVNTxqIGlOU8vwFe0CekQ4/edit?usp=sharing

It is also based on @kellan-simiotics 's earlier work on staking: #21

Invalidates #21 and #5

zomglings added 12 commits July 10, 2024 16:16
Also removed package-lock.json from the git commit tree - not a good
practice to include it for a package like our web3 contracts.
The docs it navigates are not easy to generate. I think doc generation
should be subject of a different PR anyway.
Also made the following changes:
- Gas profiling turned on or off using the `GAS_PROFILER` environment
  variable. Set it to `t`/`true`/`y`/`yes`/`1` in order to enable gas
  profiling.
- Added prettier and prettier solidity plugin as dev dependencies.
That's the default value in mapping of staking pools for tokenType.

Changed NATIVE_TOKEN_TYPE = 1.
Made it so that it updates on `make` when the contract is updated.
@zomglings zomglings marked this pull request as ready for review July 12, 2024 07:13
Copy link
Contributor

@karacurt karacurt left a comment

Choose a reason for hiding this comment

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

web3/test/Staker.test.ts Outdated Show resolved Hide resolved
web3/test/Staker.test.ts Outdated Show resolved Hide resolved
web3/test/Staker.test.ts Outdated Show resolved Hide resolved
web3/test/Staker.test.ts Outdated Show resolved Hide resolved
And added the corresponding tests.

MAde a few small changes to the metadata itself.
@zomglings
Copy link
Contributor Author

Tests for 114 execution flows are ready:

$ cat test/Staker.test.* | ../bin/graffiti match -s flows/staker.md -t STAKER --missing | grep "Source label:" | wc -l
0

uint256 tokenID;
bool transferable;
uint256 lockupSeconds;
uint256 cooldownSeconds;
Copy link
Contributor

Choose a reason for hiding this comment

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

Tracking the total currently amount deposited into each staking pool.
This could aid in extension of smart contracts that wish to determine the amount their community has deposited for on chain/decentralized interactions. Such as a distribution mechanic. Since more then 1 pool can be created for Native, 20, 1155(tokenIds) and erc721.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mrk-hub : This is a great suggestion. I will track:

  1. Total amount deposited into a pool.
  2. Number of positions opened under a pool.

Copy link
Contributor

@mrk-hub mrk-hub left a comment

Choose a reason for hiding this comment

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

Current on page comments.

Comment on lines +396 to +397
// TODO(zomglings): Change image URI
'","image": "https://badges.moonstream.to/test/staking_logo.png"',
Copy link
Contributor

Choose a reason for hiding this comment

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

question: just double checking if this TODO needs to be addressed before merging

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, confirmed. Working on getting an image from the design team.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@karacurt : We can change the URL once the design team has something for us.

web3/contracts/staking/Staker.sol Show resolved Hide resolved
@zomglings zomglings merged commit 707b114 into main Jul 30, 2024
1 check passed
@zomglings zomglings deleted the feature/staking branch July 30, 2024 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants