wayfinder-paths 0.1.14__py3-none-any.whl → 0.1.16__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.
Files changed (58) hide show
  1. wayfinder_paths/adapters/balance_adapter/README.md +19 -20
  2. wayfinder_paths/adapters/balance_adapter/adapter.py +91 -22
  3. wayfinder_paths/adapters/balance_adapter/test_adapter.py +5 -11
  4. wayfinder_paths/adapters/brap_adapter/README.md +22 -19
  5. wayfinder_paths/adapters/brap_adapter/adapter.py +95 -45
  6. wayfinder_paths/adapters/brap_adapter/test_adapter.py +8 -24
  7. wayfinder_paths/adapters/hyperlend_adapter/adapter.py +40 -42
  8. wayfinder_paths/adapters/hyperlend_adapter/test_adapter.py +8 -15
  9. wayfinder_paths/adapters/hyperliquid_adapter/test_adapter.py +6 -6
  10. wayfinder_paths/adapters/hyperliquid_adapter/test_adapter_live.py +12 -12
  11. wayfinder_paths/adapters/ledger_adapter/test_adapter.py +6 -6
  12. wayfinder_paths/adapters/moonwell_adapter/README.md +29 -31
  13. wayfinder_paths/adapters/moonwell_adapter/adapter.py +326 -364
  14. wayfinder_paths/adapters/moonwell_adapter/test_adapter.py +285 -189
  15. wayfinder_paths/adapters/pool_adapter/test_adapter.py +2 -2
  16. wayfinder_paths/adapters/token_adapter/test_adapter.py +4 -4
  17. wayfinder_paths/core/config.py +8 -47
  18. wayfinder_paths/core/constants/base.py +0 -1
  19. wayfinder_paths/core/constants/erc20_abi.py +13 -24
  20. wayfinder_paths/core/engine/StrategyJob.py +3 -1
  21. wayfinder_paths/core/services/test_local_evm_txn.py +145 -0
  22. wayfinder_paths/core/strategies/Strategy.py +22 -4
  23. wayfinder_paths/core/utils/erc20_service.py +100 -0
  24. wayfinder_paths/core/utils/evm_helpers.py +1 -8
  25. wayfinder_paths/core/utils/transaction.py +191 -0
  26. wayfinder_paths/core/utils/web3.py +66 -0
  27. wayfinder_paths/policies/erc20.py +1 -1
  28. wayfinder_paths/run_strategy.py +42 -6
  29. wayfinder_paths/strategies/basis_trading_strategy/strategy.py +263 -220
  30. wayfinder_paths/strategies/basis_trading_strategy/test_strategy.py +132 -155
  31. wayfinder_paths/strategies/hyperlend_stable_yield_strategy/README.md +0 -1
  32. wayfinder_paths/strategies/hyperlend_stable_yield_strategy/strategy.py +123 -80
  33. wayfinder_paths/strategies/hyperlend_stable_yield_strategy/test_strategy.py +0 -12
  34. wayfinder_paths/strategies/moonwell_wsteth_loop_strategy/README.md +6 -6
  35. wayfinder_paths/strategies/moonwell_wsteth_loop_strategy/strategy.py +2270 -1328
  36. wayfinder_paths/strategies/moonwell_wsteth_loop_strategy/test_strategy.py +282 -121
  37. wayfinder_paths/strategies/stablecoin_yield_strategy/README.md +0 -1
  38. wayfinder_paths/strategies/stablecoin_yield_strategy/strategy.py +107 -85
  39. wayfinder_paths/strategies/stablecoin_yield_strategy/test_strategy.py +0 -8
  40. wayfinder_paths/templates/adapter/README.md +1 -1
  41. wayfinder_paths/templates/strategy/README.md +1 -5
  42. {wayfinder_paths-0.1.14.dist-info → wayfinder_paths-0.1.16.dist-info}/METADATA +3 -41
  43. {wayfinder_paths-0.1.14.dist-info → wayfinder_paths-0.1.16.dist-info}/RECORD +45 -54
  44. {wayfinder_paths-0.1.14.dist-info → wayfinder_paths-0.1.16.dist-info}/WHEEL +1 -1
  45. wayfinder_paths/abis/generic/erc20.json +0 -383
  46. wayfinder_paths/core/clients/sdk_example.py +0 -125
  47. wayfinder_paths/core/engine/__init__.py +0 -5
  48. wayfinder_paths/core/services/__init__.py +0 -0
  49. wayfinder_paths/core/services/base.py +0 -130
  50. wayfinder_paths/core/services/local_evm_txn.py +0 -334
  51. wayfinder_paths/core/services/local_token_txn.py +0 -242
  52. wayfinder_paths/core/services/web3_service.py +0 -43
  53. wayfinder_paths/core/wallets/README.md +0 -88
  54. wayfinder_paths/core/wallets/WalletManager.py +0 -56
  55. wayfinder_paths/core/wallets/__init__.py +0 -7
  56. wayfinder_paths/scripts/run_strategy.py +0 -152
  57. wayfinder_paths/strategies/config.py +0 -85
  58. {wayfinder_paths-0.1.14.dist-info → wayfinder_paths-0.1.16.dist-info}/LICENSE +0 -0
