wayfinder-paths 0.1.28__py3-none-any.whl → 0.1.30__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/adapters/boros_adapter/adapter.py +445 -14
- wayfinder_paths/adapters/boros_adapter/client.py +7 -5
- wayfinder_paths/adapters/boros_adapter/test_adapter.py +259 -19
- wayfinder_paths/adapters/hyperliquid_adapter/adapter.py +4 -14
- wayfinder_paths/adapters/hyperliquid_adapter/exchange.py +2 -2
- wayfinder_paths/adapters/hyperliquid_adapter/local_signer.py +2 -33
- wayfinder_paths/adapters/multicall_adapter/adapter.py +2 -4
- wayfinder_paths/core/clients/TokenClient.py +1 -1
- wayfinder_paths/core/constants/__init__.py +23 -1
- wayfinder_paths/core/constants/contracts.py +22 -0
- wayfinder_paths/core/constants/hype_oft_abi.py +151 -0
- wayfinder_paths/core/constants/hyperliquid.py +20 -3
- wayfinder_paths/core/engine/manifest.py +1 -1
- wayfinder_paths/core/strategies/Strategy.py +1 -2
- wayfinder_paths/mcp/scripting.py +2 -2
- wayfinder_paths/mcp/tools/discovery.py +3 -72
- wayfinder_paths/mcp/tools/execute.py +8 -4
- wayfinder_paths/mcp/tools/hyperliquid.py +1 -1
- wayfinder_paths/mcp/tools/quotes.py +11 -133
- wayfinder_paths/mcp/tools/wallets.py +4 -7
- wayfinder_paths/mcp/utils.py +0 -22
- wayfinder_paths/policies/lifi.py +5 -2
- wayfinder_paths/policies/moonwell.py +3 -1
- wayfinder_paths/policies/util.py +4 -2
- wayfinder_paths/strategies/basis_trading_strategy/strategy.py +2 -4
- wayfinder_paths/strategies/boros_hype_strategy/boros_ops_mixin.py +57 -201
- wayfinder_paths/strategies/boros_hype_strategy/constants.py +24 -168
- wayfinder_paths/strategies/boros_hype_strategy/strategy.py +24 -63
- wayfinder_paths/strategies/hyperlend_stable_yield_strategy/strategy.py +2 -0
- wayfinder_paths/strategies/moonwell_wsteth_loop_strategy/strategy.py +2 -0
- wayfinder_paths/strategies/stablecoin_yield_strategy/strategy.py +4 -1
- {wayfinder_paths-0.1.28.dist-info → wayfinder_paths-0.1.30.dist-info}/METADATA +1 -1
- {wayfinder_paths-0.1.28.dist-info → wayfinder_paths-0.1.30.dist-info}/RECORD +35 -35
- wayfinder_paths/core/types.py +0 -19
- {wayfinder_paths-0.1.28.dist-info → wayfinder_paths-0.1.30.dist-info}/LICENSE +0 -0
- {wayfinder_paths-0.1.28.dist-info → wayfinder_paths-0.1.30.dist-info}/WHEEL +0 -0
wayfinder_paths/policies/util.py
CHANGED
|
@@ -6,7 +6,8 @@ async def allow_functions(
|
|
|
6
6
|
abi_chain_id: int,
|
|
7
7
|
address: str,
|
|
8
8
|
function_names: list[str],
|
|
9
|
-
abi_address_override=None,
|
|
9
|
+
abi_address_override: str = None,
|
|
10
|
+
manual_abi: dict = None,
|
|
10
11
|
):
|
|
11
12
|
# Note: ChainID is just for fetching ABI, doesn't appear in the final policy. Doesn't bind a strict chain.
|
|
12
13
|
return {
|
|
@@ -23,7 +24,8 @@ async def allow_functions(
|
|
|
23
24
|
{
|
|
24
25
|
"field_source": "ethereum_calldata",
|
|
25
26
|
"field": "function_name",
|
|
26
|
-
"abi":
|
|
27
|
+
"abi": manual_abi
|
|
28
|
+
or await get_abi_filtered(
|
|
27
29
|
abi_chain_id, abi_address_override or address, function_names
|
|
28
30
|
),
|
|
29
31
|
"operator": "in",
|
|
@@ -48,7 +48,7 @@ from wayfinder_paths.core.analytics import (
|
|
|
48
48
|
from wayfinder_paths.core.analytics import (
|
|
49
49
|
z_from_conf as analytics_z_from_conf,
|
|
50
50
|
)
|
|
51
|
-
from wayfinder_paths.core.constants.contracts import HYPERLIQUID_BRIDGE
|
|
51
|
+
from wayfinder_paths.core.constants.contracts import HYPE_FEE_WALLET, HYPERLIQUID_BRIDGE
|
|
52
52
|
from wayfinder_paths.core.strategies.descriptors import (
|
|
53
53
|
Complexity,
|
|
54
54
|
Directionality,
|
|
@@ -58,7 +58,6 @@ from wayfinder_paths.core.strategies.descriptors import (
|
|
|
58
58
|
Volatility,
|
|
59
59
|
)
|
|
60
60
|
from wayfinder_paths.core.strategies.Strategy import StatusDict, StatusTuple, Strategy
|
|
61
|
-
from wayfinder_paths.core.types import HyperliquidSignCallback
|
|
62
61
|
from wayfinder_paths.policies.erc20 import any_erc20_function
|
|
63
62
|
from wayfinder_paths.policies.hyperliquid import (
|
|
64
63
|
any_hyperliquid_l1_payload,
|
|
@@ -111,7 +110,6 @@ class BasisTradingStrategy(BasisSnapshotMixin, Strategy):
|
|
|
111
110
|
# Rotation cooldown
|
|
112
111
|
ROTATION_MIN_INTERVAL_DAYS = 14
|
|
113
112
|
|
|
114
|
-
HYPE_FEE_WALLET: str = "0xaA1D89f333857eD78F8434CC4f896A9293EFE65c"
|
|
115
113
|
HYPE_PRO_FEE: int = 30
|
|
116
114
|
DEFAULT_BUILDER_FEE: dict[str, Any] = {"b": HYPE_FEE_WALLET, "f": HYPE_PRO_FEE}
|
|
117
115
|
|
|
@@ -183,7 +181,7 @@ class BasisTradingStrategy(BasisSnapshotMixin, Strategy):
|
|
|
183
181
|
*,
|
|
184
182
|
main_wallet: dict[str, Any] | None = None,
|
|
185
183
|
strategy_wallet: dict[str, Any] | None = None,
|
|
186
|
-
strategy_sign_typed_data:
|
|
184
|
+
strategy_sign_typed_data: Callable[[dict], Awaitable[str]] | None = None,
|
|
187
185
|
main_wallet_signing_callback: Callable[[dict], Awaitable[str]] | None = None,
|
|
188
186
|
strategy_wallet_signing_callback: Callable[[dict], Awaitable[str]]
|
|
189
187
|
| None = None,
|
|
@@ -11,22 +11,18 @@ from datetime import datetime
|
|
|
11
11
|
from typing import Any
|
|
12
12
|
|
|
13
13
|
from loguru import logger
|
|
14
|
-
from web3 import AsyncWeb3
|
|
15
14
|
|
|
16
15
|
from wayfinder_paths.core.utils.transaction import encode_call, send_transaction
|
|
17
|
-
from wayfinder_paths.core.utils.web3 import web3_from_chain_id
|
|
18
16
|
|
|
19
17
|
from .constants import (
|
|
20
18
|
BOROS_HYPE_MARKET_ID,
|
|
21
19
|
BOROS_HYPE_TOKEN_ID,
|
|
22
20
|
BOROS_MIN_DEPOSIT_HYPE,
|
|
23
21
|
HYPE_NATIVE,
|
|
24
|
-
HYPE_OFT_ABI,
|
|
25
22
|
HYPE_OFT_ADDRESS,
|
|
26
23
|
HYPEREVM_CHAIN_ID,
|
|
27
24
|
KHYPE_LST,
|
|
28
25
|
LOOPED_HYPE,
|
|
29
|
-
LZ_EID_ARBITRUM,
|
|
30
26
|
MIN_HYPE_GAS,
|
|
31
27
|
USDC_ARB,
|
|
32
28
|
USDT_ARB,
|
|
@@ -37,11 +33,6 @@ from .constants import (
|
|
|
37
33
|
from .types import Inventory
|
|
38
34
|
|
|
39
35
|
|
|
40
|
-
def _pad_address_bytes32(address: str) -> bytes:
|
|
41
|
-
checksum = AsyncWeb3.to_checksum_address(address)
|
|
42
|
-
return bytes.fromhex(checksum[2:]).rjust(32, b"\x00")
|
|
43
|
-
|
|
44
|
-
|
|
45
36
|
class BorosHypeBorosOpsMixin:
|
|
46
37
|
async def _fund_boros(
|
|
47
38
|
self, params: dict[str, Any], inventory: Inventory
|
|
@@ -267,84 +258,21 @@ class BorosHypeBorosOpsMixin:
|
|
|
267
258
|
bridge_amount_wei = min(target_wei, max_value_wei)
|
|
268
259
|
if bridge_amount_wei <= 0:
|
|
269
260
|
return True, "Boros funding: nothing to bridge"
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
)
|
|
278
|
-
|
|
279
|
-
conversion_rate = int(
|
|
280
|
-
await contract.functions.decimalConversionRate().call()
|
|
281
|
-
) # OFT sharedDecimals rounding
|
|
282
|
-
if conversion_rate > 0:
|
|
283
|
-
bridge_amount_wei = (
|
|
284
|
-
bridge_amount_wei // conversion_rate
|
|
285
|
-
) * conversion_rate
|
|
286
|
-
if bridge_amount_wei <= 0:
|
|
287
|
-
return True, "Boros funding: amount too small after OFT rounding"
|
|
288
|
-
|
|
289
|
-
# Quote fee, then clamp amount to fit balance (amount + fee) while
|
|
290
|
-
# still leaving MIN_HYPE_GAS behind for future gas.
|
|
291
|
-
send_params = (
|
|
292
|
-
int(LZ_EID_ARBITRUM),
|
|
293
|
-
to_bytes32,
|
|
294
|
-
int(bridge_amount_wei),
|
|
295
|
-
0,
|
|
296
|
-
b"",
|
|
297
|
-
b"",
|
|
298
|
-
b"",
|
|
299
|
-
)
|
|
300
|
-
fee = await contract.functions.quoteSend(send_params, False).call()
|
|
301
|
-
native_fee = int(fee[0])
|
|
302
|
-
lz_token_fee = int(fee[1])
|
|
303
|
-
|
|
304
|
-
max_send_amount_wei = max(0, max_value_wei - native_fee)
|
|
305
|
-
if conversion_rate > 0:
|
|
306
|
-
max_send_amount_wei = (
|
|
307
|
-
max_send_amount_wei // conversion_rate
|
|
308
|
-
) * conversion_rate
|
|
309
|
-
if bridge_amount_wei > max_send_amount_wei:
|
|
310
|
-
bridge_amount_wei = max_send_amount_wei
|
|
311
|
-
if bridge_amount_wei <= 0:
|
|
312
|
-
return False, "Insufficient HyperEVM HYPE to cover OFT bridge fee"
|
|
313
|
-
|
|
314
|
-
send_params = (
|
|
315
|
-
int(LZ_EID_ARBITRUM),
|
|
316
|
-
to_bytes32,
|
|
317
|
-
int(bridge_amount_wei),
|
|
318
|
-
0,
|
|
319
|
-
b"",
|
|
320
|
-
b"",
|
|
321
|
-
b"",
|
|
322
|
-
)
|
|
323
|
-
fee = await contract.functions.quoteSend(send_params, False).call()
|
|
324
|
-
native_fee = int(fee[0])
|
|
325
|
-
lz_token_fee = int(fee[1])
|
|
326
|
-
|
|
327
|
-
total_value_wei = int(bridge_amount_wei) + int(native_fee)
|
|
328
|
-
if total_value_wei > max_value_wei:
|
|
329
|
-
return False, "Insufficient HyperEVM HYPE to bridge after fee quote"
|
|
330
|
-
|
|
331
|
-
tx = await encode_call(
|
|
332
|
-
target=HYPE_OFT_ADDRESS,
|
|
333
|
-
abi=HYPE_OFT_ABI,
|
|
334
|
-
fn_name="send",
|
|
335
|
-
args=[
|
|
336
|
-
send_params,
|
|
337
|
-
(int(native_fee), int(lz_token_fee)),
|
|
338
|
-
AsyncWeb3.to_checksum_address(wallet_address),
|
|
339
|
-
],
|
|
340
|
-
from_address=wallet_address,
|
|
341
|
-
chain_id=HYPEREVM_CHAIN_ID,
|
|
342
|
-
value=total_value_wei,
|
|
261
|
+
(
|
|
262
|
+
ok_bridge,
|
|
263
|
+
bridge_res,
|
|
264
|
+
) = await self.boros_adapter.bridge_hype_oft_hyperevm_to_arbitrum(
|
|
265
|
+
amount_wei=int(bridge_amount_wei),
|
|
266
|
+
max_value_wei=int(max_value_wei),
|
|
267
|
+
to_address=str(wallet_address),
|
|
268
|
+
from_address=str(wallet_address),
|
|
343
269
|
)
|
|
270
|
+
if not ok_bridge:
|
|
271
|
+
return False, f"OFT bridge failed: {bridge_res}"
|
|
344
272
|
|
|
345
|
-
tx_hash =
|
|
346
|
-
|
|
347
|
-
bridged_hype = float(
|
|
273
|
+
tx_hash = str(bridge_res.get("tx_hash") or "")
|
|
274
|
+
bridged_wei = int(bridge_res.get("amount_wei") or 0)
|
|
275
|
+
bridged_hype = float(bridged_wei) / 1e18
|
|
348
276
|
bridged_usd = bridged_hype * hype_price
|
|
349
277
|
|
|
350
278
|
# Track in-flight amount so planner doesn't double-fund while the bridge settles.
|
|
@@ -360,7 +288,7 @@ class BorosHypeBorosOpsMixin:
|
|
|
360
288
|
|
|
361
289
|
return True, (
|
|
362
290
|
f"Bridging {bridged_hype:.6f} HYPE (≈${bridged_usd:.2f}) HyperEVM→Arbitrum via OFT; "
|
|
363
|
-
f"tx={tx_hash} (LayerZero:
|
|
291
|
+
f"tx={tx_hash} (LayerZero: {bridge_res.get('layerzeroscan')}). "
|
|
364
292
|
"Once bridged HYPE lands on Arbitrum, the next tick will deposit it to Boros."
|
|
365
293
|
)
|
|
366
294
|
|
|
@@ -431,41 +359,15 @@ class BorosHypeBorosOpsMixin:
|
|
|
431
359
|
f"({depositable_hype:.6f} HYPE)",
|
|
432
360
|
)
|
|
433
361
|
|
|
434
|
-
# 0)
|
|
435
|
-
# Boros markets expire, so we need to get the actual market ID from isolated positions.
|
|
362
|
+
# 0) Cleanup: sweep any isolated collateral back to cross margin.
|
|
436
363
|
try:
|
|
437
|
-
|
|
364
|
+
ok_sweep, sweep_res = await self.boros_adapter.sweep_isolated_to_cross(
|
|
438
365
|
token_id=int(token_id)
|
|
439
366
|
)
|
|
440
|
-
if
|
|
441
|
-
|
|
442
|
-
logger.debug(
|
|
443
|
-
f"Boros position check: isolated={balances.get('isolated', 0):.6f}, "
|
|
444
|
-
f"cross={balances.get('cross', 0):.6f}, "
|
|
445
|
-
f"total={balances.get('total', 0):.6f}, "
|
|
446
|
-
f"isolated_positions={isolated_positions}"
|
|
447
|
-
)
|
|
448
|
-
for iso_pos in isolated_positions:
|
|
449
|
-
iso_market_id = iso_pos.get("market_id")
|
|
450
|
-
iso_balance = float(iso_pos.get("balance", 0) or 0.0)
|
|
451
|
-
if iso_market_id and iso_balance > 0.001:
|
|
452
|
-
iso_wei = int(iso_balance * 1e18) # Boros cash units
|
|
453
|
-
logger.info(
|
|
454
|
-
f"Moving {iso_balance:.6f} collateral from isolated market {iso_market_id} to cross"
|
|
455
|
-
)
|
|
456
|
-
ok_xfer, res_xfer = await self.boros_adapter.cash_transfer(
|
|
457
|
-
market_id=int(iso_market_id),
|
|
458
|
-
amount_wei=iso_wei,
|
|
459
|
-
is_deposit=False, # isolated -> cross
|
|
460
|
-
)
|
|
461
|
-
if ok_xfer:
|
|
462
|
-
await asyncio.sleep(2)
|
|
463
|
-
else:
|
|
464
|
-
logger.warning(
|
|
465
|
-
f"Failed Boros isolated->cross transfer for market {iso_market_id}: {res_xfer}"
|
|
466
|
-
)
|
|
367
|
+
if not ok_sweep:
|
|
368
|
+
logger.warning(f"Failed Boros isolated->cross sweep: {sweep_res}")
|
|
467
369
|
except Exception as exc: # noqa: BLE001
|
|
468
|
-
logger.warning(f"Failed Boros isolated->cross
|
|
370
|
+
logger.warning(f"Failed Boros isolated->cross sweep: {exc}")
|
|
469
371
|
|
|
470
372
|
# 1) Best-effort: if any OFT HYPE is sitting idle on Arbitrum, deposit it to cross margin.
|
|
471
373
|
if inventory.hype_oft_arb_balance > 0.0:
|
|
@@ -491,104 +393,58 @@ class BorosHypeBorosOpsMixin:
|
|
|
491
393
|
except Exception as exc: # noqa: BLE001
|
|
492
394
|
logger.warning(f"Failed to deposit OFT HYPE to Boros: {exc}")
|
|
493
395
|
|
|
494
|
-
# Deposits can land as isolated cash for the given market_id; ensure we
|
|
495
|
-
# sweep isolated -> cross again before attempting to trade.
|
|
496
|
-
try:
|
|
497
|
-
ok_bal, balances = await self.boros_adapter.get_account_balances(
|
|
498
|
-
token_id=int(token_id)
|
|
499
|
-
)
|
|
500
|
-
if ok_bal and isinstance(balances, dict):
|
|
501
|
-
isolated_positions = balances.get("isolated_positions", [])
|
|
502
|
-
for iso_pos in isolated_positions:
|
|
503
|
-
iso_market_id = iso_pos.get("market_id")
|
|
504
|
-
iso_balance = float(iso_pos.get("balance", 0) or 0.0)
|
|
505
|
-
if iso_market_id and iso_balance > 0.001:
|
|
506
|
-
iso_wei = int(iso_balance * 1e18) # Boros cash units
|
|
507
|
-
logger.info(
|
|
508
|
-
f"Moving {iso_balance:.6f} collateral from isolated market {iso_market_id} to cross"
|
|
509
|
-
)
|
|
510
|
-
ok_xfer, res_xfer = await self.boros_adapter.cash_transfer(
|
|
511
|
-
market_id=int(iso_market_id),
|
|
512
|
-
amount_wei=iso_wei,
|
|
513
|
-
is_deposit=False, # isolated -> cross
|
|
514
|
-
)
|
|
515
|
-
if ok_xfer:
|
|
516
|
-
await asyncio.sleep(2)
|
|
517
|
-
else:
|
|
518
|
-
logger.warning(
|
|
519
|
-
f"Failed Boros isolated->cross transfer for market {iso_market_id}: {res_xfer}"
|
|
520
|
-
)
|
|
521
|
-
except Exception as exc: # noqa: BLE001
|
|
522
|
-
logger.warning(
|
|
523
|
-
f"Failed Boros isolated->cross transfer after deposit: {exc}"
|
|
524
|
-
)
|
|
525
|
-
|
|
526
396
|
# 2) Rollover: close positions in other markets (best effort).
|
|
527
397
|
try:
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
await self.boros_adapter.close_positions_market(
|
|
537
|
-
mid_int, token_id=int(token_id)
|
|
538
|
-
)
|
|
539
|
-
await asyncio.sleep(2)
|
|
540
|
-
except Exception as exc: # noqa: BLE001
|
|
541
|
-
logger.warning(f"Failed to close Boros market {mid_int}: {exc}")
|
|
398
|
+
ok_roll, roll_res = await self.boros_adapter.close_positions_except(
|
|
399
|
+
keep_market_id=int(market_id),
|
|
400
|
+
token_id=int(token_id),
|
|
401
|
+
market_ids=inventory.boros_position_market_ids or [],
|
|
402
|
+
best_effort=True,
|
|
403
|
+
)
|
|
404
|
+
if not ok_roll:
|
|
405
|
+
logger.warning(f"Failed Boros rollover close: {roll_res}")
|
|
542
406
|
except Exception as exc: # noqa: BLE001
|
|
543
407
|
logger.warning(f"Failed Boros rollover close: {exc}")
|
|
544
408
|
|
|
545
|
-
|
|
546
|
-
|
|
409
|
+
yu_to_usd = (
|
|
410
|
+
float(inventory.hype_price_usd or 0.0)
|
|
411
|
+
if int(token_id) == BOROS_HYPE_TOKEN_ID
|
|
412
|
+
else 1.0
|
|
547
413
|
)
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
market_id=int(market_id),
|
|
568
|
-
token_id=int(token_id),
|
|
569
|
-
size_yu_wei=size_yu_wei,
|
|
570
|
-
side="short",
|
|
571
|
-
tif="IOC",
|
|
414
|
+
ok_set, set_res = await self.boros_adapter.ensure_position_size_yu(
|
|
415
|
+
market_id=int(market_id),
|
|
416
|
+
token_id=int(token_id),
|
|
417
|
+
target_size_yu=float(target_size_yu),
|
|
418
|
+
tif="IOC",
|
|
419
|
+
min_resize_excess_usd=float(
|
|
420
|
+
self._planner_config.boros_resize_min_excess_usd
|
|
421
|
+
),
|
|
422
|
+
yu_to_usd=float(yu_to_usd),
|
|
423
|
+
)
|
|
424
|
+
if not ok_set:
|
|
425
|
+
return False, f"Failed to ensure Boros position: {set_res}"
|
|
426
|
+
|
|
427
|
+
action = str(set_res.get("action") or "unknown")
|
|
428
|
+
diff_yu = float(set_res.get("diff_yu") or 0.0)
|
|
429
|
+
if action == "no_op":
|
|
430
|
+
return (
|
|
431
|
+
True,
|
|
432
|
+
f"Boros position already at target ({set_res.get('current_size_yu', 0.0):.4f} YU)",
|
|
572
433
|
)
|
|
573
|
-
|
|
574
|
-
return False, f"Failed to open Boros position: {open_res}"
|
|
434
|
+
if action == "increase_short":
|
|
575
435
|
return (
|
|
576
436
|
True,
|
|
577
437
|
f"Boros position increased by {diff_yu:.4f} YU on market {market_id}",
|
|
578
438
|
)
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
size_yu_wei=size_yu_wei,
|
|
585
|
-
)
|
|
586
|
-
if not ok_close:
|
|
587
|
-
return False, f"Failed to close Boros position: {close_res}"
|
|
439
|
+
if action == "decrease":
|
|
440
|
+
return (
|
|
441
|
+
True,
|
|
442
|
+
f"Boros position decreased by {abs(diff_yu):.4f} YU on market {market_id}",
|
|
443
|
+
)
|
|
588
444
|
|
|
589
445
|
return (
|
|
590
446
|
True,
|
|
591
|
-
f"Boros position
|
|
447
|
+
f"Boros position adjusted ({action}) on market {market_id}: Δ={diff_yu:.4f} YU",
|
|
592
448
|
)
|
|
593
449
|
|
|
594
450
|
async def _complete_pending_withdrawal(
|
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
from wayfinder_paths.core.constants.contracts import (
|
|
2
|
+
HYPE_OFT_ADDRESS,
|
|
3
|
+
KHYPE_ADDRESS,
|
|
4
|
+
KHYPE_STAKING_ACCOUNTANT,
|
|
5
|
+
LHYPE_ACCOUNTANT,
|
|
6
|
+
LOOPED_HYPE_ADDRESS,
|
|
7
|
+
)
|
|
8
|
+
from wayfinder_paths.core.constants.contracts import (
|
|
9
|
+
HYPEREVM_WHYPE as WHYPE_ADDRESS,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
# Re-export addresses for use by strategy modules
|
|
13
|
+
__all__ = [
|
|
14
|
+
"HYPE_OFT_ADDRESS",
|
|
15
|
+
"WHYPE_ADDRESS",
|
|
16
|
+
"KHYPE_ADDRESS",
|
|
17
|
+
"KHYPE_STAKING_ACCOUNTANT",
|
|
18
|
+
"LHYPE_ACCOUNTANT",
|
|
19
|
+
"LOOPED_HYPE_ADDRESS",
|
|
20
|
+
]
|
|
21
|
+
|
|
1
22
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
2
23
|
# TOKEN IDS (wayfinder token identifiers)
|
|
3
24
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
@@ -14,20 +35,6 @@ KHYPE_LST = "kinetic-staked-hype-hyperevm"
|
|
|
14
35
|
LOOPED_HYPE = "looped-hype-hyperevm"
|
|
15
36
|
USDC_HYPE = "usd-coin-hyperevm"
|
|
16
37
|
|
|
17
|
-
|
|
18
|
-
# ─────────────────────────────────────────────────────────────────────────────
|
|
19
|
-
# CONTRACT ADDRESSES
|
|
20
|
-
# ─────────────────────────────────────────────────────────────────────────────
|
|
21
|
-
|
|
22
|
-
# HyperEVM token addresses
|
|
23
|
-
KHYPE_ADDRESS = "0xfD739d4e423301CE9385c1fb8850539D657C296D"
|
|
24
|
-
LOOPED_HYPE_ADDRESS = "0x5748ae796AE46A4F1348a1693de4b50560485562"
|
|
25
|
-
WHYPE_ADDRESS = "0x5555555555555555555555555555555555555555"
|
|
26
|
-
|
|
27
|
-
# Accountant contracts for exchange rate calculations
|
|
28
|
-
KHYPE_STAKING_ACCOUNTANT = "0x9209648Ec9D448EF57116B73A2f081835643dc7A"
|
|
29
|
-
LHYPE_ACCOUNTANT = "0xcE621a3CA6F72706678cFF0572ae8d15e5F001c3"
|
|
30
|
-
|
|
31
38
|
# Chain IDs
|
|
32
39
|
HYPEREVM_CHAIN_ID = 999
|
|
33
40
|
ARBITRUM_CHAIN_ID = 42161
|
|
@@ -100,160 +107,9 @@ BOROS_MIN_DEPOSIT_HYPE = 0.4
|
|
|
100
107
|
BOROS_MIN_TENOR_DAYS = 3 # Roll to new market if < 3 days to expiry
|
|
101
108
|
BOROS_ENABLE_MIN_TOTAL_USD = 80.0 # Skip Boros if capital below this
|
|
102
109
|
|
|
103
|
-
# LayerZero OFT bridge (HyperEVM native HYPE
|
|
104
|
-
HYPE_OFT_ADDRESS
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
# Minimal IOFT ABI for quoting + sending.
|
|
108
|
-
HYPE_OFT_ABI = [
|
|
109
|
-
{
|
|
110
|
-
"inputs": [
|
|
111
|
-
{
|
|
112
|
-
"components": [
|
|
113
|
-
{"internalType": "uint32", "name": "dstEid", "type": "uint32"},
|
|
114
|
-
{"internalType": "bytes32", "name": "to", "type": "bytes32"},
|
|
115
|
-
{"internalType": "uint256", "name": "amountLD", "type": "uint256"},
|
|
116
|
-
{
|
|
117
|
-
"internalType": "uint256",
|
|
118
|
-
"name": "minAmountLD",
|
|
119
|
-
"type": "uint256",
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
"internalType": "bytes",
|
|
123
|
-
"name": "extraOptions",
|
|
124
|
-
"type": "bytes",
|
|
125
|
-
},
|
|
126
|
-
{"internalType": "bytes", "name": "composeMsg", "type": "bytes"},
|
|
127
|
-
{"internalType": "bytes", "name": "oftCmd", "type": "bytes"},
|
|
128
|
-
],
|
|
129
|
-
"internalType": "struct SendParam",
|
|
130
|
-
"name": "_sendParam",
|
|
131
|
-
"type": "tuple",
|
|
132
|
-
},
|
|
133
|
-
{"internalType": "bool", "name": "_payInLzToken", "type": "bool"},
|
|
134
|
-
],
|
|
135
|
-
"name": "quoteSend",
|
|
136
|
-
"outputs": [
|
|
137
|
-
{
|
|
138
|
-
"components": [
|
|
139
|
-
{"internalType": "uint256", "name": "nativeFee", "type": "uint256"},
|
|
140
|
-
{
|
|
141
|
-
"internalType": "uint256",
|
|
142
|
-
"name": "lzTokenFee",
|
|
143
|
-
"type": "uint256",
|
|
144
|
-
},
|
|
145
|
-
],
|
|
146
|
-
"internalType": "struct MessagingFee",
|
|
147
|
-
"name": "",
|
|
148
|
-
"type": "tuple",
|
|
149
|
-
}
|
|
150
|
-
],
|
|
151
|
-
"stateMutability": "view",
|
|
152
|
-
"type": "function",
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
"inputs": [
|
|
156
|
-
{
|
|
157
|
-
"components": [
|
|
158
|
-
{"internalType": "uint32", "name": "dstEid", "type": "uint32"},
|
|
159
|
-
{"internalType": "bytes32", "name": "to", "type": "bytes32"},
|
|
160
|
-
{"internalType": "uint256", "name": "amountLD", "type": "uint256"},
|
|
161
|
-
{
|
|
162
|
-
"internalType": "uint256",
|
|
163
|
-
"name": "minAmountLD",
|
|
164
|
-
"type": "uint256",
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
"internalType": "bytes",
|
|
168
|
-
"name": "extraOptions",
|
|
169
|
-
"type": "bytes",
|
|
170
|
-
},
|
|
171
|
-
{"internalType": "bytes", "name": "composeMsg", "type": "bytes"},
|
|
172
|
-
{"internalType": "bytes", "name": "oftCmd", "type": "bytes"},
|
|
173
|
-
],
|
|
174
|
-
"internalType": "struct SendParam",
|
|
175
|
-
"name": "_sendParam",
|
|
176
|
-
"type": "tuple",
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
"components": [
|
|
180
|
-
{"internalType": "uint256", "name": "nativeFee", "type": "uint256"},
|
|
181
|
-
{
|
|
182
|
-
"internalType": "uint256",
|
|
183
|
-
"name": "lzTokenFee",
|
|
184
|
-
"type": "uint256",
|
|
185
|
-
},
|
|
186
|
-
],
|
|
187
|
-
"internalType": "struct MessagingFee",
|
|
188
|
-
"name": "_fee",
|
|
189
|
-
"type": "tuple",
|
|
190
|
-
},
|
|
191
|
-
{"internalType": "address", "name": "_refundAddress", "type": "address"},
|
|
192
|
-
],
|
|
193
|
-
"name": "send",
|
|
194
|
-
"outputs": [
|
|
195
|
-
{
|
|
196
|
-
"components": [
|
|
197
|
-
{"internalType": "bytes32", "name": "guid", "type": "bytes32"},
|
|
198
|
-
{"internalType": "uint64", "name": "nonce", "type": "uint64"},
|
|
199
|
-
{
|
|
200
|
-
"components": [
|
|
201
|
-
{
|
|
202
|
-
"internalType": "uint256",
|
|
203
|
-
"name": "nativeFee",
|
|
204
|
-
"type": "uint256",
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
"internalType": "uint256",
|
|
208
|
-
"name": "lzTokenFee",
|
|
209
|
-
"type": "uint256",
|
|
210
|
-
},
|
|
211
|
-
],
|
|
212
|
-
"internalType": "struct MessagingFee",
|
|
213
|
-
"name": "fee",
|
|
214
|
-
"type": "tuple",
|
|
215
|
-
},
|
|
216
|
-
],
|
|
217
|
-
"internalType": "struct MessagingReceipt",
|
|
218
|
-
"name": "",
|
|
219
|
-
"type": "tuple",
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
"components": [
|
|
223
|
-
{
|
|
224
|
-
"internalType": "uint256",
|
|
225
|
-
"name": "amountSentLD",
|
|
226
|
-
"type": "uint256",
|
|
227
|
-
},
|
|
228
|
-
{
|
|
229
|
-
"internalType": "uint256",
|
|
230
|
-
"name": "amountReceivedLD",
|
|
231
|
-
"type": "uint256",
|
|
232
|
-
},
|
|
233
|
-
],
|
|
234
|
-
"internalType": "struct OFTReceipt",
|
|
235
|
-
"name": "",
|
|
236
|
-
"type": "tuple",
|
|
237
|
-
},
|
|
238
|
-
],
|
|
239
|
-
"stateMutability": "payable",
|
|
240
|
-
"type": "function",
|
|
241
|
-
},
|
|
242
|
-
{
|
|
243
|
-
"inputs": [],
|
|
244
|
-
"name": "sharedDecimals",
|
|
245
|
-
"outputs": [{"internalType": "uint8", "name": "", "type": "uint8"}],
|
|
246
|
-
"stateMutability": "view",
|
|
247
|
-
"type": "function",
|
|
248
|
-
},
|
|
249
|
-
{
|
|
250
|
-
"inputs": [],
|
|
251
|
-
"name": "decimalConversionRate",
|
|
252
|
-
"outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}],
|
|
253
|
-
"stateMutability": "view",
|
|
254
|
-
"type": "function",
|
|
255
|
-
},
|
|
256
|
-
]
|
|
110
|
+
# LayerZero OFT bridge (HyperEVM native HYPE -> Arbitrum OFT HYPE)
|
|
111
|
+
# HYPE_OFT_ADDRESS imported from contracts.py
|
|
112
|
+
# ABI lives in `wayfinder_paths/core/constants/hype_oft_abi.py`.
|
|
257
113
|
|
|
258
114
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
259
115
|
# GAS CONFIGURATION
|