wayfinder-paths 0.1.7__py3-none-any.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 wayfinder-paths might be problematic. Click here for more details.

Files changed (149) hide show
  1. wayfinder_paths/CONFIG_GUIDE.md +399 -0
  2. wayfinder_paths/__init__.py +22 -0
  3. wayfinder_paths/abis/generic/erc20.json +383 -0
  4. wayfinder_paths/adapters/__init__.py +0 -0
  5. wayfinder_paths/adapters/balance_adapter/README.md +94 -0
  6. wayfinder_paths/adapters/balance_adapter/adapter.py +238 -0
  7. wayfinder_paths/adapters/balance_adapter/examples.json +6 -0
  8. wayfinder_paths/adapters/balance_adapter/manifest.yaml +8 -0
  9. wayfinder_paths/adapters/balance_adapter/test_adapter.py +59 -0
  10. wayfinder_paths/adapters/brap_adapter/README.md +249 -0
  11. wayfinder_paths/adapters/brap_adapter/__init__.py +7 -0
  12. wayfinder_paths/adapters/brap_adapter/adapter.py +726 -0
  13. wayfinder_paths/adapters/brap_adapter/examples.json +175 -0
  14. wayfinder_paths/adapters/brap_adapter/manifest.yaml +11 -0
  15. wayfinder_paths/adapters/brap_adapter/test_adapter.py +286 -0
  16. wayfinder_paths/adapters/hyperlend_adapter/__init__.py +7 -0
  17. wayfinder_paths/adapters/hyperlend_adapter/adapter.py +305 -0
  18. wayfinder_paths/adapters/hyperlend_adapter/manifest.yaml +10 -0
  19. wayfinder_paths/adapters/hyperlend_adapter/test_adapter.py +274 -0
  20. wayfinder_paths/adapters/hyperliquid_adapter/__init__.py +18 -0
  21. wayfinder_paths/adapters/hyperliquid_adapter/adapter.py +1093 -0
  22. wayfinder_paths/adapters/hyperliquid_adapter/executor.py +549 -0
  23. wayfinder_paths/adapters/hyperliquid_adapter/manifest.yaml +8 -0
  24. wayfinder_paths/adapters/hyperliquid_adapter/paired_filler.py +1050 -0
  25. wayfinder_paths/adapters/hyperliquid_adapter/test_adapter.py +126 -0
  26. wayfinder_paths/adapters/hyperliquid_adapter/test_adapter_live.py +219 -0
  27. wayfinder_paths/adapters/hyperliquid_adapter/test_utils.py +220 -0
  28. wayfinder_paths/adapters/hyperliquid_adapter/utils.py +134 -0
  29. wayfinder_paths/adapters/ledger_adapter/README.md +145 -0
  30. wayfinder_paths/adapters/ledger_adapter/__init__.py +7 -0
  31. wayfinder_paths/adapters/ledger_adapter/adapter.py +289 -0
  32. wayfinder_paths/adapters/ledger_adapter/examples.json +137 -0
  33. wayfinder_paths/adapters/ledger_adapter/manifest.yaml +11 -0
  34. wayfinder_paths/adapters/ledger_adapter/test_adapter.py +205 -0
  35. wayfinder_paths/adapters/pool_adapter/README.md +206 -0
  36. wayfinder_paths/adapters/pool_adapter/__init__.py +7 -0
  37. wayfinder_paths/adapters/pool_adapter/adapter.py +282 -0
  38. wayfinder_paths/adapters/pool_adapter/examples.json +143 -0
  39. wayfinder_paths/adapters/pool_adapter/manifest.yaml +10 -0
  40. wayfinder_paths/adapters/pool_adapter/test_adapter.py +220 -0
  41. wayfinder_paths/adapters/token_adapter/README.md +101 -0
  42. wayfinder_paths/adapters/token_adapter/__init__.py +3 -0
  43. wayfinder_paths/adapters/token_adapter/adapter.py +96 -0
  44. wayfinder_paths/adapters/token_adapter/examples.json +26 -0
  45. wayfinder_paths/adapters/token_adapter/manifest.yaml +6 -0
  46. wayfinder_paths/adapters/token_adapter/test_adapter.py +125 -0
  47. wayfinder_paths/config.example.json +22 -0
  48. wayfinder_paths/conftest.py +31 -0
  49. wayfinder_paths/core/__init__.py +18 -0
  50. wayfinder_paths/core/adapters/BaseAdapter.py +65 -0
  51. wayfinder_paths/core/adapters/__init__.py +5 -0
  52. wayfinder_paths/core/adapters/base.py +5 -0
  53. wayfinder_paths/core/adapters/models.py +46 -0
  54. wayfinder_paths/core/analytics/__init__.py +11 -0
  55. wayfinder_paths/core/analytics/bootstrap.py +57 -0
  56. wayfinder_paths/core/analytics/stats.py +48 -0
  57. wayfinder_paths/core/analytics/test_analytics.py +170 -0
  58. wayfinder_paths/core/clients/AuthClient.py +83 -0
  59. wayfinder_paths/core/clients/BRAPClient.py +109 -0
  60. wayfinder_paths/core/clients/ClientManager.py +210 -0
  61. wayfinder_paths/core/clients/HyperlendClient.py +192 -0
  62. wayfinder_paths/core/clients/LedgerClient.py +443 -0
  63. wayfinder_paths/core/clients/PoolClient.py +128 -0
  64. wayfinder_paths/core/clients/SimulationClient.py +192 -0
  65. wayfinder_paths/core/clients/TokenClient.py +89 -0
  66. wayfinder_paths/core/clients/TransactionClient.py +63 -0
  67. wayfinder_paths/core/clients/WalletClient.py +94 -0
  68. wayfinder_paths/core/clients/WayfinderClient.py +269 -0
  69. wayfinder_paths/core/clients/__init__.py +48 -0
  70. wayfinder_paths/core/clients/protocols.py +392 -0
  71. wayfinder_paths/core/clients/sdk_example.py +110 -0
  72. wayfinder_paths/core/config.py +458 -0
  73. wayfinder_paths/core/constants/__init__.py +26 -0
  74. wayfinder_paths/core/constants/base.py +42 -0
  75. wayfinder_paths/core/constants/erc20_abi.py +118 -0
  76. wayfinder_paths/core/constants/hyperlend_abi.py +152 -0
  77. wayfinder_paths/core/engine/StrategyJob.py +188 -0
  78. wayfinder_paths/core/engine/__init__.py +5 -0
  79. wayfinder_paths/core/engine/manifest.py +97 -0
  80. wayfinder_paths/core/services/__init__.py +0 -0
  81. wayfinder_paths/core/services/base.py +179 -0
  82. wayfinder_paths/core/services/local_evm_txn.py +430 -0
  83. wayfinder_paths/core/services/local_token_txn.py +231 -0
  84. wayfinder_paths/core/services/web3_service.py +45 -0
  85. wayfinder_paths/core/settings.py +61 -0
  86. wayfinder_paths/core/strategies/Strategy.py +280 -0
  87. wayfinder_paths/core/strategies/__init__.py +5 -0
  88. wayfinder_paths/core/strategies/base.py +7 -0
  89. wayfinder_paths/core/strategies/descriptors.py +81 -0
  90. wayfinder_paths/core/utils/__init__.py +1 -0
  91. wayfinder_paths/core/utils/evm_helpers.py +206 -0
  92. wayfinder_paths/core/utils/wallets.py +77 -0
  93. wayfinder_paths/core/wallets/README.md +91 -0
  94. wayfinder_paths/core/wallets/WalletManager.py +56 -0
  95. wayfinder_paths/core/wallets/__init__.py +7 -0
  96. wayfinder_paths/policies/enso.py +17 -0
  97. wayfinder_paths/policies/erc20.py +34 -0
  98. wayfinder_paths/policies/evm.py +21 -0
  99. wayfinder_paths/policies/hyper_evm.py +19 -0
  100. wayfinder_paths/policies/hyperlend.py +12 -0
  101. wayfinder_paths/policies/hyperliquid.py +30 -0
  102. wayfinder_paths/policies/moonwell.py +54 -0
  103. wayfinder_paths/policies/prjx.py +30 -0
  104. wayfinder_paths/policies/util.py +27 -0
  105. wayfinder_paths/run_strategy.py +411 -0
  106. wayfinder_paths/scripts/__init__.py +0 -0
  107. wayfinder_paths/scripts/create_strategy.py +181 -0
  108. wayfinder_paths/scripts/make_wallets.py +169 -0
  109. wayfinder_paths/scripts/run_strategy.py +124 -0
  110. wayfinder_paths/scripts/validate_manifests.py +213 -0
  111. wayfinder_paths/strategies/__init__.py +0 -0
  112. wayfinder_paths/strategies/basis_trading_strategy/README.md +213 -0
  113. wayfinder_paths/strategies/basis_trading_strategy/__init__.py +3 -0
  114. wayfinder_paths/strategies/basis_trading_strategy/constants.py +1 -0
  115. wayfinder_paths/strategies/basis_trading_strategy/examples.json +16 -0
  116. wayfinder_paths/strategies/basis_trading_strategy/manifest.yaml +23 -0
  117. wayfinder_paths/strategies/basis_trading_strategy/snapshot_mixin.py +1011 -0
  118. wayfinder_paths/strategies/basis_trading_strategy/strategy.py +4522 -0
  119. wayfinder_paths/strategies/basis_trading_strategy/test_strategy.py +727 -0
  120. wayfinder_paths/strategies/basis_trading_strategy/types.py +39 -0
  121. wayfinder_paths/strategies/config.py +85 -0
  122. wayfinder_paths/strategies/hyperlend_stable_yield_strategy/README.md +100 -0
  123. wayfinder_paths/strategies/hyperlend_stable_yield_strategy/examples.json +8 -0
  124. wayfinder_paths/strategies/hyperlend_stable_yield_strategy/manifest.yaml +7 -0
  125. wayfinder_paths/strategies/hyperlend_stable_yield_strategy/strategy.py +2270 -0
  126. wayfinder_paths/strategies/hyperlend_stable_yield_strategy/test_strategy.py +352 -0
  127. wayfinder_paths/strategies/stablecoin_yield_strategy/README.md +96 -0
  128. wayfinder_paths/strategies/stablecoin_yield_strategy/examples.json +17 -0
  129. wayfinder_paths/strategies/stablecoin_yield_strategy/manifest.yaml +17 -0
  130. wayfinder_paths/strategies/stablecoin_yield_strategy/strategy.py +1810 -0
  131. wayfinder_paths/strategies/stablecoin_yield_strategy/test_strategy.py +520 -0
  132. wayfinder_paths/templates/adapter/README.md +105 -0
  133. wayfinder_paths/templates/adapter/adapter.py +26 -0
  134. wayfinder_paths/templates/adapter/examples.json +8 -0
  135. wayfinder_paths/templates/adapter/manifest.yaml +6 -0
  136. wayfinder_paths/templates/adapter/test_adapter.py +49 -0
  137. wayfinder_paths/templates/strategy/README.md +153 -0
  138. wayfinder_paths/templates/strategy/examples.json +11 -0
  139. wayfinder_paths/templates/strategy/manifest.yaml +8 -0
  140. wayfinder_paths/templates/strategy/strategy.py +57 -0
  141. wayfinder_paths/templates/strategy/test_strategy.py +197 -0
  142. wayfinder_paths/tests/__init__.py +0 -0
  143. wayfinder_paths/tests/test_smoke_manifest.py +48 -0
  144. wayfinder_paths/tests/test_test_coverage.py +212 -0
  145. wayfinder_paths/tests/test_utils.py +64 -0
  146. wayfinder_paths-0.1.7.dist-info/LICENSE +21 -0
  147. wayfinder_paths-0.1.7.dist-info/METADATA +777 -0
  148. wayfinder_paths-0.1.7.dist-info/RECORD +149 -0
  149. wayfinder_paths-0.1.7.dist-info/WHEEL +4 -0