@@ -121,14 +121,6 @@ def strategy():
121
121
  "decimals": 6,
122
122
  }
123
123
  )
124
- s.balance_adapter.token_transactions = AsyncMock()
125
- s.balance_adapter.token_transactions.build_send = AsyncMock(
126
- return_value=(True, {"transaction": "0xMOCK"})
127
- )
128
- s.balance_adapter.wallet_provider = AsyncMock()
129
- s.balance_adapter.wallet_provider.broadcast_transaction = AsyncMock(
130
- return_value=(True, {"transaction_hash": "0xCAFEBABE"})
131
- )
132
124
  # token_adapter might already be set, so check before overriding
133
125
  if (
134
126
  not hasattr(s.balance_adapter, "token_adapter")
@@ -205,10 +197,6 @@ def strategy():
205
197
  and hasattr(s.brap_adapter, "swap_from_quote")
206
198
  ):
207
199
  s.brap_adapter.swap_from_quote = AsyncMock(return_value=None)
208
- if hasattr(s, "brap_adapter") and hasattr(s.brap_adapter, "wallet_provider"):
209
- s.brap_adapter.wallet_provider.broadcast_transaction = AsyncMock(
210
- return_value=(True, {"transaction_hash": "0xF00D"})
211
- )
212
200
 
213
201
  if hasattr(s, "hyperlend_adapter") and s.hyperlend_adapter:
214
202
  s.hyperlend_adapter.get_assets_view = AsyncMock(
@@ -31,9 +31,10 @@ The position is **delta-neutral**: WETH debt offsets wstETH collateral, so PnL i
31
31
  ## Safety features
32
32
 
33
33
  - **Depeg guard**: `_max_safe_F()` calculates leverage ceiling based on wstETH collateral factor and max depeg tolerance.
34
- - **Delta-neutrality**: `_balance_weth_debt()` rebalances when WETH debt exceeds wstETH collateral value.
34
+ - **Delta-neutrality**: `_post_run_guard()` enforces wstETH collateral ≥ WETH debt (within tolerance) via `_reconcile_wallet_into_position()` and `_settle_weth_debt_to_target_usd()`.
35
35
  - **Swap retries**: `_swap_with_retries()` uses progressive slippage (0.5% → 1% → 1.5%) with exponential backoff.
36
36
  - **Health monitoring**: Automatic deleveraging when health factor drops below `MIN_HEALTH_FACTOR`.
37
+ - **Deterministic Base reads**: waits 2 blocks after receipts by default and pins ETH/ERC20 balance reads to the confirmed block to avoid stale RPC reads on Base.
37
38
  - **Rollback protection**: Checks actual balances before rollback swaps to prevent failed transactions.
38
39
 
39
40
  ## Adapters used
@@ -43,7 +44,6 @@ The position is **delta-neutral**: WETH debt offsets wstETH collateral, so PnL i
43
44
  - `LedgerAdapter` for net deposit tracking.
44
45
  - `BRAPAdapter` for swap quotes and execution via Aerodrome/routing.
45
46
  - `MoonwellAdapter` for lending, borrowing, collateral management, and position queries.
46
- - `LocalTokenTxnService` via `DefaultWeb3Service` for low-level sends/approvals.
47
47
 
48
48
  ## Actions
49
49
 
@@ -58,9 +58,9 @@ The position is **delta-neutral**: WETH debt offsets wstETH collateral, so PnL i
58
58
  ### Update
59
59
 
60
60
  - Checks gas balance meets maintenance threshold.
61
- - Balances WETH debt against wstETH collateral for delta-neutrality.
62
- - Computes health factor from aggregated positions.
63
- - If HF < MIN: triggers deleveraging via `_repay_debt_loop()`.
61
+ - Reconciles wallet leftovers into the intended position (`_reconcile_wallet_into_position()`).
62
+ - Computes HF/LTV/delta from a single accounting snapshot.
63
+ - If HF < MIN: triggers deleveraging via `_settle_weth_debt_to_target_usd()`.
64
64
  - If HF > MAX: executes additional leverage loops to optimize yield.
65
65
  - Claims WELL rewards if above minimum threshold.
66
66
 
@@ -75,7 +75,7 @@ The position is **delta-neutral**: WETH debt offsets wstETH collateral, so PnL i
75
75
  ### Withdraw
76
76
 
77
77
  - Sweeps miscellaneous token balances to WETH.
78
- - Repays all WETH debt via `_repay_debt_loop()`.
78
+ - Repays all WETH debt via `_settle_weth_debt_to_target_usd(target_debt_usd=0.0, mode="exit")`.
79
79
  - Unlends wstETH, swaps to USDC.
80
80
  - Unlends USDC collateral.
81
81
  - Returns USDC and remaining ETH to main wallet.