dao-treasury 0.0.34__cp312-cp312-win32.whl → 0.0.72__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.

Files changed (48) hide show
  1. dao_treasury/.grafana/provisioning/dashboards/breakdowns/Expenses.json +553 -0
  2. dao_treasury/.grafana/provisioning/dashboards/breakdowns/Revenue.json +555 -0
  3. dao_treasury/.grafana/provisioning/dashboards/dashboards.yaml +7 -57
  4. dao_treasury/.grafana/provisioning/dashboards/streams/LlamaPay.json +124 -20
  5. dao_treasury/.grafana/provisioning/dashboards/summary/Monthly.json +284 -22
  6. dao_treasury/.grafana/provisioning/dashboards/transactions/Treasury Transactions.json +47 -63
  7. dao_treasury/.grafana/provisioning/dashboards/transactions/Unsorted Transactions.json +368 -0
  8. dao_treasury/.grafana/provisioning/dashboards/treasury/Cashflow (Including Unsorted).json +122 -149
  9. dao_treasury/.grafana/provisioning/dashboards/treasury/Cashflow.json +87 -100
  10. dao_treasury/.grafana/provisioning/dashboards/treasury/Current Treasury Assets.json +941 -0
  11. dao_treasury/.grafana/provisioning/dashboards/treasury/Historical Treasury Balances.json +3931 -0
  12. dao_treasury/.grafana/provisioning/dashboards/treasury/Operating Cashflow.json +64 -78
  13. dao_treasury/ENVIRONMENT_VARIABLES.py +12 -0
  14. dao_treasury/__init__.py +14 -0
  15. dao_treasury/_docker.cp312-win32.pyd +0 -0
  16. dao_treasury/_docker.py +38 -21
  17. dao_treasury/_nicknames.cp312-win32.pyd +0 -0
  18. dao_treasury/_nicknames.py +15 -0
  19. dao_treasury/_wallet.cp312-win32.pyd +0 -0
  20. dao_treasury/_wallet.py +14 -10
  21. dao_treasury/constants.cp312-win32.pyd +0 -0
  22. dao_treasury/constants.py +24 -0
  23. dao_treasury/db.py +116 -25
  24. dao_treasury/docker-compose.yaml +1 -5
  25. dao_treasury/main.py +39 -1
  26. dao_treasury/sorting/__init__.cp312-win32.pyd +0 -0
  27. dao_treasury/sorting/_matchers.cp312-win32.pyd +0 -0
  28. dao_treasury/sorting/_rules.cp312-win32.pyd +0 -0
  29. dao_treasury/sorting/factory.cp312-win32.pyd +0 -0
  30. dao_treasury/sorting/rule.cp312-win32.pyd +0 -0
  31. dao_treasury/sorting/rule.py +8 -10
  32. dao_treasury/sorting/rules/__init__.cp312-win32.pyd +0 -0
  33. dao_treasury/sorting/rules/ignore/__init__.cp312-win32.pyd +0 -0
  34. dao_treasury/sorting/rules/ignore/llamapay.cp312-win32.pyd +0 -0
  35. dao_treasury/streams/__init__.cp312-win32.pyd +0 -0
  36. dao_treasury/streams/llamapay.cp312-win32.pyd +0 -0
  37. dao_treasury/streams/llamapay.py +14 -2
  38. dao_treasury/treasury.py +37 -16
  39. dao_treasury/types.cp312-win32.pyd +0 -0
  40. {dao_treasury-0.0.34.dist-info → dao_treasury-0.0.72.dist-info}/METADATA +18 -3
  41. dao_treasury-0.0.72.dist-info/RECORD +55 -0
  42. dao_treasury-0.0.72.dist-info/top_level.txt +2 -0
  43. dao_treasury__mypyc.cp312-win32.pyd +0 -0
  44. bf2b4fe1f86ad2ea158b__mypyc.cp312-win32.pyd +0 -0
  45. dao_treasury/.grafana/provisioning/dashboards/treasury/Treasury.json +0 -2018
  46. dao_treasury-0.0.34.dist-info/RECORD +0 -51
  47. dao_treasury-0.0.34.dist-info/top_level.txt +0 -2
  48. {dao_treasury-0.0.34.dist-info → dao_treasury-0.0.72.dist-info}/WHEEL +0 -0
@@ -18,16 +18,15 @@
18
18
  "editable": true,
19
19
  "fiscalYearStartMonth": 0,
20
20
  "graphTooltip": 0,
21
- "id": 7,
21
+ "id": 11,
22
22
  "links": [],
