Skip to content

Commit

Permalink
Clean up "APR" language around inflation rewards (#16732)
Browse files Browse the repository at this point in the history
(cherry picked from commit b8b5456)

Co-authored-by: Michael Vines <[email protected]>
  • Loading branch information
mergify[bot] and mvines authored Apr 22, 2021
1 parent 13e176a commit 9413051
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
16 changes: 10 additions & 6 deletions cli-output/src/cli_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1405,25 +1405,29 @@ impl fmt::Display for CliInflation {
if (self.governor.initial - self.governor.terminal).abs() < f64::EPSILON {
writeln!(
f,
"Fixed APR: {:>5.2}%",
"Fixed rate: {:>5.2}%",
self.governor.terminal * 100.
)?;
} else {
writeln!(
f,
"Initial APR: {:>5.2}%",
"Initial rate: {:>5.2}%",
self.governor.initial * 100.
)?;
writeln!(
f,
"Terminal APR: {:>5.2}%",
"Terminal rate: {:>5.2}%",
self.governor.terminal * 100.
)?;
writeln!(
f,
"Rate reduction per year: {:>5.2}%",
self.governor.taper * 100.
)?;
writeln!(
f,
"* Rate reduction is derived using the target slot time in genesis config"
)?;
}
if self.governor.foundation_term > 0. {
writeln!(
Expand All @@ -1445,17 +1449,17 @@ impl fmt::Display for CliInflation {
)?;
writeln!(
f,
"Total APR: {:>5.2}%",
"Total rate: {:>5.2}%",
self.current_rate.total * 100.
)?;
writeln!(
f,
"Staking APR: {:>5.2}%",
"Staking rate: {:>5.2}%",
self.current_rate.validator * 100.
)?;
writeln!(
f,
"Foundation APR: {:>5.2}%",
"Foundation rate: {:>5.2}%",
self.current_rate.foundation * 100.
)
}
Expand Down
3 changes: 2 additions & 1 deletion docs/src/developing/clients/jsonrpc-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1410,7 +1410,8 @@ The result field will be a JSON object with the following fields:

- `initial: <f64>`, the initial inflation percentage from time 0
- `terminal: <f64>`, terminal inflation percentage
- `taper: <f64>`, rate per year at which inflation is lowered
- `taper: <f64>`, rate per year at which inflation is lowered.
Rate reduction is derived using the target slot time in genesis config
- `foundation: <f64>`, percentage of total inflation allocated to the foundation
- `foundationTerm: <f64>`, duration of foundation pool inflation in years

Expand Down
4 changes: 4 additions & 0 deletions sdk/src/genesis_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,10 @@ impl fmt::Display for GenesisConfig {
Shred version: {}\n\
Ticks per slot: {:?}\n\
Hashes per tick: {:?}\n\
Target tick duration: {:?}\n\
Slots per epoch: {}\n\
Warmup epochs: {}abled\n\
Slots per year: {}\n\
{:?}\n\
{:?}\n\
{:?}\n\
Expand All @@ -256,12 +258,14 @@ impl fmt::Display for GenesisConfig {
compute_shred_version(&self.hash(), None),
self.ticks_per_slot,
self.poh_config.hashes_per_tick,
self.poh_config.target_tick_duration,
self.epoch_schedule.slots_per_epoch,
if self.epoch_schedule.warmup {
"en"
} else {
"dis"
},
self.slots_per_year(),
self.inflation,
self.rent,
self.fee_rate_governor,
Expand Down

0 comments on commit 9413051

Please sign in to comment.