dao-treasury 0.0.39__tar.gz → 0.0.41__tar.gz

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 (49) hide show
  1. {dao_treasury-0.0.39 → dao_treasury-0.0.41}/PKG-INFO +1 -1
  2. dao_treasury-0.0.41/dao_treasury/ENVIRONMENT_VARIABLES.py +20 -0
  3. {dao_treasury-0.0.39 → dao_treasury-0.0.41}/dao_treasury/__init__.py +14 -0
  4. {dao_treasury-0.0.39 → dao_treasury-0.0.41}/dao_treasury/_docker.py +14 -1
  5. dao_treasury-0.0.41/dao_treasury/_nicknames.py +32 -0
  6. dao_treasury-0.0.41/dao_treasury/constants.py +34 -0
  7. {dao_treasury-0.0.39 → dao_treasury-0.0.41}/dao_treasury/db.py +23 -0
  8. dao_treasury-0.0.41/dao_treasury/sorting/rules/ignore/__init__.py +1 -0
  9. {dao_treasury-0.0.39 → dao_treasury-0.0.41}/dao_treasury/treasury.py +33 -14
  10. {dao_treasury-0.0.39 → dao_treasury-0.0.41}/dao_treasury.egg-info/PKG-INFO +1 -1
  11. {dao_treasury-0.0.39 → dao_treasury-0.0.41}/dao_treasury.egg-info/SOURCES.txt +0 -1
  12. dao_treasury-0.0.41/dao_treasury.egg-info/requires.txt +1 -0
  13. {dao_treasury-0.0.39 → dao_treasury-0.0.41}/pyproject.toml +3 -3
  14. dao_treasury-0.0.39/dao_treasury/ENVIRONMENT_VARIABLES.py +0 -8
  15. dao_treasury-0.0.39/dao_treasury/_nicknames.py +0 -17
  16. dao_treasury-0.0.39/dao_treasury/constants.py +0 -15
  17. dao_treasury-0.0.39/dao_treasury/sorting/rules/ignore/__init__.py +0 -2
  18. dao_treasury-0.0.39/dao_treasury/sorting/rules/ignore/shitcoins.py +0 -24
  19. dao_treasury-0.0.39/dao_treasury.egg-info/requires.txt +0 -1
  20. {dao_treasury-0.0.39 → dao_treasury-0.0.41}/MANIFEST.in +0 -0
  21. {dao_treasury-0.0.39 → dao_treasury-0.0.41}/README.md +0 -0
  22. {dao_treasury-0.0.39 → dao_treasury-0.0.41}/dao_treasury/.grafana/provisioning/dashboards/dashboards.yaml +0 -0
  23. {dao_treasury-0.0.39 → dao_treasury-0.0.41}/dao_treasury/.grafana/provisioning/dashboards/streams/LlamaPay.json +0 -0
  24. {dao_treasury-0.0.39 → dao_treasury-0.0.41}/dao_treasury/.grafana/provisioning/dashboards/summary/Monthly.json +0 -0
  25. {dao_treasury-0.0.39 → dao_treasury-0.0.41}/dao_treasury/.grafana/provisioning/dashboards/transactions/Treasury Transactions.json +0 -0
  26. {dao_treasury-0.0.39 → dao_treasury-0.0.41}/dao_treasury/.grafana/provisioning/dashboards/treasury/Cashflow (Including Unsorted).json +0 -0
  27. {dao_treasury-0.0.39 → dao_treasury-0.0.41}/dao_treasury/.grafana/provisioning/dashboards/treasury/Cashflow.json +0 -0
  28. {dao_treasury-0.0.39 → dao_treasury-0.0.41}/dao_treasury/.grafana/provisioning/dashboards/treasury/Operating Cashflow.json +0 -0
  29. {dao_treasury-0.0.39 → dao_treasury-0.0.41}/dao_treasury/.grafana/provisioning/dashboards/treasury/Treasury.json +0 -0
  30. {dao_treasury-0.0.39 → dao_treasury-0.0.41}/dao_treasury/.grafana/provisioning/datasources/datasources.yaml +0 -0
  31. {dao_treasury-0.0.39 → dao_treasury-0.0.41}/dao_treasury/_wallet.py +0 -0
  32. {dao_treasury-0.0.39 → dao_treasury-0.0.41}/dao_treasury/docker-compose.yaml +0 -0
  33. {dao_treasury-0.0.39 → dao_treasury-0.0.41}/dao_treasury/main.py +0 -0
  34. {dao_treasury-0.0.39 → dao_treasury-0.0.41}/dao_treasury/py.typed +0 -0
  35. {dao_treasury-0.0.39 → dao_treasury-0.0.41}/dao_treasury/sorting/__init__.py +0 -0
  36. {dao_treasury-0.0.39 → dao_treasury-0.0.41}/dao_treasury/sorting/_matchers.py +0 -0
  37. {dao_treasury-0.0.39 → dao_treasury-0.0.41}/dao_treasury/sorting/_rules.py +0 -0
  38. {dao_treasury-0.0.39 → dao_treasury-0.0.41}/dao_treasury/sorting/factory.py +0 -0
  39. {dao_treasury-0.0.39 → dao_treasury-0.0.41}/dao_treasury/sorting/rule.py +0 -0
  40. {dao_treasury-0.0.39 → dao_treasury-0.0.41}/dao_treasury/sorting/rules/__init__.py +0 -0
  41. {dao_treasury-0.0.39 → dao_treasury-0.0.41}/dao_treasury/sorting/rules/ignore/llamapay.py +0 -0
  42. {dao_treasury-0.0.39 → dao_treasury-0.0.41}/dao_treasury/streams/__init__.py +0 -0
  43. {dao_treasury-0.0.39 → dao_treasury-0.0.41}/dao_treasury/streams/llamapay.py +0 -0
  44. {dao_treasury-0.0.39 → dao_treasury-0.0.41}/dao_treasury/types.py +0 -0
  45. {dao_treasury-0.0.39 → dao_treasury-0.0.41}/dao_treasury.egg-info/dependency_links.txt +0 -0
  46. {dao_treasury-0.0.39 → dao_treasury-0.0.41}/dao_treasury.egg-info/not-zip-safe +0 -0
  47. {dao_treasury-0.0.39 → dao_treasury-0.0.41}/dao_treasury.egg-info/top_level.txt +0 -0
  48. {dao_treasury-0.0.39 → dao_treasury-0.0.41}/setup.cfg +0 -0
  49. {dao_treasury-0.0.39 → dao_treasury-0.0.41}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dao_treasury
