wayfinder-paths 0.1.8__py3-none-any.whl → 0.1.10__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 (80) hide show
  1. wayfinder_paths/CONFIG_GUIDE.md +6 -15
  2. wayfinder_paths/adapters/balance_adapter/README.md +1 -2
  3. wayfinder_paths/adapters/balance_adapter/adapter.py +4 -4
  4. wayfinder_paths/adapters/brap_adapter/README.md +1 -1
  5. wayfinder_paths/adapters/brap_adapter/adapter.py +139 -74
  6. wayfinder_paths/adapters/hyperlend_adapter/adapter.py +0 -7
  7. wayfinder_paths/adapters/hyperliquid_adapter/adapter.py +0 -54
  8. wayfinder_paths/adapters/hyperliquid_adapter/test_adapter_live.py +1 -1
  9. wayfinder_paths/adapters/ledger_adapter/README.md +1 -1
  10. wayfinder_paths/adapters/moonwell_adapter/README.md +174 -0
  11. wayfinder_paths/adapters/moonwell_adapter/__init__.py +7 -0
  12. wayfinder_paths/adapters/moonwell_adapter/adapter.py +1226 -0
  13. wayfinder_paths/adapters/moonwell_adapter/test_adapter.py +635 -0
  14. wayfinder_paths/adapters/pool_adapter/README.md +1 -77
  15. wayfinder_paths/adapters/pool_adapter/adapter.py +0 -122
  16. wayfinder_paths/adapters/pool_adapter/examples.json +0 -57
  17. wayfinder_paths/adapters/pool_adapter/test_adapter.py +0 -86
  18. wayfinder_paths/adapters/token_adapter/README.md +1 -1
  19. wayfinder_paths/core/clients/ClientManager.py +1 -22
  20. wayfinder_paths/core/clients/WalletClient.py +0 -8
  21. wayfinder_paths/core/clients/WayfinderClient.py +7 -12
  22. wayfinder_paths/core/clients/__init__.py +0 -8
  23. wayfinder_paths/core/clients/protocols.py +0 -60
  24. wayfinder_paths/core/config.py +5 -45
  25. wayfinder_paths/core/constants/__init__.py +0 -2
  26. wayfinder_paths/core/constants/base.py +6 -2
  27. wayfinder_paths/core/constants/moonwell_abi.py +411 -0
  28. wayfinder_paths/core/services/base.py +7 -1
  29. wayfinder_paths/core/services/local_evm_txn.py +223 -222
  30. wayfinder_paths/core/services/local_token_txn.py +103 -92
  31. wayfinder_paths/core/services/web3_service.py +0 -2
  32. wayfinder_paths/core/settings.py +8 -8
  33. wayfinder_paths/core/strategies/Strategy.py +1 -5
  34. wayfinder_paths/core/strategies/descriptors.py +1 -1
  35. wayfinder_paths/core/utils/evm_helpers.py +7 -12
  36. wayfinder_paths/core/wallets/README.md +3 -6
  37. wayfinder_paths/run_strategy.py +62 -105
  38. wayfinder_paths/scripts/create_strategy.py +2 -27
  39. wayfinder_paths/scripts/make_wallets.py +1 -25
  40. wayfinder_paths/scripts/run_strategy.py +37 -9
  41. wayfinder_paths/strategies/basis_trading_strategy/snapshot_mixin.py +1 -3
  42. wayfinder_paths/strategies/basis_trading_strategy/strategy.py +87 -138
  43. wayfinder_paths/strategies/basis_trading_strategy/test_strategy.py +96 -58
  44. wayfinder_paths/strategies/hyperlend_stable_yield_strategy/README.md +2 -17
  45. wayfinder_paths/strategies/hyperlend_stable_yield_strategy/examples.json +4 -1
  46. wayfinder_paths/strategies/hyperlend_stable_yield_strategy/strategy.py +107 -29
  47. wayfinder_paths/strategies/hyperlend_stable_yield_strategy/test_strategy.py +53 -14
  48. wayfinder_paths/strategies/moonwell_wsteth_loop_strategy/README.md +108 -0
  49. wayfinder_paths/strategies/moonwell_wsteth_loop_strategy/examples.json +11 -0
  50. wayfinder_paths/strategies/moonwell_wsteth_loop_strategy/strategy.py +2975 -0
  51. wayfinder_paths/strategies/moonwell_wsteth_loop_strategy/test_strategy.py +886 -0
  52. wayfinder_paths/strategies/stablecoin_yield_strategy/README.md +0 -7
  53. wayfinder_paths/strategies/stablecoin_yield_strategy/strategy.py +2 -7
  54. wayfinder_paths/strategies/stablecoin_yield_strategy/test_strategy.py +0 -4
  55. wayfinder_paths/templates/adapter/README.md +5 -21
  56. wayfinder_paths/templates/adapter/adapter.py +1 -2
  57. wayfinder_paths/templates/adapter/test_adapter.py +1 -1
  58. wayfinder_paths/templates/strategy/README.md +4 -21
  59. wayfinder_paths/templates/strategy/test_strategy.py +0 -4
  60. wayfinder_paths/tests/test_smoke_manifest.py +17 -2
  61. {wayfinder_paths-0.1.8.dist-info → wayfinder_paths-0.1.10.dist-info}/METADATA +64 -201
  62. {wayfinder_paths-0.1.8.dist-info → wayfinder_paths-0.1.10.dist-info}/RECORD +64 -71
  63. wayfinder_paths/adapters/balance_adapter/manifest.yaml +0 -8
  64. wayfinder_paths/adapters/brap_adapter/manifest.yaml +0 -11
  65. wayfinder_paths/adapters/hyperlend_adapter/manifest.yaml +0 -10
  66. wayfinder_paths/adapters/hyperliquid_adapter/manifest.yaml +0 -8
  67. wayfinder_paths/adapters/ledger_adapter/manifest.yaml +0 -11
  68. wayfinder_paths/adapters/pool_adapter/manifest.yaml +0 -10
  69. wayfinder_paths/adapters/token_adapter/manifest.yaml +0 -6
  70. wayfinder_paths/core/clients/SimulationClient.py +0 -192
  71. wayfinder_paths/core/clients/TransactionClient.py +0 -63
  72. wayfinder_paths/core/engine/manifest.py +0 -97
  73. wayfinder_paths/scripts/validate_manifests.py +0 -213
  74. wayfinder_paths/strategies/basis_trading_strategy/manifest.yaml +0 -23
  75. wayfinder_paths/strategies/hyperlend_stable_yield_strategy/manifest.yaml +0 -7
  76. wayfinder_paths/strategies/stablecoin_yield_strategy/manifest.yaml +0 -17
  77. wayfinder_paths/templates/adapter/manifest.yaml +0 -6
  78. wayfinder_paths/templates/strategy/manifest.yaml +0 -8
  79. {wayfinder_paths-0.1.8.dist-info → wayfinder_paths-0.1.10.dist-info}/LICENSE +0 -0
  80. {wayfinder_paths-0.1.8.dist-info → wayfinder_paths-0.1.10.dist-info}/WHEEL +0 -0
