dao-treasury 0.0.32__cp311-cp311-musllinux_1_2_i686.whl → 0.0.33__cp311-cp311-musllinux_1_2_i686.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.
- bf2b4fe1f86ad2ea158b__mypyc.cpython-311-i386-linux-musl.so +0 -0
- dao_treasury/.grafana/provisioning/dashboards/dashboards.yaml +31 -5
- dao_treasury/.grafana/provisioning/dashboards/summary/Monthly.json +5 -10
- dao_treasury/.grafana/provisioning/dashboards/transactions/Treasury Transactions.json +13 -13
- dao_treasury/.grafana/provisioning/dashboards/treasury/Cashflow (Including Unsorted).json +834 -0
- dao_treasury/.grafana/provisioning/dashboards/treasury/Cashflow.json +25 -428
- dao_treasury/.grafana/provisioning/dashboards/treasury/Operating Cashflow.json +491 -0
- dao_treasury/db.py +58 -31
- dao_treasury/sorting/__init__.py +109 -6
- {dao_treasury-0.0.32.dist-info → dao_treasury-0.0.33.dist-info}/METADATA +2 -2
- {dao_treasury-0.0.32.dist-info → dao_treasury-0.0.33.dist-info}/RECORD +13 -11
- {dao_treasury-0.0.32.dist-info → dao_treasury-0.0.33.dist-info}/WHEEL +0 -0
- {dao_treasury-0.0.32.dist-info → dao_treasury-0.0.33.dist-info}/top_level.txt +0 -0
dao_treasury/sorting/__init__.py
CHANGED
@@ -1,5 +1,28 @@
|
|
1
1
|
"""
|
2
|
-
This module
|
2
|
+
This module provides the core logic for sorting DAO Treasury transactions into transaction groups (categories).
|
3
|
+
|
4
|
+
Sorting enables comprehensive financial reporting and categorization tailored for on-chain organizations.
|
5
|
+
Transactions are matched against either statically defined rules or more advanced dynamic rules based on user-defined matching functions.
|
6
|
+
|
7
|
+
Sorting works by attempting matches in this order:
|
8
|
+
1. Check if the transaction is an internal transfer (within treasury wallets).
|
9
|
+
2. Check if the transaction is "Out of Range" (neither sender nor receiver was a treasury wallet at the time of the tx).
|
10
|
+
3. Match by transaction hash using registered HashMatchers.
|
11
|
+
4. Match by sender address using registered FromAddressMatchers.
|
12
|
+
5. Match by recipient address using registered ToAddressMatchers.
|
13
|
+
6. Assign "Must Sort Inbound" or "Must Sort Outbound" groups if part of treasury.
|
14
|
+
7. Raise an error if no match is found (unexpected case).
|
15
|
+
|
16
|
+
See the complete [sort rules documentation](https://bobthebuidler.github.io/dao-treasury/sort_rules.html) for detailed explanations
|
17
|
+
and examples on defining and registering sort rules.
|
18
|
+
|
19
|
+
See Also:
|
20
|
+
:func:`dao_treasury.sorting.sort_basic`
|
21
|
+
:func:`dao_treasury.sorting.sort_basic_entity`
|
22
|
+
:func:`dao_treasury.sorting.sort_advanced`
|
23
|
+
:class:`dao_treasury.sorting.HashMatcher`
|
24
|
+
:class:`dao_treasury.sorting.FromAddressMatcher`
|
25
|
+
:class:`dao_treasury.sorting.ToAddressMatcher`
|
3
26
|
"""
|
4
27
|
|
5
28
|
from logging import getLogger
|
@@ -72,16 +95,54 @@ INTERNAL_TRANSFER_TXGROUP_DBID: Final = TxGroup.get_dbid(
|
|
72
95
|
name="Internal Transfer",
|
73
96
|
parent=TxGroup.get_dbid("Ignore"),
|
74
97
|
)
|
75
|
-
|
98
|
+
"""Database ID for the 'Internal Transfer' transaction group.
|
99
|
+
|
100
|
+
This group represents transactions that occur internally between treasury-owned wallets.
|
101
|
+
Such internal movements of funds within the DAO's treasury do not require separate handling or reporting.
|
102
|
+
|
103
|
+
See Also:
|
104
|
+
:class:`dao_treasury.db.TxGroup`
|
105
|
+
"""
|
76
106
|
|
77
107
|
OUT_OF_RANGE_TXGROUP_DBID = TxGroup.get_dbid(
|
78
108
|
name="Out of Range", parent=TxGroup.get_dbid("Ignore")
|
79
109
|
)
|
80
|
-
|
110
|
+
"""Database ID for the 'Out of Range' transaction group.
|
111
|
+
|
112
|
+
This category is assigned to transactions where neither the sender nor the recipient
|
113
|
+
wallet are members of the treasury at the time of the transaction.
|
114
|
+
|
115
|
+
See Also:
|
116
|
+
:class:`dao_treasury.db.TxGroup`
|
117
|
+
"""
|
81
118
|
|
82
119
|
|
83
120
|
def sort_basic(entry: LedgerEntry) -> TxGroupDbid:
|
84
|
-
|
121
|
+
"""Determine the transaction group ID for a basic ledger entry using static matching.
|
122
|
+
|
123
|
+
The function attempts to categorize the transaction by testing:
|
124
|
+
- If both 'from' and 'to' addresses are treasury wallets (internal transfer).
|
125
|
+
- If neither ‘to’ address is a treasury wallet at the time of the transaction (out of range).
|
126
|
+
- If the transaction hash matches a known HashMatcher.
|
127
|
+
- If the 'from' address matches a FromAddressMatcher.
|
128
|
+
- If the 'to' address matches a ToAddressMatcher.
|
129
|
+
- Assignment to 'Must Sort Outbound' or 'Must Sort Inbound' groups if applicable.
|
130
|
+
- Raises `NotImplementedError` if none of the above conditions are met (should not happen).
|
131
|
+
|
132
|
+
Args:
|
133
|
+
entry: A ledger entry representing a blockchain transaction.
|
134
|
+
|
135
|
+
Examples:
|
136
|
+
>>> from eth_portfolio.structs import Transaction
|
137
|
+
>>> entry = Transaction(from_address="0xabc...", to_address="0xdef...", block_number=1234567)
|
138
|
+
>>> group_id = sort_basic(entry)
|
139
|
+
>>> print(group_id)
|
140
|
+
|
141
|
+
See Also:
|
142
|
+
:func:`sort_basic_entity`
|
143
|
+
:func:`sort_advanced`
|
144
|
+
:class:`dao_treasury.sorting.HashMatcher`
|
145
|
+
"""
|
85
146
|
from_address = entry.from_address
|
86
147
|
to_address = entry.to_address
|
87
148
|
block = entry.block_number
|
@@ -117,7 +178,25 @@ def sort_basic(entry: LedgerEntry) -> TxGroupDbid:
|
|
117
178
|
|
118
179
|
|
119
180
|
def sort_basic_entity(tx: db.TreasuryTx) -> TxGroupDbid:
|
120
|
-
|
181
|
+
"""Determine the transaction group ID for a TreasuryTx database entity using static matching.
|
182
|
+
|
183
|
+
Similar to :func:`sort_basic` but operates on a TreasuryTx entity from the database.
|
184
|
+
It considers additional constants such as `DISPERSE_APP` when determining whether
|
185
|
+
a transaction is out of range.
|
186
|
+
|
187
|
+
Args:
|
188
|
+
tx: A TreasuryTx database entity representing a treasury transaction.
|
189
|
+
|
190
|
+
Examples:
|
191
|
+
>>> from dao_treasury.db import TreasuryTx
|
192
|
+
>>> tx = TreasuryTx[123]
|
193
|
+
>>> group_id = sort_basic_entity(tx)
|
194
|
+
>>> print(group_id)
|
195
|
+
|
196
|
+
See Also:
|
197
|
+
:func:`sort_basic`
|
198
|
+
:func:`sort_advanced`
|
199
|
+
"""
|
121
200
|
from_address = tx.from_address.address
|
122
201
|
to_address = tx.to_address
|
123
202
|
block = tx.block
|
@@ -167,7 +246,31 @@ def sort_basic_entity(tx: db.TreasuryTx) -> TxGroupDbid:
|
|
167
246
|
|
168
247
|
|
169
248
|
async def sort_advanced(entry: db.TreasuryTx) -> TxGroupDbid:
|
170
|
-
|
249
|
+
"""Determine the transaction group ID for a TreasuryTx entity using advanced dynamic rules.
|
250
|
+
|
251
|
+
Starts with the result of static matching via :func:`sort_basic_entity`, then
|
252
|
+
applies advanced asynchronous matching rules registered under :data:`SORT_RULES`.
|
253
|
+
Applies rules sequentially until a match is found or all rules are exhausted.
|
254
|
+
|
255
|
+
If a rule's match attempt raises a `ContractNotVerified` exception, the rule is skipped.
|
256
|
+
|
257
|
+
Updates the TreasuryTx entity's transaction group in the database when a match
|
258
|
+
other than 'Must Sort Inbound/Outbound' is found.
|
259
|
+
|
260
|
+
Args:
|
261
|
+
entry: A TreasuryTx database entity representing a treasury transaction.
|
262
|
+
|
263
|
+
Examples:
|
264
|
+
>>> from dao_treasury.db import TreasuryTx
|
265
|
+
>>> import asyncio
|
266
|
+
>>> tx = TreasuryTx[123]
|
267
|
+
>>> group_id = asyncio.run(sort_advanced(tx))
|
268
|
+
>>> print(group_id)
|
269
|
+
|
270
|
+
See Also:
|
271
|
+
:func:`sort_basic_entity`
|
272
|
+
:data:`SORT_RULES`
|
273
|
+
"""
|
171
274
|
txgroup_dbid = sort_basic_entity(entry)
|
172
275
|
|
173
276
|
if txgroup_dbid in (
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: dao_treasury
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.33
|
4
4
|
Summary: Produce comprehensive financial reports for your on-chain org
|
5
5
|
Classifier: Development Status :: 3 - Alpha
|
6
6
|
Classifier: Intended Audience :: Developers
|
@@ -14,7 +14,7 @@ Classifier: Operating System :: OS Independent
|
|
14
14
|
Classifier: Topic :: Software Development :: Libraries
|
15
15
|
Requires-Python: >=3.10,<3.13
|
16
16
|
Description-Content-Type: text/markdown
|
17
|
-
Requires-Dist: eth-portfolio-temp<0.1,>=0.0.
|
17
|
+
Requires-Dist: eth-portfolio-temp<0.1,>=0.0.30.dev0
|
18
18
|
Dynamic: classifier
|
19
19
|
Dynamic: description
|
20
20
|
Dynamic: description-content-type
|
@@ -1,4 +1,4 @@
|
|
1
|
-
bf2b4fe1f86ad2ea158b__mypyc.cpython-311-i386-linux-musl.so,sha256=
|
1
|
+
bf2b4fe1f86ad2ea158b__mypyc.cpython-311-i386-linux-musl.so,sha256=yIZDqCAIEbt5-DLiTK1GnT3aQPgYqE_8yg38VRTbu0E,1423296
|
2
2
|
dao_treasury/ENVIRONMENT_VARIABLES.py,sha256=yKvgOMUyU7-fF_-1zSMXML7ah7-r2f0oHrOV0p10LPc,195
|
3
3
|
dao_treasury/__init__.py,sha256=ZQ0ZROQzSyJdYuQS1Z_VD0c7CiV8BWZcLTX66wO4slc,1004
|
4
4
|
dao_treasury/_docker.cpython-311-i386-linux-musl.so,sha256=0UPFT2lGlgujHEM_a8vOxs2Zf5Rls5CAh39vVUkb1A0,16568
|
@@ -9,22 +9,24 @@ dao_treasury/_wallet.cpython-311-i386-linux-musl.so,sha256=bnakBIsnnaIVT6Bf-yMGL
|
|
9
9
|
dao_treasury/_wallet.py,sha256=sIeUsyu9Y8MmOm-9bfwIEYjJ9Owgv1GXdTLZpcXMnCg,10338
|
10
10
|
dao_treasury/constants.cpython-311-i386-linux-musl.so,sha256=bi5cJnodwdtx76aNDuUlwjlZdJl57TD0yenZ_kVyLgA,16576
|
11
11
|
dao_treasury/constants.py,sha256=IFg_CyVnfPhPjKyFX1Ix4QaB8ghbOI5QZGSy2TNsUSA,507
|
12
|
-
dao_treasury/db.py,sha256=
|
12
|
+
dao_treasury/db.py,sha256=F-ZZQ21KCTCNusOgQADIMXl1mpuuI7g26nCV2Y7U8Yk,46136
|
13
13
|
dao_treasury/docker-compose.yaml,sha256=Q6NPNT9iKkKOehDcKtxltvQjbxZuXmb51Tjwb1M21_I,1376
|
14
14
|
dao_treasury/main.py,sha256=31EA10Fpaj9y-cRJPnNnvCBI38UM0848xlzn7A0BzC4,8047
|
15
15
|
dao_treasury/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
16
16
|
dao_treasury/treasury.py,sha256=7xLVQPqnDd3cexbYuF1opTjCiHgkPqHFOanRom8wiLE,6506
|
17
17
|
dao_treasury/types.cpython-311-i386-linux-musl.so,sha256=VHTbSPq4QsKdC7xcm8l1RgCu_Kz7ho7G_RurksTKck8,16560
|
18
18
|
dao_treasury/types.py,sha256=dJDx0hYfDDL3slcUzRnCgrzFFsgCzoqg8uaTtLaT4kk,3685
|
19
|
-
dao_treasury/.grafana/provisioning/dashboards/dashboards.yaml,sha256=
|
19
|
+
dao_treasury/.grafana/provisioning/dashboards/dashboards.yaml,sha256=tr6FBJeAAPX76db8E3qBBVWnq2-yrWDXDGuclMDg6dw,1277
|
20
20
|
dao_treasury/.grafana/provisioning/dashboards/streams/LlamaPay.json,sha256=7bDAboObB2LsY6EicAL-DAC0HKIaSRVW6AbGzmy_xUI,3403
|
21
|
-
dao_treasury/.grafana/provisioning/dashboards/summary/Monthly.json,sha256=
|
22
|
-
dao_treasury/.grafana/provisioning/dashboards/transactions/Treasury Transactions.json,sha256=
|
23
|
-
dao_treasury/.grafana/provisioning/dashboards/treasury/Cashflow.json,sha256=
|
21
|
+
dao_treasury/.grafana/provisioning/dashboards/summary/Monthly.json,sha256=O6ghjzBf333baPjuMuUNguxF2v6rvPCiOu39sm1zxxY,6533
|
22
|
+
dao_treasury/.grafana/provisioning/dashboards/transactions/Treasury Transactions.json,sha256=jefr19wdT7r2zNXOG_3GzKDaq3WFIQkou8veHxkisnY,13230
|
23
|
+
dao_treasury/.grafana/provisioning/dashboards/treasury/Cashflow (Including Unsorted).json,sha256=lpSE0g8lU9rEPMUxJPo1ObkHk_B2Qvp8LMrJEMzeYSk,25530
|
24
|
+
dao_treasury/.grafana/provisioning/dashboards/treasury/Cashflow.json,sha256=DOpO3leNVyUUQD5ou5FkdGCGc1xJmCRQjuzSUCvBnGU,18139
|
25
|
+
dao_treasury/.grafana/provisioning/dashboards/treasury/Operating Cashflow.json,sha256=xGQTzjF9dKzV3QSifRAbU5eGz2SrzJ7MJlmQKcFq5TE,14311
|
24
26
|
dao_treasury/.grafana/provisioning/dashboards/treasury/Treasury.json,sha256=p9bupL06-CKqkqCOb6KkgP1LCa6P1VMkq3yhkyqMAzI,70178
|
25
27
|
dao_treasury/.grafana/provisioning/datasources/datasources.yaml,sha256=mjQs8or651NgD_bZnKBm8vSghzjw_g3enL01YPt0dik,327
|
26
28
|
dao_treasury/sorting/__init__.cpython-311-i386-linux-musl.so,sha256=f3CVi0cWNDMi87x_dwUaMdEzfVpcBtMCQOu1K6-q8jc,16568
|
27
|
-
dao_treasury/sorting/__init__.py,sha256=
|
29
|
+
dao_treasury/sorting/__init__.py,sha256=vKj3NPB7EWbX7_fSUWKXk-NsyPasOkFhJvJVGclBOAE,10371
|
28
30
|
dao_treasury/sorting/_matchers.cpython-311-i386-linux-musl.so,sha256=rg2xZ9AZjMk1aIhLGLJJet_r8xwtzh9_xae2m3DPnN0,16592
|
29
31
|
dao_treasury/sorting/_matchers.py,sha256=u0GfPYiODr_NtzbfyLxEKDuXmWRiaeuZulDj9FPDOH8,14005
|
30
32
|
dao_treasury/sorting/_rules.cpython-311-i386-linux-musl.so,sha256=_fDXEdMtqm4Ap4d7NtnUPTOLYt6REy178swos5DaaoU,16580
|
@@ -43,7 +45,7 @@ dao_treasury/streams/__init__.cpython-311-i386-linux-musl.so,sha256=ClYlRoekXQee
|
|
43
45
|
dao_treasury/streams/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
44
46
|
dao_treasury/streams/llamapay.cpython-311-i386-linux-musl.so,sha256=7aI6yBDAV8bGesg3LbTQiPlMmmNaLz-7iIbCtjyYoyY,16588
|
45
47
|
dao_treasury/streams/llamapay.py,sha256=xc2sgmTV4EnQFFemea87QoUdIeGtO9OJQCwJG9c-SJQ,12774
|
46
|
-
dao_treasury-0.0.
|
47
|
-
dao_treasury-0.0.
|
48
|
-
dao_treasury-0.0.
|
49
|
-
dao_treasury-0.0.
|
48
|
+
dao_treasury-0.0.33.dist-info/METADATA,sha256=oVCiHn3_IVPb94PL9AgbZGva7AU88_vmhfO8VU1r2Qk,7030
|
49
|
+
dao_treasury-0.0.33.dist-info/WHEEL,sha256=6ltumPE74Em2X1OXYv5iIjaGYcDTCG-wPLy9Dk1DJEw,110
|
50
|
+
dao_treasury-0.0.33.dist-info/top_level.txt,sha256=Gw-ri_26lZA_3hwhnOX48mffUbmBGr8NhtoQ0XoMeF8,41
|
51
|
+
dao_treasury-0.0.33.dist-info/RECORD,,
|
File without changes
|
File without changes
|