23
- "liveNow": false,
24
23
  "panels": [
25
24
  {
26
25
  "datasource": {
27
26
  "type": "frser-sqlite-datasource",
28
27
  "uid": "P2D2EEF3E092AF52B"
29
28
  },
30
- "description": "",
29
+ "description": "Displays all LlamaPay payment streams managed by the DAO, including stream ID, factory, start/end block, token, sender, recipient, reason, budget request, amount per second, status, and transaction group.\n\nData Links: Click on addresses or blocks to view them on Etherscan. Click on a budget request to view the related Github issue.",
31
30
  "fieldConfig": {
32
31
  "defaults": {
33
32
  "color": {
@@ -46,7 +45,7 @@
46
45
  "steps": [
47
46
  {
48
47
  "color": "green",
49
- "value": null
48
+ "value": 0
50
49
  },
51
50
  {
52
51
  "color": "red",
@@ -55,7 +54,116 @@
55
54
  ]
56
55
  }
57
56
  },
58
- "overrides": []
57
+ "overrides": [
58
+ {
59
+ "matcher": {
60
+ "id": "byName",
61
+ "options": "Factory"
62
+ },
63
+ "properties": [
64
+ {
65
+ "id": "links",
66
+ "value": [
67
+ {
68
+ "targetBlank": true,
69
+ "title": "View on Etherscan",
70
+ "url": "https://etherscan.io/address/${__value.raw}"
71
+ }
72
+ ]
73
+ }
74
+ ]
75
+ },
76
+ {
77
+ "matcher": {
78
+ "id": "byName",
79
+ "options": "From"
80
+ },
81
+ "properties": [
82
+ {
83
+ "id": "links",
84
+ "value": [
85
+ {
86
+ "targetBlank": true,
87
+ "title": "View on Etherscan",
88
+ "url": "https://etherscan.io/address/${__value.raw}"
89
+ }
90
+ ]
91
+ }
92
+ ]
93
+ },
94
+ {
95
+ "matcher": {
96
+ "id": "byName",
97
+ "options": "To"
98
+ },
99
+ "properties": [
100
+ {
101
+ "id": "links",
102
+ "value": [
103
+ {
104
+ "targetBlank": true,
105
+ "title": "View on Etherscan",
106
+ "url": "https://etherscan.io/address/${__value.raw}"
107
+ }
108
+ ]
109
+ }
110
+ ]
111
+ },
112
+ {
113
+ "matcher": {
114
+ "id": "byName",
115
+ "options": "Start Block"
116
+ },
117
+ "properties": [
118
+ {
119
+ "id": "links",
120
+ "value": [
121
+ {
122
+ "targetBlank": true,
123
+ "title": "View on Etherscan",
124
+ "url": "https://etherscan.io/block/${__value.raw}"
125
+ }
126
+ ]
127
+ }
128
+ ]
129
+ },
130
+ {
131
+ "matcher": {
132
+ "id": "byName",
133
+ "options": "End Block"
134
+ },
135
+ "properties": [
136
+ {
137
+ "id": "links",
138
+ "value": [
139
+ {
140
+ "targetBlank": true,
141
+ "title": "View on Etherscan",
142
+ "url": "https://etherscan.io/block/${__value.raw}"
143
+ }
144
+ ]
145
+ }
146
+ ]
147
+ },
148
+ {
149
+ "matcher": {
150
+ "id": "byName",
151
+ "options": "Budget Request"
152
+ },
153
+ "properties": [
154
+ {
155
+ "id": "links",
156
+ "value": [
157
+ {
158
+ "targetBlank": true,
159
+ "title": "View Budget Request on Github",
160
+ "url": "https://github.com/yearn/budget/issues/${__value.raw}"
161
+ }
162
+ ]
163
+ }
164
+ ]
165
+ }
166
+ ]
59
167
  },
60
168
  "gridPos": {
61
169
  "h": 19,
@@ -69,37 +177,33 @@
69
177
  "footer": {
70
178
  "countRows": false,
71
179
  "fields": "",
72
- "reducer": [
73
- "sum"
74
- ],
180
+ "reducer": ["sum"],
75
181
  "show": false
76
182
  },
77
183
  "showHeader": true
78
184
  },
79
- "pluginVersion": "10.2.0",
185
+ "pluginVersion": "12.1.1",
80
186
  "targets": [
81
187
  {
82
188
  "datasource": {
83
189
  "type": "frser-sqlite-datasource",
84
190
  "uid": "P2D2EEF3E092AF52B"
85
191
  },
86
- "queryText": "select stream_id as \"Stream ID\", b.address as \"Factory\", start_block as \"Start Block\", end_block as \"End Block\", c.symbol as \"Token\", d.address as \"From\", e.address as \"To\", reason as \"Reason\", amount_per_second as \"Amount Per Second\", status as \"Status\", txgroup as \"TxGroup\"\nfrom streams a\nleft join addresses b on a.contract = b.address_id\nleft join tokens c on a.token = c.token_id\nleft join addresses d on a.from_address = d.address_id\nleft join addresses e on a.to_address = e.address_id",
192
+ "queryText": "SELECT\n stream_id as \"Stream ID\",\n b.address as \"Factory\",\n start_block as \"Start Block\",\n end_block as \"End Block\",\n c.symbol as \"Token\",\n d.address as \"From\",\n e.address as \"To\",\n reason as \"Reason\",\n CASE\n WHEN reason LIKE 'gh-%' AND\n -- ensures all after \"gh-\" is digits\n REPLACE(SUBSTR(reason, 4), '0', '') >= '' AND\n CAST(SUBSTR(reason, 4) AS INTEGER) || '' = SUBSTR(reason, 4)\n THEN CAST(SUBSTR(reason, 4) AS INTEGER)\n ELSE NULL\n END AS \"Budget Request\",\n amount_per_second as \"Amount Per Second\",\n status as \"Status\",\n txgroup as \"TxGroup\"\n\nFROM streams a\nLEFT JOIN addresses b ON a.contract = b.address_id\nLEFT JOIN tokens c ON a.token = c.token_id\nLEFT JOIN addresses d ON a.from_address = d.address_id\nLEFT JOIN addresses e ON a.to_address = e.address_id",
87
193
  "queryType": "table",
88
- "rawQueryText": "select stream_id as \"Stream ID\", b.address as \"Factory\", start_block as \"Start Block\", end_block as \"End Block\", c.symbol as \"Token\", d.address as \"From\", e.address as \"To\", reason as \"Reason\", amount_per_second as \"Amount Per Second\", status as \"Status\", txgroup as \"TxGroup\"\nfrom streams a\nleft join addresses b on a.contract = b.address_id\nleft join tokens c on a.token = c.token_id\nleft join addresses d on a.from_address = d.address_id\nleft join addresses e on a.to_address = e.address_id",
194
+ "rawQueryText": "SELECT\n stream_id as \"Stream ID\",\n b.address as \"Factory\",\n start_block as \"Start Block\",\n end_block as \"End Block\",\n c.symbol as \"Token\",\n d.address as \"From\",\n e.address as \"To\",\n reason as \"Reason\",\n CASE\n WHEN reason LIKE 'gh-%' AND\n -- ensures all after \"gh-\" is digits\n REPLACE(SUBSTR(reason, 4), '0', '') >= '' AND\n CAST(SUBSTR(reason, 4) AS INTEGER) || '' = SUBSTR(reason, 4)\n THEN CAST(SUBSTR(reason, 4) AS INTEGER)\n ELSE NULL\n END AS \"Budget Request\",\n amount_per_second as \"Amount Per Second\",\n status as \"Status\",\n txgroup as \"TxGroup\"\n\nFROM streams a\nLEFT JOIN addresses b ON a.contract = b.address_id\nLEFT JOIN tokens c ON a.token = c.token_id\nLEFT JOIN addresses d ON a.from_address = d.address_id\nLEFT JOIN addresses e ON a.to_address = e.address_id",
89
195
  "refId": "A",
90
- "timeColumns": [
91
- "time",
92
- "ts"
93
- ]
196
+ "timeColumns": ["time", "ts"]
94
197
  }
95
198
  ],
96
199
  "title": "LlamaPay Streams",
97
200
  "type": "table"
98
201
  }
99
202
  ],
203
+ "preload": false,
100
204
  "refresh": "",
101
- "schemaVersion": 38,
102
- "tags": [],
205
+ "schemaVersion": 41,
206
+ "tags": ["streams", "llamapay", "payments"],
103
207
  "templating": {
104
208
  "list": []
105
209
  },
@@ -110,7 +214,7 @@
110
214
  "timepicker": {},
111
215
  "timezone": "",
112
216
  "title": "LlamaPay",
217
+ "description": "A simple dashboard with a comprehensive view of all LlamaPay payment streams managed by the DAO, including stream status, participants, configuration, and transaction group.",
113
218
  "uid": "aa4d62a2-9e52-4acc-8f38-a96c77810aca",
114
- "version": 1,
115
- "weekStart": ""
116
- }
219
+ "version": 3
220
+ }
@@ -12,46 +12,314 @@
12
12
  }
