Skip to content
This repository was archived by the owner on Apr 14, 2026. It is now read-only.

Commit d4680a4

Browse files
authored
Merge pull request #39 from BalancerMaxis/test-workflow
allow manual core pool input, automated test action, new fee model
2 parents d8c6350 + ab2680a commit d4680a4

49 files changed

Lines changed: 5610 additions & 429 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 39 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,29 @@
1-
name: Process and run reports for a fee round
1+
name: Manual Fee Collection
22

33
on:
44
workflow_dispatch:
55
inputs:
66
end_day:
7-
description: "End Date of the last voting period like YYYY-MM-DD. Fees will be calcualted for the 2 week period prior 00:00GMT on this day. It should be on aThursday that during an Aura voting round."
7+
description: 'End date to process (YYYYMMDD format)'
88
required: true
9+
type: string
10+
protocol_version:
11+
description: 'Protocol version to process'
12+
required: true
13+
type: choice
14+
options:
15+
- v2
16+
- v3
917

1018
jobs:
11-
generate_fees_report:
19+
process_fees:
1220
runs-on: ubuntu-latest
1321

1422
steps:
1523
- name: Checkout
1624
uses: actions/checkout@v4
1725

18-
- name: Setup Python 3.9
26+
- name: Setup Python
1927
uses: actions/setup-python@v5
2028
with:
2129
python-version: "3.10"
@@ -25,27 +33,42 @@ jobs:
2533
DRPC_KEY: ${{ secrets.DRPC_KEY }}
2634
GRAPH_API_KEY: ${{ secrets.GRAPH_API_KEY }}
2735
run: |
28-
pwd
29-
end_day=${{ github.event.inputs.end_day }}
36+
end_day=${{ inputs.end_day }}
3037
start_day=$(date -d "$end_day -14 days" +%Y-%m-%d)
3138
date_range_string="${start_day}_${end_day}"
32-
echo $date_range_string
39+
echo "Processing fees for ${{ inputs.protocol_version }} from $start_day to $end_day"
40+
3341
start_timestamp=$(date -d "$start_day 00:00:00" +"%s")
3442
end_timestamp=$((start_timestamp + 60*60*24*14)) # 2 weeks later
3543
pip3 install -r requirements.txt
3644
37-
# v2 run
38-
python3 main.py --ts_now $end_timestamp --ts_in_the_past $start_timestamp --fees_file_name fees_${date_range_string}.json --output_file_name incentives_${date_range_string}.csv --protocol_version v2
39-
# v3 run
40-
python3 main.py --ts_now $end_timestamp --ts_in_the_past $start_timestamp --fees_file_name fees_${date_range_string}.json --output_file_name incentives_${date_range_string}.csv --protocol_version v3
41-
python3 combine_payloads.py --payload_file_name fees_${date_range_string}.json
45+
python3 main.py \
46+
--ts_now $end_timestamp \
47+
--ts_in_the_past $start_timestamp \
48+
--fees_file_name ${{ inputs.protocol_version }}_fees_${date_range_string}.json \
49+
--output_file_name ${{ inputs.protocol_version }}_incentives_${date_range_string}.csv \
50+
--protocol_version ${{ inputs.protocol_version }}
51+
4252
- name: Create PR
4353
id: cpr
4454
uses: peter-evans/create-pull-request@v7
4555
with:
46-
commit-message: "task: new fees report ending ${{ github.events.inputs.end_day }}"
47-
title: "Biweekly Fee Report ending ${{ github.events.inputs.end_day }}"
48-
branch: gha-biweekly-fees
56+
commit-message: "task: new ${{ inputs.protocol_version }} fees report ending ${{ inputs.end_day }}"
57+
title: "Manual ${{ inputs.protocol_version }} Fee Report ending ${{ inputs.end_day }}"
58+
body: |
59+
Checks before merging:
60+
- [ ] all pools must be a core pool
61+
- [ ] `total_incentives` + `fees_to_vebal` + `fees_to_dao` == [usdc onchain](https://etherscan.io/token/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48?a=0x7c68c42de679ffb0f16216154c996c354cf1161b)
62+
- [ ] `aura_incentives` / `total_incentives` ~= aurabal's vebal capture (https://app.aura.finance/#/stats)
63+
- [ ] `earned_fees` <= total_swept onchain (per chain)
64+
- [ ] `fees_to_dao` / (`fees_to_vebal` + `fees_to_dao` + `total_incentives`) == .175
65+
- [ ] `min(aura_incentives)` > threshold
66+
- [ ] `min(bal_incentives)` > threshold
67+
- [ ] latest [vote round data added](https://github.com/aurafinance/aura-contracts/pulls?q=is%3Apr+is%3Aclosed) by aura team?
68+
69+
Additional checks:
70+
- [ ] paladin quest v2 claimable earnings > $10k? https://quest.paladin.vote/#/claim
71+
branch: manual-fees-${{ inputs.protocol_version }}
4972
branch-suffix: timestamp
5073
delete-branch: true
51-
labels: "Biweekly-Report"
74+
labels: "Manual-Fee-Report,${{ inputs.protocol_version }}"

.github/workflows/get_mimic_report.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
branch: gha-mimic-fees
4747
branch-suffix: timestamp
4848
delete-branch: true
49-
base: test-workflow
49+
base: biweekly-runs
5050
labels: "Biweekly-Mimic-Report"
5151
reviewers: |
5252
gosuto-inzasheru

.github/workflows/test.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Run Tests
2+
3+
on:
4+
pull_request:
5+
branches: [ biweekly-runs ]
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
15+
- name: Set up Python 3.10
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: "3.10"
19+
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install -r requirements.txt
24+
pip install -r requirements-dev.txt
25+
26+
- name: Run pytest
27+
env:
28+
DRPC_KEY: ${{ secrets.DRPC_KEY }}
29+
GRAPH_API_KEY: ${{ secrets.GRAPH_API_KEY }}
30+
run: |
31+
pytest

.github/workflows/trigger_fee_collection.yaml

Lines changed: 57 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ on:
44
workflow_dispatch:
55
inputs:
66
manual_date:
7-
description: 'End date to process (YYYYMMDD format)'
7+
description: "End date to process (YYYYMMDD format)"
88
required: true
99
type: string
1010
push:
1111
branches:
12-
- test-workflow
12+
- biweekly-runs
1313
paths:
14-
- 'fee_allocator/fees_collected/*.json'
14+
- "fee_allocator/fees_collected/*.json"
1515

1616
jobs:
17-
trigger_fee_collection:
17+
process_fees:
1818
runs-on: ubuntu-latest
1919

2020
steps:
@@ -33,21 +33,65 @@ jobs:
3333
3434
# Get the path of the changed JSON file
3535
JSON_PATH=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep 'fee_allocator/fees_collected/.*\.json$' | head -n 1)
36-
36+
3737
if [ -z "$JSON_PATH" ]; then
3838
echo "No JSON file found in recent changes."
3939
exit 1
4040
fi
41-
41+
4242
echo "JSON Path: $JSON_PATH"
43-
43+
4444
# Extract the end date from filename using cut
45-
END_DATE=$(basename "$JSON_PATH" | cut -d'_' -f3 | cut -d'.' -f1)
46-
45+
END_DATE=$(basename "$JSON_PATH" | cut -d'_' -f4 | cut -d'.' -f1)
46+
4747
echo "end-date=$END_DATE" >> $GITHUB_OUTPUT
4848
49-
- name: Trigger collect_fees_v2 workflow
50-
uses: benc-uk/workflow-dispatch@v1
49+
- name: Setup Python 3.10
50+
uses: actions/setup-python@v5
51+
with:
52+
python-version: "3.10"
53+
54+
- name: Collect fees
55+
env:
56+
DRPC_KEY: ${{ secrets.DRPC_KEY }}
57+
GRAPH_API_KEY: ${{ secrets.GRAPH_API_KEY }}
58+
run: |
59+
pwd
60+
end_day=${{ steps.get-date.outputs.end-date }}
61+
start_day=$(date -d "$end_day -14 days" +%Y-%m-%d)
62+
date_range_string="${start_day}_${end_day}"
63+
echo $date_range_string
64+
start_timestamp=$(date -d "$start_day 00:00:00" +"%s")
65+
end_timestamp=$((start_timestamp + 60*60*24*14)) # 2 weeks later
66+
pip3 install -r requirements.txt
67+
68+
# v2 run
69+
python3 main.py --ts_now $end_timestamp --ts_in_the_past $start_timestamp --fees_file_name v2_fees_${date_range_string}.json --output_file_name v2_incentives_${date_range_string}.csv --protocol_version v2
70+
# v3 run
71+
python3 main.py --ts_now $end_timestamp --ts_in_the_past $start_timestamp --fees_file_name v3_fees_${date_range_string}.json --output_file_name v3_incentives_${date_range_string}.csv --protocol_version v3
72+
# merge v2/v3 payload
73+
python3 combine_payloads.py --payload_file_name v2_fees_${date_range_string}.json
74+
75+
- name: Create PR
76+
id: cpr
77+
uses: peter-evans/create-pull-request@v7
5178
with:
52-
workflow: Process and run reports for a fee round
53-
inputs: '{"end_day": "${{ steps.get-date.outputs.end-date }}"}'
79+
commit-message: "task: new fees report ending ${{ steps.get-date.outputs.end-date }}"
80+
title: "Biweekly Fee Report ending ${{ steps.get-date.outputs.end-date }}"
81+
body: |
82+
Checks before merging:
83+
- [ ] all pools must be a core pool
84+
- [ ] `total_incentives` + `fees_to_vebal` + `fees_to_dao` == [usdc onchain](https://etherscan.io/token/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48?a=0x7c68c42de679ffb0f16216154c996c354cf1161b)
85+
- [ ] `aura_incentives` / `total_incentives` ~= aurabal's vebal capture (https://app.aura.finance/#/stats)
86+
- [ ] `earned_fees` <= total_swept onchain (per chain)
87+
- [ ] `fees_to_dao` / (`fees_to_vebal` + `fees_to_dao` + `total_incentives`) == .175
88+
- [ ] `min(aura_incentives)` > threshold
89+
- [ ] `min(bal_incentives)` > threshold
90+
- [ ] latest [vote round data added](https://github.com/aurafinance/aura-contracts/pulls?q=is%3Apr+is%3Aclosed) by aura team?
91+
92+
Additional checks:
93+
- [ ] paladin quest v2 claimable earnings > $10k? https://quest.paladin.vote/#/claim
94+
branch: gha-biweekly-fees
95+
branch-suffix: timestamp
96+
delete-branch: true
97+
labels: "Biweekly-Report"

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,5 +164,5 @@ cython_debug/
164164
.DS_Store
165165

166166
fee_allocator/accounting/cache/
167-
backtesting/v2_allocations/cache/
167+
tests/cache/
168168
tests/output/

combine_payloads.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import argparse
2+
import json
3+
from pathlib import Path
4+
from datetime import datetime
5+
6+
7+
def combine_payloads(fees_file_name: str) -> None:
8+
date_str = fees_file_name.split('_')[3].split('.')[0]
9+
10+
payload_dir = Path("fee_allocator/payloads")
11+
12+
v2_file = payload_dir / f"v2_{date_str}.json"
13+
v3_file = payload_dir / f"v3_{date_str}.json"
14+
15+
if not v2_file.exists() or not v3_file.exists():
16+
raise FileNotFoundError(f"Could not find both v2 and v3 payload files for date {date_str}")
17+
18+
with open(v2_file) as f:
19+
v2_payload = json.load(f)
20+
21+
with open(v3_file) as f:
22+
v3_payload = json.load(f)
23+
24+
combined_payload = {
25+
"version": "1.0",
26+
"chainId": "1",
27+
"createdAt": int(datetime.now().timestamp()),
28+
"meta": {
29+
"name": "Combined V2+V3 Transactions Batch",
30+
"description": "",
31+
"txBuilderVersion": "1.16.3",
32+
"createdFromSafeAddress": v2_payload["meta"]["createdFromSafeAddress"],
33+
"createdFromOwnerAddress": "",
34+
"checksum": "0x0000000000000000000000000000000000000000000000000000000000000000"
35+
},
36+
"transactions": v2_payload["transactions"] + v3_payload["transactions"]
37+
}
38+
39+
output_file = payload_dir / f"{date_str}.json"
40+
with open(output_file, "w") as f:
41+
json.dump(combined_payload, f, indent=2)
42+
43+
print(f"Combined payload written to {output_file}")
44+
print(f"Total transactions: {len(combined_payload['transactions'])}")
45+
46+
def main():
47+
parser = argparse.ArgumentParser()
48+
parser.add_argument("--payload_file_name", help="Fees file name", type=str, required=True)
49+
args = parser.parse_args()
50+
combine_payloads(args.payload_file_name)
51+
52+
if __name__ == "__main__":
53+
main()

0 commit comments

Comments
 (0)