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.

Files changed (127) hide show
  1. yearn_treasury/__init__.py +16 -0
  2. yearn_treasury/_db.cp310-win_amd64.pyd +0 -0
  3. yearn_treasury/_db.py +41 -0
  4. yearn_treasury/_ens.cp310-win_amd64.pyd +0 -0
  5. yearn_treasury/_ens.py +14 -0
  6. yearn_treasury/_logging.cp310-win_amd64.pyd +0 -0
  7. yearn_treasury/_logging.py +43 -0
  8. yearn_treasury/address_labels.yaml +39 -0
  9. yearn_treasury/budget/__init__.cp310-win_amd64.pyd +0 -0
  10. yearn_treasury/budget/__init__.py +2 -2
  11. yearn_treasury/budget/_request.cp310-win_amd64.pyd +0 -0
  12. yearn_treasury/budget/_request.py +8 -0
  13. yearn_treasury/budget/_requests.cp310-win_amd64.pyd +0 -0
  14. yearn_treasury/budget/_requests.py +45 -14
  15. yearn_treasury/constants.py +34 -6
  16. yearn_treasury/main.py +77 -43
  17. yearn_treasury/rules/__init__.py +17 -0
  18. yearn_treasury/rules/constants.cp310-win_amd64.pyd +0 -0
  19. yearn_treasury/rules/constants.py +1 -1
  20. yearn_treasury/rules/cost_of_revenue/gas.cp310-win_amd64.pyd +0 -0
  21. yearn_treasury/rules/cost_of_revenue/gas.py +10 -3
  22. yearn_treasury/rules/expense/__init__.cp310-win_amd64.pyd +0 -0
  23. yearn_treasury/rules/expense/general.cp310-win_amd64.pyd +0 -0
  24. yearn_treasury/rules/expense/infrastructure.cp310-win_amd64.pyd +0 -0
  25. yearn_treasury/rules/expense/infrastructure.py +31 -1
  26. yearn_treasury/rules/expense/people.cp310-win_amd64.pyd +0 -0
  27. yearn_treasury/rules/expense/people.py +43 -0
  28. yearn_treasury/rules/expense/security.cp310-win_amd64.pyd +0 -0
  29. yearn_treasury/rules/expense/security.py +51 -27
  30. yearn_treasury/rules/ignore/__init__.py +8 -6
  31. yearn_treasury/rules/ignore/general.cp310-win_amd64.pyd +0 -0
  32. yearn_treasury/rules/ignore/general.py +3 -2
  33. yearn_treasury/rules/ignore/maker.py +48 -64
  34. yearn_treasury/rules/ignore/passthru.py +310 -0
  35. yearn_treasury/rules/ignore/staking.py +23 -18
  36. yearn_treasury/rules/ignore/swaps/__init__.py +18 -5
  37. yearn_treasury/rules/ignore/swaps/aave.py +39 -19
  38. yearn_treasury/rules/ignore/swaps/auctions.cp310-win_amd64.pyd +0 -0
  39. yearn_treasury/rules/ignore/swaps/auctions.py +31 -0
  40. yearn_treasury/rules/ignore/swaps/compound.py +38 -36
  41. yearn_treasury/rules/ignore/swaps/conversion_factory.cp310-win_amd64.pyd +0 -0
  42. yearn_treasury/rules/ignore/swaps/conversion_factory.py +21 -0
  43. yearn_treasury/rules/ignore/swaps/cowswap.py +87 -0
  44. yearn_treasury/rules/ignore/swaps/curve.py +170 -0
  45. yearn_treasury/rules/ignore/swaps/gearbox.cp310-win_amd64.pyd +0 -0
  46. yearn_treasury/rules/ignore/swaps/gearbox.py +37 -0
  47. yearn_treasury/rules/ignore/swaps/iearn.cp310-win_amd64.pyd +0 -0
  48. yearn_treasury/rules/ignore/swaps/iearn.py +43 -0
  49. yearn_treasury/rules/ignore/swaps/otc.cp310-win_amd64.pyd +0 -0
  50. yearn_treasury/rules/ignore/swaps/otc.py +58 -0
  51. yearn_treasury/rules/ignore/swaps/pooltogether.cp310-win_amd64.pyd +0 -0
  52. yearn_treasury/rules/ignore/swaps/pooltogether.py +23 -0
  53. yearn_treasury/rules/ignore/swaps/synthetix.cp310-win_amd64.pyd +0 -0
  54. yearn_treasury/rules/ignore/swaps/synthetix.py +10 -0
  55. yearn_treasury/rules/ignore/swaps/uniswap.py +222 -169
  56. yearn_treasury/rules/ignore/swaps/unwrapper.cp310-win_amd64.pyd +0 -0
  57. yearn_treasury/rules/ignore/swaps/unwrapper.py +17 -0
  58. yearn_treasury/rules/ignore/swaps/vaults.cp310-win_amd64.pyd +0 -0
  59. yearn_treasury/rules/ignore/swaps/vaults.py +264 -0
  60. yearn_treasury/rules/ignore/swaps/woofy.cp310-win_amd64.pyd +0 -0
  61. yearn_treasury/rules/ignore/swaps/woofy.py +80 -0
  62. yearn_treasury/rules/ignore/swaps/yfi.cp310-win_amd64.pyd +0 -0
  63. yearn_treasury/rules/ignore/swaps/yfi.py +111 -0
  64. yearn_treasury/rules/ignore/swaps/yla.cp310-win_amd64.pyd +0 -0
  65. yearn_treasury/rules/ignore/swaps/yla.py +28 -0
  66. yearn_treasury/rules/ignore/unit.cp310-win_amd64.pyd +0 -0
  67. yearn_treasury/rules/ignore/unit.py +40 -0
  68. yearn_treasury/rules/ignore/weth.cp310-win_amd64.pyd +0 -0
  69. yearn_treasury/rules/ignore/weth.py +12 -4
  70. yearn_treasury/rules/ignore/ygov.cp310-win_amd64.pyd +0 -0
  71. yearn_treasury/rules/other_expense/__init__.cp310-win_amd64.pyd +0 -0
  72. yearn_treasury/rules/other_expense/__init__.py +7 -0
  73. yearn_treasury/rules/other_expense/boost.cp310-win_amd64.pyd +0 -0
  74. yearn_treasury/rules/other_expense/boost.py +49 -0
  75. yearn_treasury/rules/other_expense/bugs.cp310-win_amd64.pyd +0 -0
  76. yearn_treasury/rules/other_expense/bugs.py +81 -0
  77. yearn_treasury/rules/other_expense/donations.cp310-win_amd64.pyd +0 -0
  78. yearn_treasury/rules/other_expense/donations.py +43 -0
  79. yearn_treasury/rules/other_expense/dyfi.cp310-win_amd64.pyd +0 -0
  80. yearn_treasury/rules/other_expense/dyfi.py +29 -0
  81. yearn_treasury/rules/other_expense/events.cp310-win_amd64.pyd +0 -0
  82. yearn_treasury/rules/other_expense/events.py +21 -0
  83. yearn_treasury/rules/other_expense/match_on_to_address.yaml +3 -2
  84. yearn_treasury/rules/other_expense/misc.cp310-win_amd64.pyd +0 -0
  85. yearn_treasury/rules/other_expense/misc.py +49 -0
  86. yearn_treasury/rules/other_expense/revshare.cp310-win_amd64.pyd +0 -0
  87. yearn_treasury/rules/other_expense/revshare.py +20 -0
  88. yearn_treasury/rules/other_income/__init__.cp310-win_amd64.pyd +0 -0
  89. yearn_treasury/rules/other_income/__init__.py +2 -77
  90. yearn_treasury/rules/other_income/airdrops.cp310-win_amd64.pyd +0 -0
  91. yearn_treasury/rules/other_income/airdrops.py +30 -0
  92. yearn_treasury/rules/other_income/match_on_hash.yaml +2 -0
  93. yearn_treasury/rules/other_income/misc.cp310-win_amd64.pyd +0 -0
  94. yearn_treasury/rules/other_income/misc.py +80 -0
  95. yearn_treasury/rules/revenue/__init__.py +5 -0
  96. yearn_treasury/rules/revenue/bribes.cp310-win_amd64.pyd +0 -0
  97. yearn_treasury/rules/revenue/farming.cp310-win_amd64.pyd +0 -0
  98. yearn_treasury/rules/revenue/farming.py +56 -0
  99. yearn_treasury/rules/revenue/keepcoins.cp310-win_amd64.pyd +0 -0
  100. yearn_treasury/rules/revenue/seasolver.cp310-win_amd64.pyd +0 -0
  101. yearn_treasury/rules/revenue/seasolver.py +7 -1
  102. yearn_treasury/rules/revenue/vaults.py +97 -34
  103. yearn_treasury/rules/revenue/yteams.cp310-win_amd64.pyd +0 -0
  104. yearn_treasury/rules/revenue/yteams.py +17 -0
  105. yearn_treasury/shitcoins.py +93 -2
  106. yearn_treasury/vaults.cp310-win_amd64.pyd +0 -0
  107. yearn_treasury/vaults.py +30 -22
  108. yearn_treasury/wallets.yaml +54 -0
  109. yearn_treasury/yteams.py +208 -0
  110. yearn_treasury-0.0.48.dist-info/METADATA +86 -0
  111. yearn_treasury-0.0.48.dist-info/RECORD +128 -0
  112. yearn_treasury-0.0.48.dist-info/top_level.txt +2 -0
  113. yearn_treasury__mypyc.cp310-win_amd64.pyd +0 -0
  114. f79b89f5f6693162015b__mypyc.cp310-win_amd64.pyd +0 -0
  115. yearn_treasury/rules/ignore/__init__.cp310-win_amd64.pyd +0 -0
  116. yearn_treasury/rules/ignore/maker.cp310-win_amd64.pyd +0 -0
  117. yearn_treasury/rules/ignore/staking.cp310-win_amd64.pyd +0 -0
  118. yearn_treasury/rules/ignore/swaps/__init__.cp310-win_amd64.pyd +0 -0
  119. yearn_treasury/rules/ignore/swaps/_skip_tokens.cp310-win_amd64.pyd +0 -0
  120. yearn_treasury/rules/ignore/swaps/aave.cp310-win_amd64.pyd +0 -0
  121. yearn_treasury/rules/ignore/swaps/compound.cp310-win_amd64.pyd +0 -0
  122. yearn_treasury/rules/ignore/swaps/uniswap.cp310-win_amd64.pyd +0 -0
  123. yearn_treasury-0.0.8.dist-info/METADATA +0 -69
  124. yearn_treasury-0.0.8.dist-info/RECORD +0 -76
  125. yearn_treasury-0.0.8.dist-info/top_level.txt +0 -2
  126. {yearn_treasury-0.0.8.dist-info → yearn_treasury-0.0.48.dist-info}/WHEEL +0 -0
  127. {yearn_treasury-0.0.8.dist-info → yearn_treasury-0.0.48.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,81 @@
1
+ from dao_treasury import TreasuryTx, other_expense
2
+ from y import Network
3
+
4
+
5
+ bugs = other_expense("Bug Reimbursements")
6
+
7
+
8
+ @bugs("yDAI Fee Calculation Bug", Network.Mainnet)
9
+ def is_double_fee_reimbursement(tx: TreasuryTx) -> bool:
10
+ """
11
+ Due to new single-sided strats that deposit into other vaults,
12
+ some users were accidentally charged 2x the expected withdrawal fee.
13
+ """
14
+ return tx.from_nickname == "Disperse.app" and tx.hash in [
15
+ "0x4ce0c829fb46fc1ea03e434599a68af4c6f65f80aff7e934a008c0fe63e9da3f",
16
+ "0x90b54bf0d35621160b5094c263a2684f8e7b37fc6467c8c1ce6a53e2e7acbfa1",
17
+ "0x2f667223aaefc4b153c28440d151fdb19333aff5d052c0524f2804fbd5a7964c",
18
+ ]
19
+
20
+
21
+ @bugs("yYFI Fee Calculation Bug", Network.Mainnet)
22
+ def is_yyfi_fee_reimbursement(tx: TreasuryTx) -> bool:
23
+ return (
24
+ tx.from_nickname == "Disperse.app"
25
+ and tx.hash == "0x867b547b67910a08c939978d8071acca28ecc444d7155c0626e87730f67c058c"
26
+ )
27
+
28
+
29
+ @bugs("yvCurve-IB Fee Calculation Bug", Network.Mainnet)
30
+ def is_lossy_fee_reimbursement(tx: TreasuryTx) -> bool:
31
+ """old vault code doesn't prevent fees from making harvest lossy. so here we airdrop the fee-take back to vault and do some housekeeper to prevent this from happening on other strats."""
32
+ return (
33
+ tx.hash == "0x61eea3d40b2dc8586a5d20109ed962998c43cc55a37c300f283820150490eaa0"
34
+ and tx.log_index == 179
35
+ )
36
+
37
+
38
+ @bugs("Reimburse st-yCRV User", Network.Mainnet)
39
+ def is_stycrv(tx: TreasuryTx) -> bool:
40
+ """Some user lost some funds in a minor issue, then was reimbursed."""
41
+ return (
42
+ tx.hash == "0x491f07d134f3253ef06a2b46d83b82cdf2927b13cce4d38225d92ce01799da96"
43
+ and tx.log_index == 197
44
+ )
45
+
46
+
47
+ @bugs("Slippage Bug", Network.Mainnet)
48
+ def is_slippage_bug_reimbursement(tx: TreasuryTx) -> bool:
49
+ """a swap tx was messed up so Yearn sent treasury funds to the relevant strategy to compensate"""
50
+ txhash = tx.hash
51
+ if txhash in [
52
+ "0xffe3883e34ae0b6ae3a7f304f00c625a7b315a021cf38f47a932e81d3f1c371c",
53
+ "0x42cfcaa06beebe61547724f22fa790c763b2937ca2af8e3d5dbc680b903aad69",
54
+ ]:
55
+ return True
56
+
57
+ other = {
58
+ # separate slippage event
59
+ "0xc179e27f0e38bca52744d71dc6ff2463ed10fa918908ce28adcf4f4c0d6d6a1e": 103,
60
+ "0x51c611597574aaa3b829004363476b1c2a4dc2941dff695c26c100498b695b4f": 214,
61
+ }
62
+
63
+ return txhash in other and tx.log_index == other[txhash]
64
+
65
+
66
+ @bugs("Reimburse GUSD Vault Bug", Network.Mainnet)
67
+ def is_gusd_vault_bug_reimbursement(tx: TreasuryTx) -> bool:
68
+ return (
69
+ tx.symbol == "GUSD"
70
+ and tx.hash == "0x22f62d0922c430232aa402296055d79a6cf5c36a8b6253a7f1f46f1e1f66e277"
71
+ and tx.log_index != 65
72
+ )
73
+
74
+
75
+ @bugs("Reimburse DAI Vault Bug", Network.Mainnet)
76
+ def is_dai_vault_reimbursement(tx: TreasuryTx) -> bool:
77
+ # this is from very early days, I'm not sure if it's documented anywhere
78
+ return (
79
+ tx.hash == "0x61ad3697ab56316ffdc7b8eaaeee57d0b3f8d4fed3e283eee35c6c38eed594e0"
80
+ and tx.log_index == 202
81
+ )
@@ -0,0 +1,43 @@
1
+ """
2
+ Other expense rules for donations in Yearn Treasury.
3
+
4
+ This module defines matching logic for donation transactions,
5
+ including Gitcoin matching rounds, 4626 Alliance, Vyper Compiler
6
+ Audit Contest, Warroom Games, and more.
7
+ """
8
+
9
+ from typing import Final
10
+
11
+ from dao_treasury import TreasuryTx, other_expense
12
+ from y import Network
13
+
14
+
15
+ donations: Final = other_expense("Donations")
16
+
17
+ gitcoin: Final = "0xde21F729137C5Af1b01d73aF1dC21eFfa2B8a0d6"
18
+
19
+
20
+ @donations("Gitcoin Matching Round", Network.Mainnet)
21
+ def is_gitcoin_matching_donation(tx: TreasuryTx) -> bool:
22
+ return tx.symbol in ["DAI", "USDC"] and tx.to_address == gitcoin
23
+
24
+
25
+ donations("4626 Alliance", Network.Mainnet).match(
26
+ hash="0xca61496c32806ba34f0deb331c32969eda11c947fdd6235173e6fa13d9a1c288",
27
+ log_index=150,
28
+ )
29
+
30
+
31
+ donations("Vyper Compiler Audit Contest", Network.Mainnet).match(
32
+ # Grant for a vyper compiler audit context, vyper-context.eth
33
+ hash="0xb8bb3728fdfb49d7c86c08dba8e3586e3761f13d2c88fa6fab80227b6a3f4519",
34
+ log_index=202,
35
+ )
36
+
37
+
38
+ @donations("Warroom Games 2023 Prizes", Network.Mainnet)
39
+ def is_warroom_games(tx: TreasuryTx) -> bool:
40
+ return (
41
+ tx.hash == "0x8f17ead9cea87166cf99ed2cdbc46dfdf98c04c261de5b5167caddce5f704cb2"
42
+ and tx.log_index in [429, 430, 431]
43
+ )
@@ -0,0 +1,29 @@
1
+ from typing import Final
2
+
3
+ from dao_treasury import TreasuryTx, other_expense
4
+ from pony.orm import commit
5
+ from y import Network
6
+
7
+
8
+ dyfi: Final = other_expense("dYFI")
9
+
10
+
11
+ @dyfi("Launch", Network.Mainnet)
12
+ def is_dyfi_launch(tx: TreasuryTx) -> bool:
13
+ txhash = tx.hash
14
+ if txhash == "0x2ec726e5ee52cdc063e61795d1b96a75d16fd91824136c990b7c3ddd52b28e31":
15
+ # unused returned
16
+ if tx.amount > 0:
17
+ tx.amount *= -1
18
+ commit()
19
+ if tx.value_usd > 0: # type: ignore [operator]
20
+ tx.value_usd *= -1 # type: ignore [operator]
21
+ commit()
22
+ return True
23
+ return txhash == "0x066c32f02fc0908d55b6651afcfb20473ec3d99363de222f2e8f4a7e0c66462e"
24
+
25
+
26
+ @dyfi("Redemptions", Network.Mainnet)
27
+ def is_dyfi_redemptions(tx: TreasuryTx) -> bool:
28
+ """YFI going to the dyfi redemptions contract"""
29
+ return tx.symbol == "YFI" and tx.to_nickname == "dYFI Redemption Contract"
@@ -0,0 +1,21 @@
1
+ from typing import Final
2
+
3
+ from dao_treasury import TreasuryTx, other_expense
4
+ from y import Network
5
+
6
+
7
+ events: Final = other_expense("Events")
8
+
9
+
10
+ events("Devcon").match(
11
+ hash="0x57bc99f6007989606bdd9d1adf91c99d198de51f61d29689ee13ccf440b244df",
12
+ log_index=83,
13
+ )
14
+
15
+
16
+ @events("EthDenver", Network.Mainnet)
17
+ def is_eth_denver(tx: TreasuryTx) -> bool:
18
+ return (
19
+ tx.hash == "0x26956f86b3f4e3ff9de2779fb73533f3e1f8ce058493eec312501d0e8053fe7a"
20
+ and tx.log_index == 179
21
+ )
@@ -3,5 +3,6 @@
3
3
  - "0x93C6c14C134C4fF52cbB6BC2f50F19d84874cDD1"
4
4
  Aztek Gas Subsidy:
5
5
  - "0xABc30E831B5Cc173A9Ed5941714A7845c909e7fA"
6
- Vyper Donation:
7
- - "0x70CCBE10F980d80b7eBaab7D2E3A73e87D67B775"
6
+ Donations:
7
+ Vyper:
8
+ - "0x70CCBE10F980d80b7eBaab7D2E3A73e87D67B775"
@@ -0,0 +1,49 @@
1
+ """
2
+ Other expense rules for miscellaneous cases in Yearn Treasury.
3
+
4
+ This module defines matching logic for miscellaneous other expenses.
5
+ If it doesn't really fit anywhere else in :mod:`~other_expenses`,
6
+ it will end up in here.
7
+ """
8
+
9
+ from dao_treasury import TreasuryTx, other_expense
10
+ from y import Network
11
+
12
+
13
+ other_expense("veYFI Launch", Network.Mainnet).match(
14
+ hash="0x51202f9e8a9afa84a9a0c37831ca9a18508810175cb95ab7c52691bbe69a56d5",
15
+ symbol="YFI",
16
+ )
17
+
18
+
19
+ @other_expense("yBudget Reward", Network.Mainnet)
20
+ def is_ybudget_reward(tx: TreasuryTx) -> bool:
21
+ txhash = tx.hash
22
+ return (
23
+ # Epoch 2
24
+ (
25
+ tx.symbol == "YFI"
26
+ and txhash == "0xae7d281b8a093da60d39179452d230de2f1da4355df3aea629d969782708da5d"
27
+ )
28
+ or txhash
29
+ in (
30
+ # Epoch 1
31
+ "0xa1b242b2626def6cdbe49d92a06aad96fa018c27b48719a98530c5e5e0ac61c5",
32
+ # Epoch 3
33
+ "0x6ba3f2bed8b766ed2185df1a492b3ecab0251747c619a5d60e7401908120c9c8",
34
+ )
35
+ )
36
+
37
+
38
+ @other_expense("1 YFI for Signers", Network.Mainnet)
39
+ def is_one_yfi_for_signers(tx: TreasuryTx) -> bool:
40
+ txhash = tx.hash
41
+ return txhash in (
42
+ "0x86700207761cdca82a0ad4e04b49b749913de63c8bd933b4f3f9a145d9b2c1fa",
43
+ # https://snapshot.box/#/s:veyfi.eth/proposal/0xc7ded2863a10154b6b520921af4ada48d64d74e5b7989f98cdf073542b2e4411
44
+ "0x5ed4ce821cb09b4c6929cc9a6b5e0a23515f9bb97d9b5916819a6986f6c89f09",
45
+ "0xe80628d90254f8da0a6016629c8811b5dd54f231e94f71697ab37d8c00482586",
46
+ ) or (
47
+ txhash == "0x831ad751e1be1dbb82cb9e1f5bf0e38e31327b8c58f6ad6b90bcfb396129bb11"
48
+ and tx.log_index == 403
49
+ )
@@ -0,0 +1,20 @@
1
+ """These predate the yteam revshare splitting implementation so were done manually"""
2
+
3
+ from typing import Final
4
+
5
+ from dao_treasury import other_expense
6
+ from y import Network
7
+
8
+
9
+ revshare: Final = other_expense("Revshare")
10
+
11
+
12
+ revshare("yAudit", Network.Mainnet).match(
13
+ hash="0xdf3e6cf2e50052e4eeb57fb2562b5e1b02701014ce65b60e6c8a850c409b341a",
14
+ log_index=127,
15
+ )
16
+
17
+ revshare("yLockers", Network.Mainnet).match(
18
+ hash="0x038aeb3351b762bc92c5e4274c01520ae08dc314e2282ececc2a19a033d994a8",
19
+ log_index=163,
20
+ )
@@ -1,77 +1,2 @@
1
- from decimal import Decimal
2
- from typing import Final
3
-
4
- from brownie import ZERO_ADDRESS
5
- from y import Contract, ContractNotVerified, ERC20, Network # type: ignore [attr-defined]
6
-
7
- from dao_treasury import TreasuryTx, other_income
8
-
9
-
10
- _POINT_ONE: Final = Decimal("0.1")
11
-
12
-
13
- @other_income("aToken Yield", Network.Mainnet)
14
- def is_atoken_yield(tx: TreasuryTx) -> bool:
15
- return (
16
- tx.symbol in ("aLEND", "aLINK")
17
- and tx.from_address.address == ZERO_ADDRESS
18
- and tx.to_nickname in ("Yearn Treasury", "Yearn Treasury V1")
19
- )
20
-
21
-
22
- @other_income("RoboVault Thank You", Network.Fantom)
23
- async def is_robovault_share(tx: TreasuryTx) -> bool:
24
- """
25
- After Yearn devs helped robovault with a vulnerability, robovault committed to sending Yearn a portion of their fees.
26
- """
27
- if not tx.symbol.startswith("rv") and tx.from_address.is_contract:
28
- return False
29
-
30
- try:
31
- strat = await Contract.coroutine(tx.from_address.address)
32
- except ContractNotVerified:
33
- return False
34
-
35
- if not hasattr(strat, "vault"):
36
- return False
37
-
38
- if await strat.vault.coroutine(block_identifier=tx.block) == tx.token:
39
- return True
40
-
41
- return (
42
- tx.from_nickname == "Contract: Strategy"
43
- and tx.symbol == "rv3USDCc"
44
- and await ERC20( # type: ignore [call-overload]
45
- await strat.vault.coroutine(block_identifier=tx.block),
46
- asynchronous=True,
47
- ).symbol
48
- == "rv3USDCb"
49
- )
50
-
51
-
52
- @other_income("Cowswap Gas Reimbursement", Network.Mainnet)
53
- def is_cowswap_gas_reimbursement(tx: TreasuryTx) -> bool:
54
- return (
55
- tx.symbol == "ETH"
56
- and tx.from_nickname == "Cowswap Multisig"
57
- and tx.to_nickname == "yMechs Multisig"
58
- )
59
-
60
-
61
- @other_income("USDS Referral Code", Network.Mainnet)
62
- def is_usds_referral_code(tx: TreasuryTx) -> bool:
63
- """Yearn earns some USDS for referring deposits to Maker"""
64
- return (
65
- tx.symbol == "USDS"
66
- and tx.from_address.address == "0x3C5142F28567E6a0F172fd0BaaF1f2847f49D02F"
67
- )
68
-
69
-
70
- @other_income("yETH Application Fee", Network.Mainnet)
71
- def is_yeth_application_fee(tx: TreasuryTx) -> bool:
72
- return tx.symbol == "yETH" and tx.to_nickname == "Yearn Treasury" and tx.amount == _POINT_ONE
73
-
74
-
75
- @other_income("yPRISMA Fees", Network.Mainnet)
76
- def is_yprisma_fees(tx: TreasuryTx) -> bool:
77
- return tx.symbol == "yvmkUSD-A" and tx.from_nickname == "Contract: YPrismaFeeDistributor"
1
+ from yearn_treasury.rules.other_income.airdrops import *
2
+ from yearn_treasury.rules.other_income.misc import *
@@ -0,0 +1,30 @@
1
+ from typing import Final
2
+
3
+ from dao_treasury import TreasuryTx, other_income
4
+ from y import Network
5
+
6
+
7
+ airdrop: Final = other_income("Airdrop")
8
+
9
+ _SAFE_AIRDROP_CONTRACTS: Final = (
10
+ "0xA0b937D5c8E32a80E3a8ed4227CD020221544ee6",
11
+ "0xC0fde70A65C7569Fe919bE57492228DEE8cDb585",
12
+ )
13
+
14
+
15
+ @airdrop("SAFE", Network.Mainnet)
16
+ def is_safe_airdrop(tx: TreasuryTx) -> bool:
17
+ return tx.symbol == "SAFE" and tx.from_address.address in _SAFE_AIRDROP_CONTRACTS # type: ignore [union-attr]
18
+
19
+
20
+ @airdrop("Other", Network.Mainnet)
21
+ def is_airdrop(tx: TreasuryTx) -> bool:
22
+ return tx.hash in {
23
+ "0x327684dab9e3ce61d125b36fe0b59cbfbc8aa5ac7a5b051125ab7cac3b93b90b",
24
+ "0x44f7d3b2030799ea45932baf6049528a059aabd6387f3128993d646d01c8e877", # TKX
25
+ "0xf2dbe58dffd3bc1476755e9f74e2ae07531579d0a3ea9e2aaac2ef902e080c2a", # TKX
26
+ "0x8079e9cae847da196dc5507561bc9d1434f765f05045bc1a82df735ec83bc6ec", # MTV
27
+ # NOTE: this one was rec'd elsewhere, dumped, and WETH sent to treasury
28
+ "0xc12ded505ea158717890e4ae6e7ab5eb5cb61edbc13dfd125dd0e6f9b1af9477", # Gnosis SAFE airdrop
29
+ "0x7c086a82b43b2f49db93b76a0698cf86a9c620b3bf924f0003175b04a17455ad", # PRISMA
30
+ }
@@ -1,4 +1,6 @@
1
1
  1:
2
+ YFI Mint:
3
+ - "0x21a3007a2547a9d6f1bceb44cb9292b36079fcccd8f36f7ec1ca066db261e153"
2
4
  yvUSDN Shutdown:
3
5
  # The USDN vault was shut down but the pool was so rekt they coulnd't even swap for want. Trace amounts of yield sent to yChad.
4
6
  - "0x12b3687f4bfbc73c11dccbd61d18c3f785e6f0f91cb46280d7df08143162ceed"
@@ -0,0 +1,80 @@
1
+ # mypy: disable-error-code="union-attr"
2
+ from decimal import Decimal
3
+ from typing import Final, Optional
4
+
5
+ from dao_treasury import TreasuryTx, other_income
6
+ from y import Contract, ContractNotVerified, ERC20, Network # type: ignore [attr-defined]
7
+
8
+ from yearn_treasury.rules.constants import ZERO_ADDRESS
9
+
10
+
11
+ _POINT_ONE: Final = Decimal("0.1")
12
+
13
+
14
+ @other_income("aToken Yield", Network.Mainnet)
15
+ def is_atoken_yield(tx: TreasuryTx) -> bool:
16
+ return (
17
+ tx.symbol in ("aLEND", "aLINK")
18
+ and tx.from_address.address == ZERO_ADDRESS
19
+ and tx.to_nickname in ("Yearn Treasury", "Yearn Treasury V1")
20
+ )
21
+
22
+
23
+ @other_income("RoboVault Thank You", Network.Fantom)
24
+ async def is_robovault_share(tx: TreasuryTx) -> bool:
25
+ """
26
+ After Yearn devs helped robovault with a vulnerability, robovault committed to sending Yearn a portion of their fees.
27
+ """
28
+ if not tx.symbol.startswith("rv") and tx.from_address.is_contract:
29
+ return False
30
+
31
+ try:
32
+ strat = await tx.from_address.contract_coro
33
+ except ContractNotVerified:
34
+ return False
35
+ else:
36
+ vault: Optional[Contract] = getattr(strat, "vault", None)
37
+
38
+ if vault is None:
39
+ return False
40
+
41
+ if await vault.coroutine(block_identifier=tx.block) == tx.token:
42
+ return True
43
+
44
+ return (
45
+ tx.from_nickname == "Contract: Strategy"
46
+ and tx.symbol == "rv3USDCc"
47
+ and await ERC20( # type: ignore [call-overload]
48
+ await vault.coroutine(block_identifier=tx.block),
49
+ asynchronous=True,
50
+ ).symbol
51
+ == "rv3USDCb"
52
+ )
53
+
54
+
55
+ @other_income("Cowswap Gas Reimbursement", Network.Mainnet)
56
+ def is_cowswap_gas_reimbursement(tx: TreasuryTx) -> bool:
57
+ return (
58
+ tx.symbol == "ETH"
59
+ and tx.from_nickname == "Cowswap Multisig"
60
+ and tx.to_nickname == "yMechs Multisig"
61
+ )
62
+
63
+
64
+ @other_income("USDS Referral Code", Network.Mainnet)
65
+ def is_usds_referral_code(tx: TreasuryTx) -> bool:
66
+ """Yearn earns some USDS for referring deposits to Maker"""
67
+ return (
68
+ tx.symbol == "USDS"
69
+ and tx.from_address.address == "0x3C5142F28567E6a0F172fd0BaaF1f2847f49D02F"
70
+ )
71
+
72
+
73
+ @other_income("yETH Application Fee", Network.Mainnet)
74
+ def is_yeth_application_fee(tx: TreasuryTx) -> bool:
75
+ return tx.symbol == "yETH" and tx.to_nickname == "Yearn Treasury" and tx.amount == _POINT_ONE
76
+
77
+
78
+ @other_income("yPRISMA Fees", Network.Mainnet)
79
+ def is_yprisma_fees(tx: TreasuryTx) -> bool:
80
+ return tx.symbol == "yvmkUSD-A" and tx.from_nickname == "Contract: YPrismaFeeDistributor"
@@ -1 +1,6 @@
1
+ from yearn_treasury.rules.revenue.bribes import *
2
+ from yearn_treasury.rules.revenue.farming import *
3
+ from yearn_treasury.rules.revenue.keepcoins import *
4
+ from yearn_treasury.rules.revenue.seasolver import *
1
5
  from yearn_treasury.rules.revenue.vaults import *
6
+ from yearn_treasury.rules.revenue.yteams import *
@@ -0,0 +1,56 @@
1
+ from typing import Final
2
+
3
+ from dao_treasury import TreasuryTx, revenue
4
+ from y import Contract, Network
5
+
6
+ from yearn_treasury.rules.constants import ZERO_ADDRESS
7
+
8
+
9
+ farming: Final = revenue("Treasury Farming")
10
+
11
+
12
+ @farming("COMP Farming", Network.Mainnet)
13
+ async def is_comp_rewards(tx: TreasuryTx) -> bool:
14
+ return tx.symbol == "COMP" and await _is_generic_comp_rewards(tx)
15
+
16
+
17
+ @farming("SCREAM Farming", Network.Fantom)
18
+ async def is_scream_rewards(tx: TreasuryTx) -> bool:
19
+ return tx.symbol == "SCREAM" and await _is_generic_comp_rewards(tx)
20
+
21
+
22
+ @farming("SEX Farming", Network.Fantom)
23
+ def is_sex(tx: TreasuryTx) -> bool:
24
+ return tx.symbol == "SEX" and tx.from_address in (
25
+ ZERO_ADDRESS,
26
+ "0x7FcE87e203501C3a035CbBc5f0Ee72661976D6E1", # StakingRewards
27
+ )
28
+
29
+
30
+ @farming("SOLID Farming", Network.Fantom)
31
+ def is_solid(tx: TreasuryTx) -> bool:
32
+ return tx.symbol == "SOLID" and tx.from_address in (
33
+ "0x7FcE87e203501C3a035CbBc5f0Ee72661976D6E1", # StakingRewards
34
+ "0x26E1A0d851CF28E697870e1b7F053B605C8b060F", # LpDepositor
35
+ )
36
+
37
+
38
+ @farming("SOLIDsex Farming", Network.Fantom)
39
+ def is_solidsex(tx: TreasuryTx) -> bool:
40
+ return tx.symbol == "SOLIDsex" and tx.from_address in (
41
+ "0x7FcE87e203501C3a035CbBc5f0Ee72661976D6E1", # StakingRewards
42
+ "0xA5e76B97e12567bbA2e822aC68842097034C55e7", # FeeDistributor
43
+ )
44
+
45
+
46
+ async def _is_generic_comp_rewards(tx: TreasuryTx) -> bool:
47
+ for event in tx.get_events("DistributedSupplierComp"):
48
+ if (
49
+ tx.from_address == event.address
50
+ and "supplier" in event
51
+ and tx.to_address == event["supplier"]
52
+ ):
53
+ troller = await Contract.coroutine(event.address)
54
+ if hasattr(troller, "getCompAddress") and tx.token == await troller.getCompAddress:
55
+ return True
56
+ return False
@@ -8,7 +8,13 @@ seasolver: Final = revenue("Seasolver", Network.Mainnet)
8
8
 
9
9
  @seasolver("Positive Slippage")
10
10
  def is_seasolver_slippage_revenue(tx: TreasuryTx) -> bool:
11
- return tx.from_nickname == "Contract: TradeHandler" and tx.to_nickname == "yMechs Multisig"
11
+ # TODO: check this earlier, probably in dao-treasury internals
12
+ # After may 1 2023 ymechs wallet separated from yearn treasury
13
+ return (
14
+ tx.block <= 17162286
15
+ and tx.from_nickname == "Contract: TradeHandler"
16
+ and tx.to_nickname == "yMechs Multisig"
17
+ )
12
18
 
13
19
 
14
20
  @seasolver("CowSwap Incentives")