wayfinder-paths 0.1.25__py3-none-any.whl → 0.1.27__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/adapters/brap_adapter/adapter.py +7 -47
- wayfinder_paths/adapters/hyperlend_adapter/adapter.py +10 -31
- wayfinder_paths/adapters/hyperliquid_adapter/adapter.py +128 -60
- wayfinder_paths/adapters/hyperliquid_adapter/exchange.py +399 -0
- wayfinder_paths/adapters/hyperliquid_adapter/executor.py +74 -0
- wayfinder_paths/adapters/hyperliquid_adapter/local_signer.py +82 -0
- wayfinder_paths/adapters/hyperliquid_adapter/test_adapter.py +1 -1
- wayfinder_paths/adapters/hyperliquid_adapter/test_adapter_live.py +1 -1
- wayfinder_paths/adapters/hyperliquid_adapter/util.py +237 -0
- wayfinder_paths/adapters/pendle_adapter/adapter.py +19 -55
- wayfinder_paths/adapters/pendle_adapter/test_adapter.py +14 -46
- wayfinder_paths/core/clients/BalanceClient.py +72 -0
- wayfinder_paths/core/clients/TokenClient.py +1 -1
- wayfinder_paths/core/clients/__init__.py +2 -0
- wayfinder_paths/core/strategies/Strategy.py +3 -3
- wayfinder_paths/core/types.py +19 -0
- wayfinder_paths/core/utils/tokens.py +19 -1
- wayfinder_paths/core/utils/transaction.py +9 -7
- wayfinder_paths/mcp/tools/balances.py +122 -214
- wayfinder_paths/mcp/tools/execute.py +63 -41
- wayfinder_paths/mcp/tools/quotes.py +16 -5
- wayfinder_paths/strategies/basis_trading_strategy/strategy.py +6 -22
- wayfinder_paths/strategies/boros_hype_strategy/boros_ops_mixin.py +227 -33
- wayfinder_paths/strategies/boros_hype_strategy/constants.py +17 -1
- wayfinder_paths/strategies/boros_hype_strategy/hyperevm_ops_mixin.py +44 -1
- wayfinder_paths/strategies/boros_hype_strategy/planner.py +87 -32
- wayfinder_paths/strategies/boros_hype_strategy/risk_ops_mixin.py +50 -28
- wayfinder_paths/strategies/boros_hype_strategy/strategy.py +71 -50
- wayfinder_paths/strategies/boros_hype_strategy/test_planner_golden.py +3 -1
- wayfinder_paths/strategies/boros_hype_strategy/test_strategy.py +0 -2
- wayfinder_paths/strategies/boros_hype_strategy/types.py +4 -1
- wayfinder_paths/strategies/hyperlend_stable_yield_strategy/strategy.py +0 -2
- wayfinder_paths/strategies/hyperlend_stable_yield_strategy/test_strategy.py +0 -2
- wayfinder_paths/strategies/moonwell_wsteth_loop_strategy/strategy.py +0 -2
- wayfinder_paths/strategies/moonwell_wsteth_loop_strategy/test_strategy.py +0 -2
- wayfinder_paths/strategies/stablecoin_yield_strategy/strategy.py +0 -2
- wayfinder_paths/strategies/stablecoin_yield_strategy/test_strategy.py +0 -2
- wayfinder_paths/tests/test_mcp_quote_swap.py +3 -3
- {wayfinder_paths-0.1.25.dist-info → wayfinder_paths-0.1.27.dist-info}/METADATA +1 -1
- {wayfinder_paths-0.1.25.dist-info → wayfinder_paths-0.1.27.dist-info}/RECORD +42 -37
- {wayfinder_paths-0.1.25.dist-info → wayfinder_paths-0.1.27.dist-info}/LICENSE +0 -0
- {wayfinder_paths-0.1.25.dist-info → wayfinder_paths-0.1.27.dist-info}/WHEEL +0 -0
|
@@ -16,6 +16,7 @@ from wayfinder_paths.adapters.hyperliquid_adapter.paired_filler import PairedFil
|
|
|
16
16
|
|
|
17
17
|
from .constants import (
|
|
18
18
|
BOROS_HYPE_MARKET_ID,
|
|
19
|
+
BOROS_HYPE_TOKEN_ID,
|
|
19
20
|
HYPE_NATIVE,
|
|
20
21
|
KHYPE_LST,
|
|
21
22
|
LOOPED_HYPE,
|
|
@@ -415,17 +416,26 @@ class BorosHypeRiskOpsMixin:
|
|
|
415
416
|
and float(inv_final.boros_pending_withdrawal_usd) <= 0.0
|
|
416
417
|
)
|
|
417
418
|
if boros_enabled and spot_usd >= 10.0 and self.boros_adapter:
|
|
418
|
-
target_usd = spot_usd * float(
|
|
419
|
-
self._planner_config.boros_coverage_target
|
|
420
|
-
)
|
|
421
419
|
market_id = (
|
|
422
420
|
self._planner_runtime.current_boros_market_id
|
|
423
421
|
or BOROS_HYPE_MARKET_ID
|
|
424
422
|
)
|
|
423
|
+
token_id = int(
|
|
424
|
+
self._planner_runtime.current_boros_token_id
|
|
425
|
+
or BOROS_HYPE_TOKEN_ID
|
|
426
|
+
)
|
|
427
|
+
if token_id == BOROS_HYPE_TOKEN_ID:
|
|
428
|
+
target_yu = float(inv_final.total_hype_exposure) * float(
|
|
429
|
+
self._planner_config.boros_coverage_target
|
|
430
|
+
)
|
|
431
|
+
else:
|
|
432
|
+
target_yu = spot_usd * float(
|
|
433
|
+
self._planner_config.boros_coverage_target
|
|
434
|
+
)
|
|
425
435
|
ok_boros, msg_boros = await self._ensure_boros_position(
|
|
426
436
|
{
|
|
427
437
|
"market_id": int(market_id),
|
|
428
|
-
"
|
|
438
|
+
"target_size_yu": float(target_yu),
|
|
429
439
|
},
|
|
430
440
|
inv_final,
|
|
431
441
|
)
|
|
@@ -721,32 +731,40 @@ class BorosHypeRiskOpsMixin:
|
|
|
721
731
|
slippage=0.01,
|
|
722
732
|
strategy_name="boros_hype_strategy",
|
|
723
733
|
)
|
|
734
|
+
trim_usd -= lhype_trim_usd
|
|
724
735
|
await asyncio.sleep(2)
|
|
725
736
|
except Exception as exc: # noqa: BLE001
|
|
726
737
|
logger.warning(f"Failed to sell looped HYPE: {exc}")
|
|
727
738
|
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
739
|
+
remaining_trim_usd = max(0.0, float(trim_usd))
|
|
740
|
+
|
|
741
|
+
# If we still need to trim, move just enough HYPE from HyperEVM -> HL spot so we
|
|
742
|
+
# can sell it for USDC and add to perp margin (avoid transferring all HYPE).
|
|
743
|
+
if remaining_trim_usd > 1.0:
|
|
744
|
+
ok_hype, hype_raw = await self.balance_adapter.get_vault_wallet_balance(
|
|
745
|
+
HYPE_NATIVE
|
|
746
|
+
)
|
|
747
|
+
hype_raw_int = (
|
|
748
|
+
int(hype_raw) if ok_hype and hype_raw and int(hype_raw) > 0 else 0
|
|
749
|
+
)
|
|
750
|
+
gas_reserve_wei = int(float(MIN_HYPE_GAS) * 1e18)
|
|
751
|
+
transferable_raw = max(0, hype_raw_int - gas_reserve_wei)
|
|
752
|
+
transferable_tokens = float(transferable_raw) / 1e18
|
|
753
|
+
|
|
754
|
+
desired_tokens = min(transferable_tokens, remaining_trim_usd / hype_price)
|
|
755
|
+
hype_to_transfer_raw = int(desired_tokens * 1e18)
|
|
756
|
+
if hype_to_transfer_raw >= int(0.01 * 1e18):
|
|
757
|
+
destination = HyperliquidAdapter.hypercore_index_to_system_address(150)
|
|
758
|
+
ok_send, send_res = await self.balance_adapter.send_to_address(
|
|
759
|
+
token_id=HYPE_NATIVE,
|
|
760
|
+
amount=int(hype_to_transfer_raw),
|
|
761
|
+
from_wallet=strategy_wallet,
|
|
762
|
+
to_address=destination,
|
|
763
|
+
signing_callback=self._sign_callback,
|
|
764
|
+
)
|
|
765
|
+
if not ok_send:
|
|
766
|
+
return False, f"Failed to transfer HYPE to Hyperliquid: {send_res}"
|
|
767
|
+
await asyncio.sleep(3)
|
|
750
768
|
|
|
751
769
|
try:
|
|
752
770
|
spot_asset_id, perp_asset_id = await self._get_hype_asset_ids()
|
|
@@ -764,9 +782,10 @@ class BorosHypeRiskOpsMixin:
|
|
|
764
782
|
spot_hype_balance = available
|
|
765
783
|
break
|
|
766
784
|
|
|
767
|
-
if spot_hype_balance > 0.01:
|
|
785
|
+
if spot_hype_balance > 0.01 and remaining_trim_usd > 1.0:
|
|
786
|
+
desired_units = min(spot_hype_balance, remaining_trim_usd / hype_price)
|
|
768
787
|
rounded_units = self.hyperliquid_adapter.get_valid_order_size(
|
|
769
|
-
int(spot_asset_id),
|
|
788
|
+
int(spot_asset_id), desired_units
|
|
770
789
|
)
|
|
771
790
|
if rounded_units > 0:
|
|
772
791
|
if (
|
|
@@ -811,6 +830,9 @@ class BorosHypeRiskOpsMixin:
|
|
|
811
830
|
builder=self.builder_fee,
|
|
812
831
|
)
|
|
813
832
|
await asyncio.sleep(2)
|
|
833
|
+
remaining_trim_usd = max(
|
|
834
|
+
0.0, remaining_trim_usd - float(rounded_units) * hype_price
|
|
835
|
+
)
|
|
814
836
|
except Exception as exc: # noqa: BLE001
|
|
815
837
|
logger.warning(f"Failed to sell spot HYPE: {exc}")
|
|
816
838
|
|
|
@@ -28,9 +28,6 @@ from wayfinder_paths.adapters.brap_adapter.adapter import BRAPAdapter
|
|
|
28
28
|
from wayfinder_paths.adapters.hyperliquid_adapter.adapter import (
|
|
29
29
|
HyperliquidAdapter,
|
|
30
30
|
)
|
|
31
|
-
from wayfinder_paths.adapters.hyperliquid_adapter.executor import (
|
|
32
|
-
LocalHyperliquidExecutor,
|
|
33
|
-
)
|
|
34
31
|
from wayfinder_paths.adapters.ledger_adapter.adapter import LedgerAdapter
|
|
35
32
|
from wayfinder_paths.core.constants.hyperliquid import (
|
|
36
33
|
DEFAULT_HYPERLIQUID_BUILDER_FEE_TENTHS_BP,
|
|
@@ -61,6 +58,7 @@ from wayfinder_paths.core.strategies.descriptors import (
|
|
|
61
58
|
from .boros_ops_mixin import BorosHypeBorosOpsMixin
|
|
62
59
|
from .constants import (
|
|
63
60
|
BOROS_HYPE_TOKEN_ID,
|
|
61
|
+
BOROS_MIN_DEPOSIT_HYPE,
|
|
64
62
|
ETH_ARB,
|
|
65
63
|
MIN_HYPE_GAS,
|
|
66
64
|
MIN_NET_DEPOSIT,
|
|
@@ -176,15 +174,11 @@ class BorosHypeStrategy(
|
|
|
176
174
|
self,
|
|
177
175
|
config: dict[str, Any] | None = None,
|
|
178
176
|
*,
|
|
179
|
-
main_wallet: dict[str, Any] | None = None,
|
|
180
|
-
strategy_wallet: dict[str, Any] | None = None,
|
|
181
177
|
simulation: bool = False,
|
|
182
178
|
**kwargs,
|
|
183
179
|
) -> None:
|
|
184
180
|
super().__init__(
|
|
185
181
|
config=config,
|
|
186
|
-
main_wallet=main_wallet,
|
|
187
|
-
strategy_wallet=strategy_wallet,
|
|
188
182
|
**kwargs,
|
|
189
183
|
)
|
|
190
184
|
|
|
@@ -291,22 +285,13 @@ class BorosHypeStrategy(
|
|
|
291
285
|
)
|
|
292
286
|
|
|
293
287
|
# Initialize Hyperliquid adapter for market data and perp trading
|
|
288
|
+
# The adapter will create Exchange internally with local signer from config
|
|
289
|
+
# if no sign_callback is provided (and not in simulation mode).
|
|
294
290
|
try:
|
|
295
|
-
# Create executor for non-simulation mode (requires private key)
|
|
296
|
-
hl_executor = None
|
|
297
|
-
if not self.simulation:
|
|
298
|
-
try:
|
|
299
|
-
hl_executor = LocalHyperliquidExecutor(config=self._config)
|
|
300
|
-
logger.info(
|
|
301
|
-
f"Hyperliquid executor initialized for {hl_executor.address}"
|
|
302
|
-
)
|
|
303
|
-
except (ImportError, ValueError) as e:
|
|
304
|
-
logger.warning(f"Hyperliquid executor not available: {e}")
|
|
305
|
-
|
|
306
291
|
self.hyperliquid_adapter = HyperliquidAdapter(
|
|
307
292
|
config=self._config,
|
|
308
293
|
simulation=self.simulation,
|
|
309
|
-
|
|
294
|
+
sign_callback=self.strategy_sign_typed_data,
|
|
310
295
|
)
|
|
311
296
|
try:
|
|
312
297
|
hl_connected = await self.hyperliquid_adapter.connect()
|
|
@@ -654,6 +639,12 @@ class BorosHypeStrategy(
|
|
|
654
639
|
hl_actual = inv.hl_perp_margin + inv.hl_spot_usdc
|
|
655
640
|
boros_actual = inv.boros_committed_collateral_usd
|
|
656
641
|
idle_actual = inv.usdc_arb_idle + inv.usdt_arb_idle
|
|
642
|
+
boros_target = self.hedge_cfg.boros_pct * total
|
|
643
|
+
if total >= self._planner_config.min_total_for_boros:
|
|
644
|
+
boros_target = max(
|
|
645
|
+
boros_target,
|
|
646
|
+
BOROS_MIN_DEPOSIT_HYPE * float(inv.hype_price_usd or 0.0),
|
|
647
|
+
)
|
|
657
648
|
|
|
658
649
|
return AllocationStatus(
|
|
659
650
|
spot_value=spot_actual,
|
|
@@ -669,7 +660,7 @@ class BorosHypeStrategy(
|
|
|
669
660
|
boros_deviation=(boros_actual / total) - self.hedge_cfg.boros_pct,
|
|
670
661
|
spot_needed_usd=max(0, (self.hedge_cfg.spot_pct * total) - spot_actual),
|
|
671
662
|
hl_needed_usd=max(0, (self.hedge_cfg.hyperliquid_pct * total) - hl_actual),
|
|
672
|
-
boros_needed_usd=max(0,
|
|
663
|
+
boros_needed_usd=max(0, boros_target - boros_actual),
|
|
673
664
|
)
|
|
674
665
|
|
|
675
666
|
# ─────────────────────────────────────────────────────────────────────────
|
|
@@ -707,24 +698,36 @@ class BorosHypeStrategy(
|
|
|
707
698
|
if inv.total_value < self._planner_config.min_total_for_boros:
|
|
708
699
|
return True, "Below Boros minimum - skipping coverage check"
|
|
709
700
|
|
|
710
|
-
|
|
711
|
-
if
|
|
701
|
+
spot_hype = float(inv.total_hype_exposure or 0.0)
|
|
702
|
+
if spot_hype * float(inv.hype_price_usd or 0.0) < 10:
|
|
712
703
|
return True, "Negligible spot exposure"
|
|
713
704
|
|
|
714
|
-
|
|
715
|
-
|
|
705
|
+
token_id = int(
|
|
706
|
+
self._planner_runtime.current_boros_token_id or BOROS_HYPE_TOKEN_ID
|
|
707
|
+
)
|
|
708
|
+
current_position_yu = float(inv.boros_position_size or 0.0)
|
|
716
709
|
|
|
717
|
-
if
|
|
710
|
+
if token_id == BOROS_HYPE_TOKEN_ID:
|
|
711
|
+
target_position_yu = spot_hype * self._planner_config.boros_coverage_target
|
|
712
|
+
diff_yu = abs(current_position_yu - target_position_yu)
|
|
713
|
+
diff_usd = diff_yu * float(inv.hype_price_usd or 0.0)
|
|
714
|
+
target_usd = target_position_yu * float(inv.hype_price_usd or 0.0)
|
|
715
|
+
else:
|
|
716
|
+
spot_usd = spot_hype * float(inv.hype_price_usd or 0.0)
|
|
717
|
+
target_position_yu = (
|
|
718
|
+
spot_usd * self._planner_config.boros_coverage_target
|
|
719
|
+
) # 1 YU = $1
|
|
720
|
+
diff_yu = abs(current_position_yu - target_position_yu)
|
|
721
|
+
diff_usd = diff_yu
|
|
722
|
+
target_usd = target_position_yu
|
|
723
|
+
|
|
724
|
+
if target_usd < 10:
|
|
718
725
|
return True, "Target Boros position too small"
|
|
719
726
|
|
|
720
727
|
# Use resize threshold as hysteresis band
|
|
721
|
-
|
|
722
|
-
ok = diff <= self._planner_config.boros_resize_min_excess_usd
|
|
728
|
+
ok = diff_usd <= self._planner_config.boros_resize_min_excess_usd
|
|
723
729
|
|
|
724
|
-
return ok, (
|
|
725
|
-
f"diff=${diff:.2f} "
|
|
726
|
-
f"(current=${current_position:.0f}, target=${target_position:.0f})"
|
|
727
|
-
)
|
|
730
|
+
return ok, f"diff≈${diff_usd:.2f} (current={current_position_yu:.4f} YU)"
|
|
728
731
|
|
|
729
732
|
# ─────────────────────────────────────────────────────────────────────────
|
|
730
733
|
# Step Handlers
|
|
@@ -912,29 +915,47 @@ class BorosHypeStrategy(
|
|
|
912
915
|
ok_boros, boros_msg = self._boros_coverage_ok(inv, self._opa_boros_quotes)
|
|
913
916
|
if not ok_boros:
|
|
914
917
|
logger.info(f"[SAFETY] Boros coverage drift: {boros_msg}")
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
918
|
+
depositable_collateral_hype = float(
|
|
919
|
+
inv.boros_collateral_hype or 0.0
|
|
920
|
+
) + float(inv.hype_oft_arb_balance or 0.0)
|
|
921
|
+
if depositable_collateral_hype < BOROS_MIN_DEPOSIT_HYPE:
|
|
922
|
+
# Collateral isn't ready yet (or still in-flight via OFT); don't fail-safe.
|
|
923
|
+
logger.info(
|
|
924
|
+
"[SAFETY] Skipping Boros coverage fix: collateral not funded yet "
|
|
925
|
+
f"({depositable_collateral_hype:.6f} HYPE)"
|
|
926
|
+
)
|
|
927
|
+
else:
|
|
928
|
+
# Attempt fix (best effort). If it fails, we log and keep running.
|
|
929
|
+
token_id = int(
|
|
930
|
+
self._planner_runtime.current_boros_token_id
|
|
931
|
+
or BOROS_HYPE_TOKEN_ID
|
|
926
932
|
)
|
|
927
|
-
if
|
|
928
|
-
|
|
929
|
-
|
|
933
|
+
if token_id == BOROS_HYPE_TOKEN_ID:
|
|
934
|
+
target_yu = (
|
|
935
|
+
float(inv.total_hype_exposure or 0.0)
|
|
936
|
+
* self._planner_config.boros_coverage_target
|
|
930
937
|
)
|
|
931
938
|
else:
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
939
|
+
target_yu = (
|
|
940
|
+
float(inv.total_hype_exposure or 0.0)
|
|
941
|
+
* float(inv.hype_price_usd or 0.0)
|
|
942
|
+
* self._planner_config.boros_coverage_target
|
|
943
|
+
)
|
|
944
|
+
|
|
945
|
+
if self._planner_runtime.current_boros_market_id:
|
|
946
|
+
ok, msg = await self._ensure_boros_position(
|
|
947
|
+
{
|
|
948
|
+
"market_id": self._planner_runtime.current_boros_market_id,
|
|
949
|
+
"target_size_yu": target_yu,
|
|
950
|
+
},
|
|
951
|
+
inv,
|
|
952
|
+
)
|
|
953
|
+
if ok:
|
|
954
|
+
safety_messages.append(
|
|
955
|
+
f"Boros coverage adjusted to {target_yu:.4f} YU"
|
|
935
956
|
)
|
|
936
|
-
|
|
937
|
-
|
|
957
|
+
else:
|
|
958
|
+
logger.warning(f"[SAFETY] Boros coverage fix failed: {msg}")
|
|
938
959
|
|
|
939
960
|
# Append safety messages to result
|
|
940
961
|
if safety_messages:
|
|
@@ -219,6 +219,8 @@ def test_build_plan_sizes_hedge_and_boros_position():
|
|
|
219
219
|
total_value=total,
|
|
220
220
|
spot_value_usd=600.0,
|
|
221
221
|
hl_perp_margin=350.0,
|
|
222
|
+
hl_withdrawable_usd=350.0,
|
|
223
|
+
boros_collateral_hype=50.0 / 24.0,
|
|
222
224
|
boros_collateral_usd=50.0,
|
|
223
225
|
boros_committed_collateral_usd=50.0,
|
|
224
226
|
usdc_arb_idle=0.0,
|
|
@@ -266,7 +268,7 @@ def test_build_plan_sizes_hedge_and_boros_position():
|
|
|
266
268
|
|
|
267
269
|
boros_step = plan.steps[1]
|
|
268
270
|
assert boros_step.params["market_id"] == BOROS_HYPE_MARKET_ID
|
|
269
|
-
assert abs(boros_step.params["
|
|
271
|
+
assert abs(boros_step.params["target_size_yu"] - 10.0) < 1e-9
|
|
270
272
|
|
|
271
273
|
# Market selection should persist in runtime (hysteresis)
|
|
272
274
|
assert runtime.current_boros_market_id == BOROS_HYPE_MARKET_ID
|
|
@@ -310,7 +310,10 @@ class DesiredState:
|
|
|
310
310
|
|
|
311
311
|
# Target positions
|
|
312
312
|
target_hype_short_size: float
|
|
313
|
-
|
|
313
|
+
# Boros order sizing is in YU. YU units depend on collateral:
|
|
314
|
+
# - HYPE collateral: 1 YU = 1 HYPE
|
|
315
|
+
# - USDT collateral: 1 YU = 1 USDT (≈$1)
|
|
316
|
+
target_boros_position_yu: float
|
|
314
317
|
|
|
315
318
|
# Selected Boros market
|
|
316
319
|
boros_market_id: int | None = None
|
|
@@ -193,13 +193,11 @@ class HyperlendStableYieldStrategy(Strategy):
|
|
|
193
193
|
*,
|
|
194
194
|
main_wallet: dict[str, Any] | None = None,
|
|
195
195
|
strategy_wallet: dict[str, Any] | None = None,
|
|
196
|
-
api_key: str | None = None,
|
|
197
196
|
main_wallet_signing_callback: Callable[[dict], Awaitable[str]] | None = None,
|
|
198
197
|
strategy_wallet_signing_callback: Callable[[dict], Awaitable[str]]
|
|
199
198
|
| None = None,
|
|
200
199
|
):
|
|
201
200
|
super().__init__(
|
|
202
|
-
api_key=api_key,
|
|
203
201
|
main_wallet_signing_callback=main_wallet_signing_callback,
|
|
204
202
|
strategy_wallet_signing_callback=strategy_wallet_signing_callback,
|
|
205
203
|
)
|
|
@@ -178,13 +178,11 @@ class MoonwellWstethLoopStrategy(Strategy):
|
|
|
178
178
|
*,
|
|
179
179
|
main_wallet: dict | None = None,
|
|
180
180
|
strategy_wallet: dict | None = None,
|
|
181
|
-
api_key: str | None = None,
|
|
182
181
|
main_wallet_signing_callback: Callable[[dict], Awaitable[str]] | None = None,
|
|
183
182
|
strategy_wallet_signing_callback: Callable[[dict], Awaitable[str]]
|
|
184
183
|
| None = None,
|
|
185
184
|
):
|
|
186
185
|
super().__init__(
|
|
187
|
-
api_key=api_key,
|
|
188
186
|
main_wallet_signing_callback=main_wallet_signing_callback,
|
|
189
187
|
strategy_wallet_signing_callback=strategy_wallet_signing_callback,
|
|
190
188
|
)
|
|
@@ -34,8 +34,6 @@ def strategy():
|
|
|
34
34
|
):
|
|
35
35
|
s = MoonwellWstethLoopStrategy(
|
|
36
36
|
config=mock_config,
|
|
37
|
-
main_wallet=mock_config["main_wallet"],
|
|
38
|
-
strategy_wallet=mock_config["strategy_wallet"],
|
|
39
37
|
)
|
|
40
38
|
# Manually set attributes that would be set in __init__
|
|
41
39
|
s.config = mock_config
|
|
@@ -151,13 +151,11 @@ class StablecoinYieldStrategy(Strategy):
|
|
|
151
151
|
*,
|
|
152
152
|
main_wallet: dict[str, Any] | None = None,
|
|
153
153
|
strategy_wallet: dict[str, Any] | None = None,
|
|
154
|
-
api_key: str | None = None,
|
|
155
154
|
main_wallet_signing_callback: Callable[[dict], Awaitable[str]] | None = None,
|
|
156
155
|
strategy_wallet_signing_callback: Callable[[dict], Awaitable[str]]
|
|
157
156
|
| None = None,
|
|
158
157
|
):
|
|
159
158
|
super().__init__(
|
|
160
|
-
api_key=api_key,
|
|
161
159
|
main_wallet_signing_callback=main_wallet_signing_callback,
|
|
162
160
|
strategy_wallet_signing_callback=strategy_wallet_signing_callback,
|
|
163
161
|
)
|
|
@@ -36,8 +36,8 @@ async def test_quote_swap_returns_compact_best_quote_by_default():
|
|
|
36
36
|
|
|
37
37
|
class FakeBRAPClient:
|
|
38
38
|
async def get_quote(self, **kwargs): # noqa: ANN003
|
|
39
|
-
assert kwargs["
|
|
40
|
-
assert kwargs["
|
|
39
|
+
assert kwargs["from_chain"] == 42161
|
|
40
|
+
assert kwargs["to_chain"] == 42161
|
|
41
41
|
assert kwargs["slippage"] == pytest.approx(0.005)
|
|
42
42
|
|
|
43
43
|
calldata = "0x" + ("ab" * 4096)
|
|
@@ -46,7 +46,7 @@ async def test_quote_swap_returns_compact_best_quote_by_default():
|
|
|
46
46
|
"quote_count": 3,
|
|
47
47
|
"best_quote": {
|
|
48
48
|
"provider": "brap_best",
|
|
49
|
-
"input_amount": kwargs["
|
|
49
|
+
"input_amount": kwargs["from_amount"],
|
|
50
50
|
"output_amount": "1234567",
|
|
51
51
|
"input_amount_usd": 5.0,
|
|
52
52
|
"output_amount_usd": 4.99,
|