13
13
  ]
14
14
  },
15
+ "description": "Summarizes the DAO's monthly profit and loss, providing a breakdown of sorted and unsorted financial activity for each month. Supports financial reporting and tracking the progress of transaction categorization.",
15
16
  "editable": true,
16
17
  "fiscalYearStartMonth": 0,
17
18
  "graphTooltip": 0,
18
19
  "id": 2,
19
20
  "links": [],
20
- "liveNow": false,
21
21
  "panels": [
22
22
  {
23
23
  "datasource": "SQLite",
24
+ "description": "Displays a table of monthly profit and loss for the DAO, including Revenue, Cost of Revenue, Expenses, Other Income, Other Expense, Sorted Net, Unsorted Income, Unsorted Expense.\n\nUseful for high-level financial reporting and tracking the progress of transaction categorization.\n\nClick on any underlined cell value to see all transactions for that transaction group and time period.\n\nYou can download this table as a CSV. Click on the three dots in the upper right corner, navigate \"Inspect\" -> \"Data\", select your desired options and click \"Download CSV\".",
24
25
  "fieldConfig": {
25
26
  "defaults": {
26
27
  "color": {
27
- "mode": "thresholds"
28
+ "mode": "continuous-RdYlGr"
28
29
  },
29
30
  "custom": {
30
31
  "align": "auto",
31
32
  "cellOptions": {
32
33
  "type": "auto"
33
34
  },
34
- "inspect": false
35
+ "footer": {
36
+ "reducers": ["sum", "max", "mean", "median"]
37
+ },
38
+ "inspect": true
35
39
  },
40
+ "fieldMinMax": true,
41
+ "links": [
42
+ {
43
+ "targetBlank": true,
44
+ "title": "View ${__field.name} transactions for this period",
45
+ "url": "/d/b21f1092-66a4-4fb0-90ef-ed77d2becaa4/treasury-transactions?var-Top=${__field.name}&from=${__data.fields.month_start}&to=${__data.fields.month_end}"
46
+ }
47
+ ],
36
48
  "mappings": [],
37
49
  "thresholds": {
38
50
  "mode": "absolute",
39
51
  "steps": [
40
52
  {
41
53
  "color": "green",
42
- "value": null
54
+ "value": 0
43
55
  },
44
56
  {
45
57
  "color": "red",
46
58
  "value": 80
47
59
  }
48
60
  ]
49
- }
61
+ },
62
+ "unit": "currencyUSD"
50
63
  },
51
- "overrides": []
64
+ "overrides": [
65
+ {
66
+ "matcher": {
67
+ "id": "byName",
68
+ "options": "Sorted Net"
69
+ },
70
+ "properties": [
71
+ {
72
+ "id": "custom.cellOptions",
73
+ "value": {
74
+ "type": "color-text"
75
+ }
76
+ },
77
+ {
78
+ "id": "links"
79
+ }
80
+ ]
81
+ },
82
+ {
83
+ "matcher": {
84
+ "id": "byName",
85
+ "options": "Net"
86
+ },
87
+ "properties": [
88
+ {
89
+ "id": "custom.cellOptions",
90
+ "value": {
91
+ "type": "color-text"
92
+ }
93
+ },
94
+ {
95
+ "id": "links"
96
+ }
97
+ ]
98
+ },
99
+ {
100
+ "matcher": {
101
+ "id": "byName",
102
+ "options": "Unsorted Income"
103
+ },
104
+ "properties": [
105
+ {
106
+ "id": "custom.cellOptions",
107
+ "value": {
108
+ "type": "color-text"
109
+ }
110
+ },
111
+ {
112
+ "id": "color",
113
+ "value": {
114
+ "mode": "fixed"
115
+ }
116
+ }
117
+ ]
118
+ },
119
+ {
120
+ "matcher": {
121
+ "id": "byName",
122
+ "options": "Unsorted Expenses"
123
+ },
124
+ "properties": [
125
+ {
126
+ "id": "custom.cellOptions",
127
+ "value": {
128
+ "type": "color-text"
129
+ }
130
+ },
131
+ {
132
+ "id": "color",
133
+ "value": {
134
+ "mode": "fixed"
135
+ }
136
+ }
137
+ ]
138
+ },
139
+ {
140
+ "matcher": {
141
+ "id": "byName",
142
+ "options": "Other Income"
143
+ },
144
+ "properties": [
145
+ {
146
+ "id": "custom.cellOptions",
147
+ "value": {
148
+ "type": "color-text"
149
+ }
150
+ },
151
+ {
152
+ "id": "color",
153
+ "value": {
154
+ "mode": "fixed"
155
+ }
156
+ }
157
+ ]
158
+ },
159
+ {
160
+ "matcher": {
161
+ "id": "byName",
162
+ "options": "Other Expenses"
163
+ },
164
+ "properties": [
165
+ {
166
+ "id": "custom.cellOptions",
167
+ "value": {
168
+ "type": "color-text"
169
+ }
170
+ },
171
+ {
172
+ "id": "color",
173
+ "value": {
174
+ "mode": "fixed"
175
+ }
176
+ }
177
+ ]
178
+ },
179
+ {
180
+ "matcher": {
181
+ "id": "byName",
182
+ "options": "Operating Net"
183
+ },
184
+ "properties": [
185
+ {
186
+ "id": "custom.cellOptions",
187
+ "value": {
188
+ "type": "color-text"
189
+ }
190
+ },
191
+ {
192
+ "id": "color",
193
+ "value": {
194
+ "mode": "continuous-RdYlGr"
195
+ }
196
+ },
197
+ {
198
+ "id": "links"
199
+ }
200
+ ]
201
+ },
202
+ {
203
+ "matcher": {
204
+ "id": "byName",
205
+ "options": "month_start"
206
+ },
207
+ "properties": [
208
+ {
209
+ "id": "unit"
210
+ },
211
+ {
212
+ "id": "custom.hideFrom.viz",
213
+ "value": true
214
+ }
215
+ ]
216
+ },
217
+ {
218
+ "matcher": {
219
+ "id": "byName",
220
+ "options": "month_end"
221
+ },
222
+ "properties": [
223
+ {
224
+ "id": "unit"
225
+ },
226
+ {
227
+ "id": "custom.hideFrom.viz",
228
+ "value": true
229
+ }
230
+ ]
231
+ },
232
+ {
233
+ "matcher": {
234
+ "id": "byName",
235
+ "options": "Revenue"
236
+ },
237
+ "properties": [
238
+ {
239
+ "id": "custom.cellOptions",
240
+ "value": {
241
+ "type": "color-text"
242
+ }
243
+ },
244
+ {
245
+ "id": "color",
246
+ "value": {
247
+ "fixedColor": "#ffffff",
248
+ "mode": "fixed"
249
+ }
250
+ }
251
+ ]
252
+ },
253
+ {
254
+ "matcher": {
255
+ "id": "byName",
256
+ "options": "Expenses"
257
+ },
258
+ "properties": [
259
+ {
260
+ "id": "custom.cellOptions",
261
+ "value": {
262
+ "type": "color-text"
263
+ }
264
+ },
265
+ {
266
+ "id": "color",
267
+ "value": {
268
+ "fixedColor": "#ffffff",
269
+ "mode": "fixed"
270
+ }
271
+ }
272
+ ]
273
+ },
274
+ {
275
+ "matcher": {
276
+ "id": "byName",
277
+ "options": "Cost of Revenue"
278
+ },
279
+ "properties": [
280
+ {
281
+ "id": "color",
282
+ "value": {
283
+ "fixedColor": "#ffffff",
284
+ "mode": "fixed"
285
+ }
286
+ },
287
+ {
288
+ "id": "custom.cellOptions",
289
+ "value": {
290
+ "type": "color-text"
291
+ }
292
+ }
293
+ ]
294
+ },
295
+ {
296
+ "matcher": {
297
+ "id": "byName",
298
+ "options": "Month"
299
+ },
300
+ "properties": [
301
+ {
302
+ "id": "color",
303
+ "value": {
304
+ "fixedColor": "#ffffff",
305
+ "mode": "fixed"
306
+ }
307
+ },
308
+ {
309
+ "id": "custom.cellOptions",
310
+ "value": {
311
+ "type": "color-text"
312
+ }
313
+ },
314
+ {
315
+ "id": "links"
316
+ }
317
+ ]
318
+ }
319
+ ]
52
320
  },
53
321
  "gridPos": {
54
- "h": 9,
322
+ "h": 20,
55
323
  "w": 24,
56
324
  "x": 0,
57
325
  "y": 0
@@ -59,14 +327,6 @@
59
327
  "id": 1,
60
328
  "options": {
61
329
  "cellHeight": "sm",
62
- "footer": {
63
- "countRows": false,
64
- "fields": "",
65
- "reducer": [
66
- "sum"
67
- ],
68
- "show": false
69
- },
70
330
  "showHeader": true,
71
331
  "sortBy": [
72
332
  {
@@ -75,33 +335,35 @@
75
335
  }
76
336
  ]
77
337
  },
78
- "pluginVersion": "10.2.0",
338
+ "pluginVersion": "12.2.1",
79
339
  "targets": [
80
340
  {
81
341
  "datasource": "SQLite",
82
- "queryText": "SELECT\n month AS \"Month\",\n SUM(CASE WHEN s.top_category = 'Revenue' THEN value_usd ELSE 0 END) AS \"Revenue\",\n SUM(CASE WHEN s.top_category = 'Cost of Revenue' THEN value_usd ELSE 0 END) AS \"Cost of Revenue\",\n SUM(CASE WHEN s.top_category = 'Expenses' THEN value_usd ELSE 0 END) AS \"Expenses\",\n SUM(CASE WHEN s.top_category = 'Other Income' THEN value_usd ELSE 0 END) AS \"Other Income\",\n SUM(CASE WHEN s.top_category = 'Other Expenses' THEN value_usd ELSE 0 END) AS \"Other Expense\",\n (\n SUM(CASE WHEN s.top_category = 'Revenue' THEN value_usd ELSE 0 END)\n - SUM(CASE WHEN s.top_category = 'Cost of Revenue' THEN value_usd ELSE 0 END)\n - SUM(CASE WHEN s.top_category = 'Expenses' THEN value_usd ELSE 0 END)\n + SUM(CASE WHEN s.top_category = 'Other Income' THEN value_usd ELSE 0 END)\n - SUM(CASE WHEN s.top_category = 'Other Expenses' THEN value_usd ELSE 0 END)\n ) AS \"Sorted Net\",\n SUM(CASE WHEN s.top_category = 'Sort Me (Inbound)' THEN value_usd ELSE 0 END) AS \"Unsorted Income\",\n SUM(CASE WHEN s.top_category = 'Sort Me (Outbound)' THEN value_usd ELSE 0 END) AS \"Unsorted Expense\",\n (\n SUM(CASE WHEN s.top_category = 'Revenue' THEN value_usd ELSE 0 END)\n - SUM(CASE WHEN s.top_category = 'Cost of Revenue' THEN value_usd ELSE 0 END)\n - SUM(CASE WHEN s.top_category = 'Expenses' THEN value_usd ELSE 0 END)\n + SUM(CASE WHEN s.top_category = 'Other Income' THEN value_usd ELSE 0 END)\n - SUM(CASE WHEN s.top_category = 'Other Expenses' THEN value_usd ELSE 0 END)\n + SUM(CASE WHEN s.top_category = 'Sort Me (Inbound)' THEN value_usd ELSE 0 END)\n - SUM(CASE WHEN s.top_category = 'Sort Me (Outbound)' THEN value_usd ELSE 0 END)\n ) AS \"Net\"\nFROM (\n SELECT\n strftime('%Y-%m', datetime(t.timestamp, 'unixepoch')) AS month,\n gh.top_category,\n COALESCE(t.value_usd, 0) AS value_usd\n FROM treasury_txs AS t\n JOIN txgroups AS tg ON t.txgroup_id = tg.txgroup_id\n JOIN txgroup_hierarchy AS gh ON tg.txgroup_id = gh.txgroup_id\n WHERE t.timestamp >= strftime('%s', '2025-01-01') AND tg.name <> 'Ignore'\n) AS s\nGROUP BY month;",
342
+ "queryText": "SELECT\n month AS \"Month\",\n SUM(CASE WHEN s.top_category = 'Revenue' THEN value_usd ELSE 0 END) AS \"Revenue\",\n SUM(CASE WHEN s.top_category = 'Cost of Revenue' THEN value_usd ELSE 0 END) AS \"Cost of Revenue\",\n SUM(CASE WHEN s.top_category = 'Expenses' THEN value_usd ELSE 0 END) AS \"Expenses\",\n (\n SUM(CASE WHEN s.top_category = 'Revenue' THEN value_usd ELSE 0 END)\n - SUM(CASE WHEN s.top_category = 'Cost of Revenue' THEN value_usd ELSE 0 END)\n - SUM(CASE WHEN s.top_category = 'Expenses' THEN value_usd ELSE 0 END)\n ) AS \"Operating Net\",\n SUM(CASE WHEN s.top_category = 'Other Income' THEN value_usd ELSE 0 END) AS \"Other Income\",\n SUM(CASE WHEN s.top_category = 'Other Expenses' THEN value_usd ELSE 0 END) AS \"Other Expenses\",\n (\n SUM(CASE WHEN s.top_category = 'Revenue' THEN value_usd ELSE 0 END)\n - SUM(CASE WHEN s.top_category = 'Cost of Revenue' THEN value_usd ELSE 0 END)\n - SUM(CASE WHEN s.top_category = 'Expenses' THEN value_usd ELSE 0 END)\n + SUM(CASE WHEN s.top_category = 'Other Income' THEN value_usd ELSE 0 END)\n - SUM(CASE WHEN s.top_category = 'Other Expenses' THEN value_usd ELSE 0 END)\n ) AS \"Sorted Net\",\n SUM(CASE WHEN s.top_category = 'Sort Me (Inbound)' THEN value_usd ELSE 0 END) AS \"Unsorted Income\",\n SUM(CASE WHEN s.top_category = 'Sort Me (Outbound)' THEN value_usd ELSE 0 END) AS \"Unsorted Expenses\",\n (\n SUM(CASE WHEN s.top_category = 'Revenue' THEN value_usd ELSE 0 END)\n - SUM(CASE WHEN s.top_category = 'Cost of Revenue' THEN value_usd ELSE 0 END)\n - SUM(CASE WHEN s.top_category = 'Expenses' THEN value_usd ELSE 0 END)\n + SUM(CASE WHEN s.top_category = 'Other Income' THEN value_usd ELSE 0 END)\n - SUM(CASE WHEN s.top_category = 'Other Expenses' THEN value_usd ELSE 0 END)\n + SUM(CASE WHEN s.top_category = 'Sort Me (Inbound)' THEN value_usd ELSE 0 END)\n - SUM(CASE WHEN s.top_category = 'Sort Me (Outbound)' THEN value_usd ELSE 0 END)\n ) AS \"Net\",\n -- Month Start as UNIX timestamp (midnight on the first day)\n CAST(strftime('%s', month || '-01') * 1000 AS TEXT) AS \"month_start\",\n -- Month End as UNIX timestamp (one millisecond before the next month starts)\n CAST(strftime('%s', date(month || '-01', '+1 month')) * 1000 - 1 AS TEXT) AS \"month_end\"\nFROM (\n SELECT\n strftime('%Y-%m', datetime(t.timestamp, 'unixepoch')) AS month,\n gh.top_category,\n COALESCE(t.value_usd, 0) AS value_usd\n FROM treasury_txs AS t\n JOIN txgroups AS tg ON t.txgroup_id = tg.txgroup_id\n JOIN txgroup_hierarchy AS gh ON tg.txgroup_id = gh.txgroup_id\n WHERE t.timestamp >= strftime('%s', '2025-01-01') AND tg.name <> 'Ignore'\n) AS s\nGROUP BY month;",
83
343
  "queryType": "table",
84
- "rawQueryText": "SELECT\n month AS \"Month\",\n SUM(CASE WHEN s.top_category = 'Revenue' THEN value_usd ELSE 0 END) AS \"Revenue\",\n SUM(CASE WHEN s.top_category = 'Cost of Revenue' THEN value_usd ELSE 0 END) AS \"Cost of Revenue\",\n SUM(CASE WHEN s.top_category = 'Expenses' THEN value_usd ELSE 0 END) AS \"Expenses\",\n SUM(CASE WHEN s.top_category = 'Other Income' THEN value_usd ELSE 0 END) AS \"Other Income\",\n SUM(CASE WHEN s.top_category = 'Other Expenses' THEN value_usd ELSE 0 END) AS \"Other Expense\",\n (\n SUM(CASE WHEN s.top_category = 'Revenue' THEN value_usd ELSE 0 END)\n - SUM(CASE WHEN s.top_category = 'Cost of Revenue' THEN value_usd ELSE 0 END)\n - SUM(CASE WHEN s.top_category = 'Expenses' THEN value_usd ELSE 0 END)\n + SUM(CASE WHEN s.top_category = 'Other Income' THEN value_usd ELSE 0 END)\n - SUM(CASE WHEN s.top_category = 'Other Expenses' THEN value_usd ELSE 0 END)\n ) AS \"Sorted Net\",\n SUM(CASE WHEN s.top_category = 'Sort Me (Inbound)' THEN value_usd ELSE 0 END) AS \"Unsorted Income\",\n SUM(CASE WHEN s.top_category = 'Sort Me (Outbound)' THEN value_usd ELSE 0 END) AS \"Unsorted Expense\",\n (\n SUM(CASE WHEN s.top_category = 'Revenue' THEN value_usd ELSE 0 END)\n - SUM(CASE WHEN s.top_category = 'Cost of Revenue' THEN value_usd ELSE 0 END)\n - SUM(CASE WHEN s.top_category = 'Expenses' THEN value_usd ELSE 0 END)\n + SUM(CASE WHEN s.top_category = 'Other Income' THEN value_usd ELSE 0 END)\n - SUM(CASE WHEN s.top_category = 'Other Expenses' THEN value_usd ELSE 0 END)\n + SUM(CASE WHEN s.top_category = 'Sort Me (Inbound)' THEN value_usd ELSE 0 END)\n - SUM(CASE WHEN s.top_category = 'Sort Me (Outbound)' THEN value_usd ELSE 0 END)\n ) AS \"Net\"\nFROM (\n SELECT\n strftime('%Y-%m', datetime(t.timestamp, 'unixepoch')) AS month,\n gh.top_category,\n COALESCE(t.value_usd, 0) AS value_usd\n FROM treasury_txs AS t\n JOIN txgroups AS tg ON t.txgroup_id = tg.txgroup_id\n JOIN txgroup_hierarchy AS gh ON tg.txgroup_id = gh.txgroup_id\n WHERE t.timestamp >= strftime('%s', '2025-01-01') AND tg.name <> 'Ignore'\n) AS s\nGROUP BY month;"
344
+ "rawQueryText": "SELECT\n month AS \"Month\",\n SUM(CASE WHEN s.top_category = 'Revenue' THEN value_usd ELSE 0 END) AS \"Revenue\",\n SUM(CASE WHEN s.top_category = 'Cost of Revenue' THEN value_usd ELSE 0 END) AS \"Cost of Revenue\",\n SUM(CASE WHEN s.top_category = 'Expenses' THEN value_usd ELSE 0 END) AS \"Expenses\",\n (\n SUM(CASE WHEN s.top_category = 'Revenue' THEN value_usd ELSE 0 END)\n - SUM(CASE WHEN s.top_category = 'Cost of Revenue' THEN value_usd ELSE 0 END)\n - SUM(CASE WHEN s.top_category = 'Expenses' THEN value_usd ELSE 0 END)\n ) AS \"Operating Net\",\n SUM(CASE WHEN s.top_category = 'Other Income' THEN value_usd ELSE 0 END) AS \"Other Income\",\n SUM(CASE WHEN s.top_category = 'Other Expenses' THEN value_usd ELSE 0 END) AS \"Other Expenses\",\n (\n SUM(CASE WHEN s.top_category = 'Revenue' THEN value_usd ELSE 0 END)\n - SUM(CASE WHEN s.top_category = 'Cost of Revenue' THEN value_usd ELSE 0 END)\n - SUM(CASE WHEN s.top_category = 'Expenses' THEN value_usd ELSE 0 END)\n + SUM(CASE WHEN s.top_category = 'Other Income' THEN value_usd ELSE 0 END)\n - SUM(CASE WHEN s.top_category = 'Other Expenses' THEN value_usd ELSE 0 END)\n ) AS \"Sorted Net\",\n SUM(CASE WHEN s.top_category = 'Sort Me (Inbound)' THEN value_usd ELSE 0 END) AS \"Unsorted Income\",\n SUM(CASE WHEN s.top_category = 'Sort Me (Outbound)' THEN value_usd ELSE 0 END) AS \"Unsorted Expenses\",\n (\n SUM(CASE WHEN s.top_category = 'Revenue' THEN value_usd ELSE 0 END)\n - SUM(CASE WHEN s.top_category = 'Cost of Revenue' THEN value_usd ELSE 0 END)\n - SUM(CASE WHEN s.top_category = 'Expenses' THEN value_usd ELSE 0 END)\n + SUM(CASE WHEN s.top_category = 'Other Income' THEN value_usd ELSE 0 END)\n - SUM(CASE WHEN s.top_category = 'Other Expenses' THEN value_usd ELSE 0 END)\n + SUM(CASE WHEN s.top_category = 'Sort Me (Inbound)' THEN value_usd ELSE 0 END)\n - SUM(CASE WHEN s.top_category = 'Sort Me (Outbound)' THEN value_usd ELSE 0 END)\n ) AS \"Net\",\n -- Month Start as UNIX timestamp (midnight on the first day)\n CAST(strftime('%s', month || '-01') * 1000 AS TEXT) AS \"month_start\",\n -- Month End as UNIX timestamp (one millisecond before the next month starts)\n CAST(strftime('%s', date(month || '-01', '+1 month')) * 1000 - 1 AS TEXT) AS \"month_end\"\nFROM (\n SELECT\n strftime('%Y-%m', datetime(t.timestamp, 'unixepoch')) AS month,\n gh.top_category,\n COALESCE(t.value_usd, 0) AS value_usd\n FROM treasury_txs AS t\n JOIN txgroups AS tg ON t.txgroup_id = tg.txgroup_id\n JOIN txgroup_hierarchy AS gh ON tg.txgroup_id = gh.txgroup_id\n WHERE t.timestamp >= strftime('%s', '2025-01-01') AND tg.name <> 'Ignore'\n) AS s\nGROUP BY month;",
345
+ "refId": "A",
346
+ "timeColumns": ["time", "ts"]
85
347
  }
86
348
  ],
87
349
  "title": "Monthly Profit & Loss",
88
350
  "type": "table"
89
351
  }
90
352
  ],
353
+ "preload": false,
91
354
  "refresh": "",
92
- "schemaVersion": 38,
355
+ "schemaVersion": 42,
93
356
  "tags": [],
94
357
  "templating": {
95
358
  "list": []
96
359
  },
97
360
  "time": {
98
- "from": "now-6h",
361
+ "from": "now/y",
99
362
  "to": "now"
100
363
  },
101
364
  "timepicker": {},
102
365
  "timezone": "",
103
366
  "title": "Monthly P&L",
104
367
  "uid": "a63fa9a7-d4f3-4092-9bde-194add8bcbeb",
105
- "version": 1,
106
- "weekStart": ""
368
+ "version": 6
107
369
  }