Compare commits

..

No commits in common. "493a4db663e7fa47a6f7d756d00f4f29f833c28c" and "87eca056a3a6f1f27e053fe0f70f03f2f95b5a2f" have entirely different histories.

4 changed files with 43 additions and 51 deletions

View File

@ -2,7 +2,7 @@
name = "ghost-eye"
authors = ["str3tch <stretch@ghostchain.io>"]
description = "Application for interacting with Casper/Ghost nodes that are exposing RPC only to the localhost"
version = "0.3.16"
version = "0.3.15"
edition = "2021"
[dependencies]

View File

@ -44,7 +44,7 @@ impl RewardDetails {
"blocked".to_string()
} else {
let result = self.commission as f64 / 1_000_000_000.0;
format!("{:.2}%", result)
format!("{:.1}%", result)
}
}
}

View File

@ -1,46 +1,47 @@
use subxt::ext::sp_runtime::Perbill;
// generated outside, based on params
// MIN_INFLATION: u32 = 0_006_900;
// MAX_INFLATION: u32 = 0_690_000;
// IDEAL_STAKE: u32 = 0_690_000;
// MIN_INFLATION: u32 = 0_025_000;
// MAX_INFLATION: u32 = 0_100_000;
// IDEAL_STAKE: u32 = 0_750_000;
// FALLOFF: u32 = 0_050_000;
// MAX_PIECE_COUNT: u32 = 40;
const PIECEWISE_LINEAR_POUNTS: [(Perbill, Perbill); 32] = [
(Perbill::from_parts(0), Perbill::from_parts(6900000)),
(Perbill::from_parts(690000000), Perbill::from_parts(690000000)),
(Perbill::from_parts(692740000), Perbill::from_parts(664536000)),
(Perbill::from_parts(695588000), Perbill::from_parts(639072000)),
(Perbill::from_parts(698554000), Perbill::from_parts(613608000)),
(Perbill::from_parts(701647000), Perbill::from_parts(588144000)),
(Perbill::from_parts(704879000), Perbill::from_parts(562680000)),
(Perbill::from_parts(708262000), Perbill::from_parts(537216000)),
(Perbill::from_parts(711811000), Perbill::from_parts(511752000)),
(Perbill::from_parts(715545000), Perbill::from_parts(486288000)),
(Perbill::from_parts(719482000), Perbill::from_parts(460824000)),
(Perbill::from_parts(723646000), Perbill::from_parts(435360000)),
(Perbill::from_parts(728066000), Perbill::from_parts(409896000)),
(Perbill::from_parts(732774000), Perbill::from_parts(384432000)),
(Perbill::from_parts(737811000), Perbill::from_parts(358968000)),
(Perbill::from_parts(743227000), Perbill::from_parts(333504000)),
(Perbill::from_parts(749083000), Perbill::from_parts(308040000)),
(Perbill::from_parts(755456000), Perbill::from_parts(282576000)),
(Perbill::from_parts(762447000), Perbill::from_parts(257112000)),
(Perbill::from_parts(770189000), Perbill::from_parts(231648000)),
(Perbill::from_parts(778863000), Perbill::from_parts(206184000)),
(Perbill::from_parts(788725000), Perbill::from_parts(180720000)),
(Perbill::from_parts(800151000), Perbill::from_parts(155256000)),
(Perbill::from_parts(813735000), Perbill::from_parts(129792000)),
(Perbill::from_parts(830484000), Perbill::from_parts(104328000)),
(Perbill::from_parts(852337000), Perbill::from_parts(78864000)),
(Perbill::from_parts(877801000), Perbill::from_parts(57460000)),
(Perbill::from_parts(903265000), Perbill::from_parts(42422000)),
(Perbill::from_parts(928728000), Perbill::from_parts(31857000)),
(Perbill::from_parts(954189000), Perbill::from_parts(24435000)),
(Perbill::from_parts(979651000), Perbill::from_parts(19220000)),
(Perbill::from_parts(1000000000), Perbill::from_parts(16291000)),
const PIECEWISE_LINEAR_POUNTS: [(Perbill, Perbill); 33] = [
(Perbill::from_parts(0), Perbill::from_parts(25000000)),
(Perbill::from_parts(750000000), Perbill::from_parts(100000000)),
(Perbill::from_parts(758333000), Perbill::from_parts(91817000)),
(Perbill::from_parts(766666000), Perbill::from_parts(84528000)),
(Perbill::from_parts(774999000), Perbill::from_parts(78033000)),
(Perbill::from_parts(783331000), Perbill::from_parts(72248000)),
(Perbill::from_parts(791663000), Perbill::from_parts(67094000)),
(Perbill::from_parts(799996000), Perbill::from_parts(62502000)),
(Perbill::from_parts(808328000), Perbill::from_parts(58411000)),
(Perbill::from_parts(816661000), Perbill::from_parts(54766000)),
(Perbill::from_parts(824993000), Perbill::from_parts(51519000)),
(Perbill::from_parts(833325000), Perbill::from_parts(48626000)),
(Perbill::from_parts(841656000), Perbill::from_parts(46049000)),
(Perbill::from_parts(849988000), Perbill::from_parts(43753000)),
(Perbill::from_parts(858321000), Perbill::from_parts(41707000)),
(Perbill::from_parts(866651000), Perbill::from_parts(39885000)),
(Perbill::from_parts(874984000), Perbill::from_parts(38261000)),
(Perbill::from_parts(883313000), Perbill::from_parts(36815000)),
(Perbill::from_parts(891646000), Perbill::from_parts(35526000)),
(Perbill::from_parts(899976000), Perbill::from_parts(34378000)),
(Perbill::from_parts(908308000), Perbill::from_parts(33355000)),
(Perbill::from_parts(916636000), Perbill::from_parts(32444000)),
(Perbill::from_parts(924968000), Perbill::from_parts(31632000)),
(Perbill::from_parts(933295000), Perbill::from_parts(30909000)),
(Perbill::from_parts(941619000), Perbill::from_parts(30265000)),
(Perbill::from_parts(949946000), Perbill::from_parts(29691000)),
(Perbill::from_parts(958265000), Perbill::from_parts(29180000)),
(Perbill::from_parts(966598000), Perbill::from_parts(28724000)),
(Perbill::from_parts(974925000), Perbill::from_parts(28318000)),
(Perbill::from_parts(983258000), Perbill::from_parts(27956000)),
(Perbill::from_parts(991578000), Perbill::from_parts(27634000)),
(Perbill::from_parts(999899000), Perbill::from_parts(27347000)),
(Perbill::from_parts(1000000000), Perbill::from_parts(27343000)),
];
const MAXIMUM_INFLATION: Perbill = Perbill::from_parts(690000000);
const MAXIMUM_INFLATION: Perbill = Perbill::from_parts(100000000);
pub fn calculate_for_fraction(n: u128, d: u128) -> (Perbill, Perbill) {
let n = n.min(d.clone());
@ -110,5 +111,5 @@ pub fn prepare_perbill_fraction_string(value: Perbill) -> String {
m /= 10;
}
format!("{}.{:02}%", units, rest / m)
format!("{}.{}%", units, rest / m)
}

View File

@ -283,18 +283,9 @@ pub async fn get_validator_staking_results(
) -> Result<()> {
let (start, end) = super::raw_calls::historical::stored_range(api, None)
.await?
.map(|range| {
(
range.0
.saturating_div(6)
.saturating_sub(1),
range.1
.saturating_div(6)
.saturating_sub(1),
)
})
.map(|range| (range.0.saturating_div(6), range.1.saturating_div(6)))
.unwrap_or((0, 0));
for era_index in start..end {
for era_index in start..end.saturating_sub(2) {
get_validator_staking_result(action_tx, api, account_id, era_index).await?;
}
Ok(())