Skip to content
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(rpc): Add RPC call to query inflation and ROI #3290

Merged
merged 1 commit into from
Sep 18, 2023

Conversation

ekovalev
Copy link
Member

New RPC call in pallet-gear-staking-rewards (and respective runtime-api call) to query current inflation and ROI values (either at current best block or any block hash in the past).
This is needed to be able to correctly display staking-related numbers in UI.

Note: even though technically inflation is 0 (any newly minted tokens at the end of an era are offset against the inflation pool), the value returned from the call is still relevant as an indicator of how close/far we are from the ideal staking ratio.

@ekovalev ekovalev added A0-pleasereview PR is ready to be reviewed by the team D2-node Gear Node C1-feature Feature request labels Sep 15, 2023
@NikVolf NikVolf merged commit 7ccc91c into master Sep 18, 2023
6 checks passed
@NikVolf NikVolf deleted the ek-staking-rewards-rpc branch September 18, 2023 14:19
Comment on lines +3 to +8
version = "1.0.0"
authors.workspace = true
edition.workspace = true
license.workspace = true
homepage = "https://gear-tech.io"
repository = "https://github.com/gear-tech/gear"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
version = "1.0.0"
authors.workspace = true
edition.workspace = true
license.workspace = true
homepage = "https://gear-tech.io"
repository = "https://github.com/gear-tech/gear"
version.workspace = true
authors.workspace = true
edition.workspace = true
license.workspace = true
homepage.workspace = true
repository.workspace = true

@@ -0,0 +1,19 @@
[package]
name = "pallet-gear-staking-rewards-rpc-runtime-api"
version = "1.0.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

impl From<Error> for i32 {
fn from(e: Error) -> i32 {
match e {
Error::RuntimeError => 1,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?
decode_error => 0,
runtime_error => 1, isn't it?

@breathx
Copy link
Member

breathx commented Sep 18, 2023

Merged before review, but anyway please pay attention on the small fixes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A0-pleasereview PR is ready to be reviewed by the team C1-feature Feature request D2-node Gear Node
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants