From 42984bd0bd24ab4b14a4fb72868423f949d5b911 Mon Sep 17 00:00:00 2001 From: Timotej Vesel Date: Sat, 23 Nov 2024 20:29:14 +0100 Subject: [PATCH] few updates and temporary stop auto calculation --- .github/workflows/scheduled-commit.yaml | 150 ++++++++++++------------ README.md | 2 + ftso-address.csv | 3 +- 3 files changed, 79 insertions(+), 76 deletions(-) diff --git a/.github/workflows/scheduled-commit.yaml b/.github/workflows/scheduled-commit.yaml index 6d9c30f..b545736 100644 --- a/.github/workflows/scheduled-commit.yaml +++ b/.github/workflows/scheduled-commit.yaml @@ -1,87 +1,87 @@ -name: "Calculate rewards" +# name: "Calculate rewards" -on: - schedule: - - cron: '30 7 * * 1' # Every Monday at 07:30 UCT - - cron: '30 19 * * 4' # Every Thursday at 19:30 UCT - workflow_dispatch: - inputs: - first_reward_epoch: - description: "Reward epoch (Last epoch if of-four)" - type: number - reward_amount_epoch_wei: - description: "Reward amount (in wei)" - type: number - trigger_generate_report_workflow: - description: "Run github pages deployment workflow" - type: string - required: true - default: 'true' +# on: +# # schedule: +# # - cron: '30 7 * * 1' # Every Monday at 07:30 UCT +# # - cron: '30 19 * * 4' # Every Thursday at 19:30 UCT +# workflow_dispatch: +# inputs: +# first_reward_epoch: +# description: "Reward epoch (Last epoch if of-four)" +# type: number +# reward_amount_epoch_wei: +# description: "Reward amount (in wei)" +# type: number +# trigger_generate_report_workflow: +# description: "Run github pages deployment workflow" +# type: string +# required: true +# default: 'true' -permissions: - contents: write - actions: write +# permissions: +# contents: write +# actions: write -jobs: - process-staking-rewards: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 - with: - node-version: 20 - - name: Install jq - run: sudo apt update -y && sudo apt install jq moreutils -y - - name: Install node modules - run: yarn install --frozen-lockfile - - name: Calculate epoch vars - run: | - export REWARD_EPOCH_DEFINED="${{ github.event.inputs.first_reward_epoch }}" - export REWARD_EPOCH_CALCULATED="$(node .github/workflows/get-current-reward-epoch.js)" - export USE_REWARD_EPOCH="${REWARD_EPOCH_DEFINED:-$REWARD_EPOCH_CALCULATED}" - echo "USE_REWARD_EPOCH=$USE_REWARD_EPOCH" >> "$GITHUB_ENV" +# jobs: +# process-staking-rewards: +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v4 +# - uses: actions/setup-node@v3 +# with: +# node-version: 20 +# - name: Install jq +# run: sudo apt update -y && sudo apt install jq moreutils -y +# - name: Install node modules +# run: yarn install --frozen-lockfile +# - name: Calculate epoch vars +# run: | +# export REWARD_EPOCH_DEFINED="${{ github.event.inputs.first_reward_epoch }}" +# export REWARD_EPOCH_CALCULATED="$(node .github/workflows/get-current-reward-epoch.js)" +# export USE_REWARD_EPOCH="${REWARD_EPOCH_DEFINED:-$REWARD_EPOCH_CALCULATED}" +# echo "USE_REWARD_EPOCH=$USE_REWARD_EPOCH" >> "$GITHUB_ENV" - export USE_FIRST_REWARD_EPOCH="$((${USE_REWARD_EPOCH} - 3))" - echo "USE_FIRST_REWARD_EPOCH=${USE_FIRST_REWARD_EPOCH}" >> "$GITHUB_ENV" +# export USE_FIRST_REWARD_EPOCH="$((${USE_REWARD_EPOCH} - 3))" +# echo "USE_FIRST_REWARD_EPOCH=${USE_FIRST_REWARD_EPOCH}" >> "$GITHUB_ENV" - echo "EPOCH_OF4_if0=$(( $(( $USE_REWARD_EPOCH - 1 )) % 4 ))" >> "$GITHUB_ENV" +# echo "EPOCH_OF4_if0=$(( $(( $USE_REWARD_EPOCH - 1 )) % 4 ))" >> "$GITHUB_ENV" - - name: Set reward amount wei overwrite - if: github.event.inputs.reward_amount_epoch_wei != '' - run: jq --raw-output --monochrome-output --argjson amount "${{ github.event.inputs.reward_amount_epoch_wei }}" '.REWARD_AMOUNT_EPOCH_WEI = $amunt' configs/networks/flare.json | sponge configs/networks/flare.json +# - name: Set reward amount wei overwrite +# if: github.event.inputs.reward_amount_epoch_wei != '' +# run: jq --raw-output --monochrome-output --argjson amount "${{ github.event.inputs.reward_amount_epoch_wei }}" '.REWARD_AMOUNT_EPOCH_WEI = $amunt' configs/networks/flare.json | sponge configs/networks/flare.json - - name: Process staking rewards for ${{ env.USE_REWARD_EPOCH }} - run: | - jq --raw-output --monochrome-output '.NUM_EPOCHS = 1' configs/networks/flare.json | sponge configs/networks/flare.json - jq --raw-output --monochrome-output --argjson epoch "$USE_REWARD_EPOCH" '.REWARD_EPOCH = $epoch' configs/networks/flare.json | sponge configs/networks/flare.json - yarn run process-staking-rewards +# - name: Process staking rewards for ${{ env.USE_REWARD_EPOCH }} +# run: | +# jq --raw-output --monochrome-output '.NUM_EPOCHS = 1' configs/networks/flare.json | sponge configs/networks/flare.json +# jq --raw-output --monochrome-output --argjson epoch "$USE_REWARD_EPOCH" '.REWARD_EPOCH = $epoch' configs/networks/flare.json | sponge configs/networks/flare.json +# yarn run process-staking-rewards - - name: Combine rewards for [epoch ${{ env.USE_FIRST_REWARD_EPOCH }}-${{ env.USE_REWARD_EPOCH }}] - if: env.EPOCH_OF4_if0 == 0 - run: | - jq --raw-output --monochrome-output '.NUM_EPOCHS = 4' configs/networks/flare.json | sponge configs/networks/flare.json - jq --raw-output --monochrome-output --argjson epoch "$USE_REWARD_EPOCH" '.REWARD_EPOCH = $epoch' configs/networks/flare.json | sponge configs/networks/flare.json - yarn sum-staking-rewards +# - name: Combine rewards for [epoch ${{ env.USE_FIRST_REWARD_EPOCH }}-${{ env.USE_REWARD_EPOCH }}] +# if: env.EPOCH_OF4_if0 == 0 +# run: | +# jq --raw-output --monochrome-output '.NUM_EPOCHS = 4' configs/networks/flare.json | sponge configs/networks/flare.json +# jq --raw-output --monochrome-output --argjson epoch "$USE_REWARD_EPOCH" '.REWARD_EPOCH = $epoch' configs/networks/flare.json | sponge configs/networks/flare.json +# yarn sum-staking-rewards - - name: Commit generated-files - run: | - git config --global user.name 'Reward scripts automation' - git config --global user.email 'flare-foundation-reward-scripts-automation@users.noreply.github.com' - git add generated-files/reward-epoch-${{ env.USE_REWARD_EPOCH }} - if [ "$EPOCH_OF4_if0" -eq 0 ]; then git add generated-files/validator-rewards/epochs-${{ env.USE_FIRST_REWARD_EPOCH }}-${{ env.USE_REWARD_EPOCH }}.json; fi - git commit -m "Processed staking rewards for epoch ${{ env.USE_REWARD_EPOCH }}" && git push || echo "No changes were present, failed to commit, proceeding..." +# - name: Commit generated-files +# run: | +# git config --global user.name 'Reward scripts automation' +# git config --global user.email 'flare-foundation-reward-scripts-automation@users.noreply.github.com' +# git add generated-files/reward-epoch-${{ env.USE_REWARD_EPOCH }} +# if [ "$EPOCH_OF4_if0" -eq 0 ]; then git add generated-files/validator-rewards/epochs-${{ env.USE_FIRST_REWARD_EPOCH }}-${{ env.USE_REWARD_EPOCH }}.json; fi +# git commit -m "Processed staking rewards for epoch ${{ env.USE_REWARD_EPOCH }}" && git push || echo "No changes were present, failed to commit, proceeding..." - - name: Upload artifacts - uses: actions/upload-artifact@v3 - with: - name: staking-rewards - path: | - generated-files/reward-epoch-${{ env.USE_REWARD_EPOCH }} - generated-files/validator-rewards/epochs-${{ env.USE_FIRST_REWARD_EPOCH }}-${{ env.USE_REWARD_EPOCH }}.json +# - name: Upload artifacts +# uses: actions/upload-artifact@v3 +# with: +# name: staking-rewards +# path: | +# generated-files/reward-epoch-${{ env.USE_REWARD_EPOCH }} +# generated-files/validator-rewards/epochs-${{ env.USE_FIRST_REWARD_EPOCH }}-${{ env.USE_REWARD_EPOCH }}.json - - name: Trigger "generate report" workflow - if: github.event.inputs.trigger_generate_report_workflow == 'true' || github.event.inputs.trigger_generate_report_workflow == '' - env: - GH_TOKEN: ${{ github.token }} - run: gh workflow run "Generate report" -f first_reward_epoch=${{ env.USE_REWARD_EPOCH }} +# - name: Trigger "generate report" workflow +# if: github.event.inputs.trigger_generate_report_workflow == 'true' || github.event.inputs.trigger_generate_report_workflow == '' +# env: +# GH_TOKEN: ${{ github.token }} +# run: gh workflow run "Generate report" -f first_reward_epoch=${{ env.USE_REWARD_EPOCH }} diff --git a/README.md b/README.md index 0f3c735..738bdc5 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,9 @@ You can also run it with optional parameters from [file](./src/processProviders. For each run output of the process is in folder `generated-files/reward-epochs-`. +### Verifying the results To verify the official results posted in this repository one needs to update its configuration file with values from the `configFileData` object of a `data.json` file for some reward epoch. +To verify the results for the reward epochs from 126 to 243 inclusive one needs to use branch `version-1`. ### Data for distributing rewards Rewards will be distributed every four reward epochs, which means that every 14 days reward amounts from the past four reward epochs will be summed. This is achieved by running the process diff --git a/ftso-address.csv b/ftso-address.csv index acb0f37..b7c8f7b 100644 --- a/ftso-address.csv +++ b/ftso-address.csv @@ -108,4 +108,5 @@ Encode Club,0x1c2bb2ca14914a462ab7268de4a48ef6445116c2,NodeID-9fsCXCFJ7hzgsGK4FV FlareFi,0x184DbC7F2D96aBDfDe5CDa8c56F3F13DbF138cdF,NodeID-8aGBxZssVWRvEr57YGRsWjZTHbnoWrfcc,235 Bifrost Wallet 2,0x9A46864A3b0a7805B266C445289C3fAD1E48f18e,NodeID-GZEWkCpn852hwKhbGNJgZvbjtvEfU6Ktg,238 Oracle Daemon,0xfe532cB6Fb3C47940aeA7BeAd4d61C5e041D950e,NodeID-GEC63GVfeYLG5UUBPSgiiN4YMvT71jdP,241 -Oracle Daemon,0xfe532cB6Fb3C47940aeA7BeAd4d61C5e041D950e,NodeID-2miZhA7JAnyf9s5rYzDeNciwg4448LKsP,241 \ No newline at end of file +Oracle Daemon,0xfe532cB6Fb3C47940aeA7BeAd4d61C5e041D950e,NodeID-2miZhA7JAnyf9s5rYzDeNciwg4448LKsP,241 +Poseidon FTSO,0xD3b3Bd5207687d43c9cCBBbca830dfe2A13EE5b7,NodeID-CtSfUZd8nvr4RDaQnKRiP9cae15Nrb1bX,244 \ No newline at end of file