@@ -0,0 +1,174 @@
1
+ # Moonwell Adapter
2
+
3
+ Adapter for interacting with the [Moonwell](https://moonwell.fi/) lending protocol on Base chain.
4
+
5
+ - Entrypoint: `adapters.moonwell_adapter.adapter.MoonwellAdapter`
6
+ - Tests: `test_adapter.py`
7
+
8
+ ## Capabilities
9
+
10
+ The adapter provides the following capabilities:
11
+ - Lending: Supply and withdraw tokens
12
+ - Borrowing: Borrow and repay tokens
13
+ - Collateral management: Enable/disable markets as collateral
14
+ - Rewards: Claim WELL token rewards
15
+ - Position & market queries: Get balances, APYs, and liquidity info
16
+
17
+ ## Overview
18
+
19
+ The MoonwellAdapter provides functionality for:
20
+ - **Lending**: Supply tokens to earn yield
21
+ - **Borrowing**: Borrow against collateral
22
+ - **Collateral Management**: Enable/disable markets as collateral
23
+ - **Rewards**: Claim WELL token rewards
24
+ - **Position Queries**: Get balances, APYs, and liquidity info
25
+
26
+ ## Supported Markets (Base Chain)
27
+
28
+ | Token | mToken Address | Underlying Address |
29
+ |-------|----------------|-------------------|
30
+ | USDC | `0xEdc817A28E8B93B03976FBd4a3dDBc9f7D176c22` | `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913` |
31
+ | WETH | `0x628ff693426583D9a7FB391E54366292F509D457` | `0x4200000000000000000000000000000000000006` |
32
+ | wstETH | `0x627Fe393Bc6EdDA28e99AE648fD6fF362514304b` | `0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452` |
33
+
34
+ ## Protocol Addresses (Base Chain)
35
+
36
+ - **Comptroller**: `0xfbb21d0380bee3312b33c4353c8936a0f13ef26c`
37
+ - **Reward Distributor**: `0xe9005b078701e2a0948d2eac43010d35870ad9d2`
38
+ - **WELL Token**: `0xA88594D404727625A9437C3f886C7643872296AE`
39
+
40
+ ## Construction
41
+
42
+ ```python
43
+ from wayfinder_paths.core.services.web3_service import DefaultWeb3Service
44
+ from wayfinder_paths.adapters.moonwell_adapter import MoonwellAdapter
45
+
46
+ config = {
47
+ "strategy_wallet": {"address": "0x...your_wallet..."},
48
+ "moonwell_adapter": {
49
+ "chain_id": 8453, # Base chain (default)
50
+ }
51
+ }
52
+ web3_service = DefaultWeb3Service(config)
53
+ adapter = MoonwellAdapter(config=config, web3_service=web3_service)
54
+ ```
55
+
56
+ `web3_service` is required so the adapter can share the same wallet provider as the rest of the strategy.
57
+
58
+ ## Usage
59
+
60
+ ```python
61
+ # Supply tokens
62
+ await adapter.lend(
63
+ mtoken="0xEdc817A28E8B93B03976FBd4a3dDBc9f7D176c22", # mUSDC
64
+ underlying_token="0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", # USDC
65
+ amount=1000 * 10**6, # 1000 USDC
66
+ )
67
+
68
+ # Enable as collateral
69
+ await adapter.set_collateral(
70
+ mtoken="0x627Fe393Bc6EdDA28e99AE648fD6fF362514304b", # mwstETH
71
+ )
72
+
73
+ # Borrow
74
+ await adapter.borrow(
75
+ mtoken="0x628ff693426583D9a7FB391E54366292F509D457", # mWETH
76
+ amount=10**17, # 0.1 WETH
77
+ )
78
+
79
+ # Get position info
80
+ success, position = await adapter.get_pos(
81
+ mtoken="0xEdc817A28E8B93B03976FBd4a3dDBc9f7D176c22",
82
+ )
83
+ # Returns: {mtoken_balance, underlying_balance, borrow_balance, exchange_rate, balances}
84
+
85
+ # Get collateral factor
86
+ success, cf = await adapter.get_collateral_factor(
87
+ mtoken="0x627Fe393Bc6EdDA28e99AE648fD6fF362514304b",
88
+ )
89
+ # Returns: 0.75 (75% LTV)
90
+
91
+ # Get APY
92
+ success, apy = await adapter.get_apy(
93
+ mtoken="0xEdc817A28E8B93B03976FBd4a3dDBc9f7D176c22",
94
+ apy_type="supply", # or "borrow"
95
+ )
96
+
97
+ # Claim rewards
98
+ await adapter.claim_rewards()
99
+ ```
100
+
101
+ ## API Reference
102
+
103
+ ### Lending Operations
104
+
105
+ | Method | Description |
106
+ |--------|-------------|
107
+ | `lend(mtoken, underlying_token, amount)` | Supply tokens to earn yield |
108
+ | `unlend(mtoken, amount)` | Withdraw by redeeming mTokens |
109
+
110
+ ### Borrowing Operations
111
+
112
+ | Method | Description |
113
+ |--------|-------------|
114
+ | `borrow(mtoken, amount)` | Borrow underlying tokens |
115
+ | `repay(mtoken, underlying_token, amount)` | Repay borrowed tokens |
116
+
117
+ ### Collateral Management
118
+
119
+ | Method | Description |
120
+ |--------|-------------|
121
+ | `set_collateral(mtoken)` | Enable market as collateral (enterMarkets) |
122
+ | `remove_collateral(mtoken)` | Disable market as collateral (exitMarket) |
123
+
124
+ ### Position & Market Data
125
+
126
+ | Method | Description |
127
+ |--------|-------------|
128
+ | `get_pos(mtoken, account)` | Get position data (balances, debt, rewards) |
129
+ | `get_collateral_factor(mtoken)` | Get collateral factor (LTV) |
130
+ | `get_apy(mtoken, apy_type)` | Get supply or borrow APY |
131
+ | `get_borrowable_amount(account)` | Get max borrowable in USD |
132
+ | `max_withdrawable_mtoken(mtoken, account)` | Calculate safe withdrawal amount via binary search |
133
+
134
+ ### Rewards
135
+
136
+ | Method | Description |
137
+ |--------|-------------|
138
+ | `claim_rewards(min_rewards_usd)` | Claim WELL rewards (skips if below threshold) |
139
+
140
+ ### Utilities
141
+
142
+ | Method | Description |
143
+ |--------|-------------|
144
+ | `wrap_eth(amount)` | Wrap ETH to WETH |
145
+
146
+ All methods return `(success: bool, payload: Any)` tuples. On failure the payload is an error string.
147
+
148
+ ## Testing
149
+
150
+ ```bash
151
+ poetry run pytest wayfinder_paths/adapters/moonwell_adapter/ -v
152
+ ```
153
+
154
+ ## Configuration
155
+
156
+ The adapter can be configured via the `moonwell_adapter` config key:
157
+
158
+ ```python
159
+ config = {
160
+ "strategy_wallet": {"address": "0x..."},
161
+ "moonwell_adapter": {
162
+ "chain_id": 8453, # Chain ID (default: Base)
163
+ "comptroller": "0x...", # Override comptroller address
164
+ "reward_distributor": "0x...", # Override reward distributor
165
+ "m_usdc": "0x...", # Override mUSDC address
166
+ "m_weth": "0x...", # Override mWETH address
167
+ "m_wsteth": "0x...", # Override mwstETH address
168
+ }
169
+ }
170
+ ```
171
+
172
+ ## Error handling
173
+
174
+ Any exception raised by the underlying web3 calls is caught and returned as a `(False, "message")` tuple. The inherited `health_check()` method reports adapter status, making it safe to call from `Strategy.health_check`.
@@ -0,0 +1,7 @@
1
+ """
2
+ Moonwell Adapter
3
+ """
4
+
5
+ from wayfinder_paths.adapters.moonwell_adapter.adapter import MoonwellAdapter
6
+
7
+ __all__ = ["MoonwellAdapter"]