dao-treasury 0.0.10__cp310-cp310-win32.whl → 0.0.70__cp310-cp310-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.
Files changed (58) hide show
  1. dao_treasury/.grafana/provisioning/dashboards/breakdowns/Expenses.json +551 -0
  2. dao_treasury/.grafana/provisioning/dashboards/breakdowns/Revenue.json +551 -0
  3. dao_treasury/.grafana/provisioning/dashboards/dashboards.yaml +7 -7
  4. dao_treasury/.grafana/provisioning/dashboards/streams/LlamaPay.json +220 -0
  5. dao_treasury/.grafana/provisioning/dashboards/summary/Monthly.json +153 -29
  6. dao_treasury/.grafana/provisioning/dashboards/transactions/Treasury Transactions.json +181 -29
  7. dao_treasury/.grafana/provisioning/dashboards/treasury/Cashflow (Including Unsorted).json +808 -0
  8. dao_treasury/.grafana/provisioning/dashboards/treasury/Cashflow.json +602 -0
  9. dao_treasury/.grafana/provisioning/dashboards/treasury/Current Treasury Assets.json +981 -0
  10. dao_treasury/.grafana/provisioning/dashboards/treasury/Historical Treasury Balances.json +2989 -0
  11. dao_treasury/.grafana/provisioning/dashboards/treasury/Operating Cashflow.json +478 -0
  12. dao_treasury/.grafana/provisioning/datasources/datasources.yaml +17 -0
  13. dao_treasury/ENVIRONMENT_VARIABLES.py +20 -0
  14. dao_treasury/__init__.py +36 -10
  15. dao_treasury/_docker.cp310-win32.pyd +0 -0
  16. dao_treasury/_docker.py +169 -37
  17. dao_treasury/_nicknames.cp310-win32.pyd +0 -0
  18. dao_treasury/_nicknames.py +32 -0
  19. dao_treasury/_wallet.cp310-win32.pyd +0 -0
  20. dao_treasury/_wallet.py +164 -12
  21. dao_treasury/constants.cp310-win32.pyd +0 -0
  22. dao_treasury/constants.py +39 -0
  23. dao_treasury/db.py +925 -150
  24. dao_treasury/docker-compose.yaml +6 -5
  25. dao_treasury/main.py +238 -28
  26. dao_treasury/sorting/__init__.cp310-win32.pyd +0 -0
  27. dao_treasury/sorting/__init__.py +219 -115
  28. dao_treasury/sorting/_matchers.cp310-win32.pyd +0 -0
  29. dao_treasury/sorting/_matchers.py +261 -17
  30. dao_treasury/sorting/_rules.cp310-win32.pyd +0 -0
  31. dao_treasury/sorting/_rules.py +166 -21
  32. dao_treasury/sorting/factory.cp310-win32.pyd +0 -0
  33. dao_treasury/sorting/factory.py +245 -37
  34. dao_treasury/sorting/rule.cp310-win32.pyd +0 -0
  35. dao_treasury/sorting/rule.py +228 -46
  36. dao_treasury/sorting/rules/__init__.cp310-win32.pyd +0 -0
  37. dao_treasury/sorting/rules/__init__.py +1 -0
  38. dao_treasury/sorting/rules/ignore/__init__.cp310-win32.pyd +0 -0
  39. dao_treasury/sorting/rules/ignore/__init__.py +1 -0
  40. dao_treasury/sorting/rules/ignore/llamapay.cp310-win32.pyd +0 -0
  41. dao_treasury/sorting/rules/ignore/llamapay.py +20 -0
  42. dao_treasury/streams/__init__.cp310-win32.pyd +0 -0
  43. dao_treasury/streams/__init__.py +0 -0
  44. dao_treasury/streams/llamapay.cp310-win32.pyd +0 -0
  45. dao_treasury/streams/llamapay.py +388 -0
  46. dao_treasury/treasury.py +118 -25
  47. dao_treasury/types.cp310-win32.pyd +0 -0
  48. dao_treasury/types.py +104 -7
  49. dao_treasury-0.0.70.dist-info/METADATA +134 -0
  50. dao_treasury-0.0.70.dist-info/RECORD +54 -0
  51. dao_treasury-0.0.70.dist-info/top_level.txt +2 -0
  52. dao_treasury__mypyc.cp310-win32.pyd +0 -0
  53. a743a720bbc4482d330e__mypyc.cp310-win32.pyd +0 -0
  54. dao_treasury/.grafana/provisioning/datasources/sqlite.yaml +0 -10
  55. dao_treasury-0.0.10.dist-info/METADATA +0 -36
  56. dao_treasury-0.0.10.dist-info/RECORD +0 -28
  57. dao_treasury-0.0.10.dist-info/top_level.txt +0 -2
  58. {dao_treasury-0.0.10.dist-info → dao_treasury-0.0.70.dist-info}/WHEEL +0 -0
