dao-treasury 0.0.35__cp311-cp311-win_amd64.whl → 0.1.1__cp311-cp311-win_amd64.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 +567 -0
- dao_treasury/.grafana/provisioning/dashboards/breakdowns/Revenue.json +569 -0
- dao_treasury/.grafana/provisioning/dashboards/dashboards.yaml +7 -57
- dao_treasury/.grafana/provisioning/dashboards/streams/LlamaPay.json +15 -27
- dao_treasury/.grafana/provisioning/dashboards/summary/Monthly.json +286 -25
- dao_treasury/.grafana/provisioning/dashboards/transactions/Treasury Transactions.json +54 -71
- dao_treasury/.grafana/provisioning/dashboards/transactions/Unsorted Transactions.json +367 -0
- dao_treasury/.grafana/provisioning/dashboards/treasury/Cashflow (Including Unsorted).json +172 -209
- dao_treasury/.grafana/provisioning/dashboards/treasury/Cashflow.json +122 -142
- dao_treasury/.grafana/provisioning/dashboards/treasury/Current Treasury Assets.json +941 -0
- dao_treasury/.grafana/provisioning/dashboards/treasury/Historical Treasury Balances.json +3931 -0
- dao_treasury/.grafana/provisioning/dashboards/treasury/Operating Cashflow.json +89 -108
- dao_treasury/.grafana/provisioning/datasources/datasources.yaml +9 -4
- dao_treasury/ENVIRONMENT_VARIABLES.py +12 -0
- dao_treasury/__init__.py +14 -4
- dao_treasury/_docker.cp311-win_amd64.pyd +0 -0
- dao_treasury/_docker.py +44 -23
- dao_treasury/_nicknames.cp311-win_amd64.pyd +0 -0
- dao_treasury/_nicknames.py +18 -2
- dao_treasury/_wallet.cp311-win_amd64.pyd +0 -0
- dao_treasury/constants.cp311-win_amd64.pyd +0 -0
- dao_treasury/constants.py +24 -0
- dao_treasury/db.py +409 -119
- dao_treasury/docker-compose.yaml +19 -3
- dao_treasury/main.py +44 -3
- dao_treasury/sorting/__init__.cp311-win_amd64.pyd +0 -0
- dao_treasury/sorting/__init__.py +38 -21
- dao_treasury/sorting/_matchers.cp311-win_amd64.pyd +0 -0
- dao_treasury/sorting/_rules.cp311-win_amd64.pyd +0 -0
- dao_treasury/sorting/factory.cp311-win_amd64.pyd +0 -0
- dao_treasury/sorting/rule.cp311-win_amd64.pyd +0 -0
- dao_treasury/sorting/rule.py +8 -10
- dao_treasury/sorting/rules/__init__.cp311-win_amd64.pyd +0 -0
- dao_treasury/sorting/rules/ignore/__init__.cp311-win_amd64.pyd +0 -0
- dao_treasury/sorting/rules/ignore/llamapay.cp311-win_amd64.pyd +0 -0
- dao_treasury/streams/llamapay.py +14 -2
- dao_treasury/treasury.py +37 -16
- dao_treasury/types.cp311-win_amd64.pyd +0 -0
- {dao_treasury-0.0.35.dist-info → dao_treasury-0.1.1.dist-info}/METADATA +19 -3
- dao_treasury-0.1.1.dist-info/RECORD +53 -0
- dao_treasury-0.1.1.dist-info/top_level.txt +2 -0
- dao_treasury__mypyc.cp311-win_amd64.pyd +0 -0
- bf2b4fe1f86ad2ea158b__mypyc.cp311-win_amd64.pyd +0 -0
- dao_treasury/.grafana/provisioning/dashboards/treasury/Treasury.json +0 -2018
- dao_treasury/streams/__init__.cp311-win_amd64.pyd +0 -0
- dao_treasury/streams/llamapay.cp311-win_amd64.pyd +0 -0
- dao_treasury-0.0.35.dist-info/RECORD +0 -51
- dao_treasury-0.0.35.dist-info/top_level.txt +0 -2
- {dao_treasury-0.0.35.dist-info → dao_treasury-0.1.1.dist-info}/WHEEL +0 -0
|
@@ -18,11 +18,11 @@
|
|
|
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
|
-
"datasource": "
|
|
25
|
+
"datasource": "PostgreSQL",
|
|
26
26
|
"fieldConfig": {
|
|
27
27
|
"defaults": {
|
|
28
28
|
"color": {
|
|
@@ -34,14 +34,15 @@
|
|
|
34
34
|
"steps": [
|
|
35
35
|
{
|
|
36
36
|
"color": "green",
|
|
37
|
-
"value":
|
|
37
|
+
"value": 0
|
|
38
38
|
},
|
|
39
39
|
{
|
|
40
40
|
"color": "red",
|
|
41
41
|
"value": 80
|
|
42
42
|
}
|
|
43
43
|
]
|
|
44
|
-
}
|
|
44
|
+
},
|
|
45
|
+
"unit": "currencyUSD"
|
|
45
46
|
},
|
|
46
47
|
"overrides": []
|
|
47
48
|
},
|
|
@@ -57,34 +58,32 @@
|
|
|
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
|
-
"datasource": "
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"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(p.value_usd) AS total_revenue FROM usdvalue_presum p JOIN txgroup_hierarchy gh USING (txgroup_id) WHERE gh.top_category = 'Revenue' AND p.timestamp >= $__from/1000 AND p.timestamp <= $__to/1000",
|
|
76
77
|
"refId": "A",
|
|
77
|
-
"timeColumns": [
|
|
78
|
-
"time",
|
|
79
|
-
"ts"
|
|
80
|
-
]
|
|
78
|
+
"timeColumns": ["time", "ts"]
|
|
81
79
|
}
|
|
82
80
|
],
|
|
83
81
|
"title": "Revenue",
|
|
84
|
-
"type": "stat"
|
|
82
|
+
"type": "stat",
|
|
83
|
+
"description": "Displays the total value of all transactions sorted as Revenue for the selected period."
|
|
85
84
|
},
|
|
86
85
|
{
|
|
87
|
-
"datasource": "
|
|
86
|
+
"datasource": "PostgreSQL",
|
|
88
87
|
"fieldConfig": {
|
|
89
88
|
"defaults": {
|
|
90
89
|
"color": {
|
|
@@ -96,14 +95,15 @@
|
|
|
96
95
|
"steps": [
|
|
97
96
|
{
|
|
98
97
|
"color": "green",
|
|
99
|
-
"value":
|
|
98
|
+
"value": 0
|
|
100
99
|
},
|
|
101
100
|
{
|
|
102
101
|
"color": "red",
|
|
103
102
|
"value": 80
|
|
104
103
|
}
|
|
105
104
|
]
|
|
106
|
-
}
|
|
105
|
+
},
|
|
106
|
+
"unit": "currencyUSD"
|
|
107
107
|
},
|
|
108
108
|
"overrides": []
|
|
109
109
|
},
|
|
@@ -119,34 +119,32 @@
|
|
|
119
119
|
"graphMode": "area",
|
|
120
120
|
"justifyMode": "auto",
|
|
121
121
|
"orientation": "auto",
|
|
122
|
+
"percentChangeColorMode": "standard",
|
|
122
123
|
"reduceOptions": {
|
|
123
|
-
"calcs": [
|
|
124
|
-
"lastNotNull"
|
|
125
|
-
],
|
|
124
|
+
"calcs": ["lastNotNull"],
|
|
126
125
|
"fields": "",
|
|
127
126
|
"values": false
|
|
128
127
|
},
|
|
129
|
-
"
|
|
128
|
+
"showPercentChange": false,
|
|
129
|
+
"textMode": "auto",
|
|
130
|
+
"wideLayout": true
|
|
130
131
|
},
|
|
131
|
-
"pluginVersion": "
|
|
132
|
+
"pluginVersion": "12.1.1",
|
|
132
133
|
"targets": [
|
|
133
134
|
{
|
|
134
|
-
"datasource": "
|
|
135
|
-
"
|
|
136
|
-
"
|
|
137
|
-
"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(p.value_usd) AS total_revenue FROM usdvalue_presum p JOIN txgroup_hierarchy gh USING (txgroup_id) WHERE gh.top_category = 'Cost of Revenue' AND p.timestamp >= $__from/1000 AND p.timestamp <= $__to/1000",
|
|
138
138
|
"refId": "A",
|
|
139
|
-
"timeColumns": [
|
|
140
|
-
"time",
|
|
141
|
-
"ts"
|
|
142
|
-
]
|
|
139
|
+
"timeColumns": ["time", "ts"]
|
|
143
140
|
}
|
|
144
141
|
],
|
|
145
142
|
"title": "Cost of Revenue",
|
|
146
|
-
"type": "stat"
|
|
143
|
+
"type": "stat",
|
|
144
|
+
"description": "Displays the total value of all transactions sorted as Cost of Revenue for the selected period."
|
|
147
145
|
},
|
|
148
146
|
{
|
|
149
|
-
"datasource": "
|
|
147
|
+
"datasource": "PostgreSQL",
|
|
150
148
|
"fieldConfig": {
|
|
151
149
|
"defaults": {
|
|
152
150
|
"color": {
|
|
@@ -158,14 +156,15 @@
|
|
|
158
156
|
"steps": [
|
|
159
157
|
{
|
|
160
158
|
"color": "green",
|
|
161
|
-
"value":
|
|
159
|
+
"value": 0
|
|
162
160
|
},
|
|
163
161
|
{
|
|
164
162
|
"color": "red",
|
|
165
163
|
"value": 80
|
|
166
164
|
}
|
|
167
165
|
]
|
|
168
|
-
}
|
|
166
|
+
},
|
|
167
|
+
"unit": "currencyUSD"
|
|
169
168
|
},
|
|
170
169
|
"overrides": []
|
|
171
170
|
},
|
|
@@ -181,35 +180,33 @@
|
|
|
181
180
|
"graphMode": "area",
|
|
182
181
|
"justifyMode": "auto",
|
|
183
182
|
"orientation": "auto",
|
|
183
|
+
"percentChangeColorMode": "standard",
|
|
184
184
|
"reduceOptions": {
|
|
185
|
-
"calcs": [
|
|
186
|
-
"lastNotNull"
|
|
187
|
-
],
|
|
185
|
+
"calcs": ["lastNotNull"],
|
|
188
186
|
"fields": "",
|
|
189
187
|
"values": false
|
|
190
188
|
},
|
|
191
|
-
"
|
|
189
|
+
"showPercentChange": false,
|
|
190
|
+
"textMode": "auto",
|
|
191
|
+
"wideLayout": true
|
|
192
192
|
},
|
|
193
|
-
"pluginVersion": "
|
|
193
|
+
"pluginVersion": "12.1.1",
|
|
194
194
|
"targets": [
|
|
195
195
|
{
|
|
196
|
-
"datasource": "
|
|
197
|
-
"
|
|
198
|
-
"
|
|
199
|
-
"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(p.value_usd) AS total_revenue FROM usdvalue_presum p JOIN txgroup_hierarchy gh USING (txgroup_id) WHERE gh.top_category = 'Expenses' AND p.timestamp >= $__from/1000 AND p.timestamp <= $__to/1000",
|
|
200
199
|
"refId": "A",
|
|
201
|
-
"timeColumns": [
|
|
202
|
-
"time",
|
|
203
|
-
"ts"
|
|
204
|
-
]
|
|
200
|
+
"timeColumns": ["time", "ts"]
|
|
205
201
|
}
|
|
206
202
|
],
|
|
207
203
|
"title": "Expenses",
|
|
208
|
-
"type": "stat"
|
|
204
|
+
"type": "stat",
|
|
205
|
+
"description": "Displays the total value of all transactions sorted as Expenses for the selected period."
|
|
209
206
|
},
|
|
210
207
|
{
|
|
211
|
-
"datasource": "
|
|
212
|
-
"description": "",
|
|
208
|
+
"datasource": "PostgreSQL",
|
|
209
|
+
"description": "Shows the net operating cashflow (Revenue minus Cost of Revenue and Expenses) for the selected period.",
|
|
213
210
|
"fieldConfig": {
|
|
214
211
|
"defaults": {
|
|
215
212
|
"color": {
|
|
@@ -221,14 +218,15 @@
|
|
|
221
218
|
"steps": [
|
|
222
219
|
{
|
|
223
220
|
"color": "green",
|
|
224
|
-
"value":
|
|
221
|
+
"value": 0
|
|
225
222
|
},
|
|
226
223
|
{
|
|
227
224
|
"color": "red",
|
|
228
225
|
"value": 80
|
|
229
226
|
}
|
|
230
227
|
]
|
|
231
|
-
}
|
|
228
|
+
},
|
|
229
|
+
"unit": "currencyUSD"
|
|
232
230
|
},
|
|
233
231
|
"overrides": []
|
|
234
232
|
},
|
|
@@ -244,35 +242,32 @@
|
|
|
244
242
|
"graphMode": "area",
|
|
245
243
|
"justifyMode": "auto",
|
|
246
244
|
"orientation": "auto",
|
|
245
|
+
"percentChangeColorMode": "standard",
|
|
247
246
|
"reduceOptions": {
|
|
248
|
-
"calcs": [
|
|
249
|
-
"lastNotNull"
|
|
250
|
-
],
|
|
247
|
+
"calcs": ["lastNotNull"],
|
|
251
248
|
"fields": "",
|
|
252
249
|
"values": false
|
|
253
250
|
},
|
|
254
|
-
"
|
|
251
|
+
"showPercentChange": false,
|
|
252
|
+
"textMode": "auto",
|
|
253
|
+
"wideLayout": true
|
|
255
254
|
},
|
|
256
|
-
"pluginVersion": "
|
|
255
|
+
"pluginVersion": "12.1.1",
|
|
257
256
|
"targets": [
|
|
258
257
|
{
|
|
259
|
-
"datasource": "
|
|
260
|
-
"
|
|
261
|
-
"
|
|
262
|
-
"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 gh.top_category = 'Revenue' THEN p.value_usd ELSE 0 END)\n - SUM(CASE WHEN gh.top_category = 'Cost of Revenue' THEN p.value_usd ELSE 0 END)\n - SUM(CASE WHEN gh.top_category = 'Expenses' THEN p.value_usd ELSE 0 END)\n) AS total_net\nFROM usdvalue_presum p\nJOIN txgroup_hierarchy gh USING (txgroup_id)\nWHERE p.timestamp >= $__from/1000 AND p.timestamp <= $__to/1000",
|
|
263
261
|
"refId": "A",
|
|
264
|
-
"timeColumns": [
|
|
265
|
-
"time",
|
|
266
|
-
"ts"
|
|
267
|
-
]
|
|
262
|
+
"timeColumns": ["time", "ts"]
|
|
268
263
|
}
|
|
269
264
|
],
|
|
270
265
|
"title": "Operating Total",
|
|
271
266
|
"type": "stat"
|
|
272
267
|
},
|
|
273
268
|
{
|
|
274
|
-
"datasource": "
|
|
275
|
-
"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.",
|
|
276
271
|
"fieldConfig": {
|
|
277
272
|
"defaults": {
|
|
278
273
|
"color": {
|
|
@@ -285,6 +280,7 @@
|
|
|
285
280
|
"axisLabel": "",
|
|
286
281
|
"axisPlacement": "auto",
|
|
287
282
|
"barAlignment": 0,
|
|
283
|
+
"barWidthFactor": 0.6,
|
|
288
284
|
"drawStyle": "bars",
|
|
289
285
|
"fillOpacity": 70,
|
|
290
286
|
"gradientMode": "none",
|
|
@@ -316,14 +312,15 @@
|
|
|
316
312
|
"steps": [
|
|
317
313
|
{
|
|
318
314
|
"color": "green",
|
|
319
|
-
"value":
|
|
315
|
+
"value": 0
|
|
320
316
|
},
|
|
321
317
|
{
|
|
322
318
|
"color": "red",
|
|
323
319
|
"value": 80
|
|
324
320
|
}
|
|
325
321
|
]
|
|
326
|
-
}
|
|
322
|
+
},
|
|
323
|
+
"unit": "currencyUSD"
|
|
327
324
|
},
|
|
328
325
|
"overrides": [
|
|
329
326
|
{
|
|
@@ -366,20 +363,19 @@
|
|
|
366
363
|
"showLegend": true
|
|
367
364
|
},
|
|
368
365
|
"tooltip": {
|
|
366
|
+
"hideZeros": false,
|
|
369
367
|
"mode": "single",
|
|
370
368
|
"sort": "none"
|
|
371
369
|
}
|
|
372
370
|
},
|
|
371
|
+
"pluginVersion": "12.1.1",
|
|
373
372
|
"targets": [
|
|
374
373
|
{
|
|
375
|
-
"datasource": "
|
|
376
|
-
"
|
|
377
|
-
"
|
|
378
|
-
"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(p.timestamp) AS \"timestamp\", SUM(CASE WHEN gh.top_category = 'Revenue' THEN p.value_usd ELSE 0 END) AS \"Total Revenue\", SUM(CASE WHEN gh.top_category in ('Cost of Revenue','Expenses') THEN p.value_usd ELSE 0 END) * -1 AS \"Total Expenses\", SUM(CASE WHEN gh.top_category = 'Revenue' THEN p.value_usd ELSE 0 END) - SUM(CASE WHEN gh.top_category in ('Cost of Revenue','Expenses') THEN p.value_usd ELSE 0 END) AS \"Net\" FROM usdvalue_presum AS p JOIN txgroup_hierarchy gh ON p.txgroup_id = gh.txgroup_id WHERE p.timestamp >= $__from/1000 AND p.timestamp <= $__to/1000 GROUP BY timestamp ORDER BY timestamp;",
|
|
379
377
|
"refId": "A",
|
|
380
|
-
"timeColumns": [
|
|
381
|
-
"timestamp"
|
|
382
|
-
]
|
|
378
|
+
"timeColumns": ["timestamp"]
|
|
383
379
|
}
|
|
384
380
|
],
|
|
385
381
|
"title": "Weekly Cashflow",
|
|
@@ -411,39 +407,27 @@
|
|
|
411
407
|
"options": {
|
|
412
408
|
"fields": {
|
|
413
409
|
"Cost of Revenue": {
|
|
414
|
-
"aggregations": [
|
|
415
|
-
"sum"
|
|
416
|
-
],
|
|
410
|
+
"aggregations": ["sum"],
|
|
417
411
|
"operation": "aggregate"
|
|
418
412
|
},
|
|
419
413
|
"Expenses": {
|
|
420
|
-
"aggregations": [
|
|
421
|
-
"sum"
|
|
422
|
-
],
|
|
414
|
+
"aggregations": ["sum"],
|
|
423
415
|
"operation": "aggregate"
|
|
424
416
|
},
|
|
425
417
|
"Net": {
|
|
426
|
-
"aggregations": [
|
|
427
|
-
"sum"
|
|
428
|
-
],
|
|
418
|
+
"aggregations": ["sum"],
|
|
429
419
|
"operation": "aggregate"
|
|
430
420
|
},
|
|
431
421
|
"Other Expenses": {
|
|
432
|
-
"aggregations": [
|
|
433
|
-
"sum"
|
|
434
|
-
],
|
|
422
|
+
"aggregations": ["sum"],
|
|
435
423
|
"operation": "aggregate"
|
|
436
424
|
},
|
|
437
425
|
"Other Income": {
|
|
438
|
-
"aggregations": [
|
|
439
|
-
"sum"
|
|
440
|
-
],
|
|
426
|
+
"aggregations": ["sum"],
|
|
441
427
|
"operation": "aggregate"
|
|
442
428
|
},
|
|
443
429
|
"Revenue": {
|
|
444
|
-
"aggregations": [
|
|
445
|
-
"sum"
|
|
446
|
-
],
|
|
430
|
+
"aggregations": ["sum"],
|
|
447
431
|
"operation": "aggregate"
|
|
448
432
|
},
|
|
449
433
|
"Timestamp": {
|
|
@@ -451,15 +435,11 @@
|
|
|
451
435
|
"operation": "groupby"
|
|
452
436
|
},
|
|
453
437
|
"Total Expenses": {
|
|
454
|
-
"aggregations": [
|
|
455
|
-
"sum"
|
|
456
|
-
],
|
|
438
|
+
"aggregations": ["sum"],
|
|
457
439
|
"operation": "aggregate"
|
|
458
440
|
},
|
|
459
441
|
"Total Revenue": {
|
|
460
|
-
"aggregations": [
|
|
461
|
-
"sum"
|
|
462
|
-
],
|
|
442
|
+
"aggregations": ["sum"],
|
|
463
443
|
"operation": "aggregate"
|
|
464
444
|
},
|
|
465
445
|
"timestamp": {
|
|
@@ -473,9 +453,10 @@
|
|
|
473
453
|
"type": "timeseries"
|
|
474
454
|
}
|
|
475
455
|
],
|
|
456
|
+
"preload": false,
|
|
476
457
|
"refresh": "",
|
|
477
|
-
"schemaVersion":
|
|
478
|
-
"tags": [],
|
|
458
|
+
"schemaVersion": 41,
|
|
459
|
+
"tags": ["cashflow", "operating"],
|
|
479
460
|
"templating": {
|
|
480
461
|
"list": []
|
|
481
462
|
},
|
|
@@ -486,7 +467,7 @@
|
|
|
486
467
|
"timepicker": {},
|
|
487
468
|
"timezone": "",
|
|
488
469
|
"title": "Operating Cashflow Summary",
|
|
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.",
|
|
489
471
|
"uid": "fdf9969c-357a-4203-ae7b-12816e87bc7e",
|
|
490
|
-
"version":
|
|
491
|
-
"weekStart": ""
|
|
472
|
+
"version": 105
|
|
492
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'
|
|
@@ -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,5 +1,18 @@
|
|
|
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
|
-
from dao_treasury._nicknames import setup_address_nicknames_in_db
|
|
3
16
|
from dao_treasury._wallet import TreasuryWallet
|
|
4
17
|
from dao_treasury.db import TreasuryTx
|
|
5
18
|
from dao_treasury.sorting import (
|
|
@@ -20,9 +33,6 @@ from dao_treasury.sorting import (
|
|
|
20
33
|
from dao_treasury.treasury import Treasury
|
|
21
34
|
|
|
22
35
|
|
|
23
|
-
setup_address_nicknames_in_db()
|
|
24
|
-
|
|
25
|
-
|
|
26
36
|
if ENVS.SQL_DEBUG:
|
|
27
37
|
import pony.orm
|
|
28
38
|
|
|
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"""
|
|
@@ -39,10 +52,14 @@ def up(*services: str) -> None:
|
|
|
39
52
|
:func:`down`
|
|
40
53
|
:func:`_exec_command`
|
|
41
54
|
"""
|
|
42
|
-
#
|
|
43
|
-
|
|
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
|
+
|
|
44
61
|
build(*services)
|
|
45
|
-
|
|
62
|
+
_print_notice("starting", services)
|
|
46
63
|
_exec_command(["up", "-d", *services])
|
|
47
64
|
|
|
48
65
|
|
|
@@ -59,6 +76,7 @@ def down() -> None:
|
|
|
59
76
|
See Also:
|
|
60
77
|
:func:`up`
|
|
61
78
|
"""
|
|
79
|
+
print("stopping all dao-treasury containers")
|
|
62
80
|
_exec_command(["down"])
|
|
63
81
|
|
|
64
82
|
|
|
@@ -77,10 +95,24 @@ def build(*services: str) -> None:
|
|
|
77
95
|
:func:`up`
|
|
78
96
|
:func:`_exec_command`
|
|
79
97
|
"""
|
|
80
|
-
|
|
98
|
+
_print_notice("building", services)
|
|
81
99
|
_exec_command(["build", *services])
|
|
82
100
|
|
|
83
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
|
+
|
|
84
116
|
_P = ParamSpec("_P")
|
|
85
117
|
_T = TypeVar("_T")
|
|
86
118
|
|
|
@@ -161,17 +193,6 @@ def _exec_command(command: List[str], *, compose_options: Tuple[str, ...] = ())
|
|
|
161
193
|
See Also:
|
|
162
194
|
:func:`check_system`
|
|
163
195
|
"""
|
|
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
|
|
196
|
+
docker_compose._exec_command(
|
|
197
|
+
command, compose_file=COMPOSE_FILE, compose_options=compose_options
|
|
198
|
+
)
|
|
Binary file
|
dao_treasury/_nicknames.py
CHANGED
|
@@ -1,17 +1,33 @@
|
|
|
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
|
|
4
19
|
|
|
5
20
|
from dao_treasury import constants
|
|
6
|
-
from dao_treasury.db import Address,
|
|
21
|
+
from dao_treasury.db import Address, init_db, set_address_nicknames_for_tokens
|
|
7
22
|
|
|
8
23
|
|
|
9
24
|
set_nickname: Final = Address.set_nickname
|
|
10
25
|
|
|
11
26
|
|
|
12
27
|
def setup_address_nicknames_in_db() -> None:
|
|
28
|
+
init_db()
|
|
13
29
|
with db_session:
|
|
14
30
|
set_nickname(constants.ZERO_ADDRESS, "Zero Address")
|
|
15
31
|
for address in constants.DISPERSE_APP:
|
|
16
32
|
set_nickname(address, "Disperse.app")
|
|
17
|
-
|
|
33
|
+
set_address_nicknames_for_tokens()
|
|
Binary file
|
|
Binary file
|