dao-treasury 0.0.60__cp312-cp312-win32.whl → 0.1.6__cp312-cp312-win32.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.
Potentially problematic release.
This version of dao-treasury might be problematic. Click here for more details.
- dao_treasury/.grafana/provisioning/dashboards/breakdowns/Expenses.json +195 -154
- dao_treasury/.grafana/provisioning/dashboards/breakdowns/Revenue.json +192 -149
- dao_treasury/.grafana/provisioning/dashboards/dashboards.yaml +7 -81
- dao_treasury/.grafana/provisioning/dashboards/streams/LlamaPay.json +10 -22
- dao_treasury/.grafana/provisioning/dashboards/summary/Monthly.json +283 -23
- dao_treasury/.grafana/provisioning/dashboards/transactions/Treasury Transactions.json +49 -39
- dao_treasury/.grafana/provisioning/dashboards/transactions/Unsorted Transactions.json +367 -0
- dao_treasury/.grafana/provisioning/dashboards/treasury/Cashflow (Including Unsorted).json +109 -187
- dao_treasury/.grafana/provisioning/dashboards/treasury/Cashflow.json +77 -127
- dao_treasury/.grafana/provisioning/dashboards/treasury/Current Treasury Assets.json +509 -105
- dao_treasury/.grafana/provisioning/dashboards/treasury/Historical Treasury Balances.json +3856 -2924
- dao_treasury/.grafana/provisioning/dashboards/treasury/Operating Cashflow.json +57 -97
- dao_treasury/.grafana/provisioning/datasources/datasources.yaml +9 -4
- dao_treasury/__init__.py +0 -4
- dao_treasury/_docker.cp312-win32.pyd +0 -0
- dao_treasury/_docker.py +30 -22
- dao_treasury/_nicknames.cp312-win32.pyd +0 -0
- dao_treasury/_nicknames.py +3 -2
- dao_treasury/_wallet.cp312-win32.pyd +0 -0
- dao_treasury/constants.cp312-win32.pyd +0 -0
- dao_treasury/db.py +383 -131
- dao_treasury/docker-compose.yaml +19 -3
- dao_treasury/main.py +42 -4
- dao_treasury/sorting/__init__.cp312-win32.pyd +0 -0
- dao_treasury/sorting/__init__.py +38 -21
- dao_treasury/sorting/_matchers.cp312-win32.pyd +0 -0
- dao_treasury/sorting/_rules.cp312-win32.pyd +0 -0
- dao_treasury/sorting/factory.cp312-win32.pyd +0 -0
- dao_treasury/sorting/rule.cp312-win32.pyd +0 -0
- dao_treasury/sorting/rules/__init__.cp312-win32.pyd +0 -0
- dao_treasury/sorting/rules/ignore/__init__.cp312-win32.pyd +0 -0
- dao_treasury/sorting/rules/ignore/llamapay.cp312-win32.pyd +0 -0
- dao_treasury/treasury.py +4 -2
- dao_treasury/types.cp312-win32.pyd +0 -0
- {dao_treasury-0.0.60.dist-info → dao_treasury-0.1.6.dist-info}/METADATA +18 -4
- dao_treasury-0.1.6.dist-info/RECORD +53 -0
- dao_treasury__mypyc.cp312-win32.pyd +0 -0
- dao_treasury/streams/__init__.cp312-win32.pyd +0 -0
- dao_treasury/streams/llamapay.cp312-win32.pyd +0 -0
- dao_treasury-0.0.60.dist-info/RECORD +0 -54
- {dao_treasury-0.0.60.dist-info → dao_treasury-0.1.6.dist-info}/WHEEL +0 -0
- {dao_treasury-0.0.60.dist-info → dao_treasury-0.1.6.dist-info}/top_level.txt +0 -0
|
@@ -22,9 +22,8 @@
|
|
|
22
22
|
"links": [],
|
|
23
23
|
"panels": [
|
|
24
24
|
{
|
|
25
|
-
"datasource": "
|
|
25
|
+
"datasource": "PostgreSQL",
|
|
26
26
|
"fieldConfig": {
|
|
27
|
-
"unit": "currencyUSD",
|
|
28
27
|
"defaults": {
|
|
29
28
|
"color": {
|
|
30
29
|
"mode": "thresholds"
|
|
@@ -42,7 +41,8 @@
|
|
|
42
41
|
"value": 80
|
|
43
42
|
}
|
|
44
43
|
]
|
|
45
|
-
}
|
|
44
|
+
},
|
|
45
|
+
"unit": "currencyUSD"
|
|
46
46
|
},
|
|
47
47
|
"overrides": []
|
|
48
48
|
},
|
|
@@ -60,9 +60,7 @@
|
|
|
60
60
|
"orientation": "auto",
|
|
61
61
|
"percentChangeColorMode": "standard",
|
|
62
62
|
"reduceOptions": {
|
|
63
|
-
"calcs": [
|
|
64
|
-
"lastNotNull"
|
|
65
|
-
],
|
|
63
|
+
"calcs": ["lastNotNull"],
|
|
66
64
|
"fields": "",
|
|
67
65
|
"values": false
|
|
68
66
|
},
|
|
@@ -73,24 +71,20 @@
|
|
|
73
71
|
"pluginVersion": "12.1.1",
|
|
74
72
|
"targets": [
|
|
75
73
|
{
|
|
76
|
-
"datasource": "
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"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",
|
|
74
|
+
"datasource": "PostgreSQL",
|
|
75
|
+
"format": "table",
|
|
76
|
+
"rawSql": "SELECT SUM(value_usd) AS total_revenue FROM usdvalue_presum WHERE top_category = 'Revenue' AND timestamp >= $__from/1000 AND timestamp <= $__to/1000",
|
|
80
77
|
"refId": "A",
|
|
81
|
-
"timeColumns": [
|
|
82
|
-
"time",
|
|
83
|
-
"ts"
|
|
84
|
-
]
|
|
78
|
+
"timeColumns": ["time", "ts"]
|
|
85
79
|
}
|
|
86
80
|
],
|
|
87
81
|
"title": "Revenue",
|
|
88
|
-
"type": "stat"
|
|
82
|
+
"type": "stat",
|
|
83
|
+
"description": "Displays the total value of all transactions sorted as Revenue for the selected period."
|
|
89
84
|
},
|
|
90
85
|
{
|
|
91
|
-
"datasource": "
|
|
86
|
+
"datasource": "PostgreSQL",
|
|
92
87
|
"fieldConfig": {
|
|
93
|
-
"unit": "currencyUSD",
|
|
94
88
|
"defaults": {
|
|
95
89
|
"color": {
|
|
96
90
|
"mode": "thresholds"
|
|
@@ -108,7 +102,8 @@
|
|
|
108
102
|
"value": 80
|
|
109
103
|
}
|
|
110
104
|
]
|
|
111
|
-
}
|
|
105
|
+
},
|
|
106
|
+
"unit": "currencyUSD"
|
|
112
107
|
},
|
|
113
108
|
"overrides": []
|
|
114
109
|
},
|
|
@@ -126,9 +121,7 @@
|
|
|
126
121
|
"orientation": "auto",
|
|
127
122
|
"percentChangeColorMode": "standard",
|
|
128
123
|
"reduceOptions": {
|
|
129
|
-
"calcs": [
|
|
130
|
-
"lastNotNull"
|
|
131
|
-
],
|
|
124
|
+
"calcs": ["lastNotNull"],
|
|
132
125
|
"fields": "",
|
|
133
126
|
"values": false
|
|
134
127
|
},
|
|
@@ -139,24 +132,20 @@
|
|
|
139
132
|
"pluginVersion": "12.1.1",
|
|
140
133
|
"targets": [
|
|
141
134
|
{
|
|
142
|
-
"datasource": "
|
|
143
|
-
"
|
|
144
|
-
"
|
|
145
|
-
"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",
|
|
135
|
+
"datasource": "PostgreSQL",
|
|
136
|
+
"format": "table",
|
|
137
|
+
"rawSql": "SELECT SUM(value_usd) AS total_revenue FROM usdvalue_presum WHERE top_category = 'Cost of Revenue' AND timestamp >= $__from/1000 AND timestamp <= $__to/1000",
|
|
146
138
|
"refId": "A",
|
|
147
|
-
"timeColumns": [
|
|
148
|
-
"time",
|
|
149
|
-
"ts"
|
|
150
|
-
]
|
|
139
|
+
"timeColumns": ["time", "ts"]
|
|
151
140
|
}
|
|
152
141
|
],
|
|
153
142
|
"title": "Cost of Revenue",
|
|
154
|
-
"type": "stat"
|
|
143
|
+
"type": "stat",
|
|
144
|
+
"description": "Displays the total value of all transactions sorted as Cost of Revenue for the selected period."
|
|
155
145
|
},
|
|
156
146
|
{
|
|
157
|
-
"datasource": "
|
|
147
|
+
"datasource": "PostgreSQL",
|
|
158
148
|
"fieldConfig": {
|
|
159
|
-
"unit": "currencyUSD",
|
|
160
149
|
"defaults": {
|
|
161
150
|
"color": {
|
|
162
151
|
"mode": "thresholds"
|
|
@@ -174,7 +163,8 @@
|
|
|
174
163
|
"value": 80
|
|
175
164
|
}
|
|
176
165
|
]
|
|
177
|
-
}
|
|
166
|
+
},
|
|
167
|
+
"unit": "currencyUSD"
|
|
178
168
|
},
|
|
179
169
|
"overrides": []
|
|
180
170
|
},
|
|
@@ -192,9 +182,7 @@
|
|
|
192
182
|
"orientation": "auto",
|
|
193
183
|
"percentChangeColorMode": "standard",
|
|
194
184
|
"reduceOptions": {
|
|
195
|
-
"calcs": [
|
|
196
|
-
"lastNotNull"
|
|
197
|
-
],
|
|
185
|
+
"calcs": ["lastNotNull"],
|
|
198
186
|
"fields": "",
|
|
199
187
|
"values": false
|
|
200
188
|
},
|
|
@@ -205,25 +193,21 @@
|
|
|
205
193
|
"pluginVersion": "12.1.1",
|
|
206
194
|
"targets": [
|
|
207
195
|
{
|
|
208
|
-
"datasource": "
|
|
209
|
-
"
|
|
210
|
-
"
|
|
211
|
-
"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",
|
|
196
|
+
"datasource": "PostgreSQL",
|
|
197
|
+
"format": "table",
|
|
198
|
+
"rawSql": "SELECT SUM(value_usd) AS total_revenue FROM usdvalue_presum WHERE top_category = 'Expenses' AND timestamp >= $__from/1000 AND timestamp <= $__to/1000",
|
|
212
199
|
"refId": "A",
|
|
213
|
-
"timeColumns": [
|
|
214
|
-
"time",
|
|
215
|
-
"ts"
|
|
216
|
-
]
|
|
200
|
+
"timeColumns": ["time", "ts"]
|
|
217
201
|
}
|
|
218
202
|
],
|
|
219
203
|
"title": "Expenses",
|
|
220
|
-
"type": "stat"
|
|
204
|
+
"type": "stat",
|
|
205
|
+
"description": "Displays the total value of all transactions sorted as Expenses for the selected period."
|
|
221
206
|
},
|
|
222
207
|
{
|
|
223
|
-
"datasource": "
|
|
224
|
-
"description": "",
|
|
208
|
+
"datasource": "PostgreSQL",
|
|
209
|
+
"description": "Shows the net operating cashflow (Revenue minus Cost of Revenue and Expenses) for the selected period.",
|
|
225
210
|
"fieldConfig": {
|
|
226
|
-
"unit": "currencyUSD",
|
|
227
211
|
"defaults": {
|
|
228
212
|
"color": {
|
|
229
213
|
"mode": "thresholds"
|
|
@@ -241,7 +225,8 @@
|
|
|
241
225
|
"value": 80
|
|
242
226
|
}
|
|
243
227
|
]
|
|
244
|
-
}
|
|
228
|
+
},
|
|
229
|
+
"unit": "currencyUSD"
|
|
245
230
|
},
|
|
246
231
|
"overrides": []
|
|
247
232
|
},
|
|
@@ -259,9 +244,7 @@
|
|
|
259
244
|
"orientation": "auto",
|
|
260
245
|
"percentChangeColorMode": "standard",
|
|
261
246
|
"reduceOptions": {
|
|
262
|
-
"calcs": [
|
|
263
|
-
"lastNotNull"
|
|
264
|
-
],
|
|
247
|
+
"calcs": ["lastNotNull"],
|
|
265
248
|
"fields": "",
|
|
266
249
|
"values": false
|
|
267
250
|
},
|
|
@@ -272,25 +255,20 @@
|
|
|
272
255
|
"pluginVersion": "12.1.1",
|
|
273
256
|
"targets": [
|
|
274
257
|
{
|
|
275
|
-
"datasource": "
|
|
276
|
-
"
|
|
277
|
-
"
|
|
278
|
-
"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",
|
|
258
|
+
"datasource": "PostgreSQL",
|
|
259
|
+
"format": "table",
|
|
260
|
+
"rawSql": "SELECT (\n SUM(CASE WHEN top_category = 'Revenue' THEN value_usd ELSE 0 END)\n - SUM(CASE WHEN top_category = 'Cost of Revenue' THEN value_usd ELSE 0 END)\n - SUM(CASE WHEN top_category = 'Expenses' THEN value_usd ELSE 0 END)\n) AS total_net\nFROM usdvalue_presum\nWHERE timestamp >= $__from/1000 AND timestamp <= $__to/1000",
|
|
279
261
|
"refId": "A",
|
|
280
|
-
"timeColumns": [
|
|
281
|
-
"time",
|
|
282
|
-
"ts"
|
|
283
|
-
]
|
|
262
|
+
"timeColumns": ["time", "ts"]
|
|
284
263
|
}
|
|
285
264
|
],
|
|
286
265
|
"title": "Operating Total",
|
|
287
266
|
"type": "stat"
|
|
288
267
|
},
|
|
289
268
|
{
|
|
290
|
-
"datasource": "
|
|
291
|
-
"description": "",
|
|
269
|
+
"datasource": "PostgreSQL",
|
|
270
|
+
"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.",
|
|
292
271
|
"fieldConfig": {
|
|
293
|
-
"unit": "currencyUSD",
|
|
294
272
|
"defaults": {
|
|
295
273
|
"color": {
|
|
296
274
|
"mode": "palette-classic"
|
|
@@ -341,7 +319,8 @@
|
|
|
341
319
|
"value": 80
|
|
342
320
|
}
|
|
343
321
|
]
|
|
344
|
-
}
|
|
322
|
+
},
|
|
323
|
+
"unit": "currencyUSD"
|
|
345
324
|
},
|
|
346
325
|
"overrides": [
|
|
347
326
|
{
|
|
@@ -392,14 +371,11 @@
|
|
|
392
371
|
"pluginVersion": "12.1.1",
|
|
393
372
|
"targets": [
|
|
394
373
|
{
|
|
395
|
-
"datasource": "
|
|
396
|
-
"
|
|
397
|
-
"
|
|
398
|
-
"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;",
|
|
374
|
+
"datasource": "PostgreSQL",
|
|
375
|
+
"format": "table",
|
|
376
|
+
"rawSql": "SELECT to_timestamp(timestamp) AS \"timestamp\", SUM(CASE WHEN top_category = 'Revenue' THEN value_usd ELSE 0 END) AS \"Total Revenue\", SUM(CASE WHEN top_category in ('Cost of Revenue','Expenses') THEN value_usd ELSE 0 END) * -1 AS \"Total Expenses\", SUM(CASE WHEN top_category = 'Revenue' THEN value_usd ELSE 0 END) - SUM(CASE WHEN top_category in ('Cost of Revenue','Expenses') THEN value_usd ELSE 0 END) AS \"Net\" FROM usdvalue_presum WHERE timestamp >= $__from/1000 AND timestamp <= $__to/1000 GROUP BY timestamp ORDER BY timestamp;",
|
|
399
377
|
"refId": "A",
|
|
400
|
-
"timeColumns": [
|
|
401
|
-
"timestamp"
|
|
402
|
-
]
|
|
378
|
+
"timeColumns": ["timestamp"]
|
|
403
379
|
}
|
|
404
380
|
],
|
|
405
381
|
"title": "Weekly Cashflow",
|
|
@@ -431,39 +407,27 @@
|
|
|
431
407
|
"options": {
|
|
432
408
|
"fields": {
|
|
433
409
|
"Cost of Revenue": {
|
|
434
|
-
"aggregations": [
|
|
435
|
-
"sum"
|
|
436
|
-
],
|
|
410
|
+
"aggregations": ["sum"],
|
|
437
411
|
"operation": "aggregate"
|
|
438
412
|
},
|
|
439
413
|
"Expenses": {
|
|
440
|
-
"aggregations": [
|
|
441
|
-
"sum"
|
|
442
|
-
],
|
|
414
|
+
"aggregations": ["sum"],
|
|
443
415
|
"operation": "aggregate"
|
|
444
416
|
},
|
|
445
417
|
"Net": {
|
|
446
|
-
"aggregations": [
|
|
447
|
-
"sum"
|
|
448
|
-
],
|
|
418
|
+
"aggregations": ["sum"],
|
|
449
419
|
"operation": "aggregate"
|
|
450
420
|
},
|
|
451
421
|
"Other Expenses": {
|
|
452
|
-
"aggregations": [
|
|
453
|
-
"sum"
|
|
454
|
-
],
|
|
422
|
+
"aggregations": ["sum"],
|
|
455
423
|
"operation": "aggregate"
|
|
456
424
|
},
|
|
457
425
|
"Other Income": {
|
|
458
|
-
"aggregations": [
|
|
459
|
-
"sum"
|
|
460
|
-
],
|
|
426
|
+
"aggregations": ["sum"],
|
|
461
427
|
"operation": "aggregate"
|
|
462
428
|
},
|
|
463
429
|
"Revenue": {
|
|
464
|
-
"aggregations": [
|
|
465
|
-
"sum"
|
|
466
|
-
],
|
|
430
|
+
"aggregations": ["sum"],
|
|
467
431
|
"operation": "aggregate"
|
|
468
432
|
},
|
|
469
433
|
"Timestamp": {
|
|
@@ -471,15 +435,11 @@
|
|
|
471
435
|
"operation": "groupby"
|
|
472
436
|
},
|
|
473
437
|
"Total Expenses": {
|
|
474
|
-
"aggregations": [
|
|
475
|
-
"sum"
|
|
476
|
-
],
|
|
438
|
+
"aggregations": ["sum"],
|
|
477
439
|
"operation": "aggregate"
|
|
478
440
|
},
|
|
479
441
|
"Total Revenue": {
|
|
480
|
-
"aggregations": [
|
|
481
|
-
"sum"
|
|
482
|
-
],
|
|
442
|
+
"aggregations": ["sum"],
|
|
483
443
|
"operation": "aggregate"
|
|
484
444
|
},
|
|
485
445
|
"timestamp": {
|
|
@@ -496,7 +456,7 @@
|
|
|
496
456
|
"preload": false,
|
|
497
457
|
"refresh": "",
|
|
498
458
|
"schemaVersion": 41,
|
|
499
|
-
"tags": [],
|
|
459
|
+
"tags": ["cashflow", "operating"],
|
|
500
460
|
"templating": {
|
|
501
461
|
"list": []
|
|
502
462
|
},
|
|
@@ -509,5 +469,5 @@
|
|
|
509
469
|
"title": "Operating Cashflow Summary",
|
|
510
470
|
"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.",
|
|
511
471
|
"uid": "fdf9969c-357a-4203-ae7b-12816e87bc7e",
|
|
512
|
-
"version":
|
|
472
|
+
"version": 106
|
|
513
473
|
}
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
apiVersion: 1
|
|
2
2
|
|
|
3
3
|
datasources:
|
|
4
|
-
- name:
|
|
5
|
-
type:
|
|
4
|
+
- name: PostgreSQL
|
|
5
|
+
type: postgres
|
|
6
6
|
isDefault: true
|
|
7
7
|
editable: false
|
|
8
|
+
url: postgres:5432
|
|
9
|
+
user: dao_treasury
|
|
8
10
|
jsonData:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
database: dao_treasury
|
|
12
|
+
sslmode: "disable"
|
|
13
|
+
postgresVersion: 1801
|
|
14
|
+
secureJsonData:
|
|
15
|
+
password: dao_treasury
|
|
11
16
|
|
|
12
17
|
- name: 'PROMETHEUS'
|
|
13
18
|
type: 'prometheus'
|
dao_treasury/__init__.py
CHANGED
|
@@ -13,7 +13,6 @@ This is the main import point for users and integrations.
|
|
|
13
13
|
"""
|
|
14
14
|
|
|
15
15
|
from dao_treasury import ENVIRONMENT_VARIABLES as ENVS
|
|
16
|
-
from dao_treasury._nicknames import setup_address_nicknames_in_db
|
|
17
16
|
from dao_treasury._wallet import TreasuryWallet
|
|
18
17
|
from dao_treasury.db import TreasuryTx
|
|
19
18
|
from dao_treasury.sorting import (
|
|
@@ -34,9 +33,6 @@ from dao_treasury.sorting import (
|
|
|
34
33
|
from dao_treasury.treasury import Treasury
|
|
35
34
|
|
|
36
35
|
|
|
37
|
-
setup_address_nicknames_in_db()
|
|
38
|
-
|
|
39
|
-
|
|
40
36
|
if ENVS.SQL_DEBUG:
|
|
41
37
|
import pony.orm
|
|
42
38
|
|
|
Binary file
|
dao_treasury/_docker.py
CHANGED
|
@@ -14,17 +14,17 @@ This is the main entry for all Docker-based orchestration.
|
|
|
14
14
|
"""
|
|
15
15
|
|
|
16
16
|
import logging
|
|
17
|
-
from importlib import resources
|
|
18
|
-
import subprocess
|
|
19
17
|
from functools import wraps
|
|
20
|
-
from
|
|
18
|
+
from importlib import resources
|
|
19
|
+
from typing import Any, Callable, Coroutine, Final, Literal, Tuple, TypeVar, List
|
|
21
20
|
|
|
22
21
|
import eth_portfolio_scripts.docker
|
|
22
|
+
from eth_portfolio_scripts.docker import docker_compose
|
|
23
23
|
from typing_extensions import ParamSpec
|
|
24
24
|
|
|
25
25
|
logger: Final = logging.getLogger(__name__)
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
COMPOSE_FILE: Final = str(
|
|
28
28
|
resources.files("dao_treasury").joinpath("docker-compose.yaml")
|
|
29
29
|
)
|
|
30
30
|
"""The path of dao-treasury's docker-compose.yaml file on your machine"""
|
|
@@ -52,10 +52,14 @@ def up(*services: str) -> None:
|
|
|
52
52
|
:func:`down`
|
|
53
53
|
:func:`_exec_command`
|
|
54
54
|
"""
|
|
55
|
-
#
|
|
56
|
-
|
|
55
|
+
# the proper envs for victoria-metrics arent set yet when we need to start up the postgres container,
|
|
56
|
+
# but they're ready by the time we start the other containers
|
|
57
|
+
if services != ("postgres",):
|
|
58
|
+
# eth-portfolio containers must be started first so dao-treasury can attach to the eth-portfolio docker network
|
|
59
|
+
eth_portfolio_scripts.docker.up("victoria-metrics")
|
|
60
|
+
|
|
57
61
|
build(*services)
|
|
58
|
-
|
|
62
|
+
_print_notice("starting", services)
|
|
59
63
|
_exec_command(["up", "-d", *services])
|
|
60
64
|
|
|
61
65
|
|
|
@@ -72,6 +76,7 @@ def down() -> None:
|
|
|
72
76
|
See Also:
|
|
73
77
|
:func:`up`
|
|
74
78
|
"""
|
|
79
|
+
print("stopping all dao-treasury containers")
|
|
75
80
|
_exec_command(["down"])
|
|
76
81
|
|
|
77
82
|
|
|
@@ -90,10 +95,24 @@ def build(*services: str) -> None:
|
|
|
90
95
|
:func:`up`
|
|
91
96
|
:func:`_exec_command`
|
|
92
97
|
"""
|
|
93
|
-
|
|
98
|
+
_print_notice("building", services)
|
|
94
99
|
_exec_command(["build", *services])
|
|
95
100
|
|
|
96
101
|
|
|
102
|
+
def _print_notice(
|
|
103
|
+
doing: Literal["building", "starting"], services: Tuple[str, ...]
|
|
104
|
+
) -> None:
|
|
105
|
+
if len(services) == 1:
|
|
106
|
+
container = services[0]
|
|
107
|
+
print(f"{doing} the {container} container")
|
|
108
|
+
elif len(services) == 2:
|
|
109
|
+
first, second = services
|
|
110
|
+
print(f"{doing} the {first} and {second} containers")
|
|
111
|
+
else:
|
|
112
|
+
*all_but_last, last = services
|
|
113
|
+
print(f"{doing} the {', '.join(all_but_last)}, and {last} containers")
|
|
114
|
+
|
|
115
|
+
|
|
97
116
|
_P = ParamSpec("_P")
|
|
98
117
|
_T = TypeVar("_T")
|
|
99
118
|
|
|
@@ -174,17 +193,6 @@ def _exec_command(command: List[str], *, compose_options: Tuple[str, ...] = ())
|
|
|
174
193
|
See Also:
|
|
175
194
|
:func:`check_system`
|
|
176
195
|
"""
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
["docker", "compose", *compose_options, "-f", compose_file, *command]
|
|
181
|
-
)
|
|
182
|
-
except (subprocess.CalledProcessError, FileNotFoundError) as e:
|
|
183
|
-
try:
|
|
184
|
-
subprocess.check_output(
|
|
185
|
-
["docker-compose", *compose_options, "-f", compose_file, *command]
|
|
186
|
-
)
|
|
187
|
-
except (subprocess.CalledProcessError, FileNotFoundError) as _e:
|
|
188
|
-
raise RuntimeError(
|
|
189
|
-
f"Error occurred while running {' '.join(command)}: {_e}"
|
|
190
|
-
) from _e
|
|
196
|
+
docker_compose._exec_command(
|
|
197
|
+
command, compose_file=COMPOSE_FILE, compose_options=compose_options
|
|
198
|
+
)
|
|
Binary file
|
dao_treasury/_nicknames.py
CHANGED
|
@@ -18,15 +18,16 @@ from typing import Final
|
|
|
18
18
|
from pony.orm import db_session
|
|
19
19
|
|
|
20
20
|
from dao_treasury import constants
|
|
21
|
-
from dao_treasury.db import Address,
|
|
21
|
+
from dao_treasury.db import Address, init_db, set_address_nicknames_for_tokens
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
set_nickname: Final = Address.set_nickname
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
def setup_address_nicknames_in_db() -> None:
|
|
28
|
+
init_db()
|
|
28
29
|
with db_session:
|
|
29
30
|
set_nickname(constants.ZERO_ADDRESS, "Zero Address")
|
|
30
31
|
for address in constants.DISPERSE_APP:
|
|
31
32
|
set_nickname(address, "Disperse.app")
|
|
32
|
-
|
|
33
|
+
set_address_nicknames_for_tokens()
|
|
Binary file
|
|
Binary file
|