@@ -0,0 +1,220 @@
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": 0,
21
+ "id": 11,
22
+ "links": [],
23
+ "panels": [
24
+ {
25
+ "datasource": {
26
+ "type": "frser-sqlite-datasource",
27
+ "uid": "P2D2EEF3E092AF52B"
28
+ },
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.",
30
+ "fieldConfig": {
31
+ "defaults": {
32
+ "color": {
33
+ "mode": "thresholds"
34
+ },
35
+ "custom": {
36
+ "align": "auto",
37
+ "cellOptions": {
38
+ "type": "auto"
39
+ },
40
+ "inspect": false
41
+ },
42
+ "mappings": [],
43
+ "thresholds": {
44
+ "mode": "absolute",
45
+ "steps": [
46
+ {
47
+ "color": "green",
48
+ "value": 0
49
+ },
50
+ {
51
+ "color": "red",
52
+ "value": 80
53
+ }
54
+ ]
55
+ }
56
+ },
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
+ ]
167
+ },
168
+ "gridPos": {
169
+ "h": 19,
170
+ "w": 24,
171
+ "x": 0,
172
+ "y": 0
173
+ },
174
+ "id": 1,
175
+ "options": {
176
+ "cellHeight": "sm",
177
+ "footer": {
178
+ "countRows": false,
179
+ "fields": "",
180
+ "reducer": ["sum"],
181
+ "show": false
182
+ },
183
+ "showHeader": true
184
+ },
185
+ "pluginVersion": "12.1.1",
186
+ "targets": [
187
+ {
188
+ "datasource": {
189
+ "type": "frser-sqlite-datasource",
190
+ "uid": "P2D2EEF3E092AF52B"
191
+ },
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",
193
+ "queryType": "table",
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",
195
+ "refId": "A",
196
+ "timeColumns": ["time", "ts"]
197
+ }
198
+ ],
199
+ "title": "LlamaPay Streams",
200
+ "type": "table"
201
+ }
202
+ ],
203
+ "preload": false,
204
+ "refresh": "",
205
+ "schemaVersion": 41,
206
+ "tags": ["streams", "llamapay", "payments"],
207
+ "templating": {
208
+ "list": []
209
+ },
210
+ "time": {
211
+ "from": "now-6h",
212
+ "to": "now"
213
+ },
214
+ "timepicker": {},
215
+ "timezone": "",
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.",
218
+ "uid": "aa4d62a2-9e52-4acc-8f38-a96c77810aca",
219
+ "version": 3
220
+ }
@@ -12,46 +12,181 @@
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.",
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,
36
41
  "mappings": [],
37
42
  "thresholds": {
38
43
  "mode": "absolute",
39
44
  "steps": [
40
45
  {
41
46
  "color": "green",
42
- "value": null
47
+ "value": 0
43
48
  },
44
49
  {
45
50
  "color": "red",
46
51
  "value": 80
47
52
  }
48
53
  ]
49
- }
54
+ },
55
+ "unit": "currencyUSD"
50
56
  },
