You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+26-10Lines changed: 26 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,21 +10,33 @@
10
10
11
11
This java project is used to calculate the rewards of the Cardano network. It aims to be both an edge case documentation and formula implementation.
12
12
13
+
## 🧪 Test Reports
14
+
15
+
To ensure the stability and reliability of this project, unit tests have been implemented. By clicking on the link below, you can access the detailed test report.
16
+
We also generate for each version of this project calculation reports. These reports are generated by the unit tests and contain the calculation results compared to the actual values.
B --> | <a href='https://cips.cardano.org/cips/cip9/#updatableprotocolparameters'>treasuryGrowthRate</a> | C[<a href='https://github.com/cardano-foundation/cf-java-rewards-calculation/blob/a794130dc0e320426725a58b8b15f1fbe726b2de/src/main/java/org/cardanofoundation/rewards/calculation/TreasuryCalculation.java#L17'>Treasury</a/>]
19
-
B --> | 1 - <a href='https://cips.cardano.org/cips/cip9/#updatableprotocolparameters'>treasuryGrowthRate</a> | D[<a href='https://github.com/cardano-foundation/cf-java-rewards-calculation/blob/a794130dc0e320426725a58b8b15f1fbe726b2de/src/test/java/org/cardanofoundation/rewards/calculation/PoolRewardCalculationTest.java#L63'>Stake Pool Rewards Pot <br />at Epoch n</a/>]
24
+
B --> | <b><i><a href='https://cips.cardano.org/cips/cip9/#updatableprotocolparameters'>treasuryGrowthRate</a></b></i> | C[<a href='https://github.com/cardano-foundation/cf-java-rewards-calculation/blob/a794130dc0e320426725a58b8b15f1fbe726b2de/src/main/java/org/cardanofoundation/rewards/calculation/TreasuryCalculation.java#L17'>Treasury</a/>]
25
+
B --> | 1 - <b><i><a href='https://cips.cardano.org/cips/cip9/#updatableprotocolparameters'>treasuryGrowthRate</a></b></i> | D[<a href='https://github.com/cardano-foundation/cf-java-rewards-calculation/blob/a794130dc0e320426725a58b8b15f1fbe726b2de/src/test/java/org/cardanofoundation/rewards/calculation/PoolRewardCalculationTest.java#L63'>Stake Pool Rewards Pot <br />at Epoch n</a/>]
20
26
subgraph ADA_POTS[" "]
21
27
D --> | Unclaimed Rewards | E["ADA Reserves<br /> (monetary expansion) <br /> Started at ~14B ADA"]
22
-
E --> | <a href='https://cips.cardano.org/cips/cip9/#updatableprotocolparameters'>monetaryExpandRate</a> * <a href='https://github.com/cardano-foundation/cf-java-rewards-calculation/blob/main/src/main/java/org/cardanofoundation/rewards/calculation/PoolRewardCalculation.java#L19'>apparent performance of all stake pools</a> | B
28
+
E --> | <b><i><a href='https://cips.cardano.org/cips/cip9/#updatableprotocolparameters'>monetaryExpandRate</a></b></i> * <a href='https://github.com/cardano-foundation/cf-java-rewards-calculation/blob/main/src/main/java/org/cardanofoundation/rewards/calculation/PoolRewardCalculation.java#L19'>Performance of all Stake Pools</a> | B
23
29
C --> F[Payouts e.g. for <br /><a href='https://projectcatalyst.io/'>Project Catalyst</a>]
24
30
D --> | <a href='https://github.com/cardano-foundation/cf-java-rewards-calculation/blob/a794130dc0e320426725a58b8b15f1fbe726b2de/src/main/java/org/cardanofoundation/rewards/calculation/PoolRewardCalculation.java#L87'>Rewards Equation<br /> for Pool 1</a> | G[Stake Pool 1]
25
31
D --> | <a href='https://github.com/cardano-foundation/cf-java-rewards-calculation/blob/a794130dc0e320426725a58b8b15f1fbe726b2de/src/main/java/org/cardanofoundation/rewards/calculation/PoolRewardCalculation.java#L87'>Rewards Equation<br /> for Pool 2</a> | H[Stake Pool 2]
26
32
D --> I[...]
27
33
D --> | <a href='https://github.com/cardano-foundation/cf-java-rewards-calculation/blob/a794130dc0e320426725a58b8b15f1fbe726b2de/src/main/java/org/cardanofoundation/rewards/calculation/PoolRewardCalculation.java#L87'>Rewards Equation<br /> for Pool n</a> | J[Stake Pool n]
K <--> | Stake Pool Registration & <br /> Deregistration | M
39
+
M --> | Unclaimed Refunds for Retired Pools | C
28
40
end
29
41
30
42
style A fill:#5C8DFF,stroke:#5C8DFF
@@ -56,13 +68,17 @@ cd cf-java-rewards-calculation
56
68
./mvnw clean test
57
69
```
58
70
59
-
## 🧪 Test Reports
60
-
61
-
To ensure the stability and reliability of this project, unit tests have been implemented. By clicking on the link below, you can access the detailed test report.
-[ ] Add a `/docs` folder containing parsable Markdown files to explain MIR certificates and edge cases
74
+
-[ ] Implement "The difference between the maximal amount and the actual amount received is added to the amount moved to the treasury" (shelley-ledger.pdf p.65)
75
+
-[ ] Enhance reporting and add values for the other pots as well. Include information from the `/docs` folder
76
+
-[ ] Add member and operator reward calculation as well as the deposits pot
77
+
-[ ] Calculate unclaimed rewards that need to go back to the reserves
Copy file name to clipboardExpand all lines: src/main/java/org/cardanofoundation/rewards/calculation/PoolRewardCalculation.java
+15-37Lines changed: 15 additions & 37 deletions
Original file line number
Diff line number
Diff line change
@@ -11,15 +11,17 @@ public class PoolRewardCalculation {
11
11
*
12
12
* hint: shelley-delegation.pdf 3.8.3
13
13
* As long as we have d >= 0.8, we set the apparent performance of any pool to 1
14
+
*
15
+
* See Haskell implementation: https://github.com/input-output-hk/cardano-ledger/blob/64459cc87094331c79d11880e0a4c81b9a721ab0/eras/shelley/impl/src/Cardano/Ledger/Shelley/Rewards.hs#L87C32-L87C44
* See the Haskell implementation: https://github.com/input-output-hk/cardano-ledger/blob/e722881568155fc39550a8dfabda3efeb263a1e5/shelley/chain-and-ledger/executable-spec/src/Shelley/Spec/Ledger/EpochBoundary.hs#L111
for (AccountUpdateaccountUpdate : accountUpdates) {
142
+
if (latestAccountUpdates.stream().map(AccountUpdate::getStakeAddress).noneMatch(stakeAddress -> stakeAddress.equals(accountUpdate.getStakeAddress()))) {
143
+
latestAccountUpdates.add(accountUpdate);
144
+
}
145
+
}
146
+
147
+
for (AccountUpdatelastAccountUpdate : latestAccountUpdates) {
148
+
if (lastAccountUpdate.getAction() == AccountUpdateAction.DEREGISTRATION) {
0 commit comments