-
Notifications
You must be signed in to change notification settings - Fork 64
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
Only return net value
#1939
Only return net value
#1939
Conversation
+stakes[0].net_claimable_consensus_rewards! + | ||
+stakes[1].net_claimable_consensus_rewards! | ||
).toString(), |
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.
These could be summed programatically but this is done to ensure the tests break if any adjustments are made. The same for all other instances.
Pull Request Test Coverage Report for Build 10955690884Details
💛 - Coveralls |
@@ -353,7 +324,10 @@ export class NativeStakingMapper { | |||
safeAddress: args.safeAddress, | |||
validatorsPublicKeys: this.splitPublicKeys(publicKeys), | |||
}); | |||
return stakes.reduce((acc, stake) => acc + Number(stake.rewards), 0); | |||
return stakes.reduce((acc, stake) => { | |||
const netValue = stake.net_claimable_consensus_rewards ?? '0'; |
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.
nit: If net_claimable_consensus_rewards
is always expected to be a number, could we update the schema to automatically parse it as such?"
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.
After discussion, we will keep this as is as schemas don't transform in the project. We will, however, consider this separately.
Returns the net `value` of validator exit request/withdrawals and removes `rewards`: - Add `net_claimable_consensus_rewards` to `Stake` schema/entity. - Add new query to `KilnApi['getStakes']`. - Remove all instances of `rewards`. - Return value based on new new `net_claimable_consensus_rewards` value. - Update tests accordingly.
Summary
Resolves #1938
We currently return an assumed
value
by number of validators, e.g. 1 x validator = 32 ETH. This does not, however, take into account slashing. The value can be between 31-32 ETH.The
rewards
we return is also historically accumulative. The user can therefore only claim a partial amount of this.After discussion with Kiln, we now have access to a new net value that combines to claimable staked ETH and rewards. This is now returned as the
value
of validator exit request/withdrawals andrewards
removed. They are combined as we don't show one or the other in the UI.Changes
net_claimable_consensus_rewards
toStake
schema/entity.KilnApi['getStakes']
.rewards
.net_claimable_consensus_rewards
value.