3
- Version: 0.0.39
3
+ Version: 0.0.41
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
@@ -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)
@@ -1,3 +1,17 @@
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
+
1
15
  from dao_treasury import ENVIRONMENT_VARIABLES as ENVS
2
16
  from dao_treasury._nicknames import setup_address_nicknames_in_db
3
17
  from dao_treasury._wallet import TreasuryWallet
@@ -1,4 +1,17 @@
1
- """This module contains utilities for managing dao-treasury's docker containers"""
1
+ """Docker orchestration utilities for DAO Treasury.
2
+
3
+ Provides functions to build, start, and stop Docker Compose services
4
+ required for analytics dashboards (Grafana, renderer). Integrates with
5
+ eth-portfolio's Docker setup and ensures all containers are managed
6
+ consistently for local analytics.
7
+
8
+ Key Responsibilities:
9
+ - Build and manage Grafana and renderer containers.
10
+ - Integrate with eth-portfolio Docker services.
11
+ - Provide decorators/utilities for container lifecycle management.
12
+
13
+ This is the main entry for all Docker-based orchestration.
14
+ """
2
15
 
3
16
  import logging
4
17
  from importlib import resources
@@ -0,0 +1,32 @@
1
+ """Address nickname setup utilities.
2
+
3
+ This module provides functions to assign human-readable nicknames to
4
+ important on-chain addresses (e.g., Zero Address, Disperse.app, tokens).
5
+ It is used at package initialization to ensure all analytics and dashboards
6
+ display professional, consistent labels.
7
+
8
+ Key Responsibilities:
9
+ - Set nicknames for core addresses in the database.
10
+ - Integrate with constants and token metadata.
11
+ - Support professional, readable analytics outputs.
12
+
13
+ This is called automatically on package import.
14
+ """
15
+
16
+ from typing import Final
17
+
18
+ from pony.orm import db_session
19
+
20
+ from dao_treasury import constants
21
+ from dao_treasury.db import Address, _set_address_nicknames_for_tokens
22
+
23
+
24
+ set_nickname: Final = Address.set_nickname
25
+
26
+
27
+ def setup_address_nicknames_in_db() -> None:
28
+ with db_session:
29
+ set_nickname(constants.ZERO_ADDRESS, "Zero Address")
30
+ for address in constants.DISPERSE_APP:
31
+ set_nickname(address, "Disperse.app")
32
+ _set_address_nicknames_for_tokens()
@@ -0,0 +1,34 @@
1
+ """Core constants for DAO Treasury.
2
+
3
+ All constants are marked with `Final`, ensuring immutability and allowing
4
+ mypyc to compile them as extremely fast C-level constants for maximum
5
+ performance. Defines chain IDs, zero address, and key contract addresses
6
+ (e.g., Disperse.app) used throughout the system for transaction processing,
7
+ nickname assignment, and analytics.
8
+
9
+ Key Responsibilities:
10
+ - Provide canonical addresses and chain IDs.
11
+ - Support nickname setup and transaction categorization.
12
+ - Guarantee fast, immutable constants at runtime.
13
+
14
+ This is the single source of truth for system-wide constants.
15
+ """
16
+
17
+ from typing import Final
18
+
19
+ import y.constants
20
+
21
+
22
+ CHAINID: Final = y.constants.CHAINID
23
+ # TODO: add docstring
24
+
25
+ ZERO_ADDRESS: Final = "0x0000000000000000000000000000000000000000"
26
+ # TODO: add docstring
27
+
28
+ # TODO: move disperse.app stuff from yearn-treasury to dao-treasury and then write a docs file
29
+ DISPERSE_APP: Final = (
30
+ "0xD152f549545093347A162Dce210e7293f1452150",
31
+ "0xd15fE25eD0Dba12fE05e7029C88b10C25e8880E3",
32
+ )
33
+ """If your treasury sends funds to disperse.app, we create additional txs in the db so each individual send can be accounted for."""
34
+ # TODO: all crosslink to disperse.py once ready
@@ -3,6 +3,7 @@
3
3
  Database models and utilities for DAO treasury reporting.
