yearn-treasury 0.0.8__cp310-cp310-win_amd64.whl → 0.0.48__cp310-cp310-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 yearn-treasury might be problematic. Click here for more details.
- yearn_treasury/__init__.py +16 -0
- yearn_treasury/_db.cp310-win_amd64.pyd +0 -0
- yearn_treasury/_db.py +41 -0
- yearn_treasury/_ens.cp310-win_amd64.pyd +0 -0
- yearn_treasury/_ens.py +14 -0
- yearn_treasury/_logging.cp310-win_amd64.pyd +0 -0
- yearn_treasury/_logging.py +43 -0
- yearn_treasury/address_labels.yaml +39 -0
- yearn_treasury/budget/__init__.cp310-win_amd64.pyd +0 -0
- yearn_treasury/budget/__init__.py +2 -2
- yearn_treasury/budget/_request.cp310-win_amd64.pyd +0 -0
- yearn_treasury/budget/_request.py +8 -0
- yearn_treasury/budget/_requests.cp310-win_amd64.pyd +0 -0
- yearn_treasury/budget/_requests.py +45 -14
- yearn_treasury/constants.py +34 -6
- yearn_treasury/main.py +77 -43
- yearn_treasury/rules/__init__.py +17 -0
- yearn_treasury/rules/constants.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/constants.py +1 -1
- yearn_treasury/rules/cost_of_revenue/gas.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/cost_of_revenue/gas.py +10 -3
- yearn_treasury/rules/expense/__init__.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/expense/general.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/expense/infrastructure.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/expense/infrastructure.py +31 -1
- yearn_treasury/rules/expense/people.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/expense/people.py +43 -0
- yearn_treasury/rules/expense/security.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/expense/security.py +51 -27
- yearn_treasury/rules/ignore/__init__.py +8 -6
- yearn_treasury/rules/ignore/general.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/ignore/general.py +3 -2
- yearn_treasury/rules/ignore/maker.py +48 -64
- yearn_treasury/rules/ignore/passthru.py +310 -0
- yearn_treasury/rules/ignore/staking.py +23 -18
- yearn_treasury/rules/ignore/swaps/__init__.py +18 -5
- yearn_treasury/rules/ignore/swaps/aave.py +39 -19
- yearn_treasury/rules/ignore/swaps/auctions.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/ignore/swaps/auctions.py +31 -0
- yearn_treasury/rules/ignore/swaps/compound.py +38 -36
- yearn_treasury/rules/ignore/swaps/conversion_factory.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/ignore/swaps/conversion_factory.py +21 -0
- yearn_treasury/rules/ignore/swaps/cowswap.py +87 -0
- yearn_treasury/rules/ignore/swaps/curve.py +170 -0
- yearn_treasury/rules/ignore/swaps/gearbox.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/ignore/swaps/gearbox.py +37 -0
- yearn_treasury/rules/ignore/swaps/iearn.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/ignore/swaps/iearn.py +43 -0
- yearn_treasury/rules/ignore/swaps/otc.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/ignore/swaps/otc.py +58 -0
- yearn_treasury/rules/ignore/swaps/pooltogether.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/ignore/swaps/pooltogether.py +23 -0
- yearn_treasury/rules/ignore/swaps/synthetix.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/ignore/swaps/synthetix.py +10 -0
- yearn_treasury/rules/ignore/swaps/uniswap.py +222 -169
- yearn_treasury/rules/ignore/swaps/unwrapper.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/ignore/swaps/unwrapper.py +17 -0
- yearn_treasury/rules/ignore/swaps/vaults.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/ignore/swaps/vaults.py +264 -0
- yearn_treasury/rules/ignore/swaps/woofy.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/ignore/swaps/woofy.py +80 -0
- yearn_treasury/rules/ignore/swaps/yfi.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/ignore/swaps/yfi.py +111 -0
- yearn_treasury/rules/ignore/swaps/yla.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/ignore/swaps/yla.py +28 -0
- yearn_treasury/rules/ignore/unit.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/ignore/unit.py +40 -0
- yearn_treasury/rules/ignore/weth.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/ignore/weth.py +12 -4
- yearn_treasury/rules/ignore/ygov.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/other_expense/__init__.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/other_expense/__init__.py +7 -0
- yearn_treasury/rules/other_expense/boost.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/other_expense/boost.py +49 -0
- yearn_treasury/rules/other_expense/bugs.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/other_expense/bugs.py +81 -0
- yearn_treasury/rules/other_expense/donations.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/other_expense/donations.py +43 -0
- yearn_treasury/rules/other_expense/dyfi.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/other_expense/dyfi.py +29 -0
- yearn_treasury/rules/other_expense/events.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/other_expense/events.py +21 -0
- yearn_treasury/rules/other_expense/match_on_to_address.yaml +3 -2
- yearn_treasury/rules/other_expense/misc.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/other_expense/misc.py +49 -0
- yearn_treasury/rules/other_expense/revshare.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/other_expense/revshare.py +20 -0
- yearn_treasury/rules/other_income/__init__.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/other_income/__init__.py +2 -77
- yearn_treasury/rules/other_income/airdrops.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/other_income/airdrops.py +30 -0
- yearn_treasury/rules/other_income/match_on_hash.yaml +2 -0
- yearn_treasury/rules/other_income/misc.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/other_income/misc.py +80 -0
- yearn_treasury/rules/revenue/__init__.py +5 -0
- yearn_treasury/rules/revenue/bribes.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/revenue/farming.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/revenue/farming.py +56 -0
- yearn_treasury/rules/revenue/keepcoins.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/revenue/seasolver.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/revenue/seasolver.py +7 -1
- yearn_treasury/rules/revenue/vaults.py +97 -34
- yearn_treasury/rules/revenue/yteams.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/revenue/yteams.py +17 -0
- yearn_treasury/shitcoins.py +93 -2
- yearn_treasury/vaults.cp310-win_amd64.pyd +0 -0
- yearn_treasury/vaults.py +30 -22
- yearn_treasury/wallets.yaml +54 -0
- yearn_treasury/yteams.py +208 -0
- yearn_treasury-0.0.48.dist-info/METADATA +86 -0
- yearn_treasury-0.0.48.dist-info/RECORD +128 -0
- yearn_treasury-0.0.48.dist-info/top_level.txt +2 -0
- yearn_treasury__mypyc.cp310-win_amd64.pyd +0 -0
- f79b89f5f6693162015b__mypyc.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/ignore/__init__.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/ignore/maker.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/ignore/staking.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/ignore/swaps/__init__.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/ignore/swaps/_skip_tokens.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/ignore/swaps/aave.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/ignore/swaps/compound.cp310-win_amd64.pyd +0 -0
- yearn_treasury/rules/ignore/swaps/uniswap.cp310-win_amd64.pyd +0 -0
- yearn_treasury-0.0.8.dist-info/METADATA +0 -69
- yearn_treasury-0.0.8.dist-info/RECORD +0 -76
- yearn_treasury-0.0.8.dist-info/top_level.txt +0 -2
- {yearn_treasury-0.0.8.dist-info → yearn_treasury-0.0.48.dist-info}/WHEEL +0 -0
- {yearn_treasury-0.0.8.dist-info → yearn_treasury-0.0.48.dist-info}/entry_points.txt +0 -0
yearn_treasury/__init__.py
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
|
+
import warnings
|
|
2
|
+
|
|
1
3
|
from yearn_treasury import budget
|
|
4
|
+
from yearn_treasury._db import prepare_db
|
|
5
|
+
from yearn_treasury._logging import setup_eth_portfolio_logging
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
prepare_db()
|
|
9
|
+
setup_eth_portfolio_logging()
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
warnings.filterwarnings(
|
|
13
|
+
"ignore",
|
|
14
|
+
message=".Event log does not contain enough topics for the given ABI.",
|
|
15
|
+
category=UserWarning,
|
|
16
|
+
module="brownie.network.event",
|
|
17
|
+
)
|
|
2
18
|
|
|
3
19
|
|
|
4
20
|
__all__ = ["budget"]
|
|
Binary file
|
yearn_treasury/_db.py
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Database labeling utility for Yearn Treasury.
|
|
3
|
+
|
|
4
|
+
This module provides a helper function to set up address nicknames
|
|
5
|
+
in the database, mapping key Yearn Treasury addresses to human-readable
|
|
6
|
+
labels. It is used during database preparation to ensure that wallet
|
|
7
|
+
addresses are clearly labeled in analytics and reporting.
|
|
8
|
+
|
|
9
|
+
When Yearn Treasury is imported, this module maps important addresses
|
|
10
|
+
to descriptive nicknames within the DAO Treasury database entity system
|
|
11
|
+
for improved data clarity and prettification of reports.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
# mypy: disable-error-code="arg-type"
|
|
15
|
+
from dao_treasury.db import Address
|
|
16
|
+
from y import Network
|
|
17
|
+
from y.constants import CHAINID
|
|
18
|
+
|
|
19
|
+
from yearn_treasury import constants
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def prepare_db() -> None:
|
|
23
|
+
"""
|
|
24
|
+
Set up address nicknames in the Yearn Treasury database.
|
|
25
|
+
|
|
26
|
+
Maps key Yearn Treasury addresses to human-readable labels for improved
|
|
27
|
+
clarity in analytics and reporting. This function is typically called
|
|
28
|
+
during database preparation to ensure wallet addresses are labeled
|
|
29
|
+
within the DAO Treasury database entity system.
|
|
30
|
+
"""
|
|
31
|
+
chad = {Network.Mainnet: "y", Network.Fantom: "f"}[CHAINID] # type: ignore [index]
|
|
32
|
+
|
|
33
|
+
labels = {
|
|
34
|
+
constants.TREASURY_MULTISIG: "Yearn Treasury",
|
|
35
|
+
constants.YCHAD_MULTISIG: f"Yearn {chad}Chad Multisig",
|
|
36
|
+
# constants.STRATEGIST_MULTISIG: "Yearn Strategist Multisig",
|
|
37
|
+
# This wallet is an EOA that has been used to assist in bridging tokens across chains.
|
|
38
|
+
"0x5FcdC32DfC361a32e9d5AB9A384b890C62D0b8AC": "Bridge Assistooor EOA",
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
Address.set_nicknames(labels)
|
|
Binary file
|
yearn_treasury/_ens.py
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
"""
|
|
2
|
+
ENS resolver and event topic utilities for Yearn Treasury.
|
|
3
|
+
|
|
4
|
+
This module defines the ENS resolver contract and event topic set
|
|
5
|
+
used for dynamic vault discovery and event processing. It supports
|
|
6
|
+
vault mapping and analytics by enabling on-chain lookups and event
|
|
7
|
+
filtering for Yearn vaults.
|
|
8
|
+
|
|
9
|
+
Key Responsibilities:
|
|
10
|
+
- Provide the ENS resolver contract for vault registry lookups.
|
|
11
|
+
- Construct event topic sets for AddressChanged events.
|
|
12
|
+
- Used by vault discovery, analytics, and reporting modules.
|
|
13
|
+
"""
|
|
14
|
+
|
|
1
15
|
from typing import Final
|
|
2
16
|
|
|
3
17
|
from brownie import web3
|
|
Binary file
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# mypy: disable-error-code="list-item"
|
|
2
|
+
"""
|
|
3
|
+
Error log suppression utilities for the Yearn Treasury exporter.
|
|
4
|
+
|
|
5
|
+
This module suppresses noisy or irrelevant eth-portfolio error logs for specific
|
|
6
|
+
token addresses that are known to be deprecated or otherwise unpricable.
|
|
7
|
+
|
|
8
|
+
To suppress logs for additional tokens, add their addresses to the
|
|
9
|
+
`suppress_logs_for[Network.<chain>]` mapping. The rest will be done
|
|
10
|
+
automatically on package import.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from typing import Dict, Final, List
|
|
14
|
+
|
|
15
|
+
from cchecksum import to_checksum_address
|
|
16
|
+
from eth_portfolio._utils import SUPPRESS_ERROR_LOGS
|
|
17
|
+
from eth_typing import HexAddress
|
|
18
|
+
from y import Network
|
|
19
|
+
|
|
20
|
+
from yearn_treasury.constants import CHAINID
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
suppress_logs_for: Final[Dict[Network, List[HexAddress]]] = {
|
|
24
|
+
Network.Mainnet: [
|
|
25
|
+
"0xBF7AA989192b020a8d3e1C65a558e123834325cA", # unpriceable yvWBTC - This vault had a bug and does not have a pricePerShare
|
|
26
|
+
"0x5aFE3855358E112B5647B952709E6165e1c1eEEe", # SAFE - This was not tradeable at the time of the first airdrops
|
|
27
|
+
"0x718AbE90777F5B778B52D553a5aBaa148DD0dc5D", # yvCurve-alETH - The underlying curve pool had an issue and is unpriceable
|
|
28
|
+
"0x3819f64f282bf135d62168C1e513280dAF905e06", # HDRN
|
|
29
|
+
"0x5fAa989Af96Af85384b8a938c2EdE4A7378D9875", # GAL
|
|
30
|
+
],
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def setup_eth_portfolio_logging() -> None:
|
|
35
|
+
"""
|
|
36
|
+
Suppress eth-portfolio error logs for specific tokens on the current chain.
|
|
37
|
+
|
|
38
|
+
Appends token addresses from the suppress_logs_for mapping (for the current
|
|
39
|
+
CHAINID) to the SUPPRESS_ERROR_LOGS list, preventing error logs for these
|
|
40
|
+
tokens from being emitted during analytics and reporting.
|
|
41
|
+
"""
|
|
42
|
+
for token in suppress_logs_for.get(CHAINID, []): # type: ignore [call-overload]
|
|
43
|
+
SUPPRESS_ERROR_LOGS.append(to_checksum_address(token))
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
1:
|
|
2
|
+
Yearn Treasury V1:
|
|
3
|
+
- "0xb99a40fcE04cb740EB79fC04976CA15aF69AaaaE"
|
|
4
|
+
Yearn Strategist Multisig: # refactor this to do from python from constants file
|
|
5
|
+
- "0x16388463d60FFE0661Cf7F1f31a7D658aC790ff7"
|
|
6
|
+
yMechs Multisig:
|
|
7
|
+
- "0x2C01B4AD51a67E2d8F02208F54dF9aC4c0B778B6"
|
|
8
|
+
ySwap Multisig:
|
|
9
|
+
- "0x7d2aB9CA511EBD6F03971Fb417d3492aA82513f0"
|
|
10
|
+
Yearn KP3R Wallet:
|
|
11
|
+
- "0x8d12a197cb00d4747a1fe03395095ce2a5cc6819"
|
|
12
|
+
Token Dumper Multisig:
|
|
13
|
+
- "0xC001d00d425Fa92C4F840baA8f1e0c27c4297a0B"
|
|
14
|
+
Cowswap Multisig:
|
|
15
|
+
- "0xA03be496e67Ec29bC62F01a428683D7F9c204930"
|
|
16
|
+
dYFI Redemption Contract:
|
|
17
|
+
- "0x7dC3A74F0684fc026f9163C6D5c3C99fda2cf60a"
|
|
18
|
+
Yearn veFarming Multisig:
|
|
19
|
+
- "0x4fc1b14cD213e7B6212145Ba4f180C3d53d1A11e"
|
|
20
|
+
CRV Buyer Contract (DAI):
|
|
21
|
+
- "0x0000000000007F150Bd6f54c40A34d7C3d5e9f56"
|
|
22
|
+
CRV Buyer Contract (USDT):
|
|
23
|
+
- "0x0000000000005117Dd3A72E64a705198753FDD54"
|
|
24
|
+
YFI Buyer Contract:
|
|
25
|
+
- "0x0000000000884A0E1fB44F9E24Fa3BDB19514fAE"
|
|
26
|
+
- "0x0000000000051666BBfBB42925C3eE5d50cF6B10"
|
|
27
|
+
Multichain Fantom Bridge:
|
|
28
|
+
- "0xC564EE9f21Ed8A2d8E7e76c085740d5e4c5FaFbE"
|
|
29
|
+
yLockers Multisig:
|
|
30
|
+
- "0x4444AAAACDBa5580282365e25b16309Bd770ce4a"
|
|
31
|
+
yRoboTreasury Treasury Contract:
|
|
32
|
+
- "0xEf77cc176c748d291EfB6CdC982c5744fC7211c8"
|
|
33
|
+
yRoboTreasury Stables Reserve:
|
|
34
|
+
- "0x278374fFb10B7D16E7633444c13e6E565EA57c28"
|
|
35
|
+
yearn.fi Dutch Auctions:
|
|
36
|
+
- "0x861fE45742f70054917B65bE18904662bD0dBd30"
|
|
37
|
+
250:
|
|
38
|
+
Yearn Strategist Multisig:
|
|
39
|
+
- "0x72a34AbafAB09b15E7191822A679f28E067C4a16"
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from yearn_treasury.budget._request import BudgetRequest
|
|
2
|
-
from yearn_treasury.budget._requests import approved_requests,
|
|
2
|
+
from yearn_treasury.budget._requests import approved_requests, budget_requests, rejected_requests
|
|
3
3
|
|
|
4
4
|
# TODO test
|
|
5
5
|
|
|
6
|
-
__all__ = ["BudgetRequest", "
|
|
6
|
+
__all__ = ["BudgetRequest", "budget_requests", "approved_requests", "rejected_requests"]
|
|
Binary file
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Budget request data model for Yearn Treasury.
|
|
3
|
+
|
|
4
|
+
This module defines the BudgetRequest dataclass, which models a single
|
|
5
|
+
budget request and its state. It provides methods for checking approval,
|
|
6
|
+
rejection, streaming, vesting, and payment status.
|
|
7
|
+
"""
|
|
8
|
+
|
|
1
9
|
from dataclasses import dataclass
|
|
2
10
|
from logging import getLogger
|
|
3
11
|
from typing import Final, Optional, Set, final
|
|
Binary file
|
|
@@ -1,10 +1,22 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Budget request ingestion and filtering for Yearn Treasury.
|
|
3
|
+
|
|
4
|
+
This module fetches budget requests from GitHub, parses them into
|
|
5
|
+
BudgetRequest objects, and provides lists of approved and rejected
|
|
6
|
+
requests.
|
|
7
|
+
"""
|
|
8
|
+
|
|
1
9
|
import os
|
|
2
|
-
|
|
3
|
-
|
|
10
|
+
import time
|
|
11
|
+
import requests
|
|
12
|
+
from typing import Any, Dict, Final, List
|
|
4
13
|
|
|
5
14
|
from yearn_treasury.budget._request import BudgetRequest
|
|
6
15
|
|
|
7
16
|
|
|
17
|
+
API_URL: Final = "https://api.github.com/repos/yearn/budget/issues"
|
|
18
|
+
"""URL to fetch issues from the repo."""
|
|
19
|
+
|
|
8
20
|
# Optionally use a GitHub personal access token for higher API rate limits.
|
|
9
21
|
# TODO move this to envs file and document
|
|
10
22
|
_TOKEN: Final = os.environ.get("GITHUB_TOKEN")
|
|
@@ -12,18 +24,16 @@ _HEADERS: Final = {"Authorization": f"token {_TOKEN}"} if _TOKEN else {}
|
|
|
12
24
|
|
|
13
25
|
|
|
14
26
|
def fetch_brs() -> List[BudgetRequest]:
|
|
15
|
-
# URL to fetch issues from the repo
|
|
16
|
-
api_url = "https://api.github.com/repos/yearn/budget/issues"
|
|
17
27
|
# Use parameters to fetch issues in all states, up to 100 per page.
|
|
18
|
-
|
|
28
|
+
current_page = 1
|
|
29
|
+
params = {"state": "all", "per_page": 100, "page": current_page}
|
|
19
30
|
|
|
20
31
|
brs = []
|
|
32
|
+
retries = 0
|
|
21
33
|
while True:
|
|
22
|
-
response =
|
|
23
|
-
if response.status_code != 200:
|
|
24
|
-
raise ConnectionError(f"Failed to fetch issues: {response.status_code} {response.text}")
|
|
34
|
+
response = _make_get_request(params=params)
|
|
25
35
|
|
|
26
|
-
data: List[dict] = response.json()
|
|
36
|
+
data: List[dict] = response.json() # type: ignore [type-arg]
|
|
27
37
|
if not data: # If the current page is empty, we are done.
|
|
28
38
|
break
|
|
29
39
|
|
|
@@ -34,7 +44,7 @@ def fetch_brs() -> List[BudgetRequest]:
|
|
|
34
44
|
|
|
35
45
|
# TODO labels table in db (also dataclass) with the descriptions included
|
|
36
46
|
# Extract the label names (tags) from the "labels" key.
|
|
37
|
-
label_objs: List[dict] = item.get("labels", [])
|
|
47
|
+
label_objs: List[dict] = item.get("labels", []) # type: ignore [type-arg]
|
|
38
48
|
labels = {label.get("name") for label in label_objs}
|
|
39
49
|
|
|
40
50
|
if "budget request" not in labels:
|
|
@@ -55,11 +65,32 @@ def fetch_brs() -> List[BudgetRequest]:
|
|
|
55
65
|
brs.append(br)
|
|
56
66
|
|
|
57
67
|
# Move on to the next page.
|
|
58
|
-
|
|
68
|
+
current_page += 1
|
|
69
|
+
params["page"] = current_page
|
|
59
70
|
|
|
60
71
|
return brs
|
|
61
72
|
|
|
62
73
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
74
|
+
def _make_get_request(params: Dict[str, Any]) -> Any:
|
|
75
|
+
retries = 0
|
|
76
|
+
while True:
|
|
77
|
+
try:
|
|
78
|
+
response = requests.get(API_URL, headers=_HEADERS, params=params)
|
|
79
|
+
response.raise_for_status()
|
|
80
|
+
return response
|
|
81
|
+
except requests.HTTPError as e:
|
|
82
|
+
if "rate limit exceeded" in str(e):
|
|
83
|
+
print("Github API rate limited...")
|
|
84
|
+
elif retries < 5:
|
|
85
|
+
print(e)
|
|
86
|
+
else:
|
|
87
|
+
raise ConnectionError(
|
|
88
|
+
f"Failed to fetch issues: {response.status_code} {response.text}"
|
|
89
|
+
) from e
|
|
90
|
+
retries += 1
|
|
91
|
+
time.sleep(5 * (retries + 1))
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
budget_requests: Final = fetch_brs()
|
|
95
|
+
approved_requests: Final = [r for r in budget_requests if r.is_approved()]
|
|
96
|
+
rejected_requests: Final = [r for r in budget_requests if r.is_rejected()]
|
yearn_treasury/constants.py
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
|
+
from pathlib import Path
|
|
1
2
|
from typing import Final, Set
|
|
2
3
|
|
|
4
|
+
import y.constants
|
|
3
5
|
from eth_typing import BlockNumber, ChecksumAddress
|
|
4
6
|
from y import Network, convert
|
|
5
|
-
from y.constants import CHAINID
|
|
6
7
|
|
|
7
8
|
|
|
9
|
+
CHAINID: Final = y.constants.CHAINID
|
|
10
|
+
|
|
8
11
|
EEE_ADDRESS: Final = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"
|
|
9
12
|
ZERO_ADDRESS: Final = "0x0000000000000000000000000000000000000000"
|
|
10
13
|
|
|
14
|
+
_YEARN_TREASURY_ROOT_DIR: Final = Path(__file__).parent
|
|
11
15
|
|
|
12
16
|
TREASURY_MULTISIGS: Final = {
|
|
13
17
|
Network.Mainnet: "0x93A62dA5a14C80f265DAbC077fCEE437B1a0Efde",
|
|
@@ -26,6 +30,10 @@ YCHAD_MULTISIGS: Final = {
|
|
|
26
30
|
Network.Base: "0xbfAABa9F56A39B814281D68d2Ad949e88D06b02E",
|
|
27
31
|
}
|
|
28
32
|
|
|
33
|
+
YSWAP_MULTISIGS: Final = {
|
|
34
|
+
Network.Mainnet: "0x7d2aB9CA511EBD6F03971Fb417d3492aA82513f0",
|
|
35
|
+
}
|
|
36
|
+
|
|
29
37
|
|
|
30
38
|
if CHAINID not in TREASURY_MULTISIGS or CHAINID not in YCHAD_MULTISIGS:
|
|
31
39
|
raise RuntimeError(f"{Network(CHAINID)} is not supported")
|
|
@@ -35,6 +43,8 @@ TREASURY_MULTISIG: Final = convert.to_address(TREASURY_MULTISIGS[CHAINID]) # ty
|
|
|
35
43
|
|
|
36
44
|
YCHAD_MULTISIG: Final = convert.to_address(YCHAD_MULTISIGS[CHAINID]) # type: ignore [index]
|
|
37
45
|
|
|
46
|
+
__yswap_multisig = YSWAP_MULTISIGS.get(CHAINID) # type: ignore [call-overload]
|
|
47
|
+
YSWAP_MULTISIG: Final = convert.to_address(__yswap_multisig) if __yswap_multisig else None
|
|
38
48
|
|
|
39
49
|
_TREASURY_WALLETS: Final = {
|
|
40
50
|
Network.Mainnet: {
|
|
@@ -42,7 +52,7 @@ _TREASURY_WALLETS: Final = {
|
|
|
42
52
|
YCHAD_MULTISIG,
|
|
43
53
|
"0xb99a40fcE04cb740EB79fC04976CA15aF69AaaaE", # Yearn Treasury V1
|
|
44
54
|
"0x5f0845101857d2A91627478e302357860b1598a1", # Yearn KP3R Wallet
|
|
45
|
-
|
|
55
|
+
YSWAP_MULTISIG,
|
|
46
56
|
"0x2C01B4AD51a67E2d8F02208F54dF9aC4c0B778B6", # yMechs Multisig
|
|
47
57
|
"0xE376e8e8E3B0793CD61C6F1283bA18548b726C2e", # Fee Reimbursement Stash
|
|
48
58
|
"0xC001d00d425Fa92C4F840baA8f1e0c27c4297a0B", # New token dumping wallet
|
|
@@ -55,10 +65,28 @@ TREASURY_WALLETS: Final = {
|
|
|
55
65
|
}
|
|
56
66
|
|
|
57
67
|
|
|
68
|
+
YFI: Final = {
|
|
69
|
+
Network.Mainnet: "0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e",
|
|
70
|
+
Network.Fantom: "0x29b0Da86e484E1C0029B56e817912d778aC0EC69",
|
|
71
|
+
Network.Arbitrum: "0x82e3A8F066a6989666b031d916c43672085b1582",
|
|
72
|
+
Network.Polygon: "0xDA537104D6A5edd53c6fBba9A898708E465260b6",
|
|
73
|
+
}.get(
|
|
74
|
+
CHAINID, None
|
|
75
|
+
) # type: ignore [call-overload]
|
|
76
|
+
|
|
77
|
+
|
|
58
78
|
class Args:
|
|
59
|
-
|
|
60
|
-
# TODO: update dashboard def to use this label
|
|
61
|
-
|
|
62
|
-
label: Final[str] = "My Portfolio"
|
|
79
|
+
wallets: Final[Path] = _YEARN_TREASURY_ROOT_DIR / "wallets.yaml"
|
|
80
|
+
# TODO: update dashboard def to use this label (we will need to migrate the provisioning files to yearn-treasury but we need to do this anyway for yearn-specific additions)
|
|
81
|
+
label: Final[str] = "Treasury" # "Yearn"
|
|
63
82
|
first_tx_block: Final = BlockNumber({Network.Mainnet: 10_502_337}.get(CHAINID, 0)) # type: ignore [call-overload]
|
|
64
83
|
export_start_block: Final = first_tx_block
|
|
84
|
+
|
|
85
|
+
sort_rules: Final[Path] = _YEARN_TREASURY_ROOT_DIR / "rules"
|
|
86
|
+
"""The path where the sort rules for dao-treasury are defined."""
|
|
87
|
+
|
|
88
|
+
nicknames: Final[Path] = _YEARN_TREASURY_ROOT_DIR / "address_labels.yaml"
|
|
89
|
+
"""The path where yearn-treasury's address nicknames are defined."""
|
|
90
|
+
|
|
91
|
+
custom_bucket: Final[list[str]] = [f"{YFI}:Other long term assets"]
|
|
92
|
+
"""Custom bucket mapping for token addresses, tells DAO Treasury to categorize YFI as 'Other long term assets'."""
|
yearn_treasury/main.py
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Command-line interface for the Yearn Treasury exporter.
|
|
3
3
|
|
|
4
4
|
This module provides the `yearn-treasury` CLI, which connects to a Brownie network
|
|
5
|
-
based on the `--network` option
|
|
6
|
-
periodically snapshots treasury
|
|
7
|
-
|
|
5
|
+
(based on the `--network` option or the `BROWNIE_NETWORK_ID` environment variable),
|
|
6
|
+
periodically snapshots treasury metrics, and pushes them to Victoria Metrics.
|
|
7
|
+
It also launches Yearn Treasury's Grafana dashboard and an optional renderer for visual reports.
|
|
8
8
|
|
|
9
9
|
Example:
|
|
10
10
|
Run export every 12 hours on mainnet:
|
|
@@ -12,15 +12,24 @@ Example:
|
|
|
12
12
|
.. code-block:: bash
|
|
13
13
|
|
|
14
14
|
yearn-treasury run --network mainnet --interval 12h
|
|
15
|
+
|
|
16
|
+
CLI Options:
|
|
17
|
+
--network Brownie network identifier (default: mainnet)
|
|
18
|
+
--interval Time interval between datapoints (default: 12h)
|
|
19
|
+
--concurrency Max number of historical blocks to export concurrently (default: 30)
|
|
20
|
+
--daemon Run as a background daemon (currently unsupported)
|
|
21
|
+
--grafana-port Port for the Grafana dashboard (default: 3004)
|
|
22
|
+
--victoria-port Port for the Victoria metrics endpoint (default: 8430)
|
|
23
|
+
--start-renderer Start the Grafana renderer container for dashboard image export
|
|
24
|
+
--renderer-port Port for the renderer service (default: 8080)
|
|
15
25
|
"""
|
|
16
26
|
|
|
17
27
|
import asyncio
|
|
18
28
|
import os
|
|
19
29
|
from argparse import ArgumentParser
|
|
20
|
-
from pathlib import Path
|
|
21
30
|
from typing import Final, final
|
|
22
31
|
|
|
23
|
-
from
|
|
32
|
+
from yearn_treasury import yteams
|
|
24
33
|
|
|
25
34
|
|
|
26
35
|
parser = ArgumentParser(description="Treasury CLI")
|
|
@@ -39,6 +48,12 @@ run_parser.add_argument(
|
|
|
39
48
|
help="The time interval between datapoints. Default: 12h",
|
|
40
49
|
default="12h",
|
|
41
50
|
)
|
|
51
|
+
run_parser.add_argument(
|
|
52
|
+
"--concurrency",
|
|
53
|
+
type=int,
|
|
54
|
+
help="The max number of historical blocks to export concurrently. default: 30",
|
|
55
|
+
default=30,
|
|
56
|
+
)
|
|
42
57
|
run_parser.add_argument(
|
|
43
58
|
"--daemon",
|
|
44
59
|
action="store_true",
|
|
@@ -47,14 +62,8 @@ run_parser.add_argument(
|
|
|
47
62
|
run_parser.add_argument(
|
|
48
63
|
"--grafana-port",
|
|
49
64
|
type=int,
|
|
50
|
-
help="Port for the Grafana dashboard where you can view your data. Default:
|
|
51
|
-
default=
|
|
52
|
-
)
|
|
53
|
-
run_parser.add_argument(
|
|
54
|
-
"--renderer-port",
|
|
55
|
-
type=int,
|
|
56
|
-
help="Port for the service that renders visual reports. Default: 8080",
|
|
57
|
-
default=8080,
|
|
65
|
+
help="Port for the Grafana dashboard where you can view your data. Default: 3004",
|
|
66
|
+
default=3004,
|
|
58
67
|
)
|
|
59
68
|
run_parser.add_argument(
|
|
60
69
|
"--victoria-port",
|
|
@@ -62,6 +71,17 @@ run_parser.add_argument(
|
|
|
62
71
|
help="Port for the Victoria metrics reporting endpoint. Default: 8430",
|
|
63
72
|
default=8430,
|
|
64
73
|
)
|
|
74
|
+
run_parser.add_argument(
|
|
75
|
+
"--start-renderer",
|
|
76
|
+
action="store_true",
|
|
77
|
+
help="If set, the Grafana renderer container will be started for dashboard image export. By default, only the grafana container is started.",
|
|
78
|
+
)
|
|
79
|
+
run_parser.add_argument(
|
|
80
|
+
"--renderer-port",
|
|
81
|
+
type=int,
|
|
82
|
+
help="Port for the service that renders visual reports. Default: 8080",
|
|
83
|
+
default=8080,
|
|
84
|
+
)
|
|
65
85
|
args = run_parser.parse_args()
|
|
66
86
|
|
|
67
87
|
# Set BROWNIE_NETWORK_ID from --network flag if not already set
|
|
@@ -72,24 +92,21 @@ BROWNIE_NETWORK = os.environ["BROWNIE_NETWORK_ID"]
|
|
|
72
92
|
# TODO: run forever arg
|
|
73
93
|
def main() -> None:
|
|
74
94
|
"""
|
|
75
|
-
Connect to the configured Brownie network and start the export loop.
|
|
95
|
+
Connect to the configured Brownie network, clean up the database, and start the export loop.
|
|
76
96
|
|
|
77
97
|
This function is registered as a console script entrypoint under
|
|
78
|
-
``yearn-treasury
|
|
79
|
-
|
|
80
|
-
Steps:
|
|
98
|
+
``yearn-treasury``. It performs the following steps:
|
|
81
99
|
1. Reads the ``BROWNIE_NETWORK_ID`` environment variable (populated from
|
|
82
100
|
the ``--network`` option or existing env var).
|
|
83
|
-
2. Connects to
|
|
84
|
-
3.
|
|
85
|
-
4.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
6.
|
|
89
|
-
|
|
90
|
-
Raises:
|
|
91
|
-
RuntimeError: If the Brownie network cannot be determined.
|
|
101
|
+
2. Connects to the specified Brownie network.
|
|
102
|
+
3. Merges local SHITCOINS into eth_portfolio's config to skip tokens we don't care about.
|
|
103
|
+
4. Drops any shitcoin transactions that might be in the database.
|
|
104
|
+
5. Constructs an immutable Args subclass to pass CLI parameters to
|
|
105
|
+
:func:`dao_treasury.main.export`.
|
|
106
|
+
6. Exports ports for external services into environment variables.
|
|
107
|
+
7. Runs both the DAO Treasury export and Yearn team revenue/expenses calculation concurrently under asyncio.
|
|
92
108
|
"""
|
|
109
|
+
import dao_treasury.db
|
|
93
110
|
import eth_portfolio
|
|
94
111
|
|
|
95
112
|
from . import constants, rules, shitcoins
|
|
@@ -97,10 +114,16 @@ def main() -> None:
|
|
|
97
114
|
# Merge local SHITCOINS into eth_portfolio's config to skip tokens we don't care about
|
|
98
115
|
eth_portfolio.SHITCOINS[constants.CHAINID].update(shitcoins.SHITCOINS) # type: ignore [index]
|
|
99
116
|
|
|
117
|
+
# Drop any shitcoin txs that might be in the db
|
|
118
|
+
dao_treasury.db._drop_shitcoin_txs()
|
|
119
|
+
|
|
100
120
|
@final
|
|
101
121
|
class Args(constants.Args):
|
|
102
122
|
"""
|
|
103
|
-
Immutable container of CLI arguments for
|
|
123
|
+
Immutable container of CLI arguments for export and dashboard/renderer configuration.
|
|
124
|
+
|
|
125
|
+
Inherits from DAO Treasury's :class:`constants.Args` and is used to pass runtime
|
|
126
|
+
parameters to the DAO Treasury export and related services.
|
|
104
127
|
"""
|
|
105
128
|
|
|
106
129
|
network: Final[str] = args.network
|
|
@@ -109,34 +132,45 @@ def main() -> None:
|
|
|
109
132
|
interval: Final[str] = args.interval
|
|
110
133
|
"""Time interval between snapshots."""
|
|
111
134
|
|
|
135
|
+
concurrency: Final[int] = args.concurrency
|
|
136
|
+
"""The max number of historical blocks to export concurrently."""
|
|
137
|
+
|
|
112
138
|
grafana_port: Final[int] = args.grafana_port
|
|
113
139
|
"""Grafana port."""
|
|
114
140
|
|
|
115
|
-
renderer_port: Final[int] = args.renderer_port
|
|
116
|
-
"""Report renderer port."""
|
|
117
|
-
|
|
118
141
|
victoria_port: Final[int] = args.victoria_port
|
|
119
142
|
"""Victoria metrics port."""
|
|
120
143
|
|
|
144
|
+
start_renderer: Final[bool] = args.start_renderer
|
|
145
|
+
"""Boolean indicating whether to start the renderer container."""
|
|
146
|
+
|
|
147
|
+
renderer_port: Final[int] = args.renderer_port
|
|
148
|
+
"""Report renderer port."""
|
|
149
|
+
|
|
121
150
|
daemon: Final[bool] = args.daemon
|
|
122
151
|
"""Whether to run in daemon mode."""
|
|
123
152
|
|
|
124
|
-
|
|
125
|
-
"""The path where the sort rules for dao-treasury are defined."""
|
|
153
|
+
import dao_treasury.main
|
|
126
154
|
|
|
127
|
-
# Export ports for external services
|
|
128
|
-
os.environ["
|
|
129
|
-
os.environ["
|
|
155
|
+
# Export ports for external services (must come after import)
|
|
156
|
+
os.environ["DAO_TREASURY_GRAFANA_PORT"] = str(Args.grafana_port)
|
|
157
|
+
os.environ["DAO_TREASURY_RENDERER_PORT"] = str(Args.renderer_port)
|
|
130
158
|
os.environ["VICTORIA_PORT"] = str(Args.victoria_port)
|
|
131
159
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
rules # I just put this here so the import isn't flagged as unused
|
|
160
|
+
async def yearn_wrapper():
|
|
161
|
+
"""
|
|
162
|
+
Run the DAO Treasury export and Yearn team revenue/expenses calculation concurrently.
|
|
136
163
|
|
|
164
|
+
This coroutine gathers:
|
|
165
|
+
- The main DAO Treasury export process (dao_treasury.main.export)
|
|
166
|
+
- The Yearn teams' revenue and expenses calculation (yteams.calculate_teams_revenue_expenses)
|
|
167
|
+
"""
|
|
168
|
+
return await asyncio.gather(
|
|
169
|
+
dao_treasury.main.export(Args),
|
|
170
|
+
yteams.calculate_teams_revenue_expenses(),
|
|
171
|
+
)
|
|
137
172
|
|
|
138
|
-
|
|
139
|
-
|
|
173
|
+
# Start the balance export routine
|
|
174
|
+
asyncio.get_event_loop().run_until_complete(yearn_wrapper())
|
|
140
175
|
|
|
141
|
-
#
|
|
142
|
-
await asyncio.gather(export_balances(args), dao_treasury.main.export(args))
|
|
176
|
+
rules # I just put this here so the import isn't flagged as unused
|
yearn_treasury/rules/__init__.py
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
__ALRU_ENV_NAME = "ASYNC_LRU_ALLOW_SYNC"
|
|
4
|
+
__ALRU_ENV_VAL = os.environ.get(__ALRU_ENV_NAME)
|
|
5
|
+
os.environ[__ALRU_ENV_NAME] = "1"
|
|
6
|
+
|
|
1
7
|
from yearn_treasury.rules.cost_of_revenue import *
|
|
8
|
+
from yearn_treasury.rules.expense import *
|
|
9
|
+
from yearn_treasury.rules.ignore import *
|
|
10
|
+
from yearn_treasury.rules.other_expense import *
|
|
2
11
|
from yearn_treasury.rules.other_income import *
|
|
3
12
|
from yearn_treasury.rules.revenue import *
|
|
13
|
+
|
|
14
|
+
if __ALRU_ENV_VAL is None:
|
|
15
|
+
os.environ.pop(__ALRU_ENV_NAME)
|
|
16
|
+
else:
|
|
17
|
+
os.environ[__ALRU_ENV_NAME] = __ALRU_ENV_VAL
|
|
18
|
+
|
|
19
|
+
del __ALRU_ENV_NAME
|
|
20
|
+
del __ALRU_ENV_VAL
|
|
Binary file
|
|
@@ -9,7 +9,7 @@ EEE_ADDRESS: Final = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"
|
|
|
9
9
|
ZERO_ADDRESS: Final = "0x0000000000000000000000000000000000000000"
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
YFI = {
|
|
12
|
+
YFI: Final = {
|
|
13
13
|
Network.Mainnet: "0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e",
|
|
14
14
|
Network.Fantom: "0x29b0Da86e484E1C0029B56e817912d778aC0EC69",
|
|
15
15
|
Network.Arbitrum: "0x82e3A8F066a6989666b031d916c43672085b1582",
|
|
Binary file
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Gas cost rules for Yearn Treasury.
|
|
3
|
+
|
|
4
|
+
This module defines rules and matching logic for classifying gas-related
|
|
5
|
+
transactions as cost of revenue. It includes logic for multisig
|
|
6
|
+
reimbursements, strategist gas, returned gas, and more.
|
|
7
|
+
"""
|
|
8
|
+
|
|
1
9
|
# mypy: disable-error-code="call-overload"
|
|
2
10
|
from typing import Final, Set
|
|
3
11
|
|
|
4
12
|
import pony.orm
|
|
5
|
-
from dao_treasury
|
|
6
|
-
from dao_treasury.sorting import cost_of_revenue
|
|
13
|
+
from dao_treasury import TreasuryTx, cost_of_revenue
|
|
7
14
|
from eth_typing import HexStr
|
|
8
15
|
from y import Network
|
|
9
16
|
from y.constants import CHAINID
|
|
@@ -28,7 +35,7 @@ gas("Other Gas").match(
|
|
|
28
35
|
|
|
29
36
|
_STRATEGIST_GAS_HASHES: Final[Set[HexStr]] = {}.get(CHAINID, set())
|
|
30
37
|
|
|
31
|
-
_RETURNED_GAS_HASHES: Final[Set[HexStr]] = {
|
|
38
|
+
_RETURNED_GAS_HASHES: Final[Set[HexStr]] = { # type: ignore [assignment]
|
|
32
39
|
Network.Mainnet: {
|
|
33
40
|
"0x86fee63ec8efb0e7320a6d48ac3890b1089b77a3d9ed74cade389f512471c299",
|
|
34
41
|
"0xa77c4f7596968fef96565a0025cc6f9881622f62cc4c823232f9c9000ba5f981",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|