dao-treasury 0.0.37__cp310-cp310-macosx_11_0_arm64.whl → 0.0.69__cp310-cp310-macosx_11_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dao_treasury/.grafana/provisioning/dashboards/breakdowns/Expenses.json +551 -0
- dao_treasury/.grafana/provisioning/dashboards/breakdowns/Revenue.json +551 -0
- dao_treasury/.grafana/provisioning/dashboards/dashboards.yaml +7 -57
- dao_treasury/.grafana/provisioning/dashboards/streams/LlamaPay.json +11 -16
- dao_treasury/.grafana/provisioning/dashboards/summary/Monthly.json +15 -15
- dao_treasury/.grafana/provisioning/dashboards/transactions/Treasury Transactions.json +38 -61
- dao_treasury/.grafana/provisioning/dashboards/treasury/Cashflow (Including Unsorted).json +122 -149
- dao_treasury/.grafana/provisioning/dashboards/treasury/Cashflow.json +87 -100
- dao_treasury/.grafana/provisioning/dashboards/treasury/Current Treasury Assets.json +1009 -0
- dao_treasury/.grafana/provisioning/dashboards/treasury/Historical Treasury Balances.json +2989 -0
- dao_treasury/.grafana/provisioning/dashboards/treasury/Operating Cashflow.json +64 -78
- dao_treasury/ENVIRONMENT_VARIABLES.py +12 -0
- dao_treasury/__init__.py +14 -0
- dao_treasury/_docker.cpython-310-darwin.so +0 -0
- dao_treasury/_docker.py +38 -21
- dao_treasury/_nicknames.cpython-310-darwin.so +0 -0
- dao_treasury/_nicknames.py +15 -0
- dao_treasury/_wallet.cpython-310-darwin.so +0 -0
- dao_treasury/constants.cpython-310-darwin.so +0 -0
- dao_treasury/constants.py +24 -0
- dao_treasury/db.py +74 -4
- dao_treasury/docker-compose.yaml +1 -1
- dao_treasury/main.py +6 -0
- dao_treasury/sorting/__init__.cpython-310-darwin.so +0 -0
- dao_treasury/sorting/_matchers.cpython-310-darwin.so +0 -0
- dao_treasury/sorting/_rules.cpython-310-darwin.so +0 -0
- dao_treasury/sorting/factory.cpython-310-darwin.so +0 -0
- dao_treasury/sorting/rule.cpython-310-darwin.so +0 -0
- dao_treasury/sorting/rule.py +8 -10
- dao_treasury/sorting/rules/__init__.cpython-310-darwin.so +0 -0
- dao_treasury/sorting/rules/ignore/__init__.cpython-310-darwin.so +0 -0
- dao_treasury/sorting/rules/ignore/llamapay.cpython-310-darwin.so +0 -0
- dao_treasury/streams/__init__.cpython-310-darwin.so +0 -0
- dao_treasury/streams/llamapay.cpython-310-darwin.so +0 -0
- dao_treasury/streams/llamapay.py +14 -2
- dao_treasury/treasury.py +33 -14
- dao_treasury/types.cpython-310-darwin.so +0 -0
- {dao_treasury-0.0.37.dist-info → dao_treasury-0.0.69.dist-info}/METADATA +4 -3
- dao_treasury-0.0.69.dist-info/RECORD +54 -0
- dao_treasury-0.0.69.dist-info/top_level.txt +2 -0
- dao_treasury__mypyc.cpython-310-darwin.so +0 -0
- bf2b4fe1f86ad2ea158b__mypyc.cpython-310-darwin.so +0 -0
- dao_treasury/.grafana/provisioning/dashboards/treasury/Treasury.json +0 -2018
- dao_treasury-0.0.37.dist-info/RECORD +0 -51
- dao_treasury-0.0.37.dist-info/top_level.txt +0 -2
- {dao_treasury-0.0.37.dist-info → dao_treasury-0.0.69.dist-info}/WHEEL +0 -0
|
@@ -18,12 +18,13 @@
|
|
|
18
18
|
"editable": true,
|
|
19
19
|
"fiscalYearStartMonth": 0,
|
|
20
20
|
"graphTooltip": 1,
|
|
21
|
+
"id": 6,
|
|
21
22
|
"links": [],
|
|
22
|
-
"liveNow": false,
|
|
23
23
|
"panels": [
|
|
24
24
|
{
|
|
25
25
|
"datasource": "SQLite",
|
|
26
26
|
"fieldConfig": {
|
|
27
|
+
"unit": "currencyUSD",
|
|
27
28
|
"defaults": {
|
|
28
29
|
"color": {
|
|
29
30
|
"mode": "thresholds"
|
|
@@ -34,7 +35,7 @@
|
|
|
34
35
|
"steps": [
|
|
35
36
|
{
|
|
36
37
|
"color": "green",
|
|
37
|
-
"value":
|
|
38
|
+
"value": 0
|
|
38
39
|
},
|
|
39
40
|
{
|
|
40
41
|
"color": "red",
|
|
@@ -57,16 +58,17 @@
|
|
|
57
58
|
"graphMode": "area",
|
|
58
59
|
"justifyMode": "auto",
|
|
59
60
|
"orientation": "auto",
|
|
61
|
+
"percentChangeColorMode": "standard",
|
|
60
62
|
"reduceOptions": {
|
|
61
|
-
"calcs": [
|
|
62
|
-
"lastNotNull"
|
|
63
|
-
],
|
|
63
|
+
"calcs": ["lastNotNull"],
|
|
64
64
|
"fields": "",
|
|
65
65
|
"values": false
|
|
66
66
|
},
|
|
67
|
-
"
|
|
67
|
+
"showPercentChange": false,
|
|
68
|
+
"textMode": "auto",
|
|
69
|
+
"wideLayout": true
|
|
68
70
|
},
|
|
69
|
-
"pluginVersion": "
|
|
71
|
+
"pluginVersion": "12.1.1",
|
|
70
72
|
"targets": [
|
|
71
73
|
{
|
|
72
74
|
"datasource": "SQLite",
|
|
@@ -74,18 +76,17 @@
|
|
|
74
76
|
"queryType": "table",
|
|
75
77
|
"rawQueryText": "SELECT SUM(t.value_usd) AS total_revenue FROM general_ledger t JOIN txgroup_hierarchy gh USING (txgroup_id) WHERE gh.top_category = 'Revenue' AND t.timestamp >= $__from/1000 AND t.timestamp <= $__to/1000",
|
|
76
78
|
"refId": "A",
|
|
77
|
-
"timeColumns": [
|
|
78
|
-
"time",
|
|
79
|
-
"ts"
|
|
80
|
-
]
|
|
79
|
+
"timeColumns": ["time", "ts"]
|
|
81
80
|
}
|
|
82
81
|
],
|
|
83
82
|
"title": "Revenue",
|
|
84
|
-
"type": "stat"
|
|
83
|
+
"type": "stat",
|
|
84
|
+
"description": "Displays the total value of all transactions sorted as Revenue for the selected period."
|
|
85
85
|
},
|
|
86
86
|
{
|
|
87
87
|
"datasource": "SQLite",
|
|
88
88
|
"fieldConfig": {
|
|
89
|
+
"unit": "currencyUSD",
|
|
89
90
|
"defaults": {
|
|
90
91
|
"color": {
|
|
91
92
|
"mode": "thresholds"
|
|
@@ -96,7 +97,7 @@
|
|
|
96
97
|
"steps": [
|
|
97
98
|
{
|
|
98
99
|
"color": "green",
|
|
99
|
-
"value":
|
|
100
|
+
"value": 0
|
|
100
101
|
},
|
|
101
102
|
{
|
|
102
103
|
"color": "red",
|
|
@@ -119,16 +120,17 @@
|
|
|
119
120
|
"graphMode": "area",
|
|
120
121
|
"justifyMode": "auto",
|
|
121
122
|
"orientation": "auto",
|
|
123
|
+
"percentChangeColorMode": "standard",
|
|
122
124
|
"reduceOptions": {
|
|
123
|
-
"calcs": [
|
|
124
|
-
"lastNotNull"
|
|
125
|
-
],
|
|
125
|
+
"calcs": ["lastNotNull"],
|
|
126
126
|
"fields": "",
|
|
127
127
|
"values": false
|
|
128
128
|
},
|
|
129
|
-
"
|
|
129
|
+
"showPercentChange": false,
|
|
130
|
+
"textMode": "auto",
|
|
131
|
+
"wideLayout": true
|
|
130
132
|
},
|
|
131
|
-
"pluginVersion": "
|
|
133
|
+
"pluginVersion": "12.1.1",
|
|
132
134
|
"targets": [
|
|
133
135
|
{
|
|
134
136
|
"datasource": "SQLite",
|
|
@@ -136,18 +138,17 @@
|
|
|
136
138
|
"queryType": "table",
|
|
137
139
|
"rawQueryText": "SELECT SUM(t.value_usd) AS total_revenue FROM general_ledger t JOIN txgroup_hierarchy gh USING (txgroup_id) WHERE gh.top_category = 'Cost of Revenue' AND t.timestamp >= $__from/1000 AND t.timestamp <= $__to/1000",
|
|
138
140
|
"refId": "A",
|
|
139
|
-
"timeColumns": [
|
|
140
|
-
"time",
|
|
141
|
-
"ts"
|
|
142
|
-
]
|
|
141
|
+
"timeColumns": ["time", "ts"]
|
|
143
142
|
}
|
|
144
143
|
],
|
|
145
144
|
"title": "Cost of Revenue",
|
|
146
|
-
"type": "stat"
|
|
145
|
+
"type": "stat",
|
|
146
|
+
"description": "Displays the total value of all transactions sorted as Cost of Revenue for the selected period."
|
|
147
147
|
},
|
|
148
148
|
{
|
|
149
149
|
"datasource": "SQLite",
|
|
150
150
|
"fieldConfig": {
|
|
151
|
+
"unit": "currencyUSD",
|
|
151
152
|
"defaults": {
|
|
152
153
|
"color": {
|
|
153
154
|
"mode": "thresholds"
|
|
@@ -158,7 +159,7 @@
|
|
|
158
159
|
"steps": [
|
|
159
160
|
{
|
|
160
161
|
"color": "green",
|
|
161
|
-
"value":
|
|
162
|
+
"value": 0
|
|
162
163
|
},
|
|
163
164
|
{
|
|
164
165
|
"color": "red",
|
|
@@ -181,16 +182,17 @@
|
|
|
181
182
|
"graphMode": "area",
|
|
182
183
|
"justifyMode": "auto",
|
|
183
184
|
"orientation": "auto",
|
|
185
|
+
"percentChangeColorMode": "standard",
|
|
184
186
|
"reduceOptions": {
|
|
185
|
-
"calcs": [
|
|
186
|
-
"lastNotNull"
|
|
187
|
-
],
|
|
187
|
+
"calcs": ["lastNotNull"],
|
|
188
188
|
"fields": "",
|
|
189
189
|
"values": false
|
|
190
190
|
},
|
|
191
|
-
"
|
|
191
|
+
"showPercentChange": false,
|
|
192
|
+
"textMode": "auto",
|
|
193
|
+
"wideLayout": true
|
|
192
194
|
},
|
|
193
|
-
"pluginVersion": "
|
|
195
|
+
"pluginVersion": "12.1.1",
|
|
194
196
|
"targets": [
|
|
195
197
|
{
|
|
196
198
|
"datasource": "SQLite",
|
|
@@ -198,19 +200,18 @@
|
|
|
198
200
|
"queryType": "table",
|
|
199
201
|
"rawQueryText": "SELECT SUM(t.value_usd) AS total_revenue FROM general_ledger t JOIN txgroup_hierarchy gh USING (txgroup_id) WHERE gh.top_category = 'Expenses' AND t.timestamp >= $__from/1000 AND t.timestamp <= $__to/1000",
|
|
200
202
|
"refId": "A",
|
|
201
|
-
"timeColumns": [
|
|
202
|
-
"time",
|
|
203
|
-
"ts"
|
|
204
|
-
]
|
|
203
|
+
"timeColumns": ["time", "ts"]
|
|
205
204
|
}
|
|
206
205
|
],
|
|
207
206
|
"title": "Expenses",
|
|
208
|
-
"type": "stat"
|
|
207
|
+
"type": "stat",
|
|
208
|
+
"description": "Displays the total value of all transactions sorted as Expenses for the selected period."
|
|
209
209
|
},
|
|
210
210
|
{
|
|
211
211
|
"datasource": "SQLite",
|
|
212
|
-
"description": "",
|
|
212
|
+
"description": "Shows the net operating cashflow (Revenue minus Cost of Revenue and Expenses) for the selected period.",
|
|
213
213
|
"fieldConfig": {
|
|
214
|
+
"unit": "currencyUSD",
|
|
214
215
|
"defaults": {
|
|
215
216
|
"color": {
|
|
216
217
|
"mode": "thresholds"
|
|
@@ -221,7 +222,7 @@
|
|
|
221
222
|
"steps": [
|
|
222
223
|
{
|
|
223
224
|
"color": "green",
|
|
224
|
-
"value":
|
|
225
|
+
"value": 0
|
|
225
226
|
},
|
|
226
227
|
{
|
|
227
228
|
"color": "red",
|
|
@@ -244,16 +245,17 @@
|
|
|
244
245
|
"graphMode": "area",
|
|
245
246
|
"justifyMode": "auto",
|
|
246
247
|
"orientation": "auto",
|
|
248
|
+
"percentChangeColorMode": "standard",
|
|
247
249
|
"reduceOptions": {
|
|
248
|
-
"calcs": [
|
|
249
|
-
"lastNotNull"
|
|
250
|
-
],
|
|
250
|
+
"calcs": ["lastNotNull"],
|
|
251
251
|
"fields": "",
|
|
252
252
|
"values": false
|
|
253
253
|
},
|
|
254
|
-
"
|
|
254
|
+
"showPercentChange": false,
|
|
255
|
+
"textMode": "auto",
|
|
256
|
+
"wideLayout": true
|
|
255
257
|
},
|
|
256
|
-
"pluginVersion": "
|
|
258
|
+
"pluginVersion": "12.1.1",
|
|
257
259
|
"targets": [
|
|
258
260
|
{
|
|
259
261
|
"datasource": "SQLite",
|
|
@@ -261,10 +263,7 @@
|
|
|
261
263
|
"queryType": "table",
|
|
262
264
|
"rawQueryText": "SELECT (\n SUM(CASE WHEN gh.top_category = 'Revenue' THEN t.value_usd ELSE 0 END)\n - SUM(CASE WHEN gh.top_category = 'Cost of Revenue' THEN t.value_usd ELSE 0 END)\n - SUM(CASE WHEN gh.top_category = 'Expenses' THEN t.value_usd ELSE 0 END)\n) AS total_net\nFROM general_ledger t\nJOIN txgroup_hierarchy gh USING (txgroup_id)\nWHERE t.timestamp >= $__from/1000 AND t.timestamp <= $__to/1000",
|
|
263
265
|
"refId": "A",
|
|
264
|
-
"timeColumns": [
|
|
265
|
-
"time",
|
|
266
|
-
"ts"
|
|
267
|
-
]
|
|
266
|
+
"timeColumns": ["time", "ts"]
|
|
268
267
|
}
|
|
269
268
|
],
|
|
270
269
|
"title": "Operating Total",
|
|
@@ -272,8 +271,9 @@
|
|
|
272
271
|
},
|
|
273
272
|
{
|
|
274
273
|
"datasource": "SQLite",
|
|
275
|
-
"description": "",
|
|
274
|
+
"description": "Time series chart of all sorted operational cashflows, grouped by category, for the selected period. Shows Total Revenue, Total Expenses, and Net for each week, helping to analyze trends in the DAO's operational financial flows over time.",
|
|
276
275
|
"fieldConfig": {
|
|
276
|
+
"unit": "currencyUSD",
|
|
277
277
|
"defaults": {
|
|
278
278
|
"color": {
|
|
279
279
|
"mode": "palette-classic"
|
|
@@ -285,6 +285,7 @@
|
|
|
285
285
|
"axisLabel": "",
|
|
286
286
|
"axisPlacement": "auto",
|
|
287
287
|
"barAlignment": 0,
|
|
288
|
+
"barWidthFactor": 0.6,
|
|
288
289
|
"drawStyle": "bars",
|
|
289
290
|
"fillOpacity": 70,
|
|
290
291
|
"gradientMode": "none",
|
|
@@ -316,7 +317,7 @@
|
|
|
316
317
|
"steps": [
|
|
317
318
|
{
|
|
318
319
|
"color": "green",
|
|
319
|
-
"value":
|
|
320
|
+
"value": 0
|
|
320
321
|
},
|
|
321
322
|
{
|
|
322
323
|
"color": "red",
|
|
@@ -366,10 +367,12 @@
|
|
|
366
367
|
"showLegend": true
|
|
367
368
|
},
|
|
368
369
|
"tooltip": {
|
|
370
|
+
"hideZeros": false,
|
|
369
371
|
"mode": "single",
|
|
370
372
|
"sort": "none"
|
|
371
373
|
}
|
|
372
374
|
},
|
|
375
|
+
"pluginVersion": "12.1.1",
|
|
373
376
|
"targets": [
|
|
374
377
|
{
|
|
375
378
|
"datasource": "SQLite",
|
|
@@ -377,9 +380,7 @@
|
|
|
377
380
|
"queryType": "table",
|
|
378
381
|
"rawQueryText": "SELECT t.timestamp,\r\n SUM(CASE WHEN gh.top_category = 'Revenue' THEN t.value_usd ELSE 0 END) AS \"Total Revenue\",\r\n SUM(CASE WHEN gh.top_category in ('Cost of Revenue','Expenses') THEN t.value_usd ELSE 0 END) * -1 AS \"Total Expenses\",\r\n SUM(CASE WHEN gh.top_category = 'Revenue' THEN t.value_usd ELSE 0 END) - SUM(CASE WHEN gh.top_category in ('Cost of Revenue','Expenses') THEN t.value_usd ELSE 0 END) AS \"Net\"\r\nFROM general_ledger AS t\r\nJOIN txgroup_hierarchy gh ON t.txgroup_id = gh.txgroup_id\r\nWHERE t.timestamp >= $__from/1000 AND t.timestamp <= $__to/1000\r\nGROUP BY timestamp\r\nORDER BY timestamp;",
|
|
379
382
|
"refId": "A",
|
|
380
|
-
"timeColumns": [
|
|
381
|
-
"timestamp"
|
|
382
|
-
]
|
|
383
|
+
"timeColumns": ["timestamp"]
|
|
383
384
|
}
|
|
384
385
|
],
|
|
385
386
|
"title": "Weekly Cashflow",
|
|
@@ -411,39 +412,27 @@
|
|
|
411
412
|
"options": {
|
|
412
413
|
"fields": {
|
|
413
414
|
"Cost of Revenue": {
|
|
414
|
-
"aggregations": [
|
|
415
|
-
"sum"
|
|
416
|
-
],
|
|
415
|
+
"aggregations": ["sum"],
|
|
417
416
|
"operation": "aggregate"
|
|
418
417
|
},
|
|
419
418
|
"Expenses": {
|
|
420
|
-
"aggregations": [
|
|
421
|
-
"sum"
|
|
422
|
-
],
|
|
419
|
+
"aggregations": ["sum"],
|
|
423
420
|
"operation": "aggregate"
|
|
424
421
|
},
|
|
425
422
|
"Net": {
|
|
426
|
-
"aggregations": [
|
|
427
|
-
"sum"
|
|
428
|
-
],
|
|
423
|
+
"aggregations": ["sum"],
|
|
429
424
|
"operation": "aggregate"
|
|
430
425
|
},
|
|
431
426
|
"Other Expenses": {
|
|
432
|
-
"aggregations": [
|
|
433
|
-
"sum"
|
|
434
|
-
],
|
|
427
|
+
"aggregations": ["sum"],
|
|
435
428
|
"operation": "aggregate"
|
|
436
429
|
},
|
|
437
430
|
"Other Income": {
|
|
438
|
-
"aggregations": [
|
|
439
|
-
"sum"
|
|
440
|
-
],
|
|
431
|
+
"aggregations": ["sum"],
|
|
441
432
|
"operation": "aggregate"
|
|
442
433
|
},
|
|
443
434
|
"Revenue": {
|
|
444
|
-
"aggregations": [
|
|
445
|
-
"sum"
|
|
446
|
-
],
|
|
435
|
+
"aggregations": ["sum"],
|
|
447
436
|
"operation": "aggregate"
|
|
448
437
|
},
|
|
449
438
|
"Timestamp": {
|
|
@@ -451,15 +440,11 @@
|
|
|
451
440
|
"operation": "groupby"
|
|
452
441
|
},
|
|
453
442
|
"Total Expenses": {
|
|
454
|
-
"aggregations": [
|
|
455
|
-
"sum"
|
|
456
|
-
],
|
|
443
|
+
"aggregations": ["sum"],
|
|
457
444
|
"operation": "aggregate"
|
|
458
445
|
},
|
|
459
446
|
"Total Revenue": {
|
|
460
|
-
"aggregations": [
|
|
461
|
-
"sum"
|
|
462
|
-
],
|
|
447
|
+
"aggregations": ["sum"],
|
|
463
448
|
"operation": "aggregate"
|
|
464
449
|
},
|
|
465
450
|
"timestamp": {
|
|
@@ -473,9 +458,10 @@
|
|
|
473
458
|
"type": "timeseries"
|
|
474
459
|
}
|
|
475
460
|
],
|
|
461
|
+
"preload": false,
|
|
476
462
|
"refresh": "",
|
|
477
|
-
"schemaVersion":
|
|
478
|
-
"tags": [],
|
|
463
|
+
"schemaVersion": 41,
|
|
464
|
+
"tags": ["cashflow", "operating"],
|
|
479
465
|
"templating": {
|
|
480
466
|
"list": []
|
|
481
467
|
},
|
|
@@ -486,7 +472,7 @@
|
|
|
486
472
|
"timepicker": {},
|
|
487
473
|
"timezone": "",
|
|
488
474
|
"title": "Operating Cashflow Summary",
|
|
475
|
+
"description": "Provides a focused view of core operational cashflows, including only sorted transactions in Revenue, Cost of Revenue, and Expenses categories. Excludes unsorted transactions and non-operational activity, helping monitor specifically the DAO's operational financial flows.",
|
|
489
476
|
"uid": "fdf9969c-357a-4203-ae7b-12816e87bc7e",
|
|
490
|
-
"version":
|
|
491
|
-
"weekStart": ""
|
|
477
|
+
"version": 7
|
|
492
478
|
}
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
"""Environment variable configuration for DAO Treasury.
|
|
2
|
+
|
|
3
|
+
Defines and loads environment variables (with types and defaults) used for
|
|
4
|
+
system configuration, such as SQL debugging. Uses :mod:`typed_envs` for convenience and safety.
|
|
5
|
+
|
|
6
|
+
Key Responsibilities:
|
|
7
|
+
- Define and load environment variables for the system.
|
|
8
|
+
- Provide type-safe access to configuration options.
|
|
9
|
+
|
|
10
|
+
This is the single source of truth for environment-based settings.
|
|
11
|
+
"""
|
|
12
|
+
|
|
1
13
|
from typing import Final
|
|
2
14
|
|
|
3
15
|
from typed_envs import EnvVarFactory
|
dao_treasury/__init__.py
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
"""DAO Treasury package initializer.
|
|
2
|
+
|
|
3
|
+
Exposes the main public API for the library, including the Treasury class,
|
|
4
|
+
wallet management, sorting rules, and database models. Sets up address
|
|
5
|
+
nicknames and enables SQL debugging if configured.
|
|
6
|
+
|
|
7
|
+
Key Responsibilities:
|
|
8
|
+
- Import and expose core classes and functions.
|
|
9
|
+
- Initialize address nicknames in the database.
|
|
10
|
+
- Configure SQL debugging for development.
|
|
11
|
+
|
|
12
|
+
This is the main import point for users and integrations.
|
|
13
|
+
"""
|
|
14
|
+
|
|
1
15
|
from dao_treasury import ENVIRONMENT_VARIABLES as ENVS
|
|
2
16
|
from dao_treasury._nicknames import setup_address_nicknames_in_db
|
|
3
17
|
from dao_treasury._wallet import TreasuryWallet
|
|
Binary file
|
dao_treasury/_docker.py
CHANGED
|
@@ -1,17 +1,30 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""Docker orchestration utilities for DAO Treasury.
|
|
2
|
+
|
|
3
|
+
Provides functions to build, start, and stop Docker Compose services
|
|
4
|
+
required for analytics dashboards (Grafana, renderer). Integrates with
|
|
5
|
+
eth-portfolio's Docker setup and ensures all containers are managed
|
|
6
|
+
consistently for local analytics.
|
|
7
|
+
|
|
8
|
+
Key Responsibilities:
|
|
9
|
+
- Build and manage Grafana and renderer containers.
|
|
10
|
+
- Integrate with eth-portfolio Docker services.
|
|
11
|
+
- Provide decorators/utilities for container lifecycle management.
|
|
12
|
+
|
|
13
|
+
This is the main entry for all Docker-based orchestration.
|
|
14
|
+
"""
|
|
2
15
|
|
|
3
16
|
import logging
|
|
4
|
-
from importlib import resources
|
|
5
|
-
import subprocess
|
|
6
17
|
from functools import wraps
|
|
7
|
-
from
|
|
18
|
+
from importlib import resources
|
|
19
|
+
from typing import Any, Callable, Coroutine, Final, Literal, Tuple, TypeVar, List
|
|
8
20
|
|
|
9
21
|
import eth_portfolio_scripts.docker
|
|
22
|
+
from eth_portfolio_scripts.docker import docker_compose
|
|
10
23
|
from typing_extensions import ParamSpec
|
|
11
24
|
|
|
12
25
|
logger: Final = logging.getLogger(__name__)
|
|
13
26
|
|
|
14
|
-
|
|
27
|
+
COMPOSE_FILE: Final = str(
|
|
15
28
|
resources.files("dao_treasury").joinpath("docker-compose.yaml")
|
|
16
29
|
)
|
|
17
30
|
"""The path of dao-treasury's docker-compose.yaml file on your machine"""
|
|
@@ -42,7 +55,7 @@ def up(*services: str) -> None:
|
|
|
42
55
|
# eth-portfolio containers must be started first so dao-treasury can attach to the eth-portfolio docker network
|
|
43
56
|
eth_portfolio_scripts.docker.up("victoria-metrics")
|
|
44
57
|
build(*services)
|
|
45
|
-
|
|
58
|
+
_print_notice("starting", services)
|
|
46
59
|
_exec_command(["up", "-d", *services])
|
|
47
60
|
|
|
48
61
|
|
|
@@ -59,6 +72,7 @@ def down() -> None:
|
|
|
59
72
|
See Also:
|
|
60
73
|
:func:`up`
|
|
61
74
|
"""
|
|
75
|
+
print("stopping all dao-treasury containers")
|
|
62
76
|
_exec_command(["down"])
|
|
63
77
|
|
|
64
78
|
|
|
@@ -77,10 +91,24 @@ def build(*services: str) -> None:
|
|
|
77
91
|
:func:`up`
|
|
78
92
|
:func:`_exec_command`
|
|
79
93
|
"""
|
|
80
|
-
|
|
94
|
+
_print_notice("building", services)
|
|
81
95
|
_exec_command(["build", *services])
|
|
82
96
|
|
|
83
97
|
|
|
98
|
+
def _print_notice(
|
|
99
|
+
doing: Literal["building", "starting"], services: Tuple[str, ...]
|
|
100
|
+
) -> None:
|
|
101
|
+
if len(services) == 1:
|
|
102
|
+
container = services[0]
|
|
103
|
+
print(f"{doing} the {container} container")
|
|
104
|
+
elif len(services) == 2:
|
|
105
|
+
first, second = services
|
|
106
|
+
print(f"{doing} the {first} and {second} containers")
|
|
107
|
+
else:
|
|
108
|
+
*all_but_last, last = services
|
|
109
|
+
print(f"{doing} the {', '.join(all_but_last)}, and {last} containers")
|
|
110
|
+
|
|
111
|
+
|
|
84
112
|
_P = ParamSpec("_P")
|
|
85
113
|
_T = TypeVar("_T")
|
|
86
114
|
|
|
@@ -161,17 +189,6 @@ def _exec_command(command: List[str], *, compose_options: Tuple[str, ...] = ())
|
|
|
161
189
|
See Also:
|
|
162
190
|
:func:`check_system`
|
|
163
191
|
"""
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
["docker", "compose", *compose_options, "-f", compose_file, *command]
|
|
168
|
-
)
|
|
169
|
-
except (subprocess.CalledProcessError, FileNotFoundError) as e:
|
|
170
|
-
try:
|
|
171
|
-
subprocess.check_output(
|
|
172
|
-
["docker-compose", *compose_options, "-f", compose_file, *command]
|
|
173
|
-
)
|
|
174
|
-
except (subprocess.CalledProcessError, FileNotFoundError) as _e:
|
|
175
|
-
raise RuntimeError(
|
|
176
|
-
f"Error occurred while running {' '.join(command)}: {_e}"
|
|
177
|
-
) from _e
|
|
192
|
+
docker_compose._exec_command(
|
|
193
|
+
command, compose_file=COMPOSE_FILE, compose_options=compose_options
|
|
194
|
+
)
|
|
Binary file
|
dao_treasury/_nicknames.py
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
"""Address nickname setup utilities.
|
|
2
|
+
|
|
3
|
+
This module provides functions to assign human-readable nicknames to
|
|
4
|
+
important on-chain addresses (e.g., Zero Address, Disperse.app, tokens).
|
|
5
|
+
It is used at package initialization to ensure all analytics and dashboards
|
|
6
|
+
display professional, consistent labels.
|
|
7
|
+
|
|
8
|
+
Key Responsibilities:
|
|
9
|
+
- Set nicknames for core addresses in the database.
|
|
10
|
+
- Integrate with constants and token metadata.
|
|
11
|
+
- Support professional, readable analytics outputs.
|
|
12
|
+
|
|
13
|
+
This is called automatically on package import.
|
|
14
|
+
"""
|
|
15
|
+
|
|
1
16
|
from typing import Final
|
|
2
17
|
|
|
3
18
|
from pony.orm import db_session
|
|
Binary file
|
|
Binary file
|
dao_treasury/constants.py
CHANGED
|
@@ -1,11 +1,30 @@
|
|
|
1
|
+
"""Core constants for DAO Treasury.
|
|
2
|
+
|
|
3
|
+
All constants are marked with `Final`, ensuring immutability and allowing
|
|
4
|
+
mypyc to compile them as extremely fast C-level constants for maximum
|
|
5
|
+
performance. Defines chain IDs, zero address, and key contract addresses
|
|
6
|
+
(e.g., Disperse.app) used throughout the system for transaction processing,
|
|
7
|
+
nickname assignment, and analytics.
|
|
8
|
+
|
|
9
|
+
Key Responsibilities:
|
|
10
|
+
- Provide canonical addresses and chain IDs.
|
|
11
|
+
- Support nickname setup and transaction categorization.
|
|
12
|
+
- Guarantee fast, immutable constants at runtime.
|
|
13
|
+
|
|
14
|
+
This is the single source of truth for system-wide constants.
|
|
15
|
+
"""
|
|
16
|
+
|
|
1
17
|
from typing import Final
|
|
2
18
|
|
|
19
|
+
import eth_portfolio._utils
|
|
3
20
|
import y.constants
|
|
4
21
|
|
|
5
22
|
|
|
6
23
|
CHAINID: Final = y.constants.CHAINID
|
|
24
|
+
# TODO: add docstring
|
|
7
25
|
|
|
8
26
|
ZERO_ADDRESS: Final = "0x0000000000000000000000000000000000000000"
|
|
27
|
+
# TODO: add docstring
|
|
9
28
|
|
|
10
29
|
# TODO: move disperse.app stuff from yearn-treasury to dao-treasury and then write a docs file
|
|
11
30
|
DISPERSE_APP: Final = (
|
|
@@ -13,3 +32,8 @@ DISPERSE_APP: Final = (
|
|
|
13
32
|
"0xd15fE25eD0Dba12fE05e7029C88b10C25e8880E3",
|
|
14
33
|
)
|
|
15
34
|
"""If your treasury sends funds to disperse.app, we create additional txs in the db so each individual send can be accounted for."""
|
|
35
|
+
# TODO: all crosslink to disperse.py once ready
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
SUPPRESS_ERROR_LOGS: Final = eth_portfolio._utils.SUPPRESS_ERROR_LOGS
|
|
39
|
+
"""Append tokens here when you don't expect them to price successfully and do not want to see the associated error logs."""
|