-
Notifications
You must be signed in to change notification settings - Fork 334
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
feat(community): add AnnualizedRewards grpc query #1751
Conversation
253eca3
to
5c45d89
Compare
x/community/keeper/grpc_query.go
Outdated
// this module uses sdkmath.LegacyDec in its parameters | ||
// TODO: remove me after upgrade to cosmos-sdk v50 (LegacyDec is everywhere) | ||
func convertDecToLegacyDec(in sdk.Dec) sdkmath.LegacyDec { | ||
return sdkmath.LegacyNewDecFromBigIntWithPrec(in.BigInt(), sdkmath.LegacyPrecision) |
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.
This should be the sdk.Precision
or the precision of the in
param
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.
Great overall, just some minor comments and improvements that can be made.
x/community/keeper/rewards.go
Outdated
// It assumes that staking comes from one of two sources depending on if inflation is enabled or not. | ||
type StakingRewardCalculator struct { | ||
TotalSupply sdkmath.Int | ||
TotalBonded sdkmath.Int |
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 data members aren't used outside of internals, so should be private
712a4e8
to
f6a558a
Compare
* add annualized_reward query proto * use sdkmath.LegacyDec to match RPS param... * add AnnualizedRewards grpc query * add changelog entry * simplify calculation & expand test cases (cherry picked from commit 0efe7f2) # Conflicts: # CHANGELOG.md # client/docs/swagger-ui/swagger.yaml # x/community/keeper/staking.go # x/community/types/expected_keepers.go # x/community/types/query.pb.go
…1754) * feat(community): add AnnualizedRewards grpc query (#1751) * add annualized_reward query proto * use sdkmath.LegacyDec to match RPS param... * add AnnualizedRewards grpc query * add changelog entry * simplify calculation & expand test cases (cherry picked from commit 0efe7f2) * fix conflicts, remove community param references * backport update to lint CI * disable internal testnet genesis check * fix initialization order of keepers in app.go --------- Co-authored-by: Robert Pirtle <Astropirtle@gmail.com>
…1754) * feat(community): add AnnualizedRewards grpc query (#1751) * add annualized_reward query proto * use sdkmath.LegacyDec to match RPS param... * add AnnualizedRewards grpc query * add changelog entry * simplify calculation & expand test cases (cherry picked from commit 0efe7f2) * fix conflicts, remove community param references * backport update to lint CI * disable internal testnet genesis check * fix initialization order of keepers in app.go --------- Co-authored-by: Robert Pirtle <Astropirtle@gmail.com>
Description
Adds
x/community
query for annualized rewards which gives the annualized staking reward rateChecklist