wayfinder-paths 0.1.19__py3-none-any.whl → 0.1.20__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/__init__.py +0 -2
- wayfinder_paths/adapters/balance_adapter/README.md +59 -45
- wayfinder_paths/adapters/balance_adapter/adapter.py +0 -21
- wayfinder_paths/adapters/balance_adapter/test_adapter.py +0 -14
- wayfinder_paths/adapters/brap_adapter/README.md +61 -184
- wayfinder_paths/adapters/brap_adapter/__init__.py +0 -4
- wayfinder_paths/adapters/brap_adapter/adapter.py +0 -147
- wayfinder_paths/adapters/brap_adapter/test_adapter.py +0 -15
- wayfinder_paths/adapters/hyperlend_adapter/__init__.py +0 -4
- wayfinder_paths/adapters/hyperlend_adapter/adapter.py +0 -9
- wayfinder_paths/adapters/hyperlend_adapter/test_adapter.py +0 -17
- wayfinder_paths/adapters/hyperliquid_adapter/adapter.py +3 -312
- wayfinder_paths/adapters/hyperliquid_adapter/executor.py +1 -71
- wayfinder_paths/adapters/hyperliquid_adapter/paired_filler.py +0 -57
- wayfinder_paths/adapters/hyperliquid_adapter/test_adapter.py +0 -17
- wayfinder_paths/adapters/hyperliquid_adapter/test_adapter_live.py +2 -42
- wayfinder_paths/adapters/hyperliquid_adapter/test_executor.py +1 -9
- wayfinder_paths/adapters/hyperliquid_adapter/test_utils.py +15 -47
- wayfinder_paths/adapters/hyperliquid_adapter/utils.py +0 -7
- wayfinder_paths/adapters/ledger_adapter/README.md +54 -74
- wayfinder_paths/adapters/ledger_adapter/__init__.py +0 -4
- wayfinder_paths/adapters/ledger_adapter/adapter.py +0 -106
- wayfinder_paths/adapters/ledger_adapter/test_adapter.py +0 -12
- wayfinder_paths/adapters/moonwell_adapter/README.md +67 -106
- wayfinder_paths/adapters/moonwell_adapter/__init__.py +0 -4
- wayfinder_paths/adapters/moonwell_adapter/adapter.py +9 -121
- wayfinder_paths/adapters/moonwell_adapter/test_adapter.py +84 -83
- wayfinder_paths/adapters/pool_adapter/README.md +30 -51
- wayfinder_paths/adapters/pool_adapter/__init__.py +0 -4
- wayfinder_paths/adapters/pool_adapter/adapter.py +0 -19
- wayfinder_paths/adapters/pool_adapter/test_adapter.py +0 -8
- wayfinder_paths/adapters/token_adapter/README.md +41 -49
- wayfinder_paths/adapters/token_adapter/adapter.py +0 -32
- wayfinder_paths/adapters/token_adapter/test_adapter.py +1 -12
- wayfinder_paths/conftest.py +0 -8
- wayfinder_paths/core/__init__.py +0 -2
- wayfinder_paths/core/adapters/BaseAdapter.py +0 -22
- wayfinder_paths/core/adapters/__init__.py +0 -5
- wayfinder_paths/core/adapters/models.py +0 -5
- wayfinder_paths/core/analytics/__init__.py +0 -2
- wayfinder_paths/core/analytics/bootstrap.py +0 -16
- wayfinder_paths/core/analytics/stats.py +0 -7
- wayfinder_paths/core/analytics/test_analytics.py +5 -34
- wayfinder_paths/core/clients/BRAPClient.py +0 -35
- wayfinder_paths/core/clients/ClientManager.py +0 -51
- wayfinder_paths/core/clients/HyperlendClient.py +0 -77
- wayfinder_paths/core/clients/LedgerClient.py +2 -122
- wayfinder_paths/core/clients/PoolClient.py +0 -2
- wayfinder_paths/core/clients/TokenClient.py +0 -39
- wayfinder_paths/core/clients/WalletClient.py +0 -15
- wayfinder_paths/core/clients/WayfinderClient.py +0 -24
- wayfinder_paths/core/clients/__init__.py +0 -4
- wayfinder_paths/core/clients/protocols.py +25 -98
- wayfinder_paths/core/config.py +0 -24
- wayfinder_paths/core/constants/__init__.py +0 -7
- wayfinder_paths/core/constants/base.py +2 -9
- wayfinder_paths/core/constants/erc20_abi.py +0 -5
- wayfinder_paths/core/constants/hyperlend_abi.py +0 -7
- wayfinder_paths/core/constants/moonwell_abi.py +0 -35
- wayfinder_paths/core/engine/StrategyJob.py +0 -32
- wayfinder_paths/core/strategies/Strategy.py +0 -99
- wayfinder_paths/core/strategies/__init__.py +0 -2
- wayfinder_paths/core/utils/__init__.py +0 -1
- wayfinder_paths/core/utils/erc20_service.py +0 -1
- wayfinder_paths/core/utils/evm_helpers.py +0 -50
- wayfinder_paths/core/utils/transaction.py +0 -1
- wayfinder_paths/run_strategy.py +0 -46
- wayfinder_paths/scripts/create_strategy.py +0 -17
- wayfinder_paths/scripts/make_wallets.py +1 -4
- wayfinder_paths/strategies/basis_trading_strategy/README.md +71 -163
- wayfinder_paths/strategies/basis_trading_strategy/snapshot_mixin.py +0 -24
- wayfinder_paths/strategies/basis_trading_strategy/strategy.py +36 -400
- wayfinder_paths/strategies/basis_trading_strategy/test_strategy.py +15 -64
- wayfinder_paths/strategies/basis_trading_strategy/types.py +0 -4
- wayfinder_paths/strategies/hyperlend_stable_yield_strategy/README.md +65 -56
- wayfinder_paths/strategies/hyperlend_stable_yield_strategy/strategy.py +4 -27
- wayfinder_paths/strategies/hyperlend_stable_yield_strategy/test_strategy.py +0 -10
- wayfinder_paths/strategies/moonwell_wsteth_loop_strategy/README.md +71 -72
- wayfinder_paths/strategies/moonwell_wsteth_loop_strategy/strategy.py +23 -227
- wayfinder_paths/strategies/moonwell_wsteth_loop_strategy/test_strategy.py +120 -113
- wayfinder_paths/strategies/stablecoin_yield_strategy/README.md +64 -59
- wayfinder_paths/strategies/stablecoin_yield_strategy/strategy.py +4 -44
- wayfinder_paths/strategies/stablecoin_yield_strategy/test_strategy.py +2 -35
- wayfinder_paths/templates/adapter/README.md +107 -46
- wayfinder_paths/templates/adapter/adapter.py +0 -9
- wayfinder_paths/templates/adapter/test_adapter.py +0 -19
- wayfinder_paths/templates/strategy/README.md +113 -59
- wayfinder_paths/templates/strategy/strategy.py +0 -22
- wayfinder_paths/templates/strategy/test_strategy.py +0 -28
- wayfinder_paths/tests/test_test_coverage.py +2 -12
- wayfinder_paths/tests/test_utils.py +1 -31
- wayfinder_paths-0.1.20.dist-info/METADATA +355 -0
- wayfinder_paths-0.1.20.dist-info/RECORD +129 -0
- wayfinder_paths/core/adapters/base.py +0 -5
- wayfinder_paths-0.1.19.dist-info/METADATA +0 -592
- wayfinder_paths-0.1.19.dist-info/RECORD +0 -130
- {wayfinder_paths-0.1.19.dist-info → wayfinder_paths-0.1.20.dist-info}/LICENSE +0 -0
- {wayfinder_paths-0.1.19.dist-info → wayfinder_paths-0.1.20.dist-info}/WHEEL +0 -0
|
@@ -1,106 +1,105 @@
|
|
|
1
1
|
# Moonwell wstETH Loop Strategy
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
- Examples: `examples.json`
|
|
5
|
-
- Tests: `test_strategy.py`
|
|
3
|
+
Leveraged wstETH carry trade on Base via Moonwell.
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
- **Module**: `wayfinder_paths.strategies.moonwell_wsteth_loop_strategy.strategy.MoonwellWstethLoopStrategy`
|
|
6
|
+
- **Chain**: Base (8453)
|
|
7
|
+
- **Tokens**: USDC, WETH, wstETH
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Overview
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
This strategy creates a leveraged liquid-staking carry trade by:
|
|
12
|
+
1. Depositing USDC as initial collateral on Moonwell
|
|
13
|
+
2. Borrowing WETH against the USDC collateral
|
|
14
|
+
3. Swapping WETH to wstETH via Aerodrome/BRAP
|
|
15
|
+
4. Lending wstETH back to Moonwell as additional collateral
|
|
16
|
+
5. Repeating the loop until target leverage is reached
|
|
16
17
|
|
|
17
18
|
The position is **delta-neutral**: WETH debt offsets wstETH collateral, so PnL is driven by the spread between wstETH staking yield and WETH borrow cost.
|
|
18
19
|
|
|
19
|
-
## Key
|
|
20
|
+
## Key Parameters
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
| Parameter | Value | Description |
|
|
23
|
+
|-----------|-------|-------------|
|
|
24
|
+
| `MIN_GAS` | 0.002 ETH | Minimum gas buffer |
|
|
25
|
+
| `MIN_USDC_DEPOSIT` | 20 USDC | Minimum initial collateral |
|
|
26
|
+
| `MAX_DEPEG` | 0.01 (1%) | Max stETH/ETH depeg threshold |
|
|
27
|
+
| `MIN_HEALTH_FACTOR` | 1.2 | Triggers deleveraging if below |
|
|
28
|
+
| `MAX_HEALTH_FACTOR` | 1.5 | Triggers leverage loop if above |
|
|
29
|
+
| `leverage_limit` | 10 | Maximum leverage multiplier |
|
|
30
|
+
| `COLLATERAL_SAFETY_FACTOR` | 0.98 | 2% safety buffer on borrows |
|
|
31
|
+
| `MAX_SLIPPAGE_TOLERANCE` | 0.03 | 3% max slippage |
|
|
30
32
|
|
|
31
|
-
## Safety
|
|
33
|
+
## Safety Features
|
|
32
34
|
|
|
33
|
-
- **Depeg guard**:
|
|
34
|
-
- **Delta-neutrality**:
|
|
35
|
-
- **Swap retries**:
|
|
36
|
-
- **Health monitoring**: Automatic deleveraging when health factor drops
|
|
37
|
-
- **Deterministic
|
|
38
|
-
- **Rollback protection**: Checks actual balances before rollback swaps to prevent failed transactions.
|
|
35
|
+
- **Depeg guard**: Calculates leverage ceiling based on collateral factor and max depeg tolerance
|
|
36
|
+
- **Delta-neutrality**: Enforces wstETH collateral >= WETH debt
|
|
37
|
+
- **Swap retries**: Progressive slippage (0.5% -> 1% -> 1.5%) with exponential backoff
|
|
38
|
+
- **Health monitoring**: Automatic deleveraging when health factor drops
|
|
39
|
+
- **Deterministic reads**: Waits 2 blocks after receipts to avoid stale RPC data
|
|
39
40
|
|
|
40
|
-
## Adapters
|
|
41
|
+
## Adapters Used
|
|
41
42
|
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
43
|
+
- **BalanceAdapter**: Token balances, wallet transfers
|
|
44
|
+
- **TokenAdapter**: Token metadata, price feeds
|
|
45
|
+
- **LedgerAdapter**: Net deposit tracking
|
|
46
|
+
- **BRAPAdapter**: Swap quotes and execution
|
|
47
|
+
- **MoonwellAdapter**: Lending, borrowing, collateral management
|
|
47
48
|
|
|
48
49
|
## Actions
|
|
49
50
|
|
|
50
51
|
### Deposit
|
|
51
52
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
```bash
|
|
54
|
+
poetry run python wayfinder_paths/run_strategy.py moonwell_wsteth_loop_strategy \
|
|
55
|
+
--action deposit --main-token-amount 100 --gas-token-amount 0.01 --config config.json
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
- Validates USDC and ETH balances
|
|
59
|
+
- Transfers ETH gas buffer if needed
|
|
60
|
+
- Moves USDC to strategy wallet
|
|
61
|
+
- Lends USDC on Moonwell and enables as collateral
|
|
62
|
+
- Executes leverage loop (borrow WETH -> swap to wstETH -> lend)
|
|
57
63
|
|
|
58
64
|
### Update
|
|
59
65
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
-
|
|
66
|
+
```bash
|
|
67
|
+
poetry run python wayfinder_paths/run_strategy.py moonwell_wsteth_loop_strategy \
|
|
68
|
+
--action update --config config.json
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
- Checks gas balance meets threshold
|
|
72
|
+
- Reconciles wallet leftovers into position
|
|
73
|
+
- Computes health factor/LTV/delta
|
|
74
|
+
- If HF < MIN: triggers deleveraging
|
|
75
|
+
- If HF > MAX: executes additional leverage loops
|
|
76
|
+
- Claims WELL rewards if above threshold
|
|
66
77
|
|
|
67
78
|
### Status
|
|
68
79
|
|
|
69
|
-
|
|
80
|
+
```bash
|
|
81
|
+
poetry run python wayfinder_paths/run_strategy.py moonwell_wsteth_loop_strategy \
|
|
82
|
+
--action status --config config.json
|
|
83
|
+
```
|
|
70
84
|
|
|
71
|
-
|
|
72
|
-
- `
|
|
73
|
-
- `
|
|
85
|
+
Returns:
|
|
86
|
+
- `portfolio_value`: USDC lent + wstETH lent - WETH debt
|
|
87
|
+
- `net_deposit`: From LedgerAdapter
|
|
88
|
+
- `strategy_status`: Leverage, health factor, LTV, peg diff, credit remaining
|
|
74
89
|
|
|
75
90
|
### Withdraw
|
|
76
91
|
|
|
77
|
-
- Sweeps miscellaneous token balances to WETH.
|
|
78
|
-
- Repays all WETH debt via `_settle_weth_debt_to_target_usd(target_debt_usd=0.0, mode="exit")`.
|
|
79
|
-
- Unlends wstETH, swaps to USDC.
|
|
80
|
-
- Unlends USDC collateral.
|
|
81
|
-
- Returns USDC and remaining ETH to main wallet.
|
|
82
|
-
|
|
83
|
-
## Running locally
|
|
84
|
-
|
|
85
92
|
```bash
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
# Generate wallets (writes config.json)
|
|
90
|
-
poetry run python wayfinder_paths/scripts/make_wallets.py -n 1
|
|
91
|
-
|
|
92
|
-
# Copy config and edit credentials
|
|
93
|
-
cp wayfinder_paths/config.example.json config.json
|
|
94
|
-
|
|
95
|
-
# Check status / health
|
|
96
|
-
poetry run python wayfinder_paths/run_strategy.py moonwell_wsteth_loop_strategy --action status --config $(pwd)/config.json
|
|
97
|
-
|
|
98
|
-
# Perform a deposit/update/withdraw cycle
|
|
99
|
-
poetry run python wayfinder_paths/run_strategy.py moonwell_wsteth_loop_strategy --action deposit --main-token-amount 100 --gas-token-amount 0.01 --config $(pwd)/config.json
|
|
100
|
-
poetry run python wayfinder_paths/run_strategy.py moonwell_wsteth_loop_strategy --action update --config $(pwd)/config.json
|
|
101
|
-
poetry run python wayfinder_paths/run_strategy.py moonwell_wsteth_loop_strategy --action withdraw --config $(pwd)/config.json
|
|
93
|
+
poetry run python wayfinder_paths/run_strategy.py moonwell_wsteth_loop_strategy \
|
|
94
|
+
--action withdraw --config config.json
|
|
102
95
|
```
|
|
103
96
|
|
|
97
|
+
- Sweeps miscellaneous token balances to WETH
|
|
98
|
+
- Repays all WETH debt
|
|
99
|
+
- Unlends wstETH, swaps to USDC
|
|
100
|
+
- Unlends USDC collateral
|
|
101
|
+
- Returns USDC and remaining ETH to main wallet
|
|
102
|
+
|
|
104
103
|
## Testing
|
|
105
104
|
|
|
106
105
|
```bash
|