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
@@ -1,6 +1,13 @@
1
+ """
2
+ Expense rules for infrastructure payments.
3
+
4
+ This module defines matching logic for infrastructure-related expenses,
5
+ including Tenderly, Wonderland Jobs, and generic infra payments.
6
+ """
7
+
1
8
  from typing import Final
2
9
 
3
- from dao_treasury import expense
10
+ from dao_treasury import TreasuryTx, expense
4
11
 
5
12
 
6
13
  infrastructure: Final = expense("Infrastructure")
@@ -15,3 +22,26 @@ infrastructure("Tenderly Subscription").match(
15
22
  infrastructure("Wonderland Jobs").match(
16
23
  symbol="DAI", to_address="0x8bA72884984f669aBBc9a5a7b441AD8E3D9a4fD3"
17
24
  )
25
+
26
+
27
+ @infrastructure("Unspecified Infra")
28
+ def is_generic_infra(tx: TreasuryTx) -> bool:
29
+ txhash = tx.hash
30
+ if tx.symbol == "DAI" and txhash in {
31
+ "0x0c59e87027bcdcaa718e322a28bc436106d73ae8623071930437bdb0706c4d65",
32
+ "0x47035f156d4e6144c144b2ac5e91497e353c9a4e23133587bbf3da2f9d7da596",
33
+ "0x40352e7166bf5196aa1160302cfcc157facf99731af0e11741b8729dd84e131c",
34
+ "0xc269f6fb016a48fe150f689231a73532b631877d1376608df639dad79514904b",
35
+ }:
36
+ return True
37
+
38
+ other = {
39
+ "0x08ef1aacdf7d0f16be5e6fd0a64ebd0ba3b0c3dd0a7884a9a470aa89a7fe1a06": 222,
40
+ "0xeb51cb5a3b4ae618be75bf3e23c2d8e333d93d5e81e869eca7f9612a30079822": 195,
41
+ "0x3e75d22250d87c183824c3b77ddb9cb11935db2061ce7f34df4f024d0646fcfb": 117,
42
+ "0x1621ba5c9b57930c97cc43d5d6d401ee9c69fed435b0b458ee031544a10bfa75": 460,
43
+ "0x5deca5d6c934372c174bbef8be9a1e103e06d8b93fd3bf8d77865dfeb34fe3be": 98,
44
+ "0xfc07ee04d44f8e481f58339b7b8c998d454e4ec427b8021c4e453c8eeee6a9b9": 207,
45
+ }
46
+
47
+ return txhash in other and tx.log_index == other[txhash]
@@ -39,3 +39,46 @@ def is_coordinape(tx: TreasuryTx) -> bool:
39
39
  def is_ygift_grant(tx: TreasuryTx) -> bool:
40
40
  """Yearn used to use yGift to send team grants but that ended up being too expensive."""
41
41
  return tx.to_nickname == "Contract: yGift" and tx.symbol == "yyDAI+yUSDC+yUSDT+yTUSD"
42
+
43
+
44
+ # TODO: refactor all of this, there's gotta be a better way to handle yteams who have received both one-off and streamed pmnts
45
+ @grants("yHAAS Trinity [BR#263]")
46
+ def is_yhaas_trinity_ii(tx: TreasuryTx) -> bool:
47
+ """https://github.com/yearn/budget/issues/263"""
48
+ return (
49
+ tx.hash == "0xd35c30664f3241ea2ec3df1c70261086247025eb72c2bc919108dfef9b08a450"
50
+ and tx.to_address.address
51
+ in (
52
+ # team
53
+ "0x35a83D4C1305451E0448fbCa96cAb29A7cCD0811",
54
+ # stream
55
+ "0xEC83C8c3156e4f6b95B048066F3b308C93cb5848",
56
+ )
57
+ )
58
+
59
+
60
+ @grants("G-Team [BR#267]")
61
+ def is_gteam(tx: TreasuryTx) -> bool:
62
+ """https://github.com/yearn/budget/issues/267"""
63
+ return (
64
+ tx.hash == "0xd35c30664f3241ea2ec3df1c70261086247025eb72c2bc919108dfef9b08a450"
65
+ and tx.to_address == "0x63E02F93622541CfE41aFedCF96a114DB71Ba4EE"
66
+ )
67
+
68
+
69
+ @grants("Rantom [BR#129]")
70
+ def is_rantom(tx: TreasuryTx) -> bool:
71
+ """https://github.com/yearn/budget/issues/129"""
72
+ return tx.to_address == "0x254b42CaCf7290e72e2C84c0337E36E645784Ce1"
73
+
74
+
75
+ @grants("Worms")
76
+ def is_worms(tx: TreasuryTx) -> bool:
77
+ return tx.to_address == "0xB1d693B77232D88a3C9467eD5619FfE79E80BCCc"
78
+
79
+
80
+ # NOTE: this needs to go at the bottom because there are some streams that will already be caught by above matchers
81
+ @grants("Simple Vesting Escrow")
82
+ def is_simple_vesting_escrow(tx: TreasuryTx) -> bool:
83
+ # TODO: amortize the streamed funds as a daily amount and sort more granularly based on BR
84
+ return tx.to_nickname == "Contract: Simple Vesting Escrow"
@@ -1,15 +1,23 @@
1
+ """
2
+ Expense rules for security, audits, and bug bounties.
3
+
4
+ This module defines matching logic for security-related expenses,
5
+ including audits (yAcademy, ChainSec, StateMind, MixBytes, unspecified),
6
+ bug bounties, and other security-related deliverables.
7
+ """
8
+
1
9
  from typing import Final
2
10
 
3
11
  from dao_treasury import TreasuryTx, expense
4
12
  from y import Network
5
- from y.constants import CHAINID
6
13
 
7
14
 
8
- security: Final = expense("Secutiry")
15
+ security: Final = expense("Security")
9
16
  audits: Final = security("Audits")
17
+ grants: Final = security("Grants")
10
18
 
11
19
 
12
- @audits("yAcademy")
20
+ @audits("yAcademy", Network.Mainnet)
13
21
  def is_yacademy_audit(tx: TreasuryTx) -> bool:
14
22
  """Expense for an audit performed by yAcademy"""
15
23
  # NOTE: the hash we're excluding was a one-time revshare tx before the splitter was set up.
@@ -19,62 +27,69 @@ def is_yacademy_audit(tx: TreasuryTx) -> bool:
19
27
  )
