wayfinder-paths 0.1.2__py3-none-any.whl → 0.1.4__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 +23 -18
- wayfinder_paths/abis/generic/erc20.json +383 -0
- wayfinder_paths/{vaults/adapters → adapters}/balance_adapter/README.md +2 -2
- wayfinder_paths/{vaults/adapters → adapters}/balance_adapter/adapter.py +2 -2
- 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 +1 -1
- wayfinder_paths/{vaults/adapters → adapters}/brap_adapter/adapter.py +2 -2
- 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/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 +1 -1
- wayfinder_paths/{vaults/adapters → adapters}/ledger_adapter/manifest.yaml +1 -1
- wayfinder_paths/{vaults/adapters → adapters}/ledger_adapter/test_adapter.py +2 -2
- wayfinder_paths/{vaults/adapters → adapters}/pool_adapter/README.md +1 -1
- 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/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/engine/manifest.py +1 -1
- wayfinder_paths/core/strategies/Strategy.py +3 -3
- wayfinder_paths/core/strategies/descriptors.py +80 -0
- wayfinder_paths/core/utils/evm_helpers.py +39 -0
- wayfinder_paths/policies/enso.py +17 -0
- wayfinder_paths/policies/erc20.py +34 -0
- wayfinder_paths/policies/evm.py +21 -0
- wayfinder_paths/policies/hyper_evm.py +19 -0
- wayfinder_paths/policies/hyperlend.py +12 -0
- wayfinder_paths/policies/hyperliquid.py +30 -0
- wayfinder_paths/policies/moonwell.py +54 -0
- wayfinder_paths/policies/prjx.py +30 -0
- wayfinder_paths/policies/util.py +27 -0
- wayfinder_paths/run_strategy.py +3 -3
- wayfinder_paths/scripts/create_strategy.py +3 -3
- wayfinder_paths/scripts/validate_manifests.py +2 -2
- wayfinder_paths/{vaults/strategies → strategies}/hyperlend_stable_yield_strategy/README.md +4 -3
- wayfinder_paths/{vaults/strategies → strategies}/hyperlend_stable_yield_strategy/manifest.yaml +1 -1
- wayfinder_paths/{vaults/strategies → strategies}/hyperlend_stable_yield_strategy/strategy.py +143 -81
- wayfinder_paths/{vaults/strategies → strategies}/hyperlend_stable_yield_strategy/test_strategy.py +4 -2
- wayfinder_paths/{vaults/strategies → strategies}/stablecoin_yield_strategy/README.md +4 -3
- wayfinder_paths/{vaults/strategies → strategies}/stablecoin_yield_strategy/manifest.yaml +1 -1
- wayfinder_paths/{vaults/strategies → strategies}/stablecoin_yield_strategy/strategy.py +117 -80
- wayfinder_paths/{vaults/strategies → strategies}/stablecoin_yield_strategy/test_strategy.py +2 -2
- wayfinder_paths/{vaults/templates → templates}/adapter/README.md +4 -4
- wayfinder_paths/{vaults/templates → templates}/adapter/manifest.yaml +1 -1
- wayfinder_paths/{vaults/templates → templates}/strategy/README.md +6 -5
- wayfinder_paths/{vaults/templates → templates}/strategy/manifest.yaml +1 -1
- wayfinder_paths/{vaults/templates → templates}/strategy/test_strategy.py +1 -1
- {wayfinder_paths-0.1.2.dist-info → wayfinder_paths-0.1.4.dist-info}/METADATA +101 -23
- wayfinder_paths-0.1.4.dist-info/RECORD +125 -0
- wayfinder_paths/vaults/adapters/hyperlend_adapter/__init__.py +0 -7
- wayfinder_paths/vaults/adapters/token_adapter/examples.json +0 -26
- wayfinder_paths/vaults/strategies/__init__.py +0 -0
- wayfinder_paths-0.1.2.dist-info/RECORD +0 -115
- /wayfinder_paths/{vaults → adapters}/__init__.py +0 -0
- /wayfinder_paths/{vaults/adapters → adapters}/balance_adapter/examples.json +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}/hyperlend_adapter/adapter.py +0 -0
- /wayfinder_paths/{vaults/adapters → adapters}/ledger_adapter/__init__.py +0 -0
- /wayfinder_paths/{vaults/adapters → adapters}/ledger_adapter/adapter.py +0 -0
- /wayfinder_paths/{vaults/adapters → adapters}/ledger_adapter/examples.json +0 -0
- /wayfinder_paths/{vaults/adapters → adapters}/pool_adapter/__init__.py +0 -0
- /wayfinder_paths/{vaults/adapters → adapters}/pool_adapter/adapter.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/adapters → adapters}/token_adapter/adapter.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}/adapter/test_adapter.py +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.2.dist-info → wayfinder_paths-0.1.4.dist-info}/LICENSE +0 -0
- {wayfinder_paths-0.1.2.dist-info → wayfinder_paths-0.1.4.dist-info}/WHEEL +0 -0
wayfinder_paths/CONFIG_GUIDE.md
CHANGED
|
@@ -6,7 +6,9 @@ This guide explains how to configure your vault strategies for local testing.
|
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
# 1. Generate test wallets (required!)
|
|
9
|
-
|
|
9
|
+
# Creates a main wallet (or use 'just create-strategy' which auto-creates wallets)
|
|
10
|
+
just create-wallets
|
|
11
|
+
# Or manually: poetry run python wayfinder_paths/scripts/make_wallets.py -n 1
|
|
10
12
|
|
|
11
13
|
# 2. Create your config file
|
|
12
14
|
cp wayfinder_paths/config.example.json config.json
|
|
@@ -25,11 +27,11 @@ cp wayfinder_paths/config.example.json config.json
|
|
|
25
27
|
"username": "your_username", // OPTIONAL: For OAuth authentication
|
|
26
28
|
"password": "your_password", // OPTIONAL: For OAuth authentication
|
|
27
29
|
"refresh_token": null, // OPTIONAL: Alternative to username/password
|
|
28
|
-
"api_key": "sk_live_abc123..." // OPTIONAL: For service account authentication
|
|
30
|
+
"api_key": "sk_live_abc123..." // OPTIONAL: For service account authentication (loaded directly by clients, not stored in UserConfig)
|
|
29
31
|
},
|
|
30
32
|
"system": {
|
|
31
33
|
"api_base_url": "https://wayfinder.ai/api/v1",
|
|
32
|
-
"api_key": "sk_live_abc123...", // OPTIONAL: System-level API key (alternative to user.api_key)
|
|
34
|
+
"api_key": "sk_live_abc123...", // OPTIONAL: System-level API key (alternative to user.api_key, loaded directly by clients)
|
|
33
35
|
"wallets_path": "wallets.json" // Path to your generated wallets.json
|
|
34
36
|
},
|
|
35
37
|
"strategy": {
|
|
@@ -48,11 +50,13 @@ cp wayfinder_paths/config.example.json config.json
|
|
|
48
50
|
**Authentication (choose one method):**
|
|
49
51
|
|
|
50
52
|
**Option 1: Service Account (API Key) - Recommended for Production**
|
|
51
|
-
- `user.api_key` - Your Wayfinder API key for service account authentication
|
|
52
|
-
- OR `system.api_key` - System-level API key (alternative location)
|
|
53
|
+
- `user.api_key` - Your Wayfinder API key for service account authentication (loaded directly by clients from config.json)
|
|
54
|
+
- OR `system.api_key` - System-level API key (alternative location, loaded directly by clients)
|
|
53
55
|
- OR set `WAYFINDER_API_KEY` environment variable
|
|
54
56
|
- OR pass `api_key` parameter to strategy constructor
|
|
55
57
|
|
|
58
|
+
**Note:** API keys in `config.json` are loaded directly by `WayfinderClient` via `_load_config_credentials()`, not through the `UserConfig` or `SystemConfig` dataclasses. This is intentional to allow flexible credential loading.
|
|
59
|
+
|
|
56
60
|
**Option 2: Personal Access (OAuth) - For Development**
|
|
57
61
|
- `user.username` - Your Wayfinder backend username
|
|
58
62
|
- `user.password` - Your Wayfinder backend password
|
|
@@ -93,24 +97,24 @@ Individual strategies may have their own configuration parameters. Check the str
|
|
|
93
97
|
Use the built-in script to generate test wallets for local development:
|
|
94
98
|
|
|
95
99
|
```bash
|
|
96
|
-
# Generate
|
|
97
|
-
poetry run python wayfinder_paths/scripts/make_wallets.py
|
|
100
|
+
# Generate main wallet (recommended for initial setup)
|
|
101
|
+
poetry run python wayfinder_paths/scripts/make_wallets.py -n 1
|
|
98
102
|
|
|
99
103
|
# Add additional wallets for multi-account testing
|
|
100
|
-
poetry run python wayfinder_paths/scripts/make_wallets.py
|
|
104
|
+
poetry run python wayfinder_paths/scripts/make_wallets.py -n 3
|
|
101
105
|
|
|
102
|
-
#
|
|
103
|
-
poetry run python wayfinder_paths/scripts/make_wallets.py --
|
|
106
|
+
# Create a wallet with a specific label (e.g., for a strategy)
|
|
107
|
+
poetry run python wayfinder_paths/scripts/make_wallets.py --label "my_strategy_name"
|
|
104
108
|
|
|
105
109
|
# Generate keystore files (for geth/web3 compatibility)
|
|
106
|
-
poetry run python wayfinder_paths/scripts/make_wallets.py
|
|
110
|
+
poetry run python wayfinder_paths/scripts/make_wallets.py -n 1 --keystore-password "your-password"
|
|
107
111
|
```
|
|
108
112
|
|
|
109
113
|
This creates `wallets.json` in the repository root with:
|
|
110
|
-
- **
|
|
111
|
-
- Additional
|
|
114
|
+
- **main** wallet - your main wallet for testing (labeled "main")
|
|
115
|
+
- Additional wallets with labels if specified
|
|
112
116
|
|
|
113
|
-
**Note:** Generated wallets are for testing only. Wallet addresses are automatically loaded from `wallets.json` when not explicitly set in config.
|
|
117
|
+
**Note:** Generated wallets are for testing only. Wallet addresses are automatically loaded from `wallets.json` when not explicitly set in config. Strategy-specific wallets are automatically created when you use `just create-strategy "Strategy Name"`.
|
|
114
118
|
|
|
115
119
|
## Per-Strategy Wallets
|
|
116
120
|
|
|
@@ -147,7 +151,7 @@ Wallets in `wallets.json` are stored with labels that match strategy directory n
|
|
|
147
151
|
{
|
|
148
152
|
"address": "0x...",
|
|
149
153
|
"private_key_hex": "...",
|
|
150
|
-
"label": "
|
|
154
|
+
"label": "main"
|
|
151
155
|
},
|
|
152
156
|
{
|
|
153
157
|
"address": "0x...",
|
|
@@ -235,7 +239,7 @@ No code changes are required - existing strategies continue to work.
|
|
|
235
239
|
To use a custodial wallet provider (e.g., Privy, Turnkey), inject it directly into adapters:
|
|
236
240
|
|
|
237
241
|
```python
|
|
238
|
-
from
|
|
242
|
+
from adapters.evm_transaction_adapter.adapter import EvmTransactionAdapter
|
|
239
243
|
from my_privy_integration import PrivyWalletProvider
|
|
240
244
|
|
|
241
245
|
# Create your custom wallet provider
|
|
@@ -270,7 +274,7 @@ API keys provide service account authentication and are automatically discovered
|
|
|
270
274
|
|
|
271
275
|
#### Option A: Strategy Constructor (Programmatic)
|
|
272
276
|
```python
|
|
273
|
-
from wayfinder_paths.
|
|
277
|
+
from wayfinder_paths.strategies.stablecoin_yield_strategy.strategy import StablecoinYieldStrategy
|
|
274
278
|
|
|
275
279
|
strategy = StablecoinYieldStrategy(
|
|
276
280
|
config={...},
|
|
@@ -301,10 +305,11 @@ export WAYFINDER_API_KEY="sk_live_abc123..."
|
|
|
301
305
|
- When a strategy receives an `api_key`, it sets `os.environ["WAYFINDER_API_KEY"]`
|
|
302
306
|
- All clients created by adapters automatically discover the API key from:
|
|
303
307
|
- Constructor parameter (if passed)
|
|
304
|
-
- `config.json` (via `_load_config_credentials()`)
|
|
308
|
+
- `config.json` (via `WayfinderClient._load_config_credentials()` which reads `user.api_key` or `system.api_key`)
|
|
305
309
|
- `WAYFINDER_API_KEY` environment variable
|
|
306
310
|
- API keys are included in **all** API requests (including public endpoints) for rate limiting
|
|
307
311
|
- No need to pass API keys explicitly to adapters or clients—they auto-discover it
|
|
312
|
+
- **Note:** API keys in `config.json` are loaded directly by clients, not stored in the `UserConfig` or `SystemConfig` dataclasses
|
|
308
313
|
|
|
309
314
|
### 2. Personal Access Authentication (OAuth)
|
|
310
315
|
|
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"constant": true,
|
|
4
|
+
"inputs": [
|
|
5
|
+
{
|
|
6
|
+
"name": "owner",
|
|
7
|
+
"type": "address"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"name": "spender",
|
|
11
|
+
"type": "address"
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"name": "allowance",
|
|
15
|
+
"outputs": [
|
|
16
|
+
{
|
|
17
|
+
"name": "",
|
|
18
|
+
"type": "uint256"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"type": "function"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"constant": true,
|
|
25
|
+
"inputs": [
|
|
26
|
+
{
|
|
27
|
+
"name": "account",
|
|
28
|
+
"type": "address"
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
"name": "balanceOf",
|
|
32
|
+
"outputs": [
|
|
33
|
+
{
|
|
34
|
+
"name": "",
|
|
35
|
+
"type": "uint256"
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
"type": "function"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"constant": true,
|
|
42
|
+
"inputs": [],
|
|
43
|
+
"name": "decimals",
|
|
44
|
+
"outputs": [
|
|
45
|
+
{
|
|
46
|
+
"name": "",
|
|
47
|
+
"type": "uint8"
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
"type": "function"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"constant": true,
|
|
54
|
+
"inputs": [],
|
|
55
|
+
"name": "name",
|
|
56
|
+
"outputs": [
|
|
57
|
+
{
|
|
58
|
+
"name": "",
|
|
59
|
+
"type": "string"
|
|
60
|
+
}
|
|
61
|
+
],
|
|
62
|
+
"type": "function"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"constant": true,
|
|
66
|
+
"inputs": [],
|
|
67
|
+
"name": "symbol",
|
|
68
|
+
"outputs": [
|
|
69
|
+
{
|
|
70
|
+
"name": "",
|
|
71
|
+
"type": "string"
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
"type": "function"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"constant": false,
|
|
78
|
+
"inputs": [
|
|
79
|
+
{
|
|
80
|
+
"name": "recipient",
|
|
81
|
+
"type": "address"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"name": "amount",
|
|
85
|
+
"type": "uint256"
|
|
86
|
+
}
|
|
87
|
+
],
|
|
88
|
+
"name": "transfer",
|
|
89
|
+
"outputs": [
|
|
90
|
+
{
|
|
91
|
+
"name": "",
|
|
92
|
+
"type": "bool"
|
|
93
|
+
}
|
|
94
|
+
],
|
|
95
|
+
"type": "function"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"constant": false,
|
|
99
|
+
"inputs": [
|
|
100
|
+
{
|
|
101
|
+
"name": "spender",
|
|
102
|
+
"type": "address"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"name": "amount",
|
|
106
|
+
"type": "uint256"
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
"name": "approve",
|
|
110
|
+
"outputs": [
|
|
111
|
+
{
|
|
112
|
+
"name": "",
|
|
113
|
+
"type": "bool"
|
|
114
|
+
}
|
|
115
|
+
],
|
|
116
|
+
"type": "function"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"inputs": [
|
|
120
|
+
{
|
|
121
|
+
"internalType": "address",
|
|
122
|
+
"name": "tokenA",
|
|
123
|
+
"type": "address"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"internalType": "address",
|
|
127
|
+
"name": "tokenB",
|
|
128
|
+
"type": "address"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"internalType": "bool",
|
|
132
|
+
"name": "stable",
|
|
133
|
+
"type": "bool"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"internalType": "uint256",
|
|
137
|
+
"name": "amountADesired",
|
|
138
|
+
"type": "uint256"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"internalType": "uint256",
|
|
142
|
+
"name": "amountBDesired",
|
|
143
|
+
"type": "uint256"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"internalType": "uint256",
|
|
147
|
+
"name": "amountAMin",
|
|
148
|
+
"type": "uint256"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"internalType": "uint256",
|
|
152
|
+
"name": "amountBMin",
|
|
153
|
+
"type": "uint256"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"internalType": "address",
|
|
157
|
+
"name": "to",
|
|
158
|
+
"type": "address"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"internalType": "uint256",
|
|
162
|
+
"name": "deadline",
|
|
163
|
+
"type": "uint256"
|
|
164
|
+
}
|
|
165
|
+
],
|
|
166
|
+
"name": "addLiquidity",
|
|
167
|
+
"outputs": [
|
|
168
|
+
{
|
|
169
|
+
"internalType": "uint256",
|
|
170
|
+
"name": "amountA",
|
|
171
|
+
"type": "uint256"
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"internalType": "uint256",
|
|
175
|
+
"name": "amountB",
|
|
176
|
+
"type": "uint256"
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"internalType": "uint256",
|
|
180
|
+
"name": "liquidity",
|
|
181
|
+
"type": "uint256"
|
|
182
|
+
}
|
|
183
|
+
],
|
|
184
|
+
"stateMutability": "nonpayable",
|
|
185
|
+
"type": "function"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"inputs": [
|
|
189
|
+
{
|
|
190
|
+
"internalType": "address",
|
|
191
|
+
"name": "tokenA",
|
|
192
|
+
"type": "address"
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"internalType": "address",
|
|
196
|
+
"name": "tokenB",
|
|
197
|
+
"type": "address"
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
"internalType": "bool",
|
|
201
|
+
"name": "stable",
|
|
202
|
+
"type": "bool"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"internalType": "address",
|
|
206
|
+
"name": "_factory",
|
|
207
|
+
"type": "address"
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"internalType": "uint256",
|
|
211
|
+
"name": "amountADesired",
|
|
212
|
+
"type": "uint256"
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
"internalType": "uint256",
|
|
216
|
+
"name": "amountBDesired",
|
|
217
|
+
"type": "uint256"
|
|
218
|
+
}
|
|
219
|
+
],
|
|
220
|
+
"name": "quoteAddLiquidity",
|
|
221
|
+
"outputs": [
|
|
222
|
+
{
|
|
223
|
+
"internalType": "uint256",
|
|
224
|
+
"name": "amountA",
|
|
225
|
+
"type": "uint256"
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"internalType": "uint256",
|
|
229
|
+
"name": "amountB",
|
|
230
|
+
"type": "uint256"
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
"internalType": "uint256",
|
|
234
|
+
"name": "liquidity",
|
|
235
|
+
"type": "uint256"
|
|
236
|
+
}
|
|
237
|
+
],
|
|
238
|
+
"stateMutability": "view",
|
|
239
|
+
"type": "function"
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
"inputs": [],
|
|
243
|
+
"name": "defaultFactory",
|
|
244
|
+
"outputs": [
|
|
245
|
+
{
|
|
246
|
+
"internalType": "address",
|
|
247
|
+
"name": "",
|
|
248
|
+
"type": "address"
|
|
249
|
+
}
|
|
250
|
+
],
|
|
251
|
+
"stateMutability": "view",
|
|
252
|
+
"type": "function"
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
"inputs": [
|
|
256
|
+
{
|
|
257
|
+
"internalType": "address",
|
|
258
|
+
"name": "tokenA",
|
|
259
|
+
"type": "address"
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
"internalType": "address",
|
|
263
|
+
"name": "tokenB",
|
|
264
|
+
"type": "address"
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
"internalType": "bool",
|
|
268
|
+
"name": "stable",
|
|
269
|
+
"type": "bool"
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
"internalType": "address",
|
|
273
|
+
"name": "_factory",
|
|
274
|
+
"type": "address"
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
"internalType": "uint256",
|
|
278
|
+
"name": "liquidity",
|
|
279
|
+
"type": "uint256"
|
|
280
|
+
}
|
|
281
|
+
],
|
|
282
|
+
"name": "quoteRemoveLiquidity",
|
|
283
|
+
"outputs": [
|
|
284
|
+
{
|
|
285
|
+
"internalType": "uint256",
|
|
286
|
+
"name": "amountA",
|
|
287
|
+
"type": "uint256"
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
"internalType": "uint256",
|
|
291
|
+
"name": "amountB",
|
|
292
|
+
"type": "uint256"
|
|
293
|
+
}
|
|
294
|
+
],
|
|
295
|
+
"stateMutability": "view",
|
|
296
|
+
"type": "function"
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
"inputs": [
|
|
300
|
+
{
|
|
301
|
+
"internalType": "address",
|
|
302
|
+
"name": "tokenA",
|
|
303
|
+
"type": "address"
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
"internalType": "address",
|
|
307
|
+
"name": "tokenB",
|
|
308
|
+
"type": "address"
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
"internalType": "bool",
|
|
312
|
+
"name": "stable",
|
|
313
|
+
"type": "bool"
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
"internalType": "uint256",
|
|
317
|
+
"name": "liquidity",
|
|
318
|
+
"type": "uint256"
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
"internalType": "uint256",
|
|
322
|
+
"name": "amountAMin",
|
|
323
|
+
"type": "uint256"
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
"internalType": "uint256",
|
|
327
|
+
"name": "amountBMin",
|
|
328
|
+
"type": "uint256"
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
"internalType": "address",
|
|
332
|
+
"name": "to",
|
|
333
|
+
"type": "address"
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
"internalType": "uint256",
|
|
337
|
+
"name": "deadline",
|
|
338
|
+
"type": "uint256"
|
|
339
|
+
}
|
|
340
|
+
],
|
|
341
|
+
"name": "removeLiquidity",
|
|
342
|
+
"outputs": [
|
|
343
|
+
{
|
|
344
|
+
"internalType": "uint256",
|
|
345
|
+
"name": "amountA",
|
|
346
|
+
"type": "uint256"
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
"internalType": "uint256",
|
|
350
|
+
"name": "amountB",
|
|
351
|
+
"type": "uint256"
|
|
352
|
+
}
|
|
353
|
+
],
|
|
354
|
+
"stateMutability": "nonpayable",
|
|
355
|
+
"type": "function"
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
"inputs": [
|
|
359
|
+
{
|
|
360
|
+
"internalType": "uint256",
|
|
361
|
+
"name": "_amount",
|
|
362
|
+
"type": "uint256"
|
|
363
|
+
}
|
|
364
|
+
],
|
|
365
|
+
"name": "deposit",
|
|
366
|
+
"outputs": [],
|
|
367
|
+
"stateMutability": "nonpayable",
|
|
368
|
+
"type": "function"
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
"inputs": [
|
|
372
|
+
{
|
|
373
|
+
"internalType": "uint256",
|
|
374
|
+
"name": "_shares",
|
|
375
|
+
"type": "uint256"
|
|
376
|
+
}
|
|
377
|
+
],
|
|
378
|
+
"name": "withdraw",
|
|
379
|
+
"outputs": [],
|
|
380
|
+
"stateMutability": "nonpayable",
|
|
381
|
+
"type": "function"
|
|
382
|
+
}
|
|
383
|
+
]
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Adapter that exposes wallet, token, and pool balances backed by `WalletClient`/`TokenClient` and now orchestrates transfers between the configured main/vault wallets (with ledger bookkeeping).
|
|
4
4
|
|
|
5
|
-
- Entrypoint: `
|
|
5
|
+
- Entrypoint: `adapters.balance_adapter.adapter.BalanceAdapter`
|
|
6
6
|
- Manifest: `manifest.yaml`
|
|
7
7
|
- Tests: `test_adapter.py`
|
|
8
8
|
|
|
@@ -14,7 +14,7 @@ The adapter declares both `wallet_read` and `wallet_transfer` capabilities in it
|
|
|
14
14
|
|
|
15
15
|
```python
|
|
16
16
|
from wayfinder_paths.core.services.web3_service import DefaultWeb3Service
|
|
17
|
-
from wayfinder_paths.
|
|
17
|
+
from wayfinder_paths.adapters.balance_adapter.adapter import BalanceAdapter
|
|
18
18
|
|
|
19
19
|
web3_service = DefaultWeb3Service(config)
|
|
20
20
|
balance = BalanceAdapter(config, web3_service=web3_service)
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
from typing import Any
|
|
2
2
|
|
|
3
|
+
from wayfinder_paths.adapters.ledger_adapter.adapter import LedgerAdapter
|
|
4
|
+
from wayfinder_paths.adapters.token_adapter.adapter import TokenAdapter
|
|
3
5
|
from wayfinder_paths.core.adapters.BaseAdapter import BaseAdapter
|
|
4
6
|
from wayfinder_paths.core.clients.TokenClient import TokenClient
|
|
5
7
|
from wayfinder_paths.core.clients.WalletClient import WalletClient
|
|
6
8
|
from wayfinder_paths.core.services.base import Web3Service
|
|
7
9
|
from wayfinder_paths.core.settings import settings
|
|
8
10
|
from wayfinder_paths.core.utils.evm_helpers import resolve_chain_id
|
|
9
|
-
from wayfinder_paths.vaults.adapters.ledger_adapter.adapter import LedgerAdapter
|
|
10
|
-
from wayfinder_paths.vaults.adapters.token_adapter.adapter import TokenAdapter
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class BalanceAdapter(BaseAdapter):
|
|
@@ -2,7 +2,7 @@ from unittest.mock import AsyncMock, patch
|
|
|
2
2
|
|
|
3
3
|
import pytest
|
|
4
4
|
|
|
5
|
-
from wayfinder_paths.
|
|
5
|
+
from wayfinder_paths.adapters.balance_adapter.adapter import BalanceAdapter
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class TestBalanceAdapter:
|
|
@@ -21,19 +21,25 @@ class TestBalanceAdapter:
|
|
|
21
21
|
return mock_client
|
|
22
22
|
|
|
23
23
|
@pytest.fixture
|
|
24
|
-
def
|
|
24
|
+
def mock_web3_service(self):
|
|
25
|
+
"""Mock TokenClient for testing"""
|
|
26
|
+
mock_client = AsyncMock()
|
|
27
|
+
return mock_client
|
|
28
|
+
|
|
29
|
+
@pytest.fixture
|
|
30
|
+
def adapter(self, mock_wallet_client, mock_token_client, mock_web3_service):
|
|
25
31
|
"""Create a BalanceAdapter instance with mocked clients for testing"""
|
|
26
32
|
with (
|
|
27
33
|
patch(
|
|
28
|
-
"wayfinder_paths.
|
|
34
|
+
"wayfinder_paths.adapters.balance_adapter.adapter.WalletClient",
|
|
29
35
|
return_value=mock_wallet_client,
|
|
30
36
|
),
|
|
31
37
|
patch(
|
|
32
|
-
"wayfinder_paths.
|
|
38
|
+
"wayfinder_paths.adapters.balance_adapter.adapter.TokenClient",
|
|
33
39
|
return_value=mock_token_client,
|
|
34
40
|
),
|
|
35
41
|
):
|
|
36
|
-
return BalanceAdapter(config={})
|
|
42
|
+
return BalanceAdapter(config={}, web3_service=mock_web3_service)
|
|
37
43
|
|
|
38
44
|
@pytest.mark.asyncio
|
|
39
45
|
async def test_health_check(self, adapter):
|
|
@@ -68,7 +74,7 @@ class TestBalanceAdapter:
|
|
|
68
74
|
return_value=(True, mock_response)
|
|
69
75
|
)
|
|
70
76
|
|
|
71
|
-
success, data = await adapter.
|
|
77
|
+
success, data = await adapter.get_all_balances(
|
|
72
78
|
wallet_address="0x1234567890123456789012345678901234567890",
|
|
73
79
|
enrich=True,
|
|
74
80
|
)
|
|
@@ -26,7 +26,7 @@ The BRAPClient will automatically:
|
|
|
26
26
|
|
|
27
27
|
```python
|
|
28
28
|
from wayfinder_paths.core.services.web3_service import DefaultWeb3Service
|
|
29
|
-
from wayfinder_paths.
|
|
29
|
+
from wayfinder_paths.adapters.brap_adapter.adapter import BRAPAdapter
|
|
30
30
|
|
|
31
31
|
web3_service = DefaultWeb3Service(config)
|
|
32
32
|
adapter = BRAPAdapter(web3_service=web3_service)
|
|
@@ -2,6 +2,8 @@ from typing import Any
|
|
|
2
2
|
|
|
3
3
|
from eth_utils import to_checksum_address
|
|
4
4
|
|
|
5
|
+
from wayfinder_paths.adapters.ledger_adapter.adapter import LedgerAdapter
|
|
6
|
+
from wayfinder_paths.adapters.token_adapter.adapter import TokenAdapter
|
|
5
7
|
from wayfinder_paths.core.adapters.BaseAdapter import BaseAdapter
|
|
6
8
|
from wayfinder_paths.core.clients.BRAPClient import BRAPClient
|
|
7
9
|
from wayfinder_paths.core.clients.SimulationClient import SimulationClient
|
|
@@ -9,8 +11,6 @@ from wayfinder_paths.core.clients.TokenClient import TokenClient
|
|
|
9
11
|
from wayfinder_paths.core.constants import DEFAULT_SLIPPAGE
|
|
10
12
|
from wayfinder_paths.core.services.base import Web3Service
|
|
11
13
|
from wayfinder_paths.core.settings import settings
|
|
12
|
-
from wayfinder_paths.vaults.adapters.ledger_adapter.adapter import LedgerAdapter
|
|
13
|
-
from wayfinder_paths.vaults.adapters.token_adapter.adapter import TokenAdapter
|
|
14
14
|
|
|
15
15
|
_NEEDS_CLEAR_APPROVAL = {
|
|
16
16
|
(1, "0xdac17f958d2ee523a2206206994597c13d831ec7"),
|
|
@@ -3,7 +3,7 @@ from unittest.mock import AsyncMock, patch
|
|
|
3
3
|
|
|
4
4
|
import pytest
|
|
5
5
|
|
|
6
|
-
from wayfinder_paths.
|
|
6
|
+
from wayfinder_paths.adapters.brap_adapter.adapter import BRAPAdapter
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class TestBRAPAdapter:
|
|
@@ -34,7 +34,7 @@ class TestBRAPAdapter:
|
|
|
34
34
|
def adapter(self, mock_brap_client, mock_web3_service):
|
|
35
35
|
"""Create a BRAPAdapter instance with mocked client for testing"""
|
|
36
36
|
with patch(
|
|
37
|
-
"
|
|
37
|
+
"adapters.brap_adapter.adapter.BRAPClient",
|
|
38
38
|
return_value=mock_brap_client,
|
|
39
39
|
):
|
|
40
40
|
return BRAPAdapter(web3_service=mock_web3_service)
|
|
@@ -2,7 +2,7 @@ from unittest.mock import AsyncMock, patch
|
|
|
2
2
|
|
|
3
3
|
import pytest
|
|
4
4
|
|
|
5
|
-
from wayfinder_paths.
|
|
5
|
+
from wayfinder_paths.adapters.hyperlend_adapter.adapter import HyperlendAdapter
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class TestHyperlendAdapter:
|
|
@@ -18,7 +18,7 @@ class TestHyperlendAdapter:
|
|
|
18
18
|
def adapter(self, mock_hyperlend_client):
|
|
19
19
|
"""Create a HyperlendAdapter instance with mocked client for testing"""
|
|
20
20
|
with patch(
|
|
21
|
-
"wayfinder_paths.
|
|
21
|
+
"wayfinder_paths.adapters.hyperlend_adapter.adapter.HyperlendClient",
|
|
22
22
|
return_value=mock_hyperlend_client,
|
|
23
23
|
):
|
|
24
24
|
return HyperlendAdapter()
|