dao-treasury 0.0.71__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.

Files changed (40) hide show
  1. dao_treasury/.grafana/provisioning/dashboards/breakdowns/Expenses.json +89 -73
  2. dao_treasury/.grafana/provisioning/dashboards/breakdowns/Revenue.json +86 -68
  3. dao_treasury/.grafana/provisioning/dashboards/streams/LlamaPay.json +5 -12
  4. dao_treasury/.grafana/provisioning/dashboards/summary/Monthly.json +5 -6
  5. dao_treasury/.grafana/provisioning/dashboards/transactions/Treasury Transactions.json +220 -195
  6. dao_treasury/.grafana/provisioning/dashboards/transactions/Unsorted Transactions.json +367 -0
  7. dao_treasury/.grafana/provisioning/dashboards/treasury/Cashflow (Including Unsorted).json +61 -71
  8. dao_treasury/.grafana/provisioning/dashboards/treasury/Cashflow.json +43 -50
  9. dao_treasury/.grafana/provisioning/dashboards/treasury/Current Treasury Assets.json +50 -90
  10. dao_treasury/.grafana/provisioning/dashboards/treasury/Historical Treasury Balances.json +1403 -532
  11. dao_treasury/.grafana/provisioning/dashboards/treasury/Operating Cashflow.json +31 -36
  12. dao_treasury/.grafana/provisioning/datasources/datasources.yaml +9 -4
  13. dao_treasury/__init__.py +0 -4
  14. dao_treasury/_docker.cp311-win_amd64.pyd +0 -0
  15. dao_treasury/_docker.py +6 -2
  16. dao_treasury/_nicknames.cp311-win_amd64.pyd +0 -0
  17. dao_treasury/_nicknames.py +3 -2
  18. dao_treasury/_wallet.cp311-win_amd64.pyd +0 -0
  19. dao_treasury/constants.cp311-win_amd64.pyd +0 -0
  20. dao_treasury/db.py +340 -120
  21. dao_treasury/docker-compose.yaml +18 -2
  22. dao_treasury/main.py +5 -2
  23. dao_treasury/sorting/__init__.cp311-win_amd64.pyd +0 -0
  24. dao_treasury/sorting/__init__.py +38 -21
  25. dao_treasury/sorting/_matchers.cp311-win_amd64.pyd +0 -0
  26. dao_treasury/sorting/_rules.cp311-win_amd64.pyd +0 -0
  27. dao_treasury/sorting/factory.cp311-win_amd64.pyd +0 -0
  28. dao_treasury/sorting/rule.cp311-win_amd64.pyd +0 -0
  29. dao_treasury/sorting/rules/__init__.cp311-win_amd64.pyd +0 -0
  30. dao_treasury/sorting/rules/ignore/__init__.cp311-win_amd64.pyd +0 -0
  31. dao_treasury/sorting/rules/ignore/llamapay.cp311-win_amd64.pyd +0 -0
  32. dao_treasury/types.cp311-win_amd64.pyd +0 -0
  33. {dao_treasury-0.0.71.dist-info → dao_treasury-0.1.1.dist-info}/METADATA +3 -2
  34. dao_treasury-0.1.1.dist-info/RECORD +53 -0
  35. dao_treasury__mypyc.cp311-win_amd64.pyd +0 -0
  36. dao_treasury/streams/__init__.cp311-win_amd64.pyd +0 -0
  37. dao_treasury/streams/llamapay.cp311-win_amd64.pyd +0 -0
  38. dao_treasury-0.0.71.dist-info/RECORD +0 -54
  39. {dao_treasury-0.0.71.dist-info → dao_treasury-0.1.1.dist-info}/WHEEL +0 -0
  40. {dao_treasury-0.0.71.dist-info → dao_treasury-0.1.1.dist-info}/top_level.txt +0 -0
@@ -22,9 +22,8 @@
22
22
  "links": [],
