1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
use *;
use BoostAccount;
/// Boost tracks the priority, deposits, and rewards of a staking incentive.
// impl Boost {
// /// Collect weighted rewards from the global rewards pool.
// pub fn collect_rewards(&mut self, config: &mut Config, proof: &Proof) {
// // Increment the global rewards factor
// if config.total_weight > 0 {
// config.rewards_factor += Numeric::from_fraction(proof.balance, config.total_weight);
// }
// // Accumulate weighted rewards into the boost rewards factor
// if config.rewards_factor > self.last_rewards_factor && self.total_deposits > 0 {
// let accumulated_rewards = config.rewards_factor - self.last_rewards_factor;
// if accumulated_rewards < Numeric::ZERO {
// panic!("Accumulated rewards is negative");
// }
// let boost_rewards = accumulated_rewards * Numeric::from_u64(self.weight);
// self.rewards_factor += boost_rewards / Numeric::from_u64(self.total_deposits);
// }
// // Update this boost's last seen rewards factor
// self.last_rewards_factor = config.rewards_factor;
// }
// }
account!;