51
- "overrides": []
57
+ "overrides": [
58
+ {
59
+ "matcher": {
60
+ "id": "byName",
61
+ "options": "Sorted Net"
62
+ },
63
+ "properties": [
64
+ {
65
+ "id": "custom.cellOptions",
66
+ "value": {
67
+ "type": "color-text"
68
+ }
69
+ }
70
+ ]
71
+ },
72
+ {
73
+ "matcher": {
74
+ "id": "byName",
75
+ "options": "Net"
76
+ },
77
+ "properties": [
78
+ {
79
+ "id": "custom.cellOptions",
80
+ "value": {
81
+ "type": "color-text"
82
+ }
83
+ }
84
+ ]
85
+ },
86
+ {
87
+ "matcher": {
88
+ "id": "byName",
89
+ "options": "Unsorted Income"
90
+ },
91
+ "properties": [
92
+ {
93
+ "id": "custom.cellOptions",
94
+ "value": {
95
+ "type": "color-text"
96
+ }
97
+ },
98
+ {
99
+ "id": "color",
100
+ "value": {
101
+ "mode": "fixed"
102
+ }
103
+ }
104
+ ]
105
+ },
106
+ {
107
+ "matcher": {
108
+ "id": "byName",
109
+ "options": "Unsorted Expense"
110
+ },
111
+ "properties": [
112
+ {
113
+ "id": "custom.cellOptions",
114
+ "value": {
115
+ "type": "color-text"
116
+ }
117
+ },
118
+ {
119
+ "id": "color",
120
+ "value": {
121
+ "mode": "fixed"
122
+ }
123
+ }
124
+ ]
125
+ },
126
+ {
127
+ "matcher": {
128
+ "id": "byName",
129
+ "options": "Other Income"
130
+ },
131
+ "properties": [
132
+ {
133
+ "id": "custom.cellOptions",
134
+ "value": {
135
+ "type": "color-text"
136
+ }
137
+ },
138
+ {
139
+ "id": "color",
140
+ "value": {
141
+ "mode": "fixed"
142
+ }
143
+ }
144
+ ]
145
+ },
146
+ {
147
+ "matcher": {
148
+ "id": "byName",
149
+ "options": "Other Expense"
150
+ },
151
+ "properties": [
152
+ {
153
+ "id": "custom.cellOptions",
154
+ "value": {
155
+ "type": "color-text"
156
+ }
157
+ },
158
+ {
159
+ "id": "color",
160
+ "value": {
161
+ "mode": "fixed"
162
+ }
163
+ }
164
+ ]
165
+ },
166
+ {
167
+ "matcher": {
168
+ "id": "byName",
169
+ "options": "Operating Net"
170
+ },
171
+ "properties": [
172
+ {
173
+ "id": "custom.cellOptions",
174
+ "value": {
175
+ "type": "color-text"
176
+ }
177
+ },
178
+ {
179
+ "id": "color",
180
+ "value": {
181
+ "mode": "continuous-RdYlGr"
182
+ }
183
+ }
184
+ ]
185
+ }
186
+ ]
52
187
  },
