wayfinder-paths 0.1.3__py3-none-any.whl → 0.1.5__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.
- wayfinder_paths/CONFIG_GUIDE.md +37 -32
- wayfinder_paths/__init__.py +3 -3
- wayfinder_paths/{vaults/adapters → adapters}/balance_adapter/README.md +12 -12
- wayfinder_paths/{vaults/adapters → adapters}/balance_adapter/adapter.py +12 -11
- wayfinder_paths/{vaults/adapters → adapters}/balance_adapter/examples.json +1 -1
- wayfinder_paths/{vaults/adapters → adapters}/balance_adapter/manifest.yaml +1 -1
- wayfinder_paths/{vaults/adapters → adapters}/balance_adapter/test_adapter.py +12 -6
- wayfinder_paths/{vaults/adapters → adapters}/brap_adapter/README.md +2 -2
- wayfinder_paths/{vaults/adapters → adapters}/brap_adapter/adapter.py +30 -23
- wayfinder_paths/{vaults/adapters → adapters}/brap_adapter/manifest.yaml +1 -1
- wayfinder_paths/{vaults/adapters → adapters}/brap_adapter/test_adapter.py +2 -2
- wayfinder_paths/adapters/hyperlend_adapter/__init__.py +7 -0
- wayfinder_paths/{vaults/adapters → adapters}/hyperlend_adapter/adapter.py +33 -26
- wayfinder_paths/{vaults/adapters → adapters}/hyperlend_adapter/manifest.yaml +1 -1
- wayfinder_paths/{vaults/adapters → adapters}/hyperlend_adapter/test_adapter.py +2 -2
- wayfinder_paths/{vaults/adapters → adapters}/ledger_adapter/README.md +27 -40
- wayfinder_paths/{vaults/adapters → adapters}/ledger_adapter/adapter.py +78 -75
- wayfinder_paths/{vaults/adapters → adapters}/ledger_adapter/examples.json +10 -4
- wayfinder_paths/adapters/ledger_adapter/manifest.yaml +11 -0
- wayfinder_paths/{vaults/adapters → adapters}/ledger_adapter/test_adapter.py +33 -28
- wayfinder_paths/{vaults/adapters → adapters}/pool_adapter/README.md +2 -14
- wayfinder_paths/{vaults/adapters → adapters}/pool_adapter/adapter.py +12 -19
- wayfinder_paths/{vaults/adapters → adapters}/pool_adapter/manifest.yaml +1 -1
- wayfinder_paths/{vaults/adapters → adapters}/pool_adapter/test_adapter.py +2 -2
- wayfinder_paths/{vaults/adapters → adapters}/token_adapter/README.md +1 -1
- wayfinder_paths/{vaults/adapters → adapters}/token_adapter/adapter.py +8 -4
- wayfinder_paths/adapters/token_adapter/examples.json +26 -0
- wayfinder_paths/{vaults/adapters → adapters}/token_adapter/manifest.yaml +1 -1
- wayfinder_paths/{vaults/adapters → adapters}/token_adapter/test_adapter.py +1 -1
- wayfinder_paths/config.example.json +3 -1
- wayfinder_paths/core/__init__.py +3 -3
- wayfinder_paths/core/adapters/BaseAdapter.py +20 -3
- wayfinder_paths/core/adapters/models.py +41 -0
- wayfinder_paths/core/clients/BRAPClient.py +21 -2
- wayfinder_paths/core/clients/ClientManager.py +42 -63
- wayfinder_paths/core/clients/HyperlendClient.py +46 -5
- wayfinder_paths/core/clients/LedgerClient.py +350 -124
- wayfinder_paths/core/clients/PoolClient.py +51 -19
- wayfinder_paths/core/clients/SimulationClient.py +16 -4
- wayfinder_paths/core/clients/TokenClient.py +34 -18
- wayfinder_paths/core/clients/TransactionClient.py +18 -2
- wayfinder_paths/core/clients/WalletClient.py +35 -4
- wayfinder_paths/core/clients/WayfinderClient.py +16 -5
- wayfinder_paths/core/clients/protocols.py +69 -62
- wayfinder_paths/core/clients/sdk_example.py +0 -5
- wayfinder_paths/core/config.py +192 -103
- wayfinder_paths/core/constants/base.py +17 -0
- wayfinder_paths/core/engine/{VaultJob.py → StrategyJob.py} +25 -19
- wayfinder_paths/core/engine/__init__.py +2 -2
- wayfinder_paths/core/engine/manifest.py +1 -1
- wayfinder_paths/core/services/base.py +6 -4
- wayfinder_paths/core/services/local_evm_txn.py +3 -2
- wayfinder_paths/core/settings.py +2 -2
- wayfinder_paths/core/strategies/Strategy.py +123 -37
- wayfinder_paths/core/utils/evm_helpers.py +12 -10
- wayfinder_paths/core/wallets/README.md +3 -3
- wayfinder_paths/core/wallets/WalletManager.py +3 -3
- wayfinder_paths/{vaults/policies → policies}/enso.py +1 -1
- wayfinder_paths/{vaults/policies → policies}/hyper_evm.py +2 -2
- wayfinder_paths/{vaults/policies → policies}/hyperlend.py +1 -1
- wayfinder_paths/{vaults/policies → policies}/moonwell.py +1 -1
- wayfinder_paths/{vaults/policies → policies}/prjx.py +1 -1
- wayfinder_paths/run_strategy.py +29 -27
- wayfinder_paths/scripts/create_strategy.py +3 -3
- wayfinder_paths/scripts/make_wallets.py +6 -6
- wayfinder_paths/scripts/validate_manifests.py +2 -2
- wayfinder_paths/{vaults/strategies → strategies}/hyperlend_stable_yield_strategy/README.md +10 -9
- wayfinder_paths/{vaults/strategies → strategies}/hyperlend_stable_yield_strategy/manifest.yaml +1 -1
- wayfinder_paths/{vaults/strategies → strategies}/hyperlend_stable_yield_strategy/strategy.py +47 -167
- wayfinder_paths/{vaults/strategies → strategies}/hyperlend_stable_yield_strategy/test_strategy.py +10 -8
- wayfinder_paths/{vaults/strategies → strategies}/stablecoin_yield_strategy/README.md +15 -14
- wayfinder_paths/{vaults/strategies → strategies}/stablecoin_yield_strategy/manifest.yaml +2 -2
- wayfinder_paths/{vaults/strategies → strategies}/stablecoin_yield_strategy/strategy.py +97 -97
- wayfinder_paths/{vaults/strategies → strategies}/stablecoin_yield_strategy/test_strategy.py +8 -8
- wayfinder_paths/{vaults/templates → templates}/adapter/README.md +5 -5
- wayfinder_paths/{vaults/templates → templates}/adapter/manifest.yaml +1 -1
- wayfinder_paths/{vaults/templates → templates}/adapter/test_adapter.py +1 -1
- wayfinder_paths/{vaults/templates → templates}/strategy/README.md +10 -9
- wayfinder_paths/{vaults/templates → templates}/strategy/manifest.yaml +1 -1
- wayfinder_paths/{vaults/templates → templates}/strategy/test_strategy.py +8 -8
- wayfinder_paths/tests/test_test_coverage.py +5 -5
- {wayfinder_paths-0.1.3.dist-info → wayfinder_paths-0.1.5.dist-info}/METADATA +146 -69
- wayfinder_paths-0.1.5.dist-info/RECORD +126 -0
- wayfinder_paths/vaults/adapters/hyperlend_adapter/__init__.py +0 -7
- wayfinder_paths/vaults/adapters/ledger_adapter/manifest.yaml +0 -11
- wayfinder_paths/vaults/adapters/token_adapter/examples.json +0 -26
- wayfinder_paths/vaults/strategies/__init__.py +0 -0
- wayfinder_paths-0.1.3.dist-info/RECORD +0 -126
- /wayfinder_paths/{vaults → adapters}/__init__.py +0 -0
- /wayfinder_paths/{vaults/adapters → adapters}/brap_adapter/__init__.py +0 -0
- /wayfinder_paths/{vaults/adapters → adapters}/brap_adapter/examples.json +0 -0
- /wayfinder_paths/{vaults/adapters → adapters}/ledger_adapter/__init__.py +0 -0
- /wayfinder_paths/{vaults/adapters → adapters}/pool_adapter/__init__.py +0 -0
- /wayfinder_paths/{vaults/adapters → adapters}/pool_adapter/examples.json +0 -0
- /wayfinder_paths/{vaults/adapters → adapters}/token_adapter/__init__.py +0 -0
- /wayfinder_paths/{vaults/policies → policies}/erc20.py +0 -0
- /wayfinder_paths/{vaults/policies → policies}/evm.py +0 -0
- /wayfinder_paths/{vaults/policies → policies}/hyperliquid.py +0 -0
- /wayfinder_paths/{vaults/policies → policies}/util.py +0 -0
- /wayfinder_paths/{vaults/adapters → strategies}/__init__.py +0 -0
- /wayfinder_paths/{vaults/strategies → strategies}/config.py +0 -0
- /wayfinder_paths/{vaults/strategies → strategies}/hyperlend_stable_yield_strategy/examples.json +0 -0
- /wayfinder_paths/{vaults/strategies → strategies}/stablecoin_yield_strategy/examples.json +0 -0
- /wayfinder_paths/{vaults/templates → templates}/adapter/adapter.py +0 -0
- /wayfinder_paths/{vaults/templates → templates}/adapter/examples.json +0 -0
- /wayfinder_paths/{vaults/templates → templates}/strategy/examples.json +0 -0
- /wayfinder_paths/{vaults/templates → templates}/strategy/strategy.py +0 -0
- {wayfinder_paths-0.1.3.dist-info → wayfinder_paths-0.1.5.dist-info}/LICENSE +0 -0
- {wayfinder_paths-0.1.3.dist-info → wayfinder_paths-0.1.5.dist-info}/WHEEL +0 -0
|
@@ -6,6 +6,11 @@ from typing import Any
|
|
|
6
6
|
|
|
7
7
|
from loguru import logger
|
|
8
8
|
|
|
9
|
+
from wayfinder_paths.adapters.balance_adapter.adapter import BalanceAdapter
|
|
10
|
+
from wayfinder_paths.adapters.brap_adapter.adapter import BRAPAdapter
|
|
11
|
+
from wayfinder_paths.adapters.ledger_adapter.adapter import LedgerAdapter
|
|
12
|
+
from wayfinder_paths.adapters.pool_adapter.adapter import PoolAdapter
|
|
13
|
+
from wayfinder_paths.adapters.token_adapter.adapter import TokenAdapter
|
|
9
14
|
from wayfinder_paths.core.constants.base import DEFAULT_SLIPPAGE
|
|
10
15
|
from wayfinder_paths.core.services.local_token_txn import (
|
|
11
16
|
LocalTokenTxnService,
|
|
@@ -21,11 +26,6 @@ from wayfinder_paths.core.strategies.descriptors import (
|
|
|
21
26
|
)
|
|
22
27
|
from wayfinder_paths.core.strategies.Strategy import StatusDict, StatusTuple, Strategy
|
|
23
28
|
from wayfinder_paths.core.wallets.WalletManager import WalletManager
|
|
24
|
-
from wayfinder_paths.vaults.adapters.balance_adapter.adapter import BalanceAdapter
|
|
25
|
-
from wayfinder_paths.vaults.adapters.brap_adapter.adapter import BRAPAdapter
|
|
26
|
-
from wayfinder_paths.vaults.adapters.ledger_adapter.adapter import LedgerAdapter
|
|
27
|
-
from wayfinder_paths.vaults.adapters.pool_adapter.adapter import PoolAdapter
|
|
28
|
-
from wayfinder_paths.vaults.adapters.token_adapter.adapter import TokenAdapter
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
class StablecoinYieldStrategy(Strategy):
|
|
@@ -154,7 +154,7 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
154
154
|
config: dict[str, Any] | None = None,
|
|
155
155
|
*,
|
|
156
156
|
main_wallet: dict[str, Any] | None = None,
|
|
157
|
-
|
|
157
|
+
strategy_wallet: dict[str, Any] | None = None,
|
|
158
158
|
simulation: bool = False,
|
|
159
159
|
web3_service=None,
|
|
160
160
|
api_key: str | None = None,
|
|
@@ -163,8 +163,8 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
163
163
|
merged_config: dict[str, Any] = dict(config or {})
|
|
164
164
|
if main_wallet is not None:
|
|
165
165
|
merged_config["main_wallet"] = main_wallet
|
|
166
|
-
if
|
|
167
|
-
merged_config["
|
|
166
|
+
if strategy_wallet is not None:
|
|
167
|
+
merged_config["strategy_wallet"] = strategy_wallet
|
|
168
168
|
|
|
169
169
|
self.config = merged_config
|
|
170
170
|
self.simulation = simulation
|
|
@@ -181,11 +181,11 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
181
181
|
|
|
182
182
|
try:
|
|
183
183
|
main_wallet_cfg = self.config.get("main_wallet")
|
|
184
|
-
|
|
184
|
+
strategy_wallet_cfg = self.config.get("strategy_wallet")
|
|
185
185
|
|
|
186
186
|
adapter_config = {
|
|
187
187
|
"main_wallet": main_wallet_cfg or None,
|
|
188
|
-
"
|
|
188
|
+
"strategy_wallet": strategy_wallet_cfg or None,
|
|
189
189
|
"strategy": self.config,
|
|
190
190
|
}
|
|
191
191
|
|
|
@@ -231,14 +231,14 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
231
231
|
except Exception:
|
|
232
232
|
pass
|
|
233
233
|
|
|
234
|
-
def
|
|
235
|
-
"""Get
|
|
236
|
-
|
|
237
|
-
if not
|
|
238
|
-
raise ValueError("
|
|
239
|
-
address =
|
|
234
|
+
def _get_strategy_wallet_address(self) -> str:
|
|
235
|
+
"""Get strategy wallet address with validation."""
|
|
236
|
+
strategy_wallet = self.config.get("strategy_wallet")
|
|
237
|
+
if not strategy_wallet or not isinstance(strategy_wallet, dict):
|
|
238
|
+
raise ValueError("strategy_wallet not configured in strategy config")
|
|
239
|
+
address = strategy_wallet.get("address")
|
|
240
240
|
if not address:
|
|
241
|
-
raise ValueError("
|
|
241
|
+
raise ValueError("strategy_wallet address not found in config")
|
|
242
242
|
return str(address)
|
|
243
243
|
|
|
244
244
|
def _get_main_wallet_address(self) -> str:
|
|
@@ -258,21 +258,21 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
258
258
|
await super().setup()
|
|
259
259
|
self.current_combined_apy_pct = 0.0
|
|
260
260
|
|
|
261
|
-
# Get
|
|
261
|
+
# Get strategy net deposit
|
|
262
262
|
try:
|
|
263
|
-
logger.info("Fetching
|
|
264
|
-
|
|
265
|
-
success, deposit_data = await self.ledger_adapter.
|
|
266
|
-
wallet_address=
|
|
263
|
+
logger.info("Fetching strategy net deposit from ledger")
|
|
264
|
+
strategy_address = self._get_strategy_wallet_address()
|
|
265
|
+
success, deposit_data = await self.ledger_adapter.get_strategy_net_deposit(
|
|
266
|
+
wallet_address=strategy_address,
|
|
267
267
|
)
|
|
268
268
|
if success:
|
|
269
269
|
self.DEPOSIT_USDC = deposit_data.get("net_deposit", 0)
|
|
270
|
-
logger.info(f"
|
|
270
|
+
logger.info(f"Strategy net deposit: {self.DEPOSIT_USDC} USDC")
|
|
271
271
|
else:
|
|
272
|
-
logger.error(f"Failed to fetch
|
|
272
|
+
logger.error(f"Failed to fetch strategy net deposit: {deposit_data}")
|
|
273
273
|
self.DEPOSIT_USDC = 0
|
|
274
274
|
except Exception as e:
|
|
275
|
-
logger.error(f"Failed to fetch
|
|
275
|
+
logger.error(f"Failed to fetch strategy net deposit: {e}")
|
|
276
276
|
self.DEPOSIT_USDC = 0
|
|
277
277
|
|
|
278
278
|
# Get USDC token info
|
|
@@ -328,11 +328,11 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
328
328
|
self.current_pool_balance = 0
|
|
329
329
|
return
|
|
330
330
|
|
|
331
|
-
# Get
|
|
331
|
+
# Get strategy transactions to determine current position
|
|
332
332
|
try:
|
|
333
|
-
logger.info("Fetching
|
|
334
|
-
success, txns_data = await self.ledger_adapter.
|
|
335
|
-
wallet_address=self.
|
|
333
|
+
logger.info("Fetching strategy transaction history")
|
|
334
|
+
success, txns_data = await self.ledger_adapter.get_strategy_transactions(
|
|
335
|
+
wallet_address=self._get_strategy_wallet_address(),
|
|
336
336
|
)
|
|
337
337
|
if success:
|
|
338
338
|
txns = [
|
|
@@ -342,10 +342,10 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
342
342
|
]
|
|
343
343
|
logger.info(f"Found {len(txns)} non-deposit transactions")
|
|
344
344
|
else:
|
|
345
|
-
logger.error(f"Failed to fetch
|
|
345
|
+
logger.error(f"Failed to fetch strategy transactions: {txns_data}")
|
|
346
346
|
txns = []
|
|
347
347
|
except Exception as e:
|
|
348
|
-
logger.error(f"Failed to fetch
|
|
348
|
+
logger.error(f"Failed to fetch strategy transactions: {e}")
|
|
349
349
|
txns = []
|
|
350
350
|
|
|
351
351
|
if txns and txns[-1].get("operation") != "WITHDRAW":
|
|
@@ -413,7 +413,7 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
413
413
|
|
|
414
414
|
pool_address = self.current_pool.get("address")
|
|
415
415
|
chain_id = self.current_pool.get("chain", {}).get("id")
|
|
416
|
-
user_address = self.
|
|
416
|
+
user_address = self._get_strategy_wallet_address()
|
|
417
417
|
if (
|
|
418
418
|
pool_address
|
|
419
419
|
and chain_id
|
|
@@ -467,7 +467,7 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
467
467
|
if self.usdc_token_info:
|
|
468
468
|
status, raw_balance = await self.balance_adapter.get_balance(
|
|
469
469
|
token_id=self.usdc_token_info.get("token_id"),
|
|
470
|
-
wallet_address=self.
|
|
470
|
+
wallet_address=self._get_strategy_wallet_address(),
|
|
471
471
|
)
|
|
472
472
|
if not status or not raw_balance:
|
|
473
473
|
return
|
|
@@ -508,7 +508,7 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
508
508
|
_,
|
|
509
509
|
wallet_balances,
|
|
510
510
|
) = await self.balance_adapter.get_all_balances(
|
|
511
|
-
wallet_address=self.
|
|
511
|
+
wallet_address=self._get_strategy_wallet_address(),
|
|
512
512
|
enrich=True,
|
|
513
513
|
from_cache=False,
|
|
514
514
|
add_llama=True,
|
|
@@ -577,13 +577,13 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
577
577
|
return None
|
|
578
578
|
|
|
579
579
|
try:
|
|
580
|
-
|
|
580
|
+
strategy_address = self._get_strategy_wallet_address()
|
|
581
581
|
(
|
|
582
582
|
success,
|
|
583
583
|
onchain_balance,
|
|
584
584
|
) = await self.balance_adapter.get_balance(
|
|
585
585
|
token_id=token.get("token_id"),
|
|
586
|
-
wallet_address=
|
|
586
|
+
wallet_address=strategy_address,
|
|
587
587
|
)
|
|
588
588
|
if not success:
|
|
589
589
|
onchain_balance = best_balance_wei
|
|
@@ -733,26 +733,26 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
733
733
|
)
|
|
734
734
|
(
|
|
735
735
|
_,
|
|
736
|
-
|
|
736
|
+
strategy_gas_raw,
|
|
737
737
|
) = await self.balance_adapter.get_balance(
|
|
738
738
|
token_id=gas_token_id,
|
|
739
|
-
wallet_address=self.
|
|
739
|
+
wallet_address=self._get_strategy_wallet_address(),
|
|
740
740
|
)
|
|
741
741
|
main_gas_int = (
|
|
742
742
|
int(main_gas_raw)
|
|
743
743
|
if isinstance(main_gas_raw, int)
|
|
744
744
|
else int(float(main_gas_raw or 0))
|
|
745
745
|
)
|
|
746
|
-
|
|
747
|
-
int(
|
|
748
|
-
if isinstance(
|
|
749
|
-
else int(float(
|
|
746
|
+
strategy_gas_int = (
|
|
747
|
+
int(strategy_gas_raw)
|
|
748
|
+
if isinstance(strategy_gas_raw, int)
|
|
749
|
+
else int(float(strategy_gas_raw or 0))
|
|
750
750
|
)
|
|
751
751
|
main_gas_native = float(main_gas_int) / (10**gas_decimals)
|
|
752
|
-
|
|
753
|
-
total_gas = main_gas_native +
|
|
752
|
+
strategy_gas_native = float(strategy_gas_int) / (10**gas_decimals)
|
|
753
|
+
total_gas = main_gas_native + strategy_gas_native
|
|
754
754
|
logger.info(
|
|
755
|
-
f"Gas balances - Main: {main_gas_native} {gas_symbol},
|
|
755
|
+
f"Gas balances - Main: {main_gas_native} {gas_symbol}, Strategy: {strategy_gas_native} {gas_symbol}, Total: {total_gas} {gas_symbol}"
|
|
756
756
|
)
|
|
757
757
|
|
|
758
758
|
# Use provided gas_token_amount if available, otherwise ensure minimum
|
|
@@ -776,22 +776,22 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
776
776
|
self.DEPOSIT_USDC = main_token_amount
|
|
777
777
|
logger.info(f"Set deposit amount to {main_token_amount} USDC")
|
|
778
778
|
|
|
779
|
-
# Transfer USDC from main to
|
|
780
|
-
logger.info("Initiating USDC transfer from main to
|
|
779
|
+
# Transfer USDC from main to strategy wallet
|
|
780
|
+
logger.info("Initiating USDC transfer from main to strategy wallet")
|
|
781
781
|
(
|
|
782
782
|
success,
|
|
783
783
|
msg,
|
|
784
|
-
) = await self.balance_adapter.
|
|
784
|
+
) = await self.balance_adapter.move_from_main_wallet_to_strategy_wallet(
|
|
785
785
|
self.usdc_token_info.get("token_id"),
|
|
786
786
|
main_token_amount,
|
|
787
787
|
strategy_name=self.name,
|
|
788
788
|
)
|
|
789
789
|
if not success:
|
|
790
790
|
logger.error(f"USDC transfer failed: {msg}")
|
|
791
|
-
return (False, f"USDC transfer to
|
|
791
|
+
return (False, f"USDC transfer to strategy failed: {msg}")
|
|
792
792
|
logger.info("USDC transfer completed successfully")
|
|
793
793
|
|
|
794
|
-
# Transfer gas if provided or if
|
|
794
|
+
# Transfer gas if provided or if strategy needs top-up
|
|
795
795
|
if gas_token_amount > 0:
|
|
796
796
|
# Get gas symbol if not already defined
|
|
797
797
|
if main_token_amount == 0:
|
|
@@ -799,33 +799,33 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
799
799
|
|
|
800
800
|
# Transfer the specified gas amount
|
|
801
801
|
logger.info(
|
|
802
|
-
f"Transferring {gas_token_amount} {gas_symbol} from main wallet to
|
|
802
|
+
f"Transferring {gas_token_amount} {gas_symbol} from main wallet to strategy"
|
|
803
803
|
)
|
|
804
804
|
(
|
|
805
805
|
success,
|
|
806
806
|
msg,
|
|
807
|
-
) = await self.balance_adapter.
|
|
807
|
+
) = await self.balance_adapter.move_from_main_wallet_to_strategy_wallet(
|
|
808
808
|
gas_token_id, gas_token_amount, strategy_name=self.name
|
|
809
809
|
)
|
|
810
810
|
if not success:
|
|
811
811
|
logger.error(f"Gas transfer failed: {msg}")
|
|
812
|
-
return (False, f"Gas transfer to
|
|
812
|
+
return (False, f"Gas transfer to strategy failed: {msg}")
|
|
813
813
|
logger.info("Gas transfer completed successfully")
|
|
814
|
-
elif main_token_amount > 0 and
|
|
814
|
+
elif main_token_amount > 0 and strategy_gas_native < self.MIN_GAS:
|
|
815
815
|
# Auto-top-up to minimum if no gas amount specified and depositing main token
|
|
816
|
-
top_up_amount = self.MIN_GAS -
|
|
816
|
+
top_up_amount = self.MIN_GAS - strategy_gas_native
|
|
817
817
|
logger.info(
|
|
818
|
-
f"
|
|
818
|
+
f"Strategy gas insufficient, transferring {top_up_amount} {gas_symbol} from main wallet"
|
|
819
819
|
)
|
|
820
820
|
(
|
|
821
821
|
success,
|
|
822
822
|
msg,
|
|
823
|
-
) = await self.balance_adapter.
|
|
823
|
+
) = await self.balance_adapter.move_from_main_wallet_to_strategy_wallet(
|
|
824
824
|
gas_token_id, top_up_amount, strategy_name=self.name
|
|
825
825
|
)
|
|
826
826
|
if not success:
|
|
827
827
|
logger.error(f"Gas transfer failed: {msg}")
|
|
828
|
-
return (False, f"Gas transfer to
|
|
828
|
+
return (False, f"Gas transfer to strategy failed: {msg}")
|
|
829
829
|
logger.info("Gas transfer completed successfully")
|
|
830
830
|
|
|
831
831
|
elapsed_time = time.time() - start_time
|
|
@@ -857,7 +857,7 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
857
857
|
) = await self.balance_adapter.get_pool_balance(
|
|
858
858
|
pool_address=self.current_pool.get("address"),
|
|
859
859
|
chain_id=self.current_pool.get("chain").get("id"),
|
|
860
|
-
user_address=self.
|
|
860
|
+
user_address=self._get_strategy_wallet_address(),
|
|
861
861
|
)
|
|
862
862
|
logger.info(f"Current pool balance: {self.current_pool_balance}")
|
|
863
863
|
except Exception as e:
|
|
@@ -883,8 +883,8 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
883
883
|
to_token_address=self.usdc_token_info.get("address"),
|
|
884
884
|
from_chain_id=self.current_pool.get("chain").get("id"),
|
|
885
885
|
to_chain_id=self.usdc_token_info.get("chain").get("id"),
|
|
886
|
-
from_address=self.
|
|
887
|
-
to_address=self.
|
|
886
|
+
from_address=self._get_strategy_wallet_address(),
|
|
887
|
+
to_address=self._get_strategy_wallet_address(),
|
|
888
888
|
amount=str(self.current_pool_balance),
|
|
889
889
|
slippage=DEFAULT_SLIPPAGE * (attempt + 1),
|
|
890
890
|
)
|
|
@@ -940,7 +940,7 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
940
940
|
success, swap_result = await self.brap_adapter.swap_from_quote(
|
|
941
941
|
self.current_pool,
|
|
942
942
|
self.usdc_token_info,
|
|
943
|
-
self.
|
|
943
|
+
self._get_strategy_wallet_address(),
|
|
944
944
|
best_quote,
|
|
945
945
|
strategy_name=self.name,
|
|
946
946
|
)
|
|
@@ -958,7 +958,7 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
958
958
|
pass
|
|
959
959
|
status, raw_balance = await self.balance_adapter.get_balance(
|
|
960
960
|
token_id=self.usdc_token_info.get("token_id"),
|
|
961
|
-
wallet_address=self.
|
|
961
|
+
wallet_address=self._get_strategy_wallet_address(),
|
|
962
962
|
)
|
|
963
963
|
if not status or not raw_balance:
|
|
964
964
|
pass
|
|
@@ -967,7 +967,7 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
967
967
|
(
|
|
968
968
|
move_status,
|
|
969
969
|
move_message,
|
|
970
|
-
) = await self.balance_adapter.
|
|
970
|
+
) = await self.balance_adapter.move_from_strategy_wallet_to_main_wallet(
|
|
971
971
|
self.usdc_token_info.get("token_id"),
|
|
972
972
|
amount,
|
|
973
973
|
strategy_name=self.name,
|
|
@@ -987,7 +987,7 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
987
987
|
if self.gas_token and self.gas_token.get("id") not in withdrawn_token_ids:
|
|
988
988
|
status, raw_gas = await self.balance_adapter.get_balance(
|
|
989
989
|
token_id=self.gas_token.get("id"),
|
|
990
|
-
wallet_address=self.
|
|
990
|
+
wallet_address=self._get_strategy_wallet_address(),
|
|
991
991
|
)
|
|
992
992
|
if status and raw_gas:
|
|
993
993
|
gas_amount = (
|
|
@@ -997,7 +997,7 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
997
997
|
(
|
|
998
998
|
move_gas_status,
|
|
999
999
|
move_gas_message,
|
|
1000
|
-
) = await self.balance_adapter.
|
|
1000
|
+
) = await self.balance_adapter.move_from_strategy_wallet_to_main_wallet(
|
|
1001
1001
|
self.gas_token.get("id"),
|
|
1002
1002
|
gas_amount,
|
|
1003
1003
|
strategy_name=self.name,
|
|
@@ -1016,7 +1016,7 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
1016
1016
|
self.current_pool_balance = 0
|
|
1017
1017
|
|
|
1018
1018
|
if not withdrawn_breakdown:
|
|
1019
|
-
return (True, f"Successfully withdrew {amount} USDC from
|
|
1019
|
+
return (True, f"Successfully withdrew {amount} USDC from strategy")
|
|
1020
1020
|
|
|
1021
1021
|
breakdown_msg = ", ".join(
|
|
1022
1022
|
f"{amount:.6f} {symbol} on {chain.capitalize()}"
|
|
@@ -1027,12 +1027,12 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
1027
1027
|
logger.info(f"Withdrawal completed successfully in {elapsed_time:.2f} seconds")
|
|
1028
1028
|
return (
|
|
1029
1029
|
True,
|
|
1030
|
-
f"Successfully withdrew {amount} USDC from
|
|
1030
|
+
f"Successfully withdrew {amount} USDC from strategy: {breakdown_msg}",
|
|
1031
1031
|
)
|
|
1032
1032
|
|
|
1033
1033
|
async def _get_last_rotation_time(self, wallet_address: str) -> datetime | None:
|
|
1034
|
-
success, data = await self.ledger_adapter.
|
|
1035
|
-
wallet_address=self.
|
|
1034
|
+
success, data = await self.ledger_adapter.get_strategy_latest_transactions(
|
|
1035
|
+
wallet_address=self._get_strategy_wallet_address(),
|
|
1036
1036
|
)
|
|
1037
1037
|
if success is False:
|
|
1038
1038
|
return None
|
|
@@ -1062,7 +1062,7 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
1062
1062
|
|
|
1063
1063
|
if not self.DEPOSIT_USDC:
|
|
1064
1064
|
logger.warning("No deposits found, cannot update strategy")
|
|
1065
|
-
return [False, "Nothing has been deposited in this
|
|
1065
|
+
return [False, "Nothing has been deposited in this strategy, cannot update"]
|
|
1066
1066
|
|
|
1067
1067
|
logger.info("Getting non-gas balances")
|
|
1068
1068
|
non_gas_balances = await self._get_non_gas_balances()
|
|
@@ -1115,7 +1115,7 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
1115
1115
|
previous_pool = self.current_pool
|
|
1116
1116
|
|
|
1117
1117
|
last_rotation = await self._get_last_rotation_time(
|
|
1118
|
-
wallet_address=self.
|
|
1118
|
+
wallet_address=self._get_strategy_wallet_address(),
|
|
1119
1119
|
)
|
|
1120
1120
|
if (
|
|
1121
1121
|
previous_pool
|
|
@@ -1144,7 +1144,7 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
1144
1144
|
await self.brap_adapter.swap_from_quote(
|
|
1145
1145
|
previous_pool,
|
|
1146
1146
|
target_pool,
|
|
1147
|
-
self.
|
|
1147
|
+
self._get_strategy_wallet_address(),
|
|
1148
1148
|
brap_quote,
|
|
1149
1149
|
strategy_name=self.name,
|
|
1150
1150
|
)
|
|
@@ -1192,7 +1192,7 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
1192
1192
|
if not pool or pool.get("chain") is None:
|
|
1193
1193
|
return
|
|
1194
1194
|
|
|
1195
|
-
|
|
1195
|
+
strategy_address = self._get_strategy_wallet_address()
|
|
1196
1196
|
try:
|
|
1197
1197
|
(
|
|
1198
1198
|
_,
|
|
@@ -1200,7 +1200,7 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
1200
1200
|
) = await self.balance_adapter.get_pool_balance(
|
|
1201
1201
|
pool_address=pool.get("address"),
|
|
1202
1202
|
chain_id=pool.get("chain").get("id"),
|
|
1203
|
-
user_address=
|
|
1203
|
+
user_address=strategy_address,
|
|
1204
1204
|
)
|
|
1205
1205
|
self.current_pool_balance = int(refreshed_pool_balance)
|
|
1206
1206
|
except Exception:
|
|
@@ -1212,7 +1212,7 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
1212
1212
|
_,
|
|
1213
1213
|
wallet_balances,
|
|
1214
1214
|
) = await self.balance_adapter.get_all_balances(
|
|
1215
|
-
wallet_address=self.
|
|
1215
|
+
wallet_address=self._get_strategy_wallet_address(),
|
|
1216
1216
|
enrich=True,
|
|
1217
1217
|
from_cache=False,
|
|
1218
1218
|
add_llama=True,
|
|
@@ -1240,7 +1240,7 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
1240
1240
|
success, msg = await self.brap_adapter.swap_from_token_ids(
|
|
1241
1241
|
token_1_id,
|
|
1242
1242
|
target_token_id,
|
|
1243
|
-
self.
|
|
1243
|
+
self._get_strategy_wallet_address(),
|
|
1244
1244
|
balance_raw,
|
|
1245
1245
|
strategy_name=self.name,
|
|
1246
1246
|
)
|
|
@@ -1253,13 +1253,13 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
1253
1253
|
if self.gas_token.get("chain").get("id") != target_pool.get("chain").get("id"):
|
|
1254
1254
|
return False, "Unsupported chain for gas management."
|
|
1255
1255
|
|
|
1256
|
-
# TODO: do we need to categorize
|
|
1257
|
-
|
|
1256
|
+
# TODO: do we need to categorize strategy wallet addresses?
|
|
1257
|
+
strategy_address = self._get_strategy_wallet_address()
|
|
1258
1258
|
|
|
1259
1259
|
required_gas = int(self.MIN_GAS * (10 ** self.gas_token.get("decimals")))
|
|
1260
1260
|
_, current_gas = await self.balance_adapter.get_balance(
|
|
1261
1261
|
token_id=self.gas_token.get("id"),
|
|
1262
|
-
wallet_address=
|
|
1262
|
+
wallet_address=strategy_address,
|
|
1263
1263
|
)
|
|
1264
1264
|
if current_gas >= required_gas:
|
|
1265
1265
|
return True, "Enough gas balance found."
|
|
@@ -1269,7 +1269,7 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
1269
1269
|
|
|
1270
1270
|
return (
|
|
1271
1271
|
False,
|
|
1272
|
-
f"
|
|
1272
|
+
f"Strategy wallet does not have enough gas. Shortfall: {shortfall} {self.gas_token.get('symbol')}",
|
|
1273
1273
|
)
|
|
1274
1274
|
|
|
1275
1275
|
async def _has_idle_assets(self, balances, target_token) -> bool:
|
|
@@ -1311,8 +1311,8 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
1311
1311
|
to_token_address=self.usdc_token_info.get("address"),
|
|
1312
1312
|
from_chain_id=chain_id,
|
|
1313
1313
|
to_chain_id=self.usdc_token_info.get("chain").get("id"),
|
|
1314
|
-
from_address=self.
|
|
1315
|
-
to_address=self.
|
|
1314
|
+
from_address=self._get_strategy_wallet_address(),
|
|
1315
|
+
to_address=self._get_strategy_wallet_address(),
|
|
1316
1316
|
amount=str(amount),
|
|
1317
1317
|
)
|
|
1318
1318
|
if not success:
|
|
@@ -1334,7 +1334,7 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
1334
1334
|
balance_wei,
|
|
1335
1335
|
) = await self.balance_adapter.get_balance(
|
|
1336
1336
|
token_id=self.usdc_token_info.get("token_id"),
|
|
1337
|
-
wallet_address=self.
|
|
1337
|
+
wallet_address=self._get_strategy_wallet_address(),
|
|
1338
1338
|
)
|
|
1339
1339
|
if not status or not balance_wei:
|
|
1340
1340
|
pass
|
|
@@ -1362,7 +1362,7 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
1362
1362
|
_,
|
|
1363
1363
|
wallet_balances,
|
|
1364
1364
|
) = await self.balance_adapter.get_all_balances(
|
|
1365
|
-
wallet_address=self.
|
|
1365
|
+
wallet_address=self._get_strategy_wallet_address(),
|
|
1366
1366
|
enrich=True,
|
|
1367
1367
|
from_cache=False,
|
|
1368
1368
|
add_llama=True,
|
|
@@ -1486,8 +1486,8 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
1486
1486
|
to_token_address=token.get("address"),
|
|
1487
1487
|
from_chain_id=current_token.get("chain").get("id"),
|
|
1488
1488
|
to_chain_id=token.get("chain").get("id"),
|
|
1489
|
-
from_address=self.
|
|
1490
|
-
to_address=self.
|
|
1489
|
+
from_address=self._get_strategy_wallet_address(),
|
|
1490
|
+
to_address=self._get_strategy_wallet_address(),
|
|
1491
1491
|
amount=str(current_token_balance),
|
|
1492
1492
|
)
|
|
1493
1493
|
if not success:
|
|
@@ -1557,7 +1557,7 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
1557
1557
|
)
|
|
1558
1558
|
total_value = self._sum_non_gas_balance_usd(wallet_balances.get("balances"))
|
|
1559
1559
|
status_payload = {
|
|
1560
|
-
"info": "No recorded
|
|
1560
|
+
"info": "No recorded strategy deposits; reporting current wallet holdings only.",
|
|
1561
1561
|
"idle_usd": total_value,
|
|
1562
1562
|
}
|
|
1563
1563
|
|
|
@@ -1570,7 +1570,7 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
1570
1570
|
_,
|
|
1571
1571
|
wallet_balances,
|
|
1572
1572
|
) = await self.balance_adapter.get_all_balances(
|
|
1573
|
-
wallet_address=self.
|
|
1573
|
+
wallet_address=self._get_strategy_wallet_address(),
|
|
1574
1574
|
enrich=True,
|
|
1575
1575
|
from_cache=False,
|
|
1576
1576
|
add_llama=True,
|
|
@@ -1615,14 +1615,14 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
1615
1615
|
_,
|
|
1616
1616
|
wallet_balances,
|
|
1617
1617
|
) = await self.balance_adapter.get_all_balances(
|
|
1618
|
-
wallet_address=self.
|
|
1618
|
+
wallet_address=self._get_strategy_wallet_address(),
|
|
1619
1619
|
enrich=True,
|
|
1620
1620
|
from_cache=False,
|
|
1621
1621
|
add_llama=True,
|
|
1622
1622
|
)
|
|
1623
1623
|
_, total_usdc_wei = await self.balance_adapter.get_balance(
|
|
1624
1624
|
token_id=self.usdc_token_info.get("token_id"),
|
|
1625
|
-
wallet_address=self.
|
|
1625
|
+
wallet_address=self._get_strategy_wallet_address(),
|
|
1626
1626
|
)
|
|
1627
1627
|
available_usdc_usd = float(total_usdc_wei or 0) / (
|
|
1628
1628
|
10 ** self.usdc_token_info.get("decimals")
|
|
@@ -1645,7 +1645,7 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
1645
1645
|
balance_wei,
|
|
1646
1646
|
) = await self.balance_adapter.get_balance(
|
|
1647
1647
|
token_id=token_id,
|
|
1648
|
-
wallet_address=self.
|
|
1648
|
+
wallet_address=self._get_strategy_wallet_address(),
|
|
1649
1649
|
)
|
|
1650
1650
|
if not balance_status or not balance_wei:
|
|
1651
1651
|
continue
|
|
@@ -1666,7 +1666,7 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
1666
1666
|
await self.brap_adapter.swap_from_token_ids(
|
|
1667
1667
|
token_1_id,
|
|
1668
1668
|
f"{self.usdc_token_info.get('chain').get('name')}_{self.usdc_token_info.get('address').lower()}",
|
|
1669
|
-
self.
|
|
1669
|
+
self._get_strategy_wallet_address(),
|
|
1670
1670
|
amount_to_swap,
|
|
1671
1671
|
strategy_name=self.name,
|
|
1672
1672
|
)
|
|
@@ -1677,7 +1677,7 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
1677
1677
|
|
|
1678
1678
|
_, total_usdc_wei = await self.balance_adapter.get_balance(
|
|
1679
1679
|
token_id=self.usdc_token_info.get("token_id"),
|
|
1680
|
-
wallet_address=self.
|
|
1680
|
+
wallet_address=self._get_strategy_wallet_address(),
|
|
1681
1681
|
)
|
|
1682
1682
|
usdc_decimals = self.usdc_token_info.get("decimals")
|
|
1683
1683
|
available_usdc_usd = float(total_usdc_wei or 0) / (10**usdc_decimals)
|
|
@@ -1695,7 +1695,7 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
1695
1695
|
) = await self.balance_adapter.get_pool_balance(
|
|
1696
1696
|
pool_address=self.current_pool.get("address"),
|
|
1697
1697
|
chain_id=self.current_pool.get("chain").get("id"),
|
|
1698
|
-
user_address=self.
|
|
1698
|
+
user_address=self._get_strategy_wallet_address(),
|
|
1699
1699
|
)
|
|
1700
1700
|
pool_decimals = self.current_pool.get("decimals")
|
|
1701
1701
|
amount_to_swap = min(
|
|
@@ -1706,7 +1706,7 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
1706
1706
|
await self.brap_adapter.swap_from_token_ids(
|
|
1707
1707
|
f"{self.current_pool.get('chain').get('code').lower()}_{self.current_pool.get('address').lower()}",
|
|
1708
1708
|
f"{self.usdc_token_info.get('chain').get('name')}_{self.usdc_token_info.get('address').lower()}",
|
|
1709
|
-
self.
|
|
1709
|
+
self._get_strategy_wallet_address(),
|
|
1710
1710
|
amount_to_swap,
|
|
1711
1711
|
strategy_name=self.name,
|
|
1712
1712
|
)
|
|
@@ -1715,7 +1715,7 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
1715
1715
|
|
|
1716
1716
|
_, total_usdc_wei = await self.balance_adapter.get_balance(
|
|
1717
1717
|
token_id=self.usdc_token_info.get("token_id"),
|
|
1718
|
-
wallet_address=self.
|
|
1718
|
+
wallet_address=self._get_strategy_wallet_address(),
|
|
1719
1719
|
)
|
|
1720
1720
|
to_pay = min(int(total_usdc_wei or 0), int(usd_value * (10**usdc_decimals)))
|
|
1721
1721
|
return (True, f"Partial liquidation completed. Paid {to_pay} USDC")
|
|
@@ -4,7 +4,7 @@ from unittest.mock import AsyncMock
|
|
|
4
4
|
|
|
5
5
|
# Ensure wayfinder-paths is on path for tests.test_utils import
|
|
6
6
|
# This is a workaround until conftest loading order is resolved
|
|
7
|
-
_wayfinder_path_dir = Path(__file__).parent.parent.parent.
|
|
7
|
+
_wayfinder_path_dir = Path(__file__).parent.parent.parent.resolve()
|
|
8
8
|
_wayfinder_path_str = str(_wayfinder_path_dir)
|
|
9
9
|
if _wayfinder_path_str not in sys.path:
|
|
10
10
|
sys.path.insert(0, _wayfinder_path_str)
|
|
@@ -29,7 +29,7 @@ except ImportError:
|
|
|
29
29
|
get_canonical_examples = test_utils.get_canonical_examples
|
|
30
30
|
load_strategy_examples = test_utils.load_strategy_examples
|
|
31
31
|
|
|
32
|
-
from wayfinder_paths.
|
|
32
|
+
from wayfinder_paths.strategies.stablecoin_yield_strategy.strategy import ( # noqa: E402
|
|
33
33
|
StablecoinYieldStrategy,
|
|
34
34
|
)
|
|
35
35
|
|
|
@@ -39,13 +39,13 @@ def strategy():
|
|
|
39
39
|
"""Create a strategy instance for testing with minimal config."""
|
|
40
40
|
mock_config = {
|
|
41
41
|
"main_wallet": {"address": "0x1234567890123456789012345678901234567890"},
|
|
42
|
-
"
|
|
42
|
+
"strategy_wallet": {"address": "0xabcdefabcdefabcdefabcdefabcdefabcdefabcd"},
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
s = StablecoinYieldStrategy(
|
|
46
46
|
config=mock_config,
|
|
47
47
|
main_wallet=mock_config["main_wallet"],
|
|
48
|
-
|
|
48
|
+
strategy_wallet=mock_config["strategy_wallet"],
|
|
49
49
|
simulation=True,
|
|
50
50
|
)
|
|
51
51
|
|
|
@@ -110,10 +110,10 @@ def strategy():
|
|
|
110
110
|
)
|
|
111
111
|
|
|
112
112
|
if hasattr(s, "balance_adapter") and s.balance_adapter:
|
|
113
|
-
s.balance_adapter.
|
|
113
|
+
s.balance_adapter.move_from_main_wallet_to_strategy_wallet = AsyncMock(
|
|
114
114
|
return_value=(True, "Transfer successful (simulated)")
|
|
115
115
|
)
|
|
116
|
-
s.balance_adapter.
|
|
116
|
+
s.balance_adapter.move_from_strategy_wallet_to_main_wallet = AsyncMock(
|
|
117
117
|
return_value=(True, "Transfer successful (simulated)")
|
|
118
118
|
)
|
|
119
119
|
if hasattr(s.balance_adapter, "wallet_provider"):
|
|
@@ -122,10 +122,10 @@ def strategy():
|
|
|
122
122
|
)
|
|
123
123
|
|
|
124
124
|
if hasattr(s, "ledger_adapter") and s.ledger_adapter:
|
|
125
|
-
s.ledger_adapter.
|
|
125
|
+
s.ledger_adapter.get_strategy_net_deposit = AsyncMock(
|
|
126
126
|
return_value=(True, {"net_deposit": 0})
|
|
127
127
|
)
|
|
128
|
-
s.ledger_adapter.
|
|
128
|
+
s.ledger_adapter.get_strategy_transactions = AsyncMock(
|
|
129
129
|
return_value=(True, {"transactions": []})
|
|
130
130
|
)
|
|
131
131
|
|