Skip to content

pie-dao/pie-reporter

Repository files navigation

pie-reporter

A collection of scripts enabling analysis of PieDAO staking initiative.

How to run

First, init a virtualenv:

python3.8 -m venv ./env # creates a python virtualenv
source ./env activate
pip install -r requirements.txt

To build a distribution:

💡 Note that you need to use Python 3.8 for all of these scripts to work properly.

# replace these as required
export NEW_REPORT=2023-2;
export OLD_REPORT=2023-1;

python3 ./reporter/run.py conf
python3 ./reporter/run.py build  "./reports/$NEW_REPORT" "./reports/$OLD_REPORT"
python3 ./reporter/run.py report "./reports/$NEW_REPORT" "./reports/$OLD_REPORT"

Reports generated explained for Dummies

reports/<month-year>
├── csv
     ├── distribution.csv: Rewards distributed for this epoch (including slashed)
     ├── rewards.csv: Rewards distributed including any unclaimed reward
     ├── voters.csv: Addresses that voted on the reporting epoch
     ├── non_voters.csv: Addresses that did not vote on the reporting epoch
     ├── votes.csv: Address vote history per proposal during the reporting epoch
     ├── proposals.csv: All eligible proposals considered for the reporting epoch
     └── stakers.csv: Amount of veDough staked per address
├── json
     ├── rewards.json: rewards.csv in a JSON format
     └── stakers.json: stakers.csv in a JSON format
├── claims.json: Claims for this epoch (used to generate the merkle tree)
├── epoch-conf.json: Epoch configuration
├── reporter-db.json: JSON format document-based database (used by the reporter)
└── merkle-tree.json: Final merkle tree

We also generate a /reports/latest folder. As the name suggests this contains the latest merkle-tree which can be used by applications to the most up to date distribution data.

Checking discrepancy with the claims generated by the backend

python3 ./reporter/double_checker/double_checker.py check "./reports/$NEW_REPORT/reporter-db.json" "./reports/$NEW_REPORT/epoch-$NEW_REPORT.json"

Example: python3.8 ./reporter/double_checker/double_checker.py check reports/2022-6/reporter-db.json epoch-2022-6.json

Generating final tree

# only run once
yarn

yarn ts-node ./scripts/CreateClaims.ts -i "./reports/$NEW_REPORT/claims.json" -o $NEW_REPORT

Future improvements

  • Implement a CLI to query reporter-db