-
Notifications
You must be signed in to change notification settings - Fork 44
feat(node): [NET-1455] Autostaker plugin #3086
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fd73f95
to
6f23cee
Compare
jtakalai
reviewed
Apr 27, 2025
teogeb
added a commit
that referenced
this pull request
Apr 28, 2025
…3087) Added a method which provides a client for querying The Graph. All entities of the Streamr graph can be queried using this client, e.g.: - `Stream` - `StreamPermission` - `Operator` - `Sponsorship` - `Stake` - `Vote` - ... This method is currently internal, but it can be made public if needed. Needed in #3086.
jtakalai
pushed a commit
that referenced
this pull request
May 20, 2025
…3087) Added a method which provides a client for querying The Graph. All entities of the Streamr graph can be queried using this client, e.g.: - `Stream` - `StreamPermission` - `Operator` - `Sponsorship` - `Stake` - `Vote` - ... This method is currently internal, but it can be made public if needed. Needed in #3086.
Two things that need solving still
|
harbu
reviewed
Jun 4, 2025
packages/node/src/plugins/autostaker/payoutProportionalStrategy.ts
Outdated
Show resolved
Hide resolved
harbu
requested changes
Jun 5, 2025
packages/node/test/unit/plugins/autostaker/payoutProportionalStrategy.test.ts
Outdated
Show resolved
Hide resolved
harbu
reviewed
Jun 5, 2025
harbu
approved these changes
Jun 10, 2025
teogeb
added a commit
that referenced
this pull request
Jun 27, 2025
## Summary Entries in the undelegation queue now affect the Autostaker calculations. ## Background When a delegator undelegates some amount from an operator, the tokens aren't immediately transferred back to the delegator. Instead the amount is added to the undelegation queue. The transfer happens as soon as there are enough unstaked tokens in the operator contract. ## Changes Modified the target stake calculation `payoutProportionalStrategy`. The rounding logic and skipping of small transactions are also affected slightly. The autostaker plugin reads the sum of undelegation queue entries from The Graph and passes the amount to the strategy function. Also added more assertions to the `autostaker.test.ts` smoke tests. ## Other changes - The `myStakedAmount` in calculated from the stakes instead of querying it from the contract - Simplified logging in the plugin ## Chores - Removed `sum.ts` from the `@streamr/utils` package - it was not exported - the file was added during the development of #3086 (we should have removed the file in that PR) - Fixed field type in `StakeQueryResultItem`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
An experimental plugin that automatically manages sponsorship stakings. It periodically checks which sponsorships offer good payouts and stakes tokens to those sponsorships when possible (i.e. if there are unstaked tokens available or tokens can be unstaked from another sponsorship with a worse payout).
Features
payoutProportionalStrategy.ts
payoutPerSec
minTransactionDataTokenAmount
)minimumStakingPeriodSeconds
maxAcceptableMinOperatorCount
)Authentication
As the plugin does transaction on behalf of the operator, it needs either operator's private key or a
CONTROLLER
role assigned to it so that it can act as a staking agent. Granting the role is the preferred approach since controllers don't have permission to withdraw funds from theOperator
contractFuture Improvements
minimumStakingPeriodSeconds
by implementing logic to prevent premature unstaking, instead of filtering them out.