@@ -0,0 +1,383 @@
1
+ [
2
+ {
3
+ "constant": true,
4
+ "inputs": [
5
+ {
6
+ "name": "owner",
7
+ "type": "address"
8
+ },
9
+ {
10
+ "name": "spender",
11
+ "type": "address"
12
+ }
13
+ ],
14
+ "name": "allowance",
15
+ "outputs": [
16
+ {
17
+ "name": "",
18
+ "type": "uint256"
19
+ }
20
+ ],
21
+ "type": "function"
22
+ },
23
+ {
24
+ "constant": true,
25
+ "inputs": [
26
+ {
27
+ "name": "account",
28
+ "type": "address"
29
+ }
30
+ ],
31
+ "name": "balanceOf",
32
+ "outputs": [
33
+ {
34
+ "name": "",
35
+ "type": "uint256"
36
+ }
37
+ ],
38
+ "type": "function"
39
+ },
40
+ {
41
+ "constant": true,
42
+ "inputs": [],
43
+ "name": "decimals",
44
+ "outputs": [
45
+ {
46
+ "name": "",
47
+ "type": "uint8"
48
+ }
49
+ ],
50
+ "type": "function"
51
+ },
52
+ {
53
+ "constant": true,
54
+ "inputs": [],
55
+ "name": "name",
56
+ "outputs": [
57
+ {
58
+ "name": "",
59
+ "type": "string"
60
+ }
61
+ ],
62
+ "type": "function"
63
+ },
64
+ {
65
+ "constant": true,
66
+ "inputs": [],
67
+ "name": "symbol",
68
+ "outputs": [
69
+ {
70
+ "name": "",
71
+ "type": "string"
72
+ }
73
+ ],
74
+ "type": "function"
75
+ },
76
+ {
77
+ "constant": false,
78
+ "inputs": [
79
+ {
80
+ "name": "recipient",
81
+ "type": "address"
82
+ },
83
+ {
84
+ "name": "amount",
85
+ "type": "uint256"
86
+ }
87
+ ],
88
+ "name": "transfer",
89
+ "outputs": [
90
+ {
91
+ "name": "",
92
+ "type": "bool"
93
+ }
94
+ ],
95
+ "type": "function"
96
+ },
97
+ {
98
+ "constant": false,
99
+ "inputs": [
100
+ {
101
+ "name": "spender",
102
+ "type": "address"
103
+ },
104
+ {
105
+ "name": "amount",
106
+ "type": "uint256"
107
+ }
108
+ ],
109
+ "name": "approve",
110
+ "outputs": [
111
+ {
112
+ "name": "",
113
+ "type": "bool"
114
+ }
115
+ ],
116
+ "type": "function"
117
+ },
118
+ {
119
+ "inputs": [
120
+ {
121
+ "internalType": "address",
122
+ "name": "tokenA",
123
+ "type": "address"
124
+ },
125
+ {
126
+ "internalType": "address",
127
+ "name": "tokenB",
128
+ "type": "address"
129
+ },
130
+ {
131
+ "internalType": "bool",
132
+ "name": "stable",
133
+ "type": "bool"
134
+ },
135
+ {
136
+ "internalType": "uint256",
137
+ "name": "amountADesired",
138
+ "type": "uint256"
139
+ },
140
+ {
141
+ "internalType": "uint256",
142
+ "name": "amountBDesired",
143
+ "type": "uint256"
144
+ },
145
+ {
146
+ "internalType": "uint256",
147
+ "name": "amountAMin",
148
+ "type": "uint256"
149
+ },
150
+ {
151
+ "internalType": "uint256",
152
+ "name": "amountBMin",
153
+ "type": "uint256"
154
+ },
155
+ {
156
+ "internalType": "address",
157
+ "name": "to",
158
+ "type": "address"
159
+ },
160
+ {
161
+ "internalType": "uint256",
162
+ "name": "deadline",
163
+ "type": "uint256"
164
+ }
165
+ ],
166
+ "name": "addLiquidity",
167
+ "outputs": [
168
+ {
169
+ "internalType": "uint256",
170
+ "name": "amountA",
171
+ "type": "uint256"
172
+ },
173
+ {
174
+ "internalType": "uint256",
175
+ "name": "amountB",
176
+ "type": "uint256"
177
+ },
178
+ {
179
+ "internalType": "uint256",
180
+ "name": "liquidity",
181
+ "type": "uint256"
182
+ }
183
+ ],
184
+ "stateMutability": "nonpayable",
185
+ "type": "function"
186
+ },
187
+ {
188
+ "inputs": [
189
+ {
190
+ "internalType": "address",
191
+ "name": "tokenA",
192
+ "type": "address"
193
+ },
194
+ {
195
+ "internalType": "address",
196
+ "name": "tokenB",
197
+ "type": "address"
198
+ },
199
+ {
200
+ "internalType": "bool",
201
+ "name": "stable",
202
+ "type": "bool"
203
+ },
204
+ {
205
+ "internalType": "address",
206
+ "name": "_factory",
207
+ "type": "address"
208
+ },
209
+ {
210
+ "internalType": "uint256",
211
+ "name": "amountADesired",
212
+ "type": "uint256"
213
+ },
214
+ {
215
+ "internalType": "uint256",
216
+ "name": "amountBDesired",
217
+ "type": "uint256"
218
+ }
219
+ ],
220
+ "name": "quoteAddLiquidity",
221
+ "outputs": [
222
+ {
223
+ "internalType": "uint256",
224
+ "name": "amountA",
225
+ "type": "uint256"
226
+ },
227
+ {
228
+ "internalType": "uint256",
229
+ "name": "amountB",
230
+ "type": "uint256"
231
+ },
232
+ {
233
+ "internalType": "uint256",
234
+ "name": "liquidity",
235
+ "type": "uint256"
236
+ }
237
+ ],
238
+ "stateMutability": "view",
239
+ "type": "function"
240
+ },
241
+ {
242
+ "inputs": [],
243
+ "name": "defaultFactory",
244
+ "outputs": [
245
+ {
246
+ "internalType": "address",
247
+ "name": "",
248
+ "type": "address"
249
+ }
250
+ ],
251
+ "stateMutability": "view",
252
+ "type": "function"
253
+ },
254
+ {
255
+ "inputs": [
256
+ {
257
+ "internalType": "address",
258
+ "name": "tokenA",
259
+ "type": "address"
260
+ },
261
+ {
262
+ "internalType": "address",
263
+ "name": "tokenB",
264
+ "type": "address"
265
+ },
266
+ {
267
+ "internalType": "bool",
268
+ "name": "stable",
269
+ "type": "bool"
270
+ },
271
+ {
272
+ "internalType": "address",
273
+ "name": "_factory",
274
+ "type": "address"
275
+ },
276
+ {
277
+ "internalType": "uint256",
278
+ "name": "liquidity",
279
+ "type": "uint256"
280
+ }
281
+ ],
282
+ "name": "quoteRemoveLiquidity",
283
+ "outputs": [
284
+ {
285
+ "internalType": "uint256",
286
+ "name": "amountA",
287
+ "type": "uint256"
288
+ },
289
+ {
290
+ "internalType": "uint256",
291
+ "name": "amountB",
292
+ "type": "uint256"
293
+ }
294
+ ],
295
+ "stateMutability": "view",
296
+ "type": "function"
297
+ },
298
+ {
299
+ "inputs": [
300
+ {
301
+ "internalType": "address",
302
+ "name": "tokenA",
303
+ "type": "address"
304
+ },
305
+ {
306
+ "internalType": "address",
307
+ "name": "tokenB",
308
+ "type": "address"
309
+ },
310
+ {
311
+ "internalType": "bool",
312
+ "name": "stable",
313
+ "type": "bool"
314
+ },
315
+ {
316
+ "internalType": "uint256",
317
+ "name": "liquidity",
318
+ "type": "uint256"
319
+ },
320
+ {
321
+ "internalType": "uint256",
322
+ "name": "amountAMin",
323
+ "type": "uint256"
324
+ },
325
+ {
326
+ "internalType": "uint256",
327
+ "name": "amountBMin",
328
+ "type": "uint256"
329
+ },
330
+ {
331
+ "internalType": "address",
332
+ "name": "to",
333
+ "type": "address"
334
+ },
335
+ {
336
+ "internalType": "uint256",
337
+ "name": "deadline",
338
+ "type": "uint256"
339
+ }
340
+ ],
341
+ "name": "removeLiquidity",
342
+ "outputs": [
343
+ {
344
+ "internalType": "uint256",
345
+ "name": "amountA",
346
+ "type": "uint256"
347
+ },
348
+ {
349
+ "internalType": "uint256",
350
+ "name": "amountB",
351
+ "type": "uint256"
352
+ }
353
+ ],
354
+ "stateMutability": "nonpayable",
355
+ "type": "function"
356
+ },
357
+ {
358
+ "inputs": [
359
+ {
360
+ "internalType": "uint256",
361
+ "name": "_amount",
362
+ "type": "uint256"
363
+ }
364
+ ],
365
+ "name": "deposit",
366
+ "outputs": [],
367
+ "stateMutability": "nonpayable",
368
+ "type": "function"
369
+ },
370
+ {
371
+ "inputs": [
372
+ {
373
+ "internalType": "uint256",
374
+ "name": "_shares",
375
+ "type": "uint256"
376
+ }
377
+ ],
378
+ "name": "withdraw",
379
+ "outputs": [],
380
+ "stateMutability": "nonpayable",
381
+ "type": "function"
382
+ }
383
+ ]
File without changes
@@ -0,0 +1,94 @@
1
+ # Balance Adapter
2
+
3
+ Adapter that exposes wallet, token, and pool balances backed by `WalletClient`/`TokenClient` and now orchestrates transfers between the configured main/strategy wallets (with ledger bookkeeping).
4
+
5
+ - Entrypoint: `adapters.balance_adapter.adapter.BalanceAdapter`
6
+ - Manifest: `manifest.yaml`
7
+ - Tests: `test_adapter.py`
8
+
9
+ ## Capabilities
10
+
11
+ The adapter declares both `wallet_read` and `wallet_transfer` capabilities in its manifest. Transfers are executed by leveraging the shared `DefaultWeb3Service.token_transactions` helper, but ledger recording + wallet selection now live inside the adapter.
12
+
13
+ ## Construction
14
+
15
+ ```python
16
+ from wayfinder_paths.core.services.web3_service import DefaultWeb3Service
17
+ from wayfinder_paths.adapters.balance_adapter.adapter import BalanceAdapter
18
+
19
+ web3_service = DefaultWeb3Service(config)
20
+ balance = BalanceAdapter(config, web3_service=web3_service)
21
+ ```
22
+
23
+ `web3_service` is required so the adapter can share the same wallet provider (and `TokenTxn` helper) as the rest of the strategy.
24
+
25
+ ## API surface
26
+
27
+ ### `get_balance(token_id: str, wallet_address: str)`
28
+ Returns the raw balance (as an integer) for a specific token on a wallet.
29
+
30
+ ```python
31
+ success, balance = await balance.get_balance(
32
+ token_id="usd-coin-base",
33
+ wallet_address=config["main_wallet"]["address"],
34
+ )
35
+ ```
36
+
37
+ ### `get_pool_balance(pool_address: str, chain_id: int, user_address: str)`
38
+ Fetches the amount supplied to a specific pool, using the `/wallets/pool-balance` endpoint.
39
+
40
+ ```python
41
+ success, amount = await balance.get_pool_balance(
42
+ pool_address="0xPool",
43
+ chain_id=8453,
44
+ user_address=config["strategy_wallet"]["address"],
45
+ )
46
+ ```
47
+
48
+ ### `move_from_main_wallet_to_strategy_wallet(token_id: str, amount: float, strategy_name="unknown", skip_ledger=False)`
49
+ Sends the specified token from the configured `main_wallet` to the strategy wallet, records the ledger deposit (unless `skip_ledger=True`), and returns the `(success, tx_result)` tuple from the underlying send helper.
50
+
51
+ ```python
52
+ success, tx = await balance.move_from_main_wallet_to_strategy_wallet(
53
+ token_id="usd-coin-base",
54
+ amount=1.5,
55
+ strategy_name="MyStrategy",
56
+ )
57
+ ```
58
+
59
+ ### `move_from_strategy_wallet_to_main_wallet(token_id: str, amount: float, strategy_name="unknown", skip_ledger=False)`
60
+ Mirrors the previous method but withdraws from the strategy wallet back to the main wallet while recording a ledger withdrawal entry.
61
+
62
+ ```python
63
+ await balance.move_from_strategy_wallet_to_main_wallet(
64
+ token_id="usd-coin-base",
65
+ amount=0.75,
66
+ strategy_name="MyStrategy",
67
+ )
68
+ ```
69
+
70
+ All methods return `(success: bool, payload: Any)` tuples. On failure the payload is an error string.
71
+
72
+ ## Usage inside strategies
73
+
74
+ ```python
75
+ class MyStrategy(Strategy):
76
+ def __init__(self, config):
77
+ super().__init__()
78
+ web3_service = DefaultWeb3Service(config)
79
+ balance_adapter = BalanceAdapter(config, web3_service=web3_service)
80
+ self.register_adapters([balance_adapter])
81
+ self.balance_adapter = balance_adapter
82
+
83
+ async def _status(self):
84
+ success, pool_balance = await self.balance_adapter.get_pool_balance(
85
+ pool_address=self.current_pool["address"],
86
+ chain_id=self.current_pool["chain"]["id"],
87
+ user_address=self.config["strategy_wallet"]["address"],
88
+ )
89
+ return {"portfolio_value": float(pool_balance or 0), ...}
90
+ ```
91
+
92
+ ## Error handling and health checks
93
+
94
+ Any exception raised by the underlying `WalletClient`/`TokenClient` is caught and emitted as a `(False, "message")` tuple. The inherited `health_check()` method reports adapter status plus dependency status, making it safe to call from `Strategy.health_check`.