dao-treasury 0.0.22__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 -7
- dao_treasury/.grafana/provisioning/dashboards/streams/LlamaPay.json +220 -0
- dao_treasury/.grafana/provisioning/dashboards/summary/Monthly.json +18 -23
- dao_treasury/.grafana/provisioning/dashboards/transactions/Treasury Transactions.json +181 -29
- dao_treasury/.grafana/provisioning/dashboards/treasury/Cashflow (Including Unsorted).json +808 -0
- dao_treasury/.grafana/provisioning/dashboards/treasury/Cashflow.json +602 -0
- 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 +478 -0
- dao_treasury/.grafana/provisioning/datasources/datasources.yaml +17 -0
- dao_treasury/ENVIRONMENT_VARIABLES.py +20 -0
- dao_treasury/__init__.py +20 -0
- dao_treasury/_docker.cpython-310-darwin.so +0 -0
- dao_treasury/_docker.py +67 -38
- dao_treasury/_nicknames.cpython-310-darwin.so +0 -0
- dao_treasury/_nicknames.py +24 -2
- dao_treasury/_wallet.cpython-310-darwin.so +0 -0
- dao_treasury/_wallet.py +157 -16
- dao_treasury/constants.cpython-310-darwin.so +0 -0
- dao_treasury/constants.py +39 -0
- dao_treasury/db.py +384 -45
- dao_treasury/docker-compose.yaml +6 -5
- dao_treasury/main.py +86 -17
- dao_treasury/sorting/__init__.cpython-310-darwin.so +0 -0
- dao_treasury/sorting/__init__.py +171 -42
- dao_treasury/sorting/_matchers.cpython-310-darwin.so +0 -0
- dao_treasury/sorting/_rules.cpython-310-darwin.so +0 -0
- dao_treasury/sorting/_rules.py +1 -3
- dao_treasury/sorting/factory.cpython-310-darwin.so +0 -0
- dao_treasury/sorting/factory.py +2 -6
- dao_treasury/sorting/rule.cpython-310-darwin.so +0 -0
- dao_treasury/sorting/rule.py +13 -10
- dao_treasury/sorting/rules/__init__.cpython-310-darwin.so +0 -0
- dao_treasury/sorting/rules/__init__.py +1 -0
- dao_treasury/sorting/rules/ignore/__init__.cpython-310-darwin.so +0 -0
- dao_treasury/sorting/rules/ignore/__init__.py +1 -0
- dao_treasury/sorting/rules/ignore/llamapay.cpython-310-darwin.so +0 -0
- dao_treasury/sorting/rules/ignore/llamapay.py +20 -0
- dao_treasury/streams/__init__.cpython-310-darwin.so +0 -0
- dao_treasury/streams/__init__.py +0 -0
- dao_treasury/streams/llamapay.cpython-310-darwin.so +0 -0
- dao_treasury/streams/llamapay.py +388 -0
- dao_treasury/treasury.py +75 -28
- dao_treasury/types.cpython-310-darwin.so +0 -0
- dao_treasury-0.0.69.dist-info/METADATA +120 -0
- 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
- 52b51d40e96d4333695d__mypyc.cpython-310-darwin.so +0 -0
- dao_treasury/.grafana/provisioning/datasources/sqlite.yaml +0 -10
- dao_treasury-0.0.22.dist-info/METADATA +0 -63
- dao_treasury-0.0.22.dist-info/RECORD +0 -31
- dao_treasury-0.0.22.dist-info/top_level.txt +0 -2
- {dao_treasury-0.0.22.dist-info → dao_treasury-0.0.69.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
{
|
|
2
|
+
"annotations": {
|
|
3
|
+
"list": [
|
|
4
|
+
{
|
|
5
|
+
"builtIn": 1,
|
|
6
|
+
"datasource": {
|
|
7
|
+
"type": "grafana",
|
|
8
|
+
"uid": "-- Grafana --"
|
|
9
|
+
},
|
|
10
|
+
"enable": true,
|
|
11
|
+
"hide": true,
|
|
12
|
+
"iconColor": "rgba(0, 211, 255, 1)",
|
|
13
|
+
"name": "Annotations & Alerts",
|
|
14
|
+
"type": "dashboard"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
},
|
|
18
|
+
"editable": true,
|
|
19
|
+
"fiscalYearStartMonth": 0,
|
|
20
|
+
"graphTooltip": 1,
|
|
21
|
+
"id": 6,
|
|
22
|
+
"links": [],
|
|
23
|
+
"panels": [
|
|
24
|
+
{
|
|
25
|
+
"datasource": "SQLite",
|
|
26
|
+
"fieldConfig": {
|
|
27
|
+
"unit": "currencyUSD",
|
|
28
|
+
"defaults": {
|
|
29
|
+
"color": {
|
|
30
|
+
"mode": "thresholds"
|
|
31
|
+
},
|
|
32
|
+
"mappings": [],
|
|
33
|
+
"thresholds": {
|
|
34
|
+
"mode": "absolute",
|
|
35
|
+
"steps": [
|
|
36
|
+
{
|
|
37
|
+
"color": "green",
|
|
38
|
+
"value": 0
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"color": "red",
|
|
42
|
+
"value": 80
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"overrides": []
|
|
48
|
+
},
|
|
49
|
+
"gridPos": {
|
|
50
|
+
"h": 4,
|
|
51
|
+
"w": 6,
|
|
52
|
+
"x": 0,
|
|
53
|
+
"y": 0
|
|
54
|
+
},
|
|
55
|
+
"id": 1,
|
|
56
|
+
"options": {
|
|
57
|
+
"colorMode": "value",
|
|
58
|
+
"graphMode": "area",
|
|
59
|
+
"justifyMode": "auto",
|
|
60
|
+
"orientation": "auto",
|
|
61
|
+
"percentChangeColorMode": "standard",
|
|
62
|
+
"reduceOptions": {
|
|
63
|
+
"calcs": ["lastNotNull"],
|
|
64
|
+
"fields": "",
|
|
65
|
+
"values": false
|
|
66
|
+
},
|
|
67
|
+
"showPercentChange": false,
|
|
68
|
+
"textMode": "auto",
|
|
69
|
+
"wideLayout": true
|
|
70
|
+
},
|
|
71
|
+
"pluginVersion": "12.1.1",
|
|
72
|
+
"targets": [
|
|
73
|
+
{
|
|
74
|
+
"datasource": "SQLite",
|
|
75
|
+
"queryText": "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
|
+
"queryType": "table",
|
|
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",
|
|
78
|
+
"refId": "A",
|
|
79
|
+
"timeColumns": ["time", "ts"]
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
"title": "Revenue",
|
|
83
|
+
"type": "stat",
|
|
84
|
+
"description": "Displays the total value of all transactions sorted as Revenue for the selected period."
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"datasource": "SQLite",
|
|
88
|
+
"fieldConfig": {
|
|
89
|
+
"unit": "currencyUSD",
|
|
90
|
+
"defaults": {
|
|
91
|
+
"color": {
|
|
92
|
+
"mode": "thresholds"
|
|
93
|
+
},
|
|
94
|
+
"mappings": [],
|
|
95
|
+
"thresholds": {
|
|
96
|
+
"mode": "absolute",
|
|
97
|
+
"steps": [
|
|
98
|
+
{
|
|
99
|
+
"color": "green",
|
|
100
|
+
"value": 0
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"color": "red",
|
|
104
|
+
"value": 80
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"overrides": []
|
|
110
|
+
},
|
|
111
|
+
"gridPos": {
|
|
112
|
+
"h": 4,
|
|
113
|
+
"w": 6,
|
|
114
|
+
"x": 6,
|
|
115
|
+
"y": 0
|
|
116
|
+
},
|
|
117
|
+
"id": 3,
|
|
118
|
+
"options": {
|
|
119
|
+
"colorMode": "value",
|
|
120
|
+
"graphMode": "area",
|
|
121
|
+
"justifyMode": "auto",
|
|
122
|
+
"orientation": "auto",
|
|
123
|
+
"percentChangeColorMode": "standard",
|
|
124
|
+
"reduceOptions": {
|
|
125
|
+
"calcs": ["lastNotNull"],
|
|
126
|
+
"fields": "",
|
|
127
|
+
"values": false
|
|
128
|
+
},
|
|
129
|
+
"showPercentChange": false,
|
|
130
|
+
"textMode": "auto",
|
|
131
|
+
"wideLayout": true
|
|
132
|
+
},
|
|
133
|
+
"pluginVersion": "12.1.1",
|
|
134
|
+
"targets": [
|
|
135
|
+
{
|
|
136
|
+
"datasource": "SQLite",
|
|
137
|
+
"queryText": "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
|
+
"queryType": "table",
|
|
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",
|
|
140
|
+
"refId": "A",
|
|
141
|
+
"timeColumns": ["time", "ts"]
|
|
142
|
+
}
|
|
143
|
+
],
|
|
144
|
+
"title": "Cost of Revenue",
|
|
145
|
+
"type": "stat",
|
|
146
|
+
"description": "Displays the total value of all transactions sorted as Cost of Revenue for the selected period."
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"datasource": "SQLite",
|
|
150
|
+
"fieldConfig": {
|
|
151
|
+
"unit": "currencyUSD",
|
|
152
|
+
"defaults": {
|
|
153
|
+
"color": {
|
|
154
|
+
"mode": "thresholds"
|
|
155
|
+
},
|
|
156
|
+
"mappings": [],
|
|
157
|
+
"thresholds": {
|
|
158
|
+
"mode": "absolute",
|
|
159
|
+
"steps": [
|
|
160
|
+
{
|
|
161
|
+
"color": "green",
|
|
162
|
+
"value": 0
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"color": "red",
|
|
166
|
+
"value": 80
|
|
167
|
+
}
|
|
168
|
+
]
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
"overrides": []
|
|
172
|
+
},
|
|
173
|
+
"gridPos": {
|
|
174
|
+
"h": 4,
|
|
175
|
+
"w": 6,
|
|
176
|
+
"x": 12,
|
|
177
|
+
"y": 0
|
|
178
|
+
},
|
|
179
|
+
"id": 2,
|
|
180
|
+
"options": {
|
|
181
|
+
"colorMode": "value",
|
|
182
|
+
"graphMode": "area",
|
|
183
|
+
"justifyMode": "auto",
|
|
184
|
+
"orientation": "auto",
|
|
185
|
+
"percentChangeColorMode": "standard",
|
|
186
|
+
"reduceOptions": {
|
|
187
|
+
"calcs": ["lastNotNull"],
|
|
188
|
+
"fields": "",
|
|
189
|
+
"values": false
|
|
190
|
+
},
|
|
191
|
+
"showPercentChange": false,
|
|
192
|
+
"textMode": "auto",
|
|
193
|
+
"wideLayout": true
|
|
194
|
+
},
|
|
195
|
+
"pluginVersion": "12.1.1",
|
|
196
|
+
"targets": [
|
|
197
|
+
{
|
|
198
|
+
"datasource": "SQLite",
|
|
199
|
+
"queryText": "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
|
+
"queryType": "table",
|
|
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",
|
|
202
|
+
"refId": "A",
|
|
203
|
+
"timeColumns": ["time", "ts"]
|
|
204
|
+
}
|
|
205
|
+
],
|
|
206
|
+
"title": "Expenses",
|
|
207
|
+
"type": "stat",
|
|
208
|
+
"description": "Displays the total value of all transactions sorted as Expenses for the selected period."
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"datasource": "SQLite",
|
|
212
|
+
"description": "Shows the net operating cashflow (Revenue minus Cost of Revenue and Expenses) for the selected period.",
|
|
213
|
+
"fieldConfig": {
|
|
214
|
+
"unit": "currencyUSD",
|
|
215
|
+
"defaults": {
|
|
216
|
+
"color": {
|
|
217
|
+
"mode": "thresholds"
|
|
218
|
+
},
|
|
219
|
+
"mappings": [],
|
|
220
|
+
"thresholds": {
|
|
221
|
+
"mode": "absolute",
|
|
222
|
+
"steps": [
|
|
223
|
+
{
|
|
224
|
+
"color": "green",
|
|
225
|
+
"value": 0
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"color": "red",
|
|
229
|
+
"value": 80
|
|
230
|
+
}
|
|
231
|
+
]
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
"overrides": []
|
|
235
|
+
},
|
|
236
|
+
"gridPos": {
|
|
237
|
+
"h": 4,
|
|
238
|
+
"w": 6,
|
|
239
|
+
"x": 18,
|
|
240
|
+
"y": 0
|
|
241
|
+
},
|
|
242
|
+
"id": 10,
|
|
243
|
+
"options": {
|
|
244
|
+
"colorMode": "value",
|
|
245
|
+
"graphMode": "area",
|
|
246
|
+
"justifyMode": "auto",
|
|
247
|
+
"orientation": "auto",
|
|
248
|
+
"percentChangeColorMode": "standard",
|
|
249
|
+
"reduceOptions": {
|
|
250
|
+
"calcs": ["lastNotNull"],
|
|
251
|
+
"fields": "",
|
|
252
|
+
"values": false
|
|
253
|
+
},
|
|
254
|
+
"showPercentChange": false,
|
|
255
|
+
"textMode": "auto",
|
|
256
|
+
"wideLayout": true
|
|
257
|
+
},
|
|
258
|
+
"pluginVersion": "12.1.1",
|
|
259
|
+
"targets": [
|
|
260
|
+
{
|
|
261
|
+
"datasource": "SQLite",
|
|
262
|
+
"queryText": "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
|
+
"queryType": "table",
|
|
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",
|
|
265
|
+
"refId": "A",
|
|
266
|
+
"timeColumns": ["time", "ts"]
|
|
267
|
+
}
|
|
268
|
+
],
|
|
269
|
+
"title": "Operating Total",
|
|
270
|
+
"type": "stat"
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"datasource": "SQLite",
|
|
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.",
|
|
275
|
+
"fieldConfig": {
|
|
276
|
+
"unit": "currencyUSD",
|
|
277
|
+
"defaults": {
|
|
278
|
+
"color": {
|
|
279
|
+
"mode": "palette-classic"
|
|
280
|
+
},
|
|
281
|
+
"custom": {
|
|
282
|
+
"axisBorderShow": false,
|
|
283
|
+
"axisCenteredZero": false,
|
|
284
|
+
"axisColorMode": "text",
|
|
285
|
+
"axisLabel": "",
|
|
286
|
+
"axisPlacement": "auto",
|
|
287
|
+
"barAlignment": 0,
|
|
288
|
+
"barWidthFactor": 0.6,
|
|
289
|
+
"drawStyle": "bars",
|
|
290
|
+
"fillOpacity": 70,
|
|
291
|
+
"gradientMode": "none",
|
|
292
|
+
"hideFrom": {
|
|
293
|
+
"legend": false,
|
|
294
|
+
"tooltip": false,
|
|
295
|
+
"viz": false
|
|
296
|
+
},
|
|
297
|
+
"insertNulls": false,
|
|
298
|
+
"lineInterpolation": "linear",
|
|
299
|
+
"lineWidth": 1,
|
|
300
|
+
"pointSize": 5,
|
|
301
|
+
"scaleDistribution": {
|
|
302
|
+
"type": "linear"
|
|
303
|
+
},
|
|
304
|
+
"showPoints": "auto",
|
|
305
|
+
"spanNulls": false,
|
|
306
|
+
"stacking": {
|
|
307
|
+
"group": "A",
|
|
308
|
+
"mode": "normal"
|
|
309
|
+
},
|
|
310
|
+
"thresholdsStyle": {
|
|
311
|
+
"mode": "off"
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
"mappings": [],
|
|
315
|
+
"thresholds": {
|
|
316
|
+
"mode": "absolute",
|
|
317
|
+
"steps": [
|
|
318
|
+
{
|
|
319
|
+
"color": "green",
|
|
320
|
+
"value": 0
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
"color": "red",
|
|
324
|
+
"value": 80
|
|
325
|
+
}
|
|
326
|
+
]
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
"overrides": [
|
|
330
|
+
{
|
|
331
|
+
"matcher": {
|
|
332
|
+
"id": "byName",
|
|
333
|
+
"options": "Net (sum)"
|
|
334
|
+
},
|
|
335
|
+
"properties": [
|
|
336
|
+
{
|
|
337
|
+
"id": "custom.drawStyle",
|
|
338
|
+
"value": "line"
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
"id": "custom.stacking",
|
|
342
|
+
"value": {
|
|
343
|
+
"group": "A",
|
|
344
|
+
"mode": "none"
|
|
345
|
+
}
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
"id": "custom.fillOpacity",
|
|
349
|
+
"value": 19
|
|
350
|
+
}
|
|
351
|
+
]
|
|
352
|
+
}
|
|
353
|
+
]
|
|
354
|
+
},
|
|
355
|
+
"gridPos": {
|
|
356
|
+
"h": 12,
|
|
357
|
+
"w": 24,
|
|
358
|
+
"x": 0,
|
|
359
|
+
"y": 4
|
|
360
|
+
},
|
|
361
|
+
"id": 11,
|
|
362
|
+
"options": {
|
|
363
|
+
"legend": {
|
|
364
|
+
"calcs": [],
|
|
365
|
+
"displayMode": "list",
|
|
366
|
+
"placement": "bottom",
|
|
367
|
+
"showLegend": true
|
|
368
|
+
},
|
|
369
|
+
"tooltip": {
|
|
370
|
+
"hideZeros": false,
|
|
371
|
+
"mode": "single",
|
|
372
|
+
"sort": "none"
|
|
373
|
+
}
|
|
374
|
+
},
|
|
375
|
+
"pluginVersion": "12.1.1",
|
|
376
|
+
"targets": [
|
|
377
|
+
{
|
|
378
|
+
"datasource": "SQLite",
|
|
379
|
+
"queryText": "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;",
|
|
380
|
+
"queryType": "table",
|
|
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;",
|
|
382
|
+
"refId": "A",
|
|
383
|
+
"timeColumns": ["timestamp"]
|
|
384
|
+
}
|
|
385
|
+
],
|
|
386
|
+
"title": "Weekly Cashflow",
|
|
387
|
+
"transformations": [
|
|
388
|
+
{
|
|
389
|
+
"id": "formatTime",
|
|
390
|
+
"options": {
|
|
391
|
+
"outputFormat": "YYYY-WW",
|
|
392
|
+
"timeField": "timestamp",
|
|
393
|
+
"timezone": "browser",
|
|
394
|
+
"useTimezone": true
|
|
395
|
+
}
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
"id": "convertFieldType",
|
|
399
|
+
"options": {
|
|
400
|
+
"conversions": [
|
|
401
|
+
{
|
|
402
|
+
"dateFormat": "YYYY-WW",
|
|
403
|
+
"destinationType": "time",
|
|
404
|
+
"targetField": "timestamp"
|
|
405
|
+
}
|
|
406
|
+
],
|
|
407
|
+
"fields": {}
|
|
408
|
+
}
|
|
409
|
+
},
|
|
410
|
+
{
|
|
411
|
+
"id": "groupBy",
|
|
412
|
+
"options": {
|
|
413
|
+
"fields": {
|
|
414
|
+
"Cost of Revenue": {
|
|
415
|
+
"aggregations": ["sum"],
|
|
416
|
+
"operation": "aggregate"
|
|
417
|
+
},
|
|
418
|
+
"Expenses": {
|
|
419
|
+
"aggregations": ["sum"],
|
|
420
|
+
"operation": "aggregate"
|
|
421
|
+
},
|
|
422
|
+
"Net": {
|
|
423
|
+
"aggregations": ["sum"],
|
|
424
|
+
"operation": "aggregate"
|
|
425
|
+
},
|
|
426
|
+
"Other Expenses": {
|
|
427
|
+
"aggregations": ["sum"],
|
|
428
|
+
"operation": "aggregate"
|
|
429
|
+
},
|
|
430
|
+
"Other Income": {
|
|
431
|
+
"aggregations": ["sum"],
|
|
432
|
+
"operation": "aggregate"
|
|
433
|
+
},
|
|
434
|
+
"Revenue": {
|
|
435
|
+
"aggregations": ["sum"],
|
|
436
|
+
"operation": "aggregate"
|
|
437
|
+
},
|
|
438
|
+
"Timestamp": {
|
|
439
|
+
"aggregations": [],
|
|
440
|
+
"operation": "groupby"
|
|
441
|
+
},
|
|
442
|
+
"Total Expenses": {
|
|
443
|
+
"aggregations": ["sum"],
|
|
444
|
+
"operation": "aggregate"
|
|
445
|
+
},
|
|
446
|
+
"Total Revenue": {
|
|
447
|
+
"aggregations": ["sum"],
|
|
448
|
+
"operation": "aggregate"
|
|
449
|
+
},
|
|
450
|
+
"timestamp": {
|
|
451
|
+
"aggregations": [],
|
|
452
|
+
"operation": "groupby"
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
],
|
|
458
|
+
"type": "timeseries"
|
|
459
|
+
}
|
|
460
|
+
],
|
|
461
|
+
"preload": false,
|
|
462
|
+
"refresh": "",
|
|
463
|
+
"schemaVersion": 41,
|
|
464
|
+
"tags": ["cashflow", "operating"],
|
|
465
|
+
"templating": {
|
|
466
|
+
"list": []
|
|
467
|
+
},
|
|
468
|
+
"time": {
|
|
469
|
+
"from": "now-6M",
|
|
470
|
+
"to": "now"
|
|
471
|
+
},
|
|
472
|
+
"timepicker": {},
|
|
473
|
+
"timezone": "",
|
|
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.",
|
|
476
|
+
"uid": "fdf9969c-357a-4203-ae7b-12816e87bc7e",
|
|
477
|
+
"version": 7
|
|
478
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
apiVersion: 1
|
|
2
|
+
|
|
3
|
+
datasources:
|
|
4
|
+
- name: SQLite
|
|
5
|
+
type: frser-sqlite-datasource
|
|
6
|
+
isDefault: true
|
|
7
|
+
editable: false
|
|
8
|
+
jsonData:
|
|
9
|
+
path: /app/dao-treasury-data/dao-treasury.sqlite
|
|
10
|
+
secureJsonData: {}
|
|
11
|
+
|
|
12
|
+
- name: 'PROMETHEUS'
|
|
13
|
+
type: 'prometheus'
|
|
14
|
+
access: 'proxy'
|
|
15
|
+
url: 'http://victoria-metrics:8428'
|
|
16
|
+
version: 1
|
|
17
|
+
editable: false
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
|
|
13
|
+
from typing import Final
|
|
14
|
+
|
|
15
|
+
from typed_envs import EnvVarFactory
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
_factory = EnvVarFactory("DAO_TREASURY")
|
|
19
|
+
|
|
20
|
+
SQL_DEBUG: Final = _factory.create_env("SQL_DEBUG", bool, default=False, verbose=False)
|
dao_treasury/__init__.py
CHANGED
|
@@ -1,3 +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
|
+
|
|
15
|
+
from dao_treasury import ENVIRONMENT_VARIABLES as ENVS
|
|
1
16
|
from dao_treasury._nicknames import setup_address_nicknames_in_db
|
|
2
17
|
from dao_treasury._wallet import TreasuryWallet
|
|
3
18
|
from dao_treasury.db import TreasuryTx
|
|
@@ -22,6 +37,11 @@ from dao_treasury.treasury import Treasury
|
|
|
22
37
|
setup_address_nicknames_in_db()
|
|
23
38
|
|
|
24
39
|
|
|
40
|
+
if ENVS.SQL_DEBUG:
|
|
41
|
+
import pony.orm
|
|
42
|
+
|
|
43
|
+
pony.orm.sql_debug(True)
|
|
44
|
+
|
|
25
45
|
__all__ = [
|
|
26
46
|
"Treasury",
|
|
27
47
|
"TreasuryWallet",
|
|
Binary file
|