This repository has been archived by the owner on May 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
Staker rewards script: Calculating operator assets #628
Merged
Conversation
This file contains 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
Implemented a stub of the assets calculator and added computations of the KEEP staked parameter.
# Conflicts: # staker-rewards/lib/context.js # staker-rewards/lib/contract-helper.js # staker-rewards/rewards.js
Added some logic which determines the starting and ending blocks for the given interval. The interval blockspan is needed for calculating the KEEP staked and ETH under management values at correct points of the timeline.
The keep staked value for given operator should be checked at interval end block according to the rewards specification.
Implemented calculations of the ETH unbonded and total values and passed the outcomes to the output table.
Added support of the `toBlock` parameter to the `getPastEvents` function. This parameter will add new filtering capabilities while fetching past events.
Implemented calculations of the ETH bonded parameter basing on `Bond*` events emitted by the bonding contract.
pdyraga
reviewed
Dec 2, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've run this script with
ETH_HOSTNAME="..." node --experimental-json-modules rewards.js 1600041600 1606821119
and all eth*
values for all operators are 0 in the table rendered.
(EDIT: which is correct because nothing was bonded at 1600041600).
# Conflicts: # staker-rewards/lib/context.js # staker-rewards/rewards.js
There should be no dependency on `KeepRandomBeaconOperator` contract in the staker rewards script. The true `operator` contract in this context should be the `BondedECDSAKeepFactory` contract.
The address of the sanctioned application can be hardcoded in the context.js file. This way we can avoid a dependency on `@keep-network/tbtc` package.
Floating point numbers which represent some of the operator assets, should be rounded only in the presentation layer. This way we keep the precise value for rewards calculations.
Tested locally with the most recent mainnet data. Works as expected. |
pdyraga
approved these changes
Dec 3, 2020
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Depends on: #625
Depends on: keep-network/tbtc.js#114
Refs: #602
This pull request introduces additional parameters to the staker rewards script. Those parameters are related with operator assets and are defined as follows:
keepStaked
: it's the value of the operator'sactiveStake
checked at the interval end blockethBonded
: it's the sum of all operator bonds active at the interval start blockethUnbonded
: it's the value of the operator'savailableUnbondedValue
checked at the interval start blockethTotal
: it's the sum ofethBonded
andethUnbonded