Skip to content

Commit 8c04ad7

Browse files
Merge pull request #4 from cardano-foundation/release-please--branches--main
chore(main): release 0.0.2-SNAPSHOT
2 parents ed7cca6 + 0dd064a commit 8c04ad7

File tree

188 files changed

+2287
-9205
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

188 files changed

+2287
-9205
lines changed

.github/workflows/publish.yaml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Run Plot Action and Upload Results
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
workflow_dispatch:
9+
10+
jobs:
11+
plot-and-publish:
12+
runs-on: ubuntu-latest
13+
if: |
14+
"contains(github.event.head_commit.message, 'release-please--branches--main')" ||
15+
${{ github.event_name == 'pull_request' }}
16+
steps:
17+
- name: ⬇️ Checkout repository
18+
uses: actions/checkout@v3
19+
20+
- name: Setup JDK 18
21+
uses: actions/setup-java@v3
22+
with:
23+
java-version: '18'
24+
distribution: 'temurin'
25+
cache: maven
26+
27+
- name: Setup dependencies
28+
run: |
29+
pip install yq
30+
31+
- name: Build
32+
run: |
33+
mvn --batch-mode --update-snapshots clean package -DskipTests && mv target/rewards-*.jar target/rewards-calculation.jar
34+
35+
- name: 📊 Generate plots
36+
run: java -jar target/rewards-calculation.jar --action=plot
37+
38+
- name: JSON result to js file
39+
run: |
40+
echo -e "const treasuryCalculationResult = $(cat ./report/treasury_calculation_result.json)" > ./report/treasury_calculation_result.js
41+
42+
- name: 👀 Lookup metadata for report
43+
run: |
44+
echo "VERSION=$(xq -r .project.version pom.xml)" >> $GITHUB_ENV
45+
echo "LATEST_COMMIT_HASH=$(git rev-parse "$GITHUB_SHA")" >> $GITHUB_ENV
46+
echo "LATEST_COMMIT_HASH_SHORT=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_ENV
47+
echo "UTC_DATE=$(date -uR|sed 's/.....$//')" >> $GITHUB_ENV
48+
49+
- name: 📂 Create report directory
50+
run: |
51+
mkdir -p report-v${{ env.VERSION }}
52+
53+
- name: 📄 Copy report files
54+
run: |
55+
cp -r report/* report-v${{ env.VERSION }}
56+
57+
- name: 📝 Add metadata to the report
58+
run: |
59+
sed -i 's|<footer></footer>|<footer><p>Created on ${{ env.UTC_DATE }} UTC as a result of modifications triggered by <a href="https://github.com/cardano-foundation/cf-java-rewards-calculation/commit/${{ env.LATEST_COMMIT_HASH }}">${{ env.LATEST_COMMIT_HASH_SHORT }}</a></p></footer>|' report-v${{ env.VERSION }}/treasury_calculation.html
60+
61+
- name: 📅 Publish report to gh-pages
62+
uses: JamesIves/github-pages-deploy-action@v4
63+
with:
64+
BRANCH: gh-pages
65+
folder: report-v${{ env.VERSION }}
66+
target-folder: report-latest/
67+
68+
- name: 📅 Publish report to gh-pages
69+
uses: JamesIves/github-pages-deploy-action@v4
70+
with:
71+
BRANCH: gh-pages
72+
folder: report-v${{ env.VERSION }}
73+
target-folder: report-v${{ env.VERSION }}/

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
HELP.md
2-
*
1+
32
!/**/
43
!*.*
54
target/

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Cardano Foundation
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,38 @@
1010

1111
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.
1212

13+
📈 [Treasury Calculation Report](https://cardano-foundation.github.io/cf-java-rewards-calculation/report-latest/treasury_calculation.html)
14+
15+
```mermaid
16+
flowchart
17+
A[Total Transaction Fees <br />at Epoch n] --> B[<a href='https://github.com/cardano-foundation/cf-java-rewards-calculation/blob/a794130dc0e320426725a58b8b15f1fbe726b2de/src/main/java/org/cardanofoundation/rewards/calculation/TreasuryCalculation.java#L42'>Total Reward Pot <br />at Epoch n</a/>]
18+
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/>]
20+
subgraph ADA_POTS[" "]
21+
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
23+
C --> F[Payouts e.g. for <br /><a href='https://projectcatalyst.io/'>Project Catalyst</a>]
24+
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+
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+
D --> I[...]
27+
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]
28+
end
29+
30+
style A fill:#5C8DFF,stroke:#5C8DFF
31+
style B fill:#5C8DFF,stroke:#5C8DFF
32+
style C fill:#1EC198,stroke:#1EC198
33+
style D fill:#5C8DFF,stroke:#5C8DFF
34+
style E fill:#1EC198,stroke:#1EC198
35+
36+
style F fill:#F6C667,stroke:#F6C667
37+
style G fill:#F6C667,stroke:#F6C667
38+
style H fill:#F6C667,stroke:#F6C667
39+
style I fill:#F6C667,stroke:#F6C667
40+
style J fill:#F6C667,stroke:#F6C667
41+
42+
style ADA_POTS fill:#f6f9ff,stroke:#f6f9ff
43+
```
44+
1345
## 🚀 Getting Started
1446

1547
#### Prerequisites
@@ -30,3 +62,7 @@ To ensure the stability and reliability of this project, unit tests have been im
3062

3163
📊 [Coverage Report](https://cardano-foundation.github.io/cf-java-rewards-calculation/coverage-report/)
3264

65+
## 📖 Sources
66+
67+
- Beavr Cardano Stake Pool: [How is the Rewards Pot (R) Calculated](https://archive.ph/HQfoV/fb8166e31d2bf61d3d6ca769e7785f2a96530f8e.webp)
68+
- Protocol Parameters: https://beta.explorer.cardano.org/en/protocol-parameters/

0 commit comments

Comments
 (0)