Skip to content

Commit

Permalink
feat(community): add AnnualizedRewards grpc query (#1751)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
pirtleshell authored and mergify[bot] committed Oct 24, 2023
1 parent 9723136 commit d798c7f
Show file tree
Hide file tree
Showing 13 changed files with 1,364 additions and 4 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ Ref: https://keepachangelog.com/en/1.0.0/
### Features
- (metrics) [#1668] Adds non-state breaking x/metrics module for custom telemetry.
- (metrics) [#1669] Add performance timing metrics to all Begin/EndBlockers
<<<<<<< HEAD
=======
- (community) [#1704] Add module params
- (community) [#1706] Add disable inflation upgrade
- (community) [#1745] Enable params update via governance with `MsgUpdateParams`
- (community) [#1751] Add `AnnualizedRewards` query endpoint
>>>>>>> 0efe7f22 (feat(community): add AnnualizedRewards grpc query (#1751))
## [v0.24.0](https://github.com/Kava-Labs/kava/releases/tag/v0.24.0)

Expand Down Expand Up @@ -277,6 +284,17 @@ the [changelog](https://github.com/cosmos/cosmos-sdk/blob/v0.38.4/CHANGELOG.md).
- [#257](https://github.com/Kava-Labs/kava/pulls/257) Include scripts to run
large-scale simulations remotely using aws-batch

<<<<<<< HEAD
=======
[#1752]: https://github.com/Kava-Labs/kava/pull/1752
[#1751]: https://github.com/Kava-Labs/kava/pull/1751
[#1745]: https://github.com/Kava-Labs/kava/pull/1745
[#1729]: https://github.com/Kava-Labs/kava/pull/1729
[#1707]: https://github.com/Kava-Labs/kava/pull/1707
[#1706]: https://github.com/Kava-Labs/kava/pull/1706
[#1704]: https://github.com/Kava-Labs/kava/pull/1704
[#1668]: https://github.com/Kava-Labs/kava/pull/1668
>>>>>>> 0efe7f22 (feat(community): add AnnualizedRewards grpc query (#1751))
[#1669]: https://github.com/Kava-Labs/kava/pull/1669
[#1668]: https://github.com/Kava-Labs/kava/pull/1668
[#1624]: https://github.com/Kava-Labs/kava/pull/1624
Expand Down
350 changes: 350 additions & 0 deletions client/docs/swagger-ui/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12991,6 +12991,232 @@ paths:
format: byte
tags:
- Savings
<<<<<<< HEAD
=======
/kava/community/v1beta1/annualized_rewards:
get:
summary: >-
AnnualizedRewards calculates and returns the current annualized reward
percentages,

like staking rewards, for the chain.
operationId: CommunityAnnualizedRewards
responses:
'200':
description: A successful response.
schema:
type: object
properties:
staking_rewards:
type: string
title: >-
staking_rewards is the calculated annualized staking rewards
percentage rate
description: >-
QueryAnnualizedRewardsResponse defines the response type for
querying the annualized rewards.
default:
description: An unexpected error response.
schema:
type: object
properties:
error:
type: string
code:
type: integer
format: int32
message:
type: string
details:
type: array
items:
type: object
properties:
type_url:
type: string
value:
type: string
format: byte
tags:
- Community
/kava/community/v1beta1/balance:
get:
summary: Balance queries the balance of all coins of x/community module.
operationId: CommunityBalance
responses:
'200':
description: A successful response.
schema:
type: object
properties:
coins:
type: array
items:
type: object
properties:
denom:
type: string
amount:
type: string
description: >-
Coin defines a token with a denomination and an amount.


NOTE: The amount field is an Int which implements the custom
method

signatures required by gogoproto.
description: >-
QueryBalanceResponse defines the response type for querying
x/community balance.
default:
description: An unexpected error response.
schema:
type: object
properties:
error:
type: string
code:
type: integer
format: int32
message:
type: string
details:
type: array
items:
type: object
properties:
type_url:
type: string
value:
type: string
format: byte
tags:
- Community
/kava/community/v1beta1/params:
get:
summary: Params queires the module params.
operationId: CommunityParams
responses:
'200':
description: A successful response.
schema:
type: object
properties:
params:
title: params represents the community module parameters
type: object
properties:
upgrade_time_disable_inflation:
type: string
format: date-time
description: >-
upgrade_time_disable_inflation is the time at which to
disable mint and kavadist module inflation.

If set to 0, inflation will be disabled from block 1.
staking_rewards_per_second:
type: string
title: >-
staking_rewards_per_second is the amount paid out to
delegators each block from the community account
upgrade_time_set_staking_rewards_per_second:
type: string
title: >-
upgrade_time_set_staking_rewards_per_second is the initial
staking_rewards_per_second to set

and use when the disable inflation time is reached
description: Params defines the parameters of the community module.
description: >-
QueryParamsResponse defines the response type for querying
x/community params.
default:
description: An unexpected error response.
schema:
type: object
properties:
error:
type: string
code:
type: integer
format: int32
message:
type: string
details:
type: array
items:
type: object
properties:
type_url:
type: string
value:
type: string
format: byte
tags:
- Community
/kava/community/v1beta1/total_balance:
get:
summary: |-
TotalBalance queries the balance of all coins, including x/distribution,
x/community, and supplied balances.
operationId: CommunityTotalBalance
responses:
'200':
description: A successful response.
schema:
type: object
properties:
pool:
type: array
items:
type: object
properties:
denom:
type: string
amount:
type: string
description: >-
DecCoin defines a token with a denomination and a decimal
amount.


NOTE: The amount field is an Dec which implements the custom
method

signatures required by gogoproto.
description: pool defines community pool's coins.
description: >-
QueryTotalBalanceResponse defines the response type for querying
total

community pool balance. This matches the x/distribution
CommunityPool query response.
default:
description: An unexpected error response.
schema:
type: object
properties:
error:
type: string
code:
type: integer
format: int32
message:
type: string
details:
type: array
items:
type: object
properties:
type_url:
type: string
value:
type: string
format: byte
tags:
- Community
>>>>>>> 0efe7f22 (feat(community): add AnnualizedRewards grpc query (#1751))
/cosmos/auth/v1beta1/accounts:
get:
summary: Accounts returns all the existing accounts
Expand Down Expand Up @@ -56830,6 +57056,130 @@ definitions:
description: >-
TotalSupplyResponse defines the response type for the Query/TotalSupply
method.
<<<<<<< HEAD
=======
cosmos.base.v1beta1.DecCoin:
type: object
properties:
denom:
type: string
amount:
type: string
description: |-
DecCoin defines a token with a denomination and a decimal amount.

NOTE: The amount field is an Dec which implements the custom method
signatures required by gogoproto.
kava.community.v1beta1.Params:
type: object
properties:
upgrade_time_disable_inflation:
type: string
format: date-time
description: >-
upgrade_time_disable_inflation is the time at which to disable mint
and kavadist module inflation.

If set to 0, inflation will be disabled from block 1.
staking_rewards_per_second:
type: string
title: >-
staking_rewards_per_second is the amount paid out to delegators each
block from the community account
upgrade_time_set_staking_rewards_per_second:
type: string
title: >-
upgrade_time_set_staking_rewards_per_second is the initial
staking_rewards_per_second to set

and use when the disable inflation time is reached
description: Params defines the parameters of the community module.
kava.community.v1beta1.QueryAnnualizedRewardsResponse:
type: object
properties:
staking_rewards:
type: string
title: >-
staking_rewards is the calculated annualized staking rewards
percentage rate
description: >-
QueryAnnualizedRewardsResponse defines the response type for querying the
annualized rewards.
kava.community.v1beta1.QueryBalanceResponse:
type: object
properties:
coins:
type: array
items:
type: object
properties:
denom:
type: string
amount:
type: string
description: |-
Coin defines a token with a denomination and an amount.

NOTE: The amount field is an Int which implements the custom method
signatures required by gogoproto.
description: >-
QueryBalanceResponse defines the response type for querying x/community
balance.
kava.community.v1beta1.QueryParamsResponse:
type: object
properties:
params:
title: params represents the community module parameters
type: object
properties:
upgrade_time_disable_inflation:
type: string
format: date-time
description: >-
upgrade_time_disable_inflation is the time at which to disable
mint and kavadist module inflation.

If set to 0, inflation will be disabled from block 1.
staking_rewards_per_second:
type: string
title: >-
staking_rewards_per_second is the amount paid out to delegators
each block from the community account
upgrade_time_set_staking_rewards_per_second:
type: string
title: >-
upgrade_time_set_staking_rewards_per_second is the initial
staking_rewards_per_second to set

and use when the disable inflation time is reached
description: Params defines the parameters of the community module.
description: >-
QueryParamsResponse defines the response type for querying x/community
params.
kava.community.v1beta1.QueryTotalBalanceResponse:
type: object
properties:
pool:
type: array
items:
type: object
properties:
denom:
type: string
amount:
type: string
description: |-
DecCoin defines a token with a denomination and a decimal amount.

NOTE: The amount field is an Dec which implements the custom method
signatures required by gogoproto.
description: pool defines community pool's coins.
description: >-
QueryTotalBalanceResponse defines the response type for querying total

community pool balance. This matches the x/distribution CommunityPool
query response.
>>>>>>> 0efe7f22 (feat(community): add AnnualizedRewards grpc query (#1751))
cosmos.auth.v1beta1.AddressBytesToStringResponse:
type: object
properties:
Expand Down
Loading

0 comments on commit d798c7f

Please sign in to comment.