23
23
  "panels": [
24
24
  {
25
- "datasource": "SQLite",
25
+ "datasource": "PostgreSQL",
26
26
  "fieldConfig": {
27
- "unit": "currencyUSD",
28
27
  "defaults": {
29
28
  "color": {
30
29
  "mode": "thresholds"
@@ -42,7 +41,8 @@
42
41
  "value": 80
43
42
  }
44
43
  ]
45
- }
44
+ },
45
+ "unit": "currencyUSD"
46
46
  },
47
47
  "overrides": []
48
48
  },
@@ -71,10 +71,9 @@
71
71
  "pluginVersion": "12.1.1",
72
72
  "targets": [
73
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",
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",
78
77
  "refId": "A",
79
78
  "timeColumns": ["time", "ts"]
80
79
  }
@@ -84,9 +83,8 @@
84
83
  "description": "Displays the total value of all transactions sorted as Revenue for the selected period."
85
84
  },
86
85
  {
87
- "datasource": "SQLite",
86
+ "datasource": "PostgreSQL",
88
87
  "fieldConfig": {
89
- "unit": "currencyUSD",
90
88
  "defaults": {
91
89
  "color": {
92
90
  "mode": "thresholds"
@@ -104,7 +102,8 @@
104
102
  "value": 80
105
103
  }
106
104
  ]
107
- }
105
+ },
106
+ "unit": "currencyUSD"
108
107
  },
109
108
  "overrides": []
110
109
  },
@@ -133,10 +132,9 @@
133
132
  "pluginVersion": "12.1.1",
134
133
  "targets": [
135
134
  {
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",
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",
140
138
  "refId": "A",
141
139
  "timeColumns": ["time", "ts"]
142
140
  }
@@ -146,9 +144,8 @@
146
144
  "description": "Displays the total value of all transactions sorted as Cost of Revenue for the selected period."
147
145
  },
148
146
  {
149
- "datasource": "SQLite",
147
+ "datasource": "PostgreSQL",
150
148
  "fieldConfig": {
151
- "unit": "currencyUSD",
152
149
  "defaults": {
153
150
  "color": {
154
151
  "mode": "thresholds"
@@ -166,7 +163,8 @@
166
163
  "value": 80
167
164
  }
168
165
  ]
169
- }
166
+ },
167
+ "unit": "currencyUSD"
170
168
  },
171
169
  "overrides": []
172
170
  },
@@ -195,10 +193,9 @@
195
193
  "pluginVersion": "12.1.1",
196
194
  "targets": [
197
195
  {
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",
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",
202
199
  "refId": "A",
203
200
  "timeColumns": ["time", "ts"]
204
201
  }
@@ -208,10 +205,9 @@
208
205
  "description": "Displays the total value of all transactions sorted as Expenses for the selected period."
209
206
  },
210
207
  {
211
- "datasource": "SQLite",
208
+ "datasource": "PostgreSQL",
212
209
  "description": "Shows the net operating cashflow (Revenue minus Cost of Revenue and Expenses) for the selected period.",
213
210
  "fieldConfig": {
214
- "unit": "currencyUSD",
215
211
  "defaults": {
216
212
  "color": {
217
213
  "mode": "thresholds"
@@ -229,7 +225,8 @@
229
225
  "value": 80
230
226
  }
231
227
  ]
232
- }
228
+ },
229
+ "unit": "currencyUSD"
233
230
  },
234
231
  "overrides": []
235
232
  },
@@ -258,10 +255,9 @@
258
255
  "pluginVersion": "12.1.1",
259
256
  "targets": [
260
257
  {
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",
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",
265
261
  "refId": "A",
266
262
  "timeColumns": ["time", "ts"]
267
263
  }
@@ -270,10 +266,9 @@
270
266
  "type": "stat"
271
267
  },
272
268
  {
273
- "datasource": "SQLite",
269
+ "datasource": "PostgreSQL",
274
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.",
275
271
  "fieldConfig": {
276
- "unit": "currencyUSD",
277
272
  "defaults": {
278
273
  "color": {
279
274
  "mode": "palette-classic"
@@ -324,7 +319,8 @@
324
319
  "value": 80
325
320
  }
326
321
  ]
327
- }
322
+ },
323
+ "unit": "currencyUSD"
328
324
  },