4
4
 
5
5
  This module defines Pony ORM entities for:
6
+
6
7
  - Blockchain networks (:class:`Chain`)
7
8
  - On-chain addresses (:class:`Address`)
8
9
  - ERC-20 tokens and native coin placeholder (:class:`Token`)
@@ -25,6 +26,7 @@ from pathlib import Path
25
26
  from typing import TYPE_CHECKING, Dict, Final, Tuple, Union, final
26
27
  from datetime import date, datetime, time, timezone
27
28
 
29
+ import eth_portfolio
28
30
  from a_sync import AsyncThreadPoolExecutor
29
31
  from brownie import chain
30
32
  from brownie.convert.datatypes import HexString
@@ -1383,3 +1385,24 @@ def _validate_integrity_error(
1383
1385
  )
1384
1386
  else None
1385
1387
  )
1388
+
1389
+
1390
+ def _drop_shitcoin_txs() -> None:
1391
+ """
1392
+ Purge any shitcoin txs from the db.
1393
+
1394
+ These should not be frequent, and only occur if a user populated the db before a shitcoin was added to the SHITCOINS mapping.
1395
+ """
1396
+ shitcoins = eth_portfolio.SHITCOINS[CHAINID]
1397
+ with db_session:
1398
+ shitcoin_txs = select(
1399
+ tx for tx in TreasuryTx if tx.token.address.address in shitcoins
1400
+ )
1401
+ if count := shitcoin_txs.count():
1402
+ logger.info(f"Purging {count} shitcoin txs from the database...")
1403
+ for tx in shitcoin_txs:
1404
+ tx.delete()
1405
+ logger.info("Shitcoin tx purge complete.")
1406
+
1407
+
1408
+ _drop_shitcoin_txs()
@@ -0,0 +1 @@
1
+ from dao_treasury.sorting.rules.ignore.llamapay import *
@@ -1,3 +1,20 @@
1
+ """Treasury orchestration and analytics interface.
2
+
3
+ This module defines the Treasury class, which aggregates DAO wallets, sets up
4
+ sorting rules, and manages transaction ingestion and streaming analytics.
5
+ It coordinates the end-to-end flow from wallet configuration to database
6
+ population and dashboard analytics.
7
+
8
+ Key Responsibilities:
9
+ - Aggregate and manage DAO-controlled wallets.
10
+ - Ingest and process on-chain transactions.
11
+ - Apply sorting/categorization rules.
12
+ - Integrate with streaming protocols (e.g., LlamaPay).
13
+ - Populate the database for analytics and dashboards.
14
+
15
+ This is the main entry point for orchestrating DAO treasury analytics.
16
+ """
17
+
1
18
  from asyncio import create_task, gather
