@@ -43,8 +43,15 @@ pub struct StakingAccountDetails {
43
43
pub staking_type : StakingType , // NEW
44
44
/// staking amounts that have been retargeted are prevented from being retargeted again for the
45
45
/// configured Thawing Period number of blocks.
46
- pub stake_change_unlocking : BoundedVec <UnlockChunk <BalanceOf <T >, EraOf <T >>, T :: MaxUnlockingChunks > // NEW
46
+ pub stake_change_unlocking : BoundedVec <UnlockChunk <BalanceOf <T >, T :: RewardEra >, T :: MaxUnlockingChunks >, // NEW
47
+ /// total staked amounts for each past era, up to StakingRewardsPastErasMax eras.
48
+ pub staking_history : BoundedVec <StakingHistory <BalanceOf <T >, T :: RewardEra >, T :: StakingRewardsPastErasMax >, // NEW
47
49
}
50
+
51
+ pub struct StakingHistory <Balance , RewardEra > {
52
+ total_staked : Balance ,
53
+ reward_era : RewardEra ,
54
+ }
48
55
```
49
56
50
57
** Unstaking thaw period**
@@ -157,8 +164,15 @@ pub trait Config: frame_system::Config {
157
164
### NEW: RewardPoolInfo
158
165
This is the necessary information about the reward pool for a given Reward Era and how it's stored.
159
166
``` rust
160
- pub struct RewardPoolInfo <T : Config > {
167
+ pub struct RewardPoolInfo <Balance > {
168
+ /// the total staked for rewards in the associated RewardEra
169
+ pub total_staked_token : Balance ,
170
+ /// the reward pool for this era
171
+ pub total_reward_pool : Balance ,
172
+ /// the remaining rewards balance to be claimed
173
+ pub unclaimed_balance : Balance ,
161
174
}
175
+
162
176
/// Reward Pool history
163
177
#[pallet:: storage]
164
178
#[pallet:: getter(fn get_reward_pool_for_era)]
@@ -265,10 +279,22 @@ pub fn change_staking_target(
265
279
fn payout_eligible (account_id : AccountIdOf <T >) -> bool ;
266
280
```
267
281
268
- ### NEW RPC
282
+ ### NEW RPCS
269
283
There are no custom RPCs for the Capacity pallet , so that work will need to be done first .
270
284
```rust
271
- /// RPC access to the pallet function by the same name
272
- pub fn payout_eligible (account_id : AccountId ) -> bool ;
273
- ```
285
+ pub struct UnclaimedRewardInfo {
286
+ /// The Reward Era for which this reward was earned
287
+ reward_era : RewardEra ,
288
+ /// An ISO8701 string, UTC, estimated using current block time, and the number of blocks between
289
+ /// the current block and the block when this era's RewardPoolInfo would be removed from StakingRewardPool history
290
+ expires_at : string ,
291
+ /// The amount staked in this era
292
+ staked_amount : BalanceOf <T >,
293
+ /// The amount in token of the reward (only if it can be calculated using only on chain data)
294
+ earned_amount : BalanceOf <T >
295
+ }
274
296
297
+ /// Check what unclaimed rewards origin has and how long they have left to claim them
298
+ /// If no unclaimed rewards, returns empty list.
299
+ fn check_for_unclaimed_rewards (origin : OriginFor <T >) -> Vec <UnclaimedRewardInfo >;
300
+ ```
0 commit comments