329
325
  "overrides": [
330
326
  {
@@ -375,10 +371,9 @@
375
371
  "pluginVersion": "12.1.1",
376
372
  "targets": [
377
373
  {
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;",
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;",
382
377
  "refId": "A",
383
378
  "timeColumns": ["timestamp"]
384
379
  }
@@ -474,5 +469,5 @@
474
469
  "title": "Operating Cashflow Summary",
475
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.",
476
471
  "uid": "fdf9969c-357a-4203-ae7b-12816e87bc7e",
477
- "version": 100
472
+ "version": 105
478
473
  }
@@ -1,13 +1,18 @@
1
1
  apiVersion: 1
2
2
 
3
3
  datasources:
4
- - name: SQLite
5
- type: frser-sqlite-datasource
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
- path: /app/dao-treasury-data/dao-treasury.sqlite
10
- secureJsonData: {}
11
+ database: dao_treasury
12
+ sslmode: "disable"
13
+ postgresVersion: 1801
14
+ secureJsonData:
15
+ password: dao_treasury
11
16
 
12
17
  - name: 'PROMETHEUS'
13
18
  type: 'prometheus'
dao_treasury/__init__.py CHANGED
@@ -13,7 +13,6 @@ This is the main import point for users and integrations.
13
13
  """
14
14
 
15
15
  from dao_treasury import ENVIRONMENT_VARIABLES as ENVS
16
- from dao_treasury._nicknames import setup_address_nicknames_in_db
17
16
  from dao_treasury._wallet import TreasuryWallet
18
17
  from dao_treasury.db import TreasuryTx
19
18
  from dao_treasury.sorting import (
@@ -34,9 +33,6 @@ from dao_treasury.sorting import (
34
33
  from dao_treasury.treasury import Treasury
35
34
 
36
35
 
37
- setup_address_nicknames_in_db()
38
-
39
-
40
36
  if ENVS.SQL_DEBUG:
41
37
  import pony.orm
42
38
 
Binary file
dao_treasury/_docker.py CHANGED
@@ -52,8 +52,12 @@ def up(*services: str) -> None:
52
52
  :func:`down`
53
53
  :func:`_exec_command`
54
54
  """
55
- # eth-portfolio containers must be started first so dao-treasury can attach to the eth-portfolio docker network
56
- eth_portfolio_scripts.docker.up("victoria-metrics")
55
+ # the proper envs for victoria-metrics arent set yet when we need to start up the postgres container,
56
+ # but they're ready by the time we start the other containers
57
+ if services != ("postgres",):
58
+ # eth-portfolio containers must be started first so dao-treasury can attach to the eth-portfolio docker network
59
+ eth_portfolio_scripts.docker.up("victoria-metrics")
60
+
57
61
  build(*services)
58
62
  _print_notice("starting", services)
59
63
  _exec_command(["up", "-d", *services])
Binary file
@@ -18,15 +18,16 @@ from typing import Final
18
18
  from pony.orm import db_session
19
19
 
20
20
  from dao_treasury import constants
21
- from dao_treasury.db import Address, _set_address_nicknames_for_tokens
21
+ from dao_treasury.db import Address, init_db, set_address_nicknames_for_tokens
22
22
 
23
23
 
24
24
  set_nickname: Final = Address.set_nickname
25
25
 
26
26
 
27
27
  def setup_address_nicknames_in_db() -> None:
28
+ init_db()
28
29
  with db_session:
29
30
  set_nickname(constants.ZERO_ADDRESS, "Zero Address")
30
31
  for address in constants.DISPERSE_APP:
31
32
  set_nickname(address, "Disperse.app")
32
- _set_address_nicknames_for_tokens()
33
+ set_address_nicknames_for_tokens()
Binary file
Binary file