11pub use fraction:: Fraction ;
22use jormungandr_lib:: { crypto:: account:: Identifier , interfaces:: Value } ;
33use proptest:: prelude:: Arbitrary ;
4+ use registration:: MainnetStakeAddress ;
45use registration:: { Delegations , MainnetRewardAddress , VotingRegistration } ;
56use serde:: { Deserialize , Serialize } ;
67use std:: { borrow:: Borrow , collections:: BTreeMap , iter:: Iterator , num:: NonZeroU64 } ;
@@ -36,6 +37,7 @@ pub enum Error {
3637/// Contribution to a voting key for some registration
3738#[ derive( Clone , Debug , PartialEq , Eq , Serialize , Deserialize ) ]
3839pub struct KeyContribution {
40+ pub stake_public_key : MainnetStakeAddress ,
3941 pub reward_address : MainnetRewardAddress ,
4042 pub value : u64 ,
4143}
@@ -79,12 +81,14 @@ impl Snapshot {
7981 reward_address,
8082 delegations,
8183 voting_power,
84+ stake_public_key,
8285 ..
8386 } = reg;
8487
8588 match delegations {
8689 Delegations :: Legacy ( vk) => {
8790 acc. entry ( vk) . or_default ( ) . push ( KeyContribution {
91+ stake_public_key,
8892 reward_address,
8993 value : voting_power. into ( ) ,
9094 } ) ;
@@ -103,6 +107,7 @@ impl Snapshot {
103107 } )
104108 . map ( |( vk, value) | {
105109 acc. entry ( vk) . or_default ( ) . push ( KeyContribution {
110+ stake_public_key : stake_public_key. clone ( ) ,
106111 reward_address : reward_address. clone ( ) ,
107112 value : value. get ( ) ,
108113 } ) ;
@@ -111,6 +116,7 @@ impl Snapshot {
111116 . sum :: < u64 > ( )
112117 } ) ;
113118 acc. entry ( last. 0 ) . or_default ( ) . push ( KeyContribution {
119+ stake_public_key,
114120 reward_address,
115121 value : voting_power - others_total_vp,
116122 } ) ;
0 commit comments