wayfinder-paths 0.1.2__py3-none-any.whl → 0.1.3__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/abis/generic/erc20.json +383 -0
- 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/vaults/policies/enso.py +17 -0
- wayfinder_paths/vaults/policies/erc20.py +34 -0
- wayfinder_paths/vaults/policies/evm.py +21 -0
- wayfinder_paths/vaults/policies/hyper_evm.py +19 -0
- wayfinder_paths/vaults/policies/hyperlend.py +12 -0
- wayfinder_paths/vaults/policies/hyperliquid.py +30 -0
- wayfinder_paths/vaults/policies/moonwell.py +54 -0
- wayfinder_paths/vaults/policies/prjx.py +30 -0
- wayfinder_paths/vaults/policies/util.py +27 -0
- wayfinder_paths/vaults/strategies/hyperlend_stable_yield_strategy/strategy.py +138 -76
- wayfinder_paths/vaults/strategies/stablecoin_yield_strategy/strategy.py +112 -75
- {wayfinder_paths-0.1.2.dist-info → wayfinder_paths-0.1.3.dist-info}/METADATA +1 -1
- {wayfinder_paths-0.1.2.dist-info → wayfinder_paths-0.1.3.dist-info}/RECORD +19 -8
- {wayfinder_paths-0.1.2.dist-info → wayfinder_paths-0.1.3.dist-info}/LICENSE +0 -0
- {wayfinder_paths-0.1.2.dist-info → wayfinder_paths-0.1.3.dist-info}/WHEEL +0 -0
|
@@ -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
|
+
]
|
|
@@ -6,6 +6,7 @@ from typing import Any, TypedDict
|
|
|
6
6
|
from loguru import logger
|
|
7
7
|
|
|
8
8
|
from wayfinder_paths.core.services.base import Web3Service
|
|
9
|
+
from wayfinder_paths.core.strategies.descriptors import StratDescriptor
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
class StatusDict(TypedDict):
|
|
@@ -19,8 +20,7 @@ StatusTuple = tuple[bool, str]
|
|
|
19
20
|
|
|
20
21
|
class Strategy(ABC):
|
|
21
22
|
name: str = None
|
|
22
|
-
|
|
23
|
-
summary: str = None
|
|
23
|
+
INFO: StratDescriptor = None
|
|
24
24
|
|
|
25
25
|
def __init__(
|
|
26
26
|
self,
|
|
@@ -90,7 +90,7 @@ class Strategy(ABC):
|
|
|
90
90
|
pass
|
|
91
91
|
|
|
92
92
|
@staticmethod
|
|
93
|
-
def policies() -> list[str]:
|
|
93
|
+
async def policies() -> list[str]:
|
|
94
94
|
"""Return policy strings for this strategy (Django-compatible)."""
|
|
95
95
|
raise NotImplementedError
|
|
96
96
|
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
from pydantic import BaseModel
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Volatility(Enum):
|
|
8
|
+
LOW = "low"
|
|
9
|
+
MEDIUM = "medium"
|
|
10
|
+
HIGH = "high"
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class Frequency(Enum):
|
|
14
|
+
LOW = "low"
|
|
15
|
+
MEDIUM = "medium"
|
|
16
|
+
HIGH = "high"
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class Directionality(Enum):
|
|
20
|
+
LONG = "Long"
|
|
21
|
+
SHORT = "Short"
|
|
22
|
+
MARKET_NEUTRAL = "market_neutral"
|
|
23
|
+
DELTA_NEUTRAL = "delta_neutral"
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class Complexity(Enum):
|
|
27
|
+
LOW = "low"
|
|
28
|
+
MEDIUM = "medium"
|
|
29
|
+
HIGH = "high"
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class TokenExposure(Enum):
|
|
33
|
+
STABLECOINS = "Stablecoins"
|
|
34
|
+
MAJORS = "Majors"
|
|
35
|
+
ALTS = "Alts"
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
# Default token rewards for all strategies
|
|
39
|
+
DEFAULT_TOKEN_REWARDS = [
|
|
40
|
+
{
|
|
41
|
+
"symbol": "B3",
|
|
42
|
+
"name": "B3",
|
|
43
|
+
"address": "0xB3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3",
|
|
44
|
+
"image_url": "https://storage.googleapis.com/prod-wayfinder-app-assets/asset-icons/B3.png",
|
|
45
|
+
},
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class StratDescriptor(BaseModel):
|
|
50
|
+
description: str
|
|
51
|
+
|
|
52
|
+
summary: str
|
|
53
|
+
|
|
54
|
+
gas_token_symbol: str
|
|
55
|
+
gas_token_id: str
|
|
56
|
+
deposit_token_id: str
|
|
57
|
+
minimum_net_deposit: float
|
|
58
|
+
gas_maximum: float
|
|
59
|
+
gas_threshold: float
|
|
60
|
+
|
|
61
|
+
available_rewards: dict[str, Any] = {
|
|
62
|
+
"token_rewards": DEFAULT_TOKEN_REWARDS,
|
|
63
|
+
"point_rewards": None,
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
# risk indicators
|
|
67
|
+
volatility: Volatility
|
|
68
|
+
volatility_description_short: str
|
|
69
|
+
directionality: Directionality
|
|
70
|
+
directionality_description: str
|
|
71
|
+
complexity: Complexity
|
|
72
|
+
complexity_description: str
|
|
73
|
+
token_exposure: TokenExposure
|
|
74
|
+
token_exposure_description: str
|
|
75
|
+
frequency: Frequency
|
|
76
|
+
frequency_description: str
|
|
77
|
+
|
|
78
|
+
return_drivers: list[str]
|
|
79
|
+
|
|
80
|
+
config: dict[str, Any]
|
|
@@ -5,7 +5,9 @@ This module provides reusable functions for EVM-related operations that are shar
|
|
|
5
5
|
across multiple adapters, extracted from evm_transaction_adapter.
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
|
+
import json
|
|
8
9
|
import os
|
|
10
|
+
from pathlib import Path
|
|
9
11
|
from typing import Any
|
|
10
12
|
|
|
11
13
|
from loguru import logger
|
|
@@ -163,3 +165,40 @@ def resolve_private_key_for_from_address(
|
|
|
163
165
|
|
|
164
166
|
# Fallback to environment variables
|
|
165
167
|
return os.getenv("PRIVATE_KEY_VAULT") or os.getenv("PRIVATE_KEY")
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
async def _get_abi(chain_id: int, address: str) -> str | None:
|
|
171
|
+
os.makedirs(f"abis/{chain_id}/", exist_ok=True)
|
|
172
|
+
|
|
173
|
+
abi_file = f"abis/{chain_id}/{address}.json"
|
|
174
|
+
if not os.path.exists(abi_file):
|
|
175
|
+
raise ValueError(
|
|
176
|
+
f"There is no downloaded ABI for {address} on chain {chain_id} -- please download it to ({abi_file}) (make sure to get the implementation if this address is a proxy)"
|
|
177
|
+
)
|
|
178
|
+
|
|
179
|
+
with open(abi_file) as f:
|
|
180
|
+
abi = f.read()
|
|
181
|
+
|
|
182
|
+
return abi
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
# We filter ABIs for Privy Policy since most of the abi is useless, and we don't wanna upload big ABIs for both size and readability reasons.
|
|
186
|
+
async def get_abi_filtered(
|
|
187
|
+
chain_id: int, address: str, function_names: list[str]
|
|
188
|
+
) -> list | None:
|
|
189
|
+
full_abi = await _get_abi(chain_id, address)
|
|
190
|
+
if full_abi is None:
|
|
191
|
+
raise Exception("Could not pull ABI, get_abi returned None")
|
|
192
|
+
abi_json = json.loads(full_abi)
|
|
193
|
+
filtered_abi = [
|
|
194
|
+
item
|
|
195
|
+
for item in abi_json
|
|
196
|
+
if item.get("type") == "function" and item.get("name") in function_names
|
|
197
|
+
]
|
|
198
|
+
return filtered_abi
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
with open(Path(__file__).parent.parent.parent.joinpath("abis/generic/erc20.json")) as f:
|
|
202
|
+
erc20_abi_raw = f.read()
|
|
203
|
+
|
|
204
|
+
ERC20_ABI = json.loads(erc20_abi_raw)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from wayfinder_paths.vaults.policies.util import allow_functions
|
|
2
|
+
|
|
3
|
+
ENSO_ROUTER = "0xf75584ef6673ad213a685a1b58cc0330b8ea22cf"
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
async def enso_swap():
|
|
7
|
+
return await allow_functions(
|
|
8
|
+
policy_name="Allow Enso Swap",
|
|
9
|
+
abi_chain_id=8453,
|
|
10
|
+
address=ENSO_ROUTER,
|
|
11
|
+
function_names=[
|
|
12
|
+
"routeMulti",
|
|
13
|
+
"routeSingle",
|
|
14
|
+
"safeRouteMulti",
|
|
15
|
+
"safeRouteSingle",
|
|
16
|
+
],
|
|
17
|
+
)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
from wayfinder_paths.core.utils.evm_helpers import ERC20_ABI
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def any_erc20_function(token_address: str) -> dict:
|
|
5
|
+
return {
|
|
6
|
+
"name": "Allow Any ERC20 Transfer To Address",
|
|
7
|
+
"method": "eth_signTransaction",
|
|
8
|
+
"action": "ALLOW",
|
|
9
|
+
"conditions": [
|
|
10
|
+
{
|
|
11
|
+
"field_source": "ethereum_transaction",
|
|
12
|
+
"field": "to",
|
|
13
|
+
"operator": "eq",
|
|
14
|
+
"value": token_address,
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def erc20_spender_for_any_token(spender_address: str) -> dict:
|
|
21
|
+
return {
|
|
22
|
+
"name": "Allow Any ERC20 Approve To Spender",
|
|
23
|
+
"method": "eth_signTransaction",
|
|
24
|
+
"action": "ALLOW",
|
|
25
|
+
"conditions": [
|
|
26
|
+
{
|
|
27
|
+
"field_source": "ethereum_calldata",
|
|
28
|
+
"field": "approve.spender",
|
|
29
|
+
"abi": ERC20_ABI,
|
|
30
|
+
"operator": "eq",
|
|
31
|
+
"value": spender_address,
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
def native_transfer(destination_address: str, value: int) -> dict:
|
|
2
|
+
# TODO THIS FUNCTION IS NOT DONE CAUSE POLICIES DONT KNOW THE WALLET ADDRESS YET.
|
|
3
|
+
return {
|
|
4
|
+
"name": "Allow Native Transfer To Address",
|
|
5
|
+
"method": "eth_signTransaction",
|
|
6
|
+
"action": "ALLOW",
|
|
7
|
+
"conditions": [
|
|
8
|
+
{
|
|
9
|
+
"field_source": "ethereum_transaction",
|
|
10
|
+
"field": "to",
|
|
11
|
+
"operator": "eq",
|
|
12
|
+
"value": destination_address,
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"field_source": "ethereum_transaction",
|
|
16
|
+
"field": "value",
|
|
17
|
+
"operator": "eq",
|
|
18
|
+
"value": hex(value),
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from wayfinder_paths.vaults.policies.evm import native_transfer
|
|
2
|
+
from wayfinder_paths.vaults.policies.util import allow_functions
|
|
3
|
+
|
|
4
|
+
WHYPE_TOKEN = "0x5555555555555555555555555555555555555555"
|
|
5
|
+
HYPERCORE_SENTINEL_ADDRESS = "0x2222222222222222222222222222222222222222"
|
|
6
|
+
HYPERCORE_SENTINEL_VALUE = 100_000_000_000
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def hypecore_sentinel_deposit():
|
|
10
|
+
return native_transfer(HYPERCORE_SENTINEL_ADDRESS, HYPERCORE_SENTINEL_VALUE)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
async def whype_deposit_and_withdraw():
|
|
14
|
+
return await allow_functions(
|
|
15
|
+
policy_name="Allow WHYPE Deposit and Withdraw",
|
|
16
|
+
abi_chain_id=999,
|
|
17
|
+
address=WHYPE_TOKEN,
|
|
18
|
+
function_names=["deposit", "withdraw"],
|
|
19
|
+
)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from wayfinder_paths.vaults.policies.util import allow_functions
|
|
2
|
+
|
|
3
|
+
HYPERLEND_POOL = "0x00A89d7a5A02160f20150EbEA7a2b5E4879A1A8b"
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
async def hyperlend_supply_and_withdraw():
|
|
7
|
+
return await allow_functions(
|
|
8
|
+
policy_name="Allow Hyperlend Supply and Withdraw",
|
|
9
|
+
abi_chain_id=999,
|
|
10
|
+
address=HYPERLEND_POOL,
|
|
11
|
+
function_names=["supply", "withdraw"],
|
|
12
|
+
)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
def any_hyperliquid_l1_payload():
|
|
2
|
+
return {
|
|
3
|
+
"name": "Allow Hypecore L1 Payload",
|
|
4
|
+
"method": "eth_signTypedData_v4",
|
|
5
|
+
"action": "ALLOW",
|
|
6
|
+
"conditions": [
|
|
7
|
+
{
|
|
8
|
+
"field": "chainId",
|
|
9
|
+
"field_source": "ethereum_typed_data_domain",
|
|
10
|
+
"operator": "eq",
|
|
11
|
+
"value": "1337",
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def any_hyperliquid_user_payload():
|
|
18
|
+
return {
|
|
19
|
+
"name": "Allow User Signed Payload",
|
|
20
|
+
"method": "eth_signTypedData_v4",
|
|
21
|
+
"action": "ALLOW",
|
|
22
|
+
"conditions": [
|
|
23
|
+
{
|
|
24
|
+
"field": "chainId",
|
|
25
|
+
"field_source": "ethereum_typed_data_domain",
|
|
26
|
+
"operator": "eq",
|
|
27
|
+
"value": "421614",
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
}
|