20
28
 
21
29
 
22
- @audits("ChainSec")
30
+ @audits("ChainSec", Network.Mainnet)
23
31
  def is_chainsec_audit(tx: TreasuryTx) -> bool:
24
32
  """Expense for an audit performed by chainsec"""
25
33
  if (
26
- CHAINID == Network.Mainnet
27
- and tx._symbol in ["USDC", "USDT"]
34
+ tx.symbol in ["USDC", "USDT"]
28
35
  and tx.to_address == "0x8bAf5eaF92E37CD9B1FcCD676918A9B3D4F87Dc7"
29
36
  ):
30
37
  return True
31
- return tx.hash == "0x83ec212072f82f4aba4b512051d52c5f016de79a620a580622a0f051e3473a78" or (
38
+
39
+ txhash = tx.hash
40
+ return txhash == "0x83ec212072f82f4aba4b512051d52c5f016de79a620a580622a0f051e3473a78" or (
32
41
  # https://github.com/yearn/budget/issues/246
33
- tx.hash == "0xd0fa31ccf6bf7577a533366955bb528d6d17c928bba1ff13ab273487a27d9602"
42
+ txhash == "0xd0fa31ccf6bf7577a533366955bb528d6d17c928bba1ff13ab273487a27d9602"
34
43
  and tx.log_index == 254
35
44
  )
36
45
 
37
46
 
38
- @audits("StateMind")
47
+ @audits("StateMind", Network.Mainnet)
39
48
  def is_statemind_audit(tx: TreasuryTx) -> bool:
40
49
  """Expense for an audit performed by statemind"""
50
+ txhash = tx.hash
51
+ log_index = tx.log_index
52
+ if log_index is None:
53
+ return False
41
54
  if (
42
- tx.hash == "0xeb51cb5a3b4ae618be75bf3e23c2d8e333d93d5e81e869eca7f9612a30079822"
43
- and tx.log_index == 193
55
+ txhash == "0xeb51cb5a3b4ae618be75bf3e23c2d8e333d93d5e81e869eca7f9612a30079822"
56
+ and log_index == 193
44
57
  ):
45
58
  return True
46
59
  elif (
47
- tx.hash == "0xcb79cbe5b68d04a1a3feab3360734277020ee0536380843a8c9db3e8356b81d6"
48
- and tx.log_index == 398
60
+ txhash == "0xcb79cbe5b68d04a1a3feab3360734277020ee0536380843a8c9db3e8356b81d6"
61
+ and log_index == 398
49
62
  ):
50
63
  return True
51
64
  elif (
52
- tx.hash == "0x3e75d22250d87c183824c3b77ddb9cb11935db2061ce7f34df4f024d0646fcfb"
53
- and tx.log_index == 115
65
+ txhash == "0x3e75d22250d87c183824c3b77ddb9cb11935db2061ce7f34df4f024d0646fcfb"
66
+ and log_index == 115
54
67
  ):
55
68
  return True
56
69
  return False
57
70
 
58
71
 
59
- @audits("MixBytes")
72
+ @audits("MixBytes", Network.Mainnet)
60
73
  def is_mixbytes_audit(tx: TreasuryTx) -> bool:
61
74
  """Expense for an audit performed by mixbytes"""
75
+ txhash = tx.hash
62
76
  if (
63
- tx.hash == "0xcb79cbe5b68d04a1a3feab3360734277020ee0536380843a8c9db3e8356b81d6"
77
+ txhash == "0xcb79cbe5b68d04a1a3feab3360734277020ee0536380843a8c9db3e8356b81d6"
64
78
  and tx.log_index == 399
65
79
  ):
66
80
  return True
67
81
  elif (
68
- tx.hash == "0xca61496c32806ba34f0deb331c32969eda11c947fdd6235173e6fa13d9a1c288"
82
+ txhash == "0xca61496c32806ba34f0deb331c32969eda11c947fdd6235173e6fa13d9a1c288"
69
83
  and tx.symbol == "USDC"
70
84
  ):
71
85
  return True
72
86
  return False
73
87
 
74
88
 
75
- @audits("Unspecified Audit")
89
+ @audits("Unspecified Audit", Network.Mainnet)
76
90
  def is_other_audit(tx: TreasuryTx) -> bool:
77
- if tx.hash in {
91
+ txhash = tx.hash
92
+ if txhash in {
78
93
  "0x7df5566cc9ff8ed0aafe126b74ad0e3957e62d530d007565ee32bd1303bcec32",
79
94
  "0x5e95d5b0773eefaef9c7187d5e9187a89717d269f48e5dcf707acfe1a7e55cb9",
80
95
  "0x9cfd1098c5459002a90ffa23931f7bbec430b3f2ec0ef2d3a641cef574eb0817",
@@ -82,25 +97,26 @@ def is_other_audit(tx: TreasuryTx) -> bool:
82
97
  }:
83
98
  return True
84
99
  elif (
85
- tx.hash == "0x70ecc34da6c461a0bb9dadfbc4d082a8486e742cbb454f0f67b2df384fb9bffc"
100
+ txhash == "0x70ecc34da6c461a0bb9dadfbc4d082a8486e742cbb454f0f67b2df384fb9bffc"
86
101
  and tx.log_index == 89
87
102
  ):
88
103
  return True
89
104
  return False
90
105
 
91
106
 
92
- @security("Bug Bounty")
107
+ @security("Bug Bounty", Network.Mainnet)
93
108
  def is_bug_bounty(tx: TreasuryTx) -> bool:
94
- if tx.hash == "0x4df2eee567ebf2a41b555fca3fed41300b12ff2dc3c79ffaee8b7bdf262f9303":
109
+ txhash = tx.hash
110
+ if txhash == "0x4df2eee567ebf2a41b555fca3fed41300b12ff2dc3c79ffaee8b7bdf262f9303":
95
111
  return True
96
112
  elif (
97
- tx.hash == "0x5deca5d6c934372c174bbef8be9a1e103e06d8b93fd3bf8d77865dfeb34fe3be"
113
+ txhash == "0x5deca5d6c934372c174bbef8be9a1e103e06d8b93fd3bf8d77865dfeb34fe3be"
98
114
  and tx.log_index in (100, 101)
99
115
  ):
100
116
  # Immunefi
101
117
  return True
102
118
  elif (
103
- tx.hash == "0x3e045ced19590db8905d8a69c2f0fd0acd4f90301cf6356742e735cd7caa0964"
119
+ txhash == "0x3e045ced19590db8905d8a69c2f0fd0acd4f90301cf6356742e735cd7caa0964"
104
120
  and tx.log_index == 327
105
121
  ):
106
122
  # Sherlock
@@ -108,16 +124,24 @@ def is_bug_bounty(tx: TreasuryTx) -> bool:
108
124
  return False
109
125
 
110
126
 
111
- security("Anti-Spam Discord Bot").match(
127
+ security("Anti-Spam Discord Bot", Network.Mainnet).match(
112
128
  hash="0xe397d5682ef780b5371f8c80670e0cd94b4f945c7b432319b24f65c288995a17",
113
129
  log_index=357,
114
130
  )
115
131
 
116
132
 
117
- @security("War Room Assistance")
133
+ @security("War Room Assistance", Network.Mainnet)
118
134
  def is_warroom_help(tx: TreasuryTx) -> bool:
119
135
  """A past yearner was paid a one-time payment to assist in a war room."""
120
136
  return (
121
137
  tx.hash == "0xca61496c32806ba34f0deb331c32969eda11c947fdd6235173e6fa13d9a1c288"
122
138
  and tx.log_index == 152
123
139
  )
140
+
141
+
142
+ @grants("ySecurity", Network.Mainnet)
143
+ def is_ysecurity(tx: TreasuryTx) -> bool:
144
+ """
145
+ https://github.com/yearn/budget/issues/145
146
+ """
147
+ return tx.to_address == "0x4851C7C7163bdF04A22C9e12Ab77e184a5dB8F0E"
@@ -1,6 +1,8 @@
1
- from .general import *
2
- from .maker import *
3
- from .staking import *
4
- from .swaps import *
5
- from .weth import *
6
- from .ygov import *
1
+ from yearn_treasury.rules.ignore.general import *
2
+ from yearn_treasury.rules.ignore.maker import *
3
+ from yearn_treasury.rules.ignore.passthru import *
4
+ from yearn_treasury.rules.ignore.staking import *
5
+ from yearn_treasury.rules.ignore.swaps import *
6
+ from yearn_treasury.rules.ignore.unit import *
7
+ from yearn_treasury.rules.ignore.weth import *
8
+ from yearn_treasury.rules.ignore.ygov import *
@@ -4,7 +4,8 @@ from dao_treasury import TreasuryTx, ignore
4
4
  @ignore("Returned Funds")
5
5
  def is_returned_fundus(tx: TreasuryTx) -> bool:
6
6
  """A user accientally refunded their yield to yChad, yChad sent it back."""
7
- return tx.hash == "0x2c2fb9d88a7a25b100ae3ba08bdb1cafbbd6a63386a08fdcfe32d077836defa3" or (
8
- tx.hash == "0xd7e7abe600aad4a3181a3a410bef2539389579d2ed28f3e75dbbf3a7d8613688"
7
+ txhash = tx.hash
8
+ return txhash == "0x2c2fb9d88a7a25b100ae3ba08bdb1cafbbd6a63386a08fdcfe32d077836defa3" or (
9
+ txhash == "0xd7e7abe600aad4a3181a3a410bef2539389579d2ed28f3e75dbbf3a7d8613688"
9
10
  and tx.log_index == 556
10
11
  )
@@ -1,3 +1,11 @@
1
+ """
2
+ Ignore rules for Maker protocol.
3
+
4
+ This module defines matching logic for Maker protocol transactions,
5
+ including DAI minting/burning, DSR deposit/withdrawal, and CDP
6
+ deposit/withdrawal for YFI and USDC.
7
+ """
8
+
1
9
  from decimal import Decimal
2
10
  from typing import Final
3
11
 
@@ -10,10 +18,10 @@ DSPROXY: Final = "0xd42e1Cb8b98382df7Db43e0F09dFE57365659D16"
10
18
  DEPOSIT_EVENT_ARGS: Final = "ilk", "usr", "wad"
11
19
  WITHDRAWAL_EVENT_ARGS: Final = "cdp", "dst", "wad"
12
20
 
13
- maker = ignore("Maker")
14
- dai = maker("DAI")
15
- dsr = maker("DSR")
16
- cdp = maker("CDP")
21
+ maker: Final = ignore("Maker")
22
+ dai: Final = maker("DAI")
23
+ dsr: Final = maker("DSR")
24
+ cdp: Final = maker("CDP")
17
25
 
18
26
 
19
27
  dai("Minting").match(symbol="DAI", from_address=ZERO_ADDRESS)
@@ -26,83 +34,59 @@ dsr("Withdrawal").match(from_nickname="Contract: DsrManager")
26
34
 
27
35
  @cdp("YFI Deposit")
28
36
  def is_yfi_cdp_deposit(tx: TreasuryTx) -> bool:
29
- if (
30
- tx.symbol == "YFI"
31
- and TreasuryWallet._get_instance(tx.from_address.address) # type: ignore [union-attr, arg-type]
32
- and slip_in_events(tx)
37
+ if tx.symbol == "YFI" and TreasuryWallet.check_membership(
38
+ tx.from_address.address, tx.block # type: ignore [union-attr, arg-type]
33
39
  ):
34
- for event in tx._events["slip"]:
35
- if (
36
- all(arg in event for arg in DEPOSIT_EVENT_ARGS)
37
- and Decimal(event["wad"]) / 10**18 == tx.amount
38
- ):
39
- return True
40
+ for event in tx.get_events("slip"):
41
+ if all(arg in event for arg in DEPOSIT_EVENT_ARGS):
42
+ # TODO: remove this rounding once we move to postgres
43
+ scaled = round(Decimal(event["wad"]) / 10**18, 12)
44
+ rounded = round(tx.amount, 12)
45
+ if scaled == rounded:
46
+ return True
47
+ print(f"yfi cdp deposit amount no match [{scaled}, {rounded}]")
40
48
  return False
41
49
 
42
50
 
43
51
  @cdp("YFI Withdrawal")
44
52
  def is_yfi_cdp_withdrawal(tx: TreasuryTx) -> bool:
45
- if (
46
- tx.symbol == "YFI"
47
- and TreasuryWallet._get_instance(tx.to_address.address) # type: ignore [union-attr, arg-type]
48
- and flux_in_events(tx)
53
+ if tx.symbol == "YFI" and TreasuryWallet.check_membership(
54
+ tx.to_address.address, tx.block # type: ignore [union-attr, arg-type]
49
55
  ):
50
- for event in tx._events["flux"]:
51
- if (
52
- all(arg in event for arg in WITHDRAWAL_EVENT_ARGS)
53
- and Decimal(event["wad"]) / 10**18 == tx.amount
54
- ):
55
- return True
56
+ for event in tx.get_events("flux"):
57
+ if all(arg in event for arg in WITHDRAWAL_EVENT_ARGS):
58
+ # TODO: remove this rounding once we move to postgres
59
+ scaled = round(Decimal(event["wad"]) / 10**18, 12)
60
+ rounded = round(tx.amount, 12)
61
+ if scaled == rounded:
62
+ return True
63
+ print(f"yfi cdp withdrawal amount no match [{scaled}, {rounded}]")
56
64
  return False
57
65
 
58
66
 
59
67
  @cdp("USDC Deposit")
60
68
  def is_usdc_cdp_deposit(tx: TreasuryTx) -> bool:
61
- if (
62
- tx.symbol == "USDC"
63
- and TreasuryWallet._get_instance(tx.from_address.address) # type: ignore [union-attr, arg-type]
64
- and slip_in_events(tx)
69
+ if tx.symbol == "USDC" and TreasuryWallet.check_membership(
70
+ tx.from_address.address, tx.block # type: ignore [union-attr, arg-type]
65
71
  ):
66
- for event in tx._events["slip"]:
67
- if (
68
- all(arg in event for arg in DEPOSIT_EVENT_ARGS)
69
- and Decimal(event["wad"]) / 10**18 == tx.amount
70
- ):
71
- return True
72
+ for event in tx.get_events("slip"):
73
+ if all(arg in event for arg in DEPOSIT_EVENT_ARGS):
74
+ scaled = Decimal(event["wad"]) / 10**18
75
+ if scaled == tx.amount:
76
+ return True
77
+ print(f"usdc cdp deposit amount no match [{scaled}, {tx.amount}]")
72
78
  return False
73
79
 
74
80
 
75
81
  @cdp("USDC Withdrawal")
76
82
  def is_usdc_cdp_withdrawal(tx: TreasuryTx) -> bool:
77
- if (
78
- tx.symbol == "USDC"
79
- and TreasuryWallet._get_instance(tx.to_address.address) # type: ignore [union-attr, arg-type]
80
- and flux_in_events(tx)
83
+ if tx.symbol == "USDC" and TreasuryWallet.check_membership(
84
+ tx.to_address.address, tx.block # type: ignore [union-attr, arg-type]
81
85
  ):
82
- for event in tx._events["flux"]:
83
- if (
84
- all(arg in event for arg in WITHDRAWAL_EVENT_ARGS)
85
- and Decimal(event["wad"]) / 10**18 == tx.amount
86
- ):
87
- return True
86
+ for event in tx.get_events("flux"):
87
+ if all(arg in event for arg in WITHDRAWAL_EVENT_ARGS):
88
+ scaled = Decimal(event["wad"]) / 10**18
89
+ if scaled == tx.amount:
90
+ return True
91
+ print(f"usdc cdp withdrawal amount no match [{scaled}, {tx.amount}]")
88
92
  return False
89
-
90
-
91
- def flux_in_events(tx: TreasuryTx) -> bool:
92
- try:
93
- return "flux" in tx._events
94
- except KeyError as e:
95
- # This happens sometimes due to a busted abi and shouldnt impact us
96
- if str(e) == "'components'":
97
- return False
98
- raise
99
-
100
-
101
- def slip_in_events(tx: TreasuryTx) -> bool:
102
- try:
103
- return "slip" in tx._events
104
- except KeyError as e:
105
- # This happens sometimes due to a busted abi and shouldnt impact us
106
- if str(e) == "'components'":
107
- return False
108
- raise