-
Notifications
You must be signed in to change notification settings - Fork 105
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
Conversation
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" |
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.
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" |
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.
same here
impl From<Error> for i32 { | ||
fn from(e: Error) -> i32 { | ||
match e { | ||
Error::RuntimeError => 1, |
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.
why?
decode_error => 0,
runtime_error => 1, isn't it?
Merged before review, but anyway please pay attention on the small fixes |
New RPC call in
pallet-gear-staking-rewards
(and respectiveruntime-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.