53
188
  "gridPos": {
54
- "h": 9,
189
+ "h": 20,
55
190
  "w": 24,
56
191
  "x": 0,
57
192
  "y": 0
@@ -59,54 +194,43 @@
59
194
  "id": 1,
60
195
  "options": {
61
196
  "cellHeight": "sm",
62
- "footer": {
63
- "countRows": false,
64
- "fields": "",
65
- "reducer": [
66
- "sum"
67
- ],
68
- "show": false
69
- },
70
197
  "showHeader": true,
71
198
  "sortBy": [
72
199
  {
73
200
  "desc": true,
74
- "displayName": "month"
201
+ "displayName": "Month"
75
202
  }
76
203
  ]
77
204
  },
78
- "pluginVersion": "10.2.0",
205
+ "pluginVersion": "12.2.1",
79
206
  "targets": [
80
207
  {
81
208
  "datasource": "SQLite",
82
- "queryText": "SELECT\n month,\n SUM(CASE WHEN top_category = 'Revenue' THEN value_usd ELSE 0 END) AS revenue,\n SUM(CASE WHEN top_category = 'Cost of Revenue' THEN value_usd ELSE 0 END) AS \"cost of revenue\",\n SUM(CASE WHEN top_category = 'Expenses' THEN value_usd ELSE 0 END) AS expenses,\n SUM(CASE WHEN top_category = 'Other Income' THEN value_usd ELSE 0 END) AS \"other income\",\n SUM(CASE WHEN top_category = 'Other Expenses' THEN value_usd ELSE 0 END) AS \"other expense\",\n (\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 SUM(CASE WHEN top_category = 'Other Income' THEN value_usd ELSE 0 END) -\n SUM(CASE WHEN top_category = 'Other Expenses' THEN value_usd ELSE 0 END)\n ) AS \"sorted net\",\n SUM(CASE WHEN top_category = 'Sort Me (Inbound)' THEN value_usd ELSE 0 END) AS \"unsorted income\",\n SUM(CASE WHEN top_category = 'Sort Me (Outbound)' THEN value_usd ELSE 0 END) AS \"unsorted expense\",\n (\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 SUM(CASE WHEN top_category = 'Other Income' THEN value_usd ELSE 0 END) -\n SUM(CASE WHEN top_category = 'Other Expenses' THEN value_usd ELSE 0 END) +\n SUM(CASE WHEN top_category = 'Sort Me (Inbound)' THEN value_usd ELSE 0 END) -\n SUM(CASE WHEN 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 CASE\n WHEN p.name IS NOT NULL THEN p.name\n ELSE tg.name\n END AS top_category,\n COALESCE(t.value_usd, 0) AS value_usd\n --COALESCE(t.gas_used, 0) * COALESCE(t.gas_price, 0) AS gas_cost\n FROM treasury_txs t\n JOIN txgroups tg ON t.txgroup_id = tg.txgroup_id\n LEFT JOIN txgroups p ON tg.parent_txgroup = p.txgroup_id\n WHERE t.timestamp >= strftime('%s', '2025-01-01') and tg.name <> 'Ignore'\n) as s\nGROUP BY month;",
209
+ "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 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;",
83
210
  "queryType": "table",
84
- "rawQueryText": "SELECT\n month,\n SUM(CASE WHEN top_category = 'Revenue' THEN value_usd ELSE 0 END) AS revenue,\n SUM(CASE WHEN top_category = 'Cost of Revenue' THEN value_usd ELSE 0 END) AS \"cost of revenue\",\n SUM(CASE WHEN top_category = 'Expenses' THEN value_usd ELSE 0 END) AS expenses,\n SUM(CASE WHEN top_category = 'Other Income' THEN value_usd ELSE 0 END) AS \"other income\",\n SUM(CASE WHEN top_category = 'Other Expenses' THEN value_usd ELSE 0 END) AS \"other expense\",\n (\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 SUM(CASE WHEN top_category = 'Other Income' THEN value_usd ELSE 0 END) -\n SUM(CASE WHEN top_category = 'Other Expenses' THEN value_usd ELSE 0 END)\n ) AS \"sorted net\",\n SUM(CASE WHEN top_category = 'Sort Me (Inbound)' THEN value_usd ELSE 0 END) AS \"unsorted income\",\n SUM(CASE WHEN top_category = 'Sort Me (Outbound)' THEN value_usd ELSE 0 END) AS \"unsorted expense\",\n (\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 SUM(CASE WHEN top_category = 'Other Income' THEN value_usd ELSE 0 END) -\n SUM(CASE WHEN top_category = 'Other Expenses' THEN value_usd ELSE 0 END) +\n SUM(CASE WHEN top_category = 'Sort Me (Inbound)' THEN value_usd ELSE 0 END) -\n SUM(CASE WHEN 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 CASE\n WHEN p.name IS NOT NULL THEN p.name\n ELSE tg.name\n END AS top_category,\n COALESCE(t.value_usd, 0) AS value_usd\n --COALESCE(t.gas_used, 0) * COALESCE(t.gas_price, 0) AS gas_cost\n FROM treasury_txs t\n JOIN txgroups tg ON t.txgroup_id = tg.txgroup_id\n LEFT JOIN txgroups p ON tg.parent_txgroup = p.txgroup_id\n WHERE t.timestamp >= strftime('%s', '2025-01-01') and tg.name <> 'Ignore'\n) as s\nGROUP BY month;",
211
+ "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 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;",
85
212
  "refId": "A",
86
- "timeColumns": [
87
- "time",
88
- "ts"
89
- ]
213
+ "timeColumns": ["time", "ts"]
90
214
  }
91
215
  ],
92
- "title": "Panel Title",
216
+ "title": "Monthly Profit & Loss",
93
217
  "type": "table"
94
218
  }
95
219
  ],
220
+ "preload": false,
96
221
  "refresh": "",
97
- "schemaVersion": 38,
222
+ "schemaVersion": 42,
98
223
  "tags": [],
99
224
  "templating": {
100
225
  "list": []
101
226
  },
102
227
  "time": {
103
- "from": "now-6h",
228
+ "from": "now/y",
104
229
  "to": "now"
105
230
  },
106
231
  "timepicker": {},
107
232
  "timezone": "",
108
233
  "title": "Monthly P&L",
109
234
  "uid": "a63fa9a7-d4f3-4092-9bde-194add8bcbeb",
110
- "version": 1,
111
- "weekStart": ""
112
- }
235
+ "version": 6
236
+ }