2
19
  from logging import getLogger
3
20
  from pathlib import Path
@@ -59,20 +76,22 @@ class Treasury(a_sync.ASyncGenericBase): # type: ignore [misc]
59
76
  TypeError: If any item in `wallets` is not a str or TreasuryWallet.
60
77
 
61
78
  Examples:
62
- Create a synchronous Treasury:
63
- >>> treasury = Treasury(
64
- ... wallets=["0xAbc123...", TreasuryWallet("0xDef456...", start_block=1000)],
65
- ... sort_rules=Path("/path/to/rules"),
66
- ... start_block=500,
67
- ... label="DAO Treasury",
68
- ... asynchronous=False
69
- ... )
70
-
71
- Create an asynchronous Treasury:
72
- >>> treasury_async = Treasury(
73
- ... wallets=["0xAbc123..."],
74
- ... asynchronous=True
75
- ... )
79
+ .. code-block:: python
80
+
81
+ # Create a synchronous Treasury
82
+ treasury = Treasury(
83
+ wallets=["0xAbc123...", TreasuryWallet("0xDef456...", start_block=1000)],
84
+ sort_rules=Path("/path/to/rules"),
85
+ start_block=500,
86
+ label="DAO Treasury",
87
+ asynchronous=False
88
+ )
89
+
90
+ # Create an asynchronous Treasury
91
+ treasury_async = Treasury(
92
+ wallets=["0xAbc123..."],
93
+ asynchronous=True
94
+ )
76
95
  """
77
96
  global TREASURY
78
97
  if TREASURY is not None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dao-treasury
3
- Version: 0.0.39
3
+ Version: 0.0.41
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
@@ -37,6 +37,5 @@ dao_treasury/sorting/rule.py
37
37
  dao_treasury/sorting/rules/__init__.py
38
38
  dao_treasury/sorting/rules/ignore/__init__.py
39
39
  dao_treasury/sorting/rules/ignore/llamapay.py
40
- dao_treasury/sorting/rules/ignore/shitcoins.py
41
40
  dao_treasury/streams/__init__.py
42
41
  dao_treasury/streams/llamapay.py
@@ -0,0 +1 @@
1
+ eth-portfolio-temp<0.1,>=0.0.38.dev0
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "dao-treasury"
3
- version = "0.0.39"
3
+ version = "0.0.41"
4
4
  description = "Produce comprehensive financial reports for your on-chain org"
5
5
  authors = ["BobTheBuidler <bobthebuidlerdefi@gmail.com>"]
6
6
  license = "MIT"
@@ -11,7 +11,7 @@ dao-treasury = "dao_treasury.main:main"
11
11
 
12
12
  [tool.poetry.dependencies]
13
13
  python = ">=3.10,<3.13"
14
- eth-portfolio-temp = ">=0.0.34.dev0,<0.1"
14
+ eth-portfolio-temp = ">=0.0.38.dev0,<0.1"
15
15
 
16
16
  [tool.poetry.group.dev.dependencies]
17
17
  pytest = "^6.2.5"
@@ -29,7 +29,7 @@ myst-parser = "*"
29
29
  requires = [
30
30
  "setuptools",
31
31
  "wheel",
32
- "mypy[mypyc]==1.16.1",
32
+ "mypy[mypyc]==1.17.0",
33
33
  "tomli>=2.0.0; python_version < '3.11'",
34
34
  "types-tqdm",
35
35
  "types-PyYAML",
@@ -1,8 +0,0 @@
1
- from typing import Final
2
-
3
- from typed_envs import EnvVarFactory
4
-
5
-
6
- _factory = EnvVarFactory("DAO_TREASURY")
7
-
8
- SQL_DEBUG: Final = _factory.create_env("SQL_DEBUG", bool, default=False, verbose=False)
@@ -1,17 +0,0 @@
1
- from typing import Final
2
-
3
- from pony.orm import db_session
4
-
5
- from dao_treasury import constants
6
- from dao_treasury.db import Address, _set_address_nicknames_for_tokens
7
-
8
-
9
- set_nickname: Final = Address.set_nickname
10
-
11
-
12
- def setup_address_nicknames_in_db() -> None:
13
- with db_session:
14
- set_nickname(constants.ZERO_ADDRESS, "Zero Address")
15
- for address in constants.DISPERSE_APP:
16
- set_nickname(address, "Disperse.app")
17
- _set_address_nicknames_for_tokens()
@@ -1,15 +0,0 @@
1
- from typing import Final
2
-
3
- import y.constants
4
-
5
-
6
- CHAINID: Final = y.constants.CHAINID
7
-
8
- ZERO_ADDRESS: Final = "0x0000000000000000000000000000000000000000"
9
-
10
- # TODO: move disperse.app stuff from yearn-treasury to dao-treasury and then write a docs file
11
- DISPERSE_APP: Final = (
12
- "0xD152f549545093347A162Dce210e7293f1452150",
13
- "0xd15fE25eD0Dba12fE05e7029C88b10C25e8880E3",
14
- )
15
- """If your treasury sends funds to disperse.app, we create additional txs in the db so each individual send can be accounted for."""
@@ -1,2 +0,0 @@
1
- from dao_treasury.sorting.rules.ignore.llamapay import *
2
- from dao_treasury.sorting.rules.ignore.shitcoins import *
@@ -1,24 +0,0 @@
1
- """This module is used to ignore any transactions that involve shitcoins in the :obj:`~eth_portfolio.SHITCOINS` mapping."""
2
-
3
- from typing import Final
4
-
5
- import eth_portfolio
6
-
7
- from dao_treasury import TreasuryTx
8
- from dao_treasury.constants import CHAINID
9
- from dao_treasury.sorting.factory import ignore
10
-
11
-
12
- SHITCOINS: Final = eth_portfolio.SHITCOINS[CHAINID]
13
-
14
-
15
- @ignore("Shitcoin")
16
- def is_shitcoin(tx: TreasuryTx) -> bool:
17
- """
18
- This category is for any token transfers involving any shitcoin which was added
19
- to your database before the shitcoin was added to :obj:`eth_portfolio.SHITCOINS`.
20
-
21
- Since the tx would now be excluded from the db entirely if you did a clean pull,
22
- we can safely ignore it.
23
- """
24
- return tx.token.address.address in SHITCOINS
@@ -1 +0,0 @@
1
- eth-portfolio-temp<0.1,>=0.0.34.dev0
File without changes
File without changes
File without changes
File without changes