@ostraagent/mcp 0.1.15 → 0.1.16

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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/dist/ostra-mcp.js +1186 -251
  3. package/package.json +1 -1
package/dist/ostra-mcp.js CHANGED
@@ -18,7 +18,7 @@ var __export = (target, all) => {
18
18
  var define_OSTRA_PACKAGED_default;
19
19
  var init_define_OSTRA_PACKAGED = __esm({
20
20
  "<define:OSTRA_PACKAGED>"() {
21
- define_OSTRA_PACKAGED_default = { version: "0.1.15", deployment: { version: 1, chainId: 4663, fromBlock: "91991509", token: "0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168", batchSettlement: "0x4020074e9dF2ce1deE5A9C1b5c3f541D02a10003", vaultImplementation: "0xec0ca4A1393D91c42cA809F7F9dd82Bd597E8E58", vaultBeacon: "0xE9F525B9EaeE48d13AEd28fE146F48f2832a18a0", vaultFactory: "0x043a15c514CFE2c797d33520bFF91a5DCdbf2979", poolImplementation: "0xC04d4a222dC1C966640B977608bE29949b0648ec", poolBeacon: "0x30669Ca534921038a531BBE27116d85bB7406fFF", pool: "0x6ea80F2462e5Fd783B0Ec3B2c7BaC96795980CD6", splitFactory: "0xAAf54A483B2c7c2c5ecFc1eDED5ed1619C1bA882", beaconOwner: "0x55533a51d9bd9b06F2D179d919BB31995EF96E5e", registry: "0xcE6Cc1f93744f4090DA1444Bb8590d9206157506", vaultModule: "0x55A89fF907f5F5756470e2ec5Dc5E4E1C54Da770", launchpad: { hook: "0x63A784afb8905452aDceC471a45E555F5caE68cC", fees: "0x8e79671DC9729476614C78aFcf2345D4c1963801", launchpad: "0xfC57162C0e3f9773F97fEa8d276e957d7c43A6C5", creatorSplit: "0x987994dE6A1d5303B9e3F50977cB0321BA4D033B", dispatcher: "0x44Bb65164b2855f8E80B142d5Fb9bDb72E869986", locker: "0xb593812363bAd70Ee381c7B54c4FC82b0BA3A4A7", devBuy: "0x0e1Fd799E136dcfEcad5695B07Ac5DAc5B2fF4bc", vesting: "0xadD9C1995910457312c156E7D8120D1b447E179a", airdrop: "0xBC798D956aF4c2B104FFC6106d5322294Bc103bb", owner: "0x6569E27A95a6A3E92A311B4Cc6600fed56aA50A2" }, breaker: "0x2E33244dE6A64007204f763e9ef81FC33F1a8e01" }, swapDeployment: { chainId: 4663, fromBlock: "94940585", router: "0x5b9686f384A5Fb768B2360cF0B893F0d1E960B01", stake: "0xaDA4FaB9c8aB9165bf4d6cD9d4Da6d6b32Bb4BC6", buyback: "0xd86083031b7Af66ecD5C9c5e90D4C6d8E661F3f5", spendVerifier: "0x0a0E28a81DE6289e5044950163FfE95b37180e3B", privatePool: "0xe4250895Da2499602Cee4e178Fb46A0cF39F5b76" }, prover: { wasm: "0xd5f3069334ab49a2f955e4b4be9493b80c3f7b2a85f4ff2073a327ef5fbc2747", glue: "0x4bc8bef7c755c83daaf833623f85473a20a7c40b390d8d639d9e4353618a0537" }, relayerUrl: "https://relayer.ostraagent.xyz", keeperUrl: "https://keeper.ostraagent.xyz", aggregatorUrl: "https://aggregator.ostraagent.xyz", aiUrl: "https://ai.ostraagent.xyz" };
21
+ define_OSTRA_PACKAGED_default = { version: "0.1.16", deployment: { version: 1, chainId: 4663, fromBlock: "91991509", token: "0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168", batchSettlement: "0x4020074e9dF2ce1deE5A9C1b5c3f541D02a10003", vaultImplementation: "0xec0ca4A1393D91c42cA809F7F9dd82Bd597E8E58", vaultBeacon: "0xE9F525B9EaeE48d13AEd28fE146F48f2832a18a0", vaultFactory: "0x043a15c514CFE2c797d33520bFF91a5DCdbf2979", poolImplementation: "0xC04d4a222dC1C966640B977608bE29949b0648ec", poolBeacon: "0x30669Ca534921038a531BBE27116d85bB7406fFF", pool: "0x6ea80F2462e5Fd783B0Ec3B2c7BaC96795980CD6", splitFactory: "0xAAf54A483B2c7c2c5ecFc1eDED5ed1619C1bA882", beaconOwner: "0x55533a51d9bd9b06F2D179d919BB31995EF96E5e", registry: "0xcE6Cc1f93744f4090DA1444Bb8590d9206157506", vaultModule: "0x55A89fF907f5F5756470e2ec5Dc5E4E1C54Da770", launchpad: { hook: "0x63A784afb8905452aDceC471a45E555F5caE68cC", fees: "0x8e79671DC9729476614C78aFcf2345D4c1963801", launchpad: "0xfC57162C0e3f9773F97fEa8d276e957d7c43A6C5", creatorSplit: "0x987994dE6A1d5303B9e3F50977cB0321BA4D033B", dispatcher: "0x44Bb65164b2855f8E80B142d5Fb9bDb72E869986", locker: "0xb593812363bAd70Ee381c7B54c4FC82b0BA3A4A7", devBuy: "0x0e1Fd799E136dcfEcad5695B07Ac5DAc5B2fF4bc", vesting: "0xadD9C1995910457312c156E7D8120D1b447E179a", airdrop: "0xBC798D956aF4c2B104FFC6106d5322294Bc103bb", owner: "0x6569E27A95a6A3E92A311B4Cc6600fed56aA50A2" }, breaker: "0x2E33244dE6A64007204f763e9ef81FC33F1a8e01" }, swapDeployment: { chainId: 4663, fromBlock: "94940585", router: "0x5b9686f384A5Fb768B2360cF0B893F0d1E960B01", stake: "0xaDA4FaB9c8aB9165bf4d6cD9d4Da6d6b32Bb4BC6", buyback: "0xd86083031b7Af66ecD5C9c5e90D4C6d8E661F3f5", spendVerifier: "0x0a0E28a81DE6289e5044950163FfE95b37180e3B", privatePool: "0xe4250895Da2499602Cee4e178Fb46A0cF39F5b76" }, prover: { wasm: "0xd5f3069334ab49a2f955e4b4be9493b80c3f7b2a85f4ff2073a327ef5fbc2747", glue: "0x4bc8bef7c755c83daaf833623f85473a20a7c40b390d8d639d9e4353618a0537" }, relayerUrl: "https://relayer.ostraagent.xyz", keeperUrl: "https://keeper.ostraagent.xyz", aggregatorUrl: "https://aggregator.ostraagent.xyz", aiUrl: "https://ai.ostraagent.xyz" };
22
22
  }
23
23
  });
24
24
 
@@ -141,7 +141,7 @@ var init_disk = __esm({
141
141
  });
142
142
 
143
143
  // ../sdk/src/abi.ts
144
- var ostraVaultAbi, ostraVaultModuleAbi, ostraBreakerAbi, ostraVaultFactoryAbi, ostraRegistryAbi, ostraPoolAbi, ostraSplitFactoryAbi, x402BatchSettlementAbi, ostraLaunchpadAbi, ostraDevBuyAbi, ostraHookAbi, ostraTokenAbi, ostraAirdropAbi, ostraVestingAbi, ostraDispatcherAbi, ostraCreatorSplitAbi, BEACON_PROXY_CREATION_CODE;
144
+ var ostraVaultAbi, ostraVaultModuleAbi, ostraVaultModuleV4Abi, ostraBreakerAbi, ostraVaultFactoryAbi, ostraRegistryAbi, ostraPoolAbi, ostraSplitFactoryAbi, x402BatchSettlementAbi, ostraLaunchpadAbi, ostraDevBuyAbi, ostraHookAbi, ostraTokenAbi, ostraAirdropAbi, ostraVestingAbi, ostraDispatcherAbi, ostraCreatorSplitAbi, BEACON_PROXY_CREATION_CODE;
145
145
  var init_abi = __esm({
146
146
  "../sdk/src/abi.ts"() {
147
147
  "use strict";
@@ -179,6 +179,11 @@ var init_abi = __esm({
179
179
  "name": "module",
180
180
  "type": "address",
181
181
  "internalType": "address"
182
+ },
183
+ {
184
+ "name": "moduleV4",
185
+ "type": "address",
186
+ "internalType": "address"
182
187
  }
183
188
  ]
184
189
  }
@@ -263,6 +268,45 @@ var init_abi = __esm({
263
268
  ],
264
269
  "stateMutability": "view"
265
270
  },
271
+ {
272
+ "type": "function",
273
+ "name": "ACTION_ENTER",
274
+ "inputs": [],
275
+ "outputs": [
276
+ {
277
+ "name": "",
278
+ "type": "uint8",
279
+ "internalType": "uint8"
280
+ }
281
+ ],
282
+ "stateMutability": "view"
283
+ },
284
+ {
285
+ "type": "function",
286
+ "name": "ACTION_EXIT",
287
+ "inputs": [],
288
+ "outputs": [
289
+ {
290
+ "name": "",
291
+ "type": "uint8",
292
+ "internalType": "uint8"
293
+ }
294
+ ],
295
+ "stateMutability": "view"
296
+ },
297
+ {
298
+ "type": "function",
299
+ "name": "ACTION_FORWARD",
300
+ "inputs": [],
301
+ "outputs": [
302
+ {
303
+ "name": "",
304
+ "type": "uint8",
305
+ "internalType": "uint8"
306
+ }
307
+ ],
308
+ "stateMutability": "view"
309
+ },
266
310
  {
267
311
  "type": "function",
268
312
  "name": "ACTION_GUARD",
@@ -445,6 +489,19 @@ var init_abi = __esm({
445
489
  ],
446
490
  "stateMutability": "view"
447
491
  },
492
+ {
493
+ "type": "function",
494
+ "name": "ACTION_SET_VENUE",
495
+ "inputs": [],
496
+ "outputs": [
497
+ {
498
+ "name": "",
499
+ "type": "uint8",
500
+ "internalType": "uint8"
501
+ }
502
+ ],
503
+ "stateMutability": "view"
504
+ },
448
505
  {
449
506
  "type": "function",
450
507
  "name": "ACTION_SET_WITHDRAWAL_LOCK",
@@ -640,6 +697,19 @@ var init_abi = __esm({
640
697
  ],
641
698
  "stateMutability": "view"
642
699
  },
700
+ {
701
+ "type": "function",
702
+ "name": "MODULE_V4",
703
+ "inputs": [],
704
+ "outputs": [
705
+ {
706
+ "name": "",
707
+ "type": "address",
708
+ "internalType": "address"
709
+ }
710
+ ],
711
+ "stateMutability": "view"
712
+ },
643
713
  {
644
714
  "type": "function",
645
715
  "name": "POOL_MANAGER",
@@ -1559,6 +1629,29 @@ var init_abi = __esm({
1559
1629
  ],
1560
1630
  "stateMutability": "view"
1561
1631
  },
1632
+ {
1633
+ "type": "function",
1634
+ "name": "tripVenue",
1635
+ "inputs": [
1636
+ {
1637
+ "name": "kind",
1638
+ "type": "uint8",
1639
+ "internalType": "uint8"
1640
+ },
1641
+ {
1642
+ "name": "venue",
1643
+ "type": "address",
1644
+ "internalType": "address"
1645
+ },
1646
+ {
1647
+ "name": "amount",
1648
+ "type": "uint256",
1649
+ "internalType": "uint256"
1650
+ }
1651
+ ],
1652
+ "outputs": [],
1653
+ "stateMutability": "nonpayable"
1654
+ },
1562
1655
  {
1563
1656
  "type": "function",
1564
1657
  "name": "unlockCallback",
@@ -1578,6 +1671,45 @@ var init_abi = __esm({
1578
1671
  ],
1579
1672
  "stateMutability": "nonpayable"
1580
1673
  },
1674
+ {
1675
+ "type": "function",
1676
+ "name": "venueOf",
1677
+ "inputs": [
1678
+ {
1679
+ "name": "kind",
1680
+ "type": "uint8",
1681
+ "internalType": "uint8"
1682
+ },
1683
+ {
1684
+ "name": "venue",
1685
+ "type": "address",
1686
+ "internalType": "address"
1687
+ }
1688
+ ],
1689
+ "outputs": [
1690
+ {
1691
+ "name": "enabled",
1692
+ "type": "bool",
1693
+ "internalType": "bool"
1694
+ },
1695
+ {
1696
+ "name": "entered",
1697
+ "type": "bool",
1698
+ "internalType": "bool"
1699
+ },
1700
+ {
1701
+ "name": "inForce",
1702
+ "type": "bool",
1703
+ "internalType": "bool"
1704
+ },
1705
+ {
1706
+ "name": "from",
1707
+ "type": "uint64",
1708
+ "internalType": "uint64"
1709
+ }
1710
+ ],
1711
+ "stateMutability": "view"
1712
+ },
1581
1713
  {
1582
1714
  "type": "function",
1583
1715
  "name": "withdrawalLock",
@@ -1936,6 +2068,19 @@ var init_abi = __esm({
1936
2068
  ],
1937
2069
  "anonymous": false
1938
2070
  },
2071
+ {
2072
+ "type": "event",
2073
+ "name": "WaitingVenuesCancelled",
2074
+ "inputs": [
2075
+ {
2076
+ "name": "by",
2077
+ "type": "address",
2078
+ "indexed": true,
2079
+ "internalType": "address"
2080
+ }
2081
+ ],
2082
+ "anonymous": false
2083
+ },
1939
2084
  {
1940
2085
  "type": "event",
1941
2086
  "name": "WithdrawalLockSet",
@@ -2381,61 +2526,801 @@ var init_abi = __esm({
2381
2526
  "stateMutability": "nonpayable"
2382
2527
  },
2383
2528
  {
2384
- "type": "event",
2385
- "name": "Borrowed",
2529
+ "type": "event",
2530
+ "name": "Borrowed",
2531
+ "inputs": [
2532
+ {
2533
+ "name": "marketId",
2534
+ "type": "bytes32",
2535
+ "indexed": true,
2536
+ "internalType": "bytes32"
2537
+ },
2538
+ {
2539
+ "name": "assets",
2540
+ "type": "uint256",
2541
+ "indexed": false,
2542
+ "internalType": "uint256"
2543
+ },
2544
+ {
2545
+ "name": "receiver",
2546
+ "type": "address",
2547
+ "indexed": true,
2548
+ "internalType": "address"
2549
+ }
2550
+ ],
2551
+ "anonymous": false
2552
+ },
2553
+ {
2554
+ "type": "event",
2555
+ "name": "CollateralPosted",
2556
+ "inputs": [
2557
+ {
2558
+ "name": "marketId",
2559
+ "type": "bytes32",
2560
+ "indexed": true,
2561
+ "internalType": "bytes32"
2562
+ },
2563
+ {
2564
+ "name": "shares",
2565
+ "type": "uint256",
2566
+ "indexed": false,
2567
+ "internalType": "uint256"
2568
+ }
2569
+ ],
2570
+ "anonymous": false
2571
+ },
2572
+ {
2573
+ "type": "event",
2574
+ "name": "CollateralWithdrawn",
2575
+ "inputs": [
2576
+ {
2577
+ "name": "marketId",
2578
+ "type": "bytes32",
2579
+ "indexed": true,
2580
+ "internalType": "bytes32"
2581
+ },
2582
+ {
2583
+ "name": "shares",
2584
+ "type": "uint256",
2585
+ "indexed": false,
2586
+ "internalType": "uint256"
2587
+ }
2588
+ ],
2589
+ "anonymous": false
2590
+ },
2591
+ {
2592
+ "type": "event",
2593
+ "name": "Guarded",
2594
+ "inputs": [
2595
+ {
2596
+ "name": "vault",
2597
+ "type": "address",
2598
+ "indexed": true,
2599
+ "internalType": "address"
2600
+ },
2601
+ {
2602
+ "name": "op",
2603
+ "type": "uint8",
2604
+ "indexed": false,
2605
+ "internalType": "uint8"
2606
+ },
2607
+ {
2608
+ "name": "ok",
2609
+ "type": "bool",
2610
+ "indexed": false,
2611
+ "internalType": "bool"
2612
+ },
2613
+ {
2614
+ "name": "reason",
2615
+ "type": "bytes4",
2616
+ "indexed": false,
2617
+ "internalType": "bytes4"
2618
+ }
2619
+ ],
2620
+ "anonymous": false
2621
+ },
2622
+ {
2623
+ "type": "event",
2624
+ "name": "HashApproved",
2625
+ "inputs": [
2626
+ {
2627
+ "name": "hash",
2628
+ "type": "bytes32",
2629
+ "indexed": true,
2630
+ "internalType": "bytes32"
2631
+ },
2632
+ {
2633
+ "name": "validFrom",
2634
+ "type": "uint64",
2635
+ "indexed": false,
2636
+ "internalType": "uint64"
2637
+ }
2638
+ ],
2639
+ "anonymous": false
2640
+ },
2641
+ {
2642
+ "type": "event",
2643
+ "name": "HashRevoked",
2644
+ "inputs": [
2645
+ {
2646
+ "name": "hash",
2647
+ "type": "bytes32",
2648
+ "indexed": true,
2649
+ "internalType": "bytes32"
2650
+ },
2651
+ {
2652
+ "name": "by",
2653
+ "type": "address",
2654
+ "indexed": true,
2655
+ "internalType": "address"
2656
+ }
2657
+ ],
2658
+ "anonymous": false
2659
+ },
2660
+ {
2661
+ "type": "event",
2662
+ "name": "Lent",
2663
+ "inputs": [
2664
+ {
2665
+ "name": "vault",
2666
+ "type": "address",
2667
+ "indexed": true,
2668
+ "internalType": "address"
2669
+ },
2670
+ {
2671
+ "name": "assets",
2672
+ "type": "uint256",
2673
+ "indexed": false,
2674
+ "internalType": "uint256"
2675
+ },
2676
+ {
2677
+ "name": "shares",
2678
+ "type": "uint256",
2679
+ "indexed": false,
2680
+ "internalType": "uint256"
2681
+ },
2682
+ {
2683
+ "name": "viaBorro",
2684
+ "type": "bool",
2685
+ "indexed": false,
2686
+ "internalType": "bool"
2687
+ }
2688
+ ],
2689
+ "anonymous": false
2690
+ },
2691
+ {
2692
+ "type": "event",
2693
+ "name": "LinkedVaultChangeScheduled",
2694
+ "inputs": [
2695
+ {
2696
+ "name": "vault",
2697
+ "type": "address",
2698
+ "indexed": true,
2699
+ "internalType": "address"
2700
+ },
2701
+ {
2702
+ "name": "effectiveAt",
2703
+ "type": "uint64",
2704
+ "indexed": false,
2705
+ "internalType": "uint64"
2706
+ }
2707
+ ],
2708
+ "anonymous": false
2709
+ },
2710
+ {
2711
+ "type": "event",
2712
+ "name": "LinkedVaultSet",
2713
+ "inputs": [
2714
+ {
2715
+ "name": "vault",
2716
+ "type": "address",
2717
+ "indexed": true,
2718
+ "internalType": "address"
2719
+ }
2720
+ ],
2721
+ "anonymous": false
2722
+ },
2723
+ {
2724
+ "type": "event",
2725
+ "name": "MorphoFailed",
2726
+ "inputs": [
2727
+ {
2728
+ "name": "action",
2729
+ "type": "uint8",
2730
+ "indexed": true,
2731
+ "internalType": "uint8"
2732
+ },
2733
+ {
2734
+ "name": "reason",
2735
+ "type": "bytes4",
2736
+ "indexed": false,
2737
+ "internalType": "bytes4"
2738
+ }
2739
+ ],
2740
+ "anonymous": false
2741
+ },
2742
+ {
2743
+ "type": "event",
2744
+ "name": "Outflow",
2745
+ "inputs": [
2746
+ {
2747
+ "name": "amount",
2748
+ "type": "uint256",
2749
+ "indexed": false,
2750
+ "internalType": "uint256"
2751
+ },
2752
+ {
2753
+ "name": "used",
2754
+ "type": "uint128",
2755
+ "indexed": false,
2756
+ "internalType": "uint128"
2757
+ }
2758
+ ],
2759
+ "anonymous": false
2760
+ },
2761
+ {
2762
+ "type": "event",
2763
+ "name": "PendingChangesCancelled",
2764
+ "inputs": [
2765
+ {
2766
+ "name": "by",
2767
+ "type": "address",
2768
+ "indexed": true,
2769
+ "internalType": "address"
2770
+ }
2771
+ ],
2772
+ "anonymous": false
2773
+ },
2774
+ {
2775
+ "type": "event",
2776
+ "name": "Redeemed",
2777
+ "inputs": [
2778
+ {
2779
+ "name": "vault",
2780
+ "type": "address",
2781
+ "indexed": true,
2782
+ "internalType": "address"
2783
+ },
2784
+ {
2785
+ "name": "shares",
2786
+ "type": "uint256",
2787
+ "indexed": false,
2788
+ "internalType": "uint256"
2789
+ },
2790
+ {
2791
+ "name": "assets",
2792
+ "type": "uint256",
2793
+ "indexed": false,
2794
+ "internalType": "uint256"
2795
+ }
2796
+ ],
2797
+ "anonymous": false
2798
+ },
2799
+ {
2800
+ "type": "event",
2801
+ "name": "Repaid",
2802
+ "inputs": [
2803
+ {
2804
+ "name": "marketId",
2805
+ "type": "bytes32",
2806
+ "indexed": true,
2807
+ "internalType": "bytes32"
2808
+ },
2809
+ {
2810
+ "name": "onBehalf",
2811
+ "type": "address",
2812
+ "indexed": true,
2813
+ "internalType": "address"
2814
+ },
2815
+ {
2816
+ "name": "assets",
2817
+ "type": "uint256",
2818
+ "indexed": false,
2819
+ "internalType": "uint256"
2820
+ },
2821
+ {
2822
+ "name": "shares",
2823
+ "type": "uint256",
2824
+ "indexed": false,
2825
+ "internalType": "uint256"
2826
+ }
2827
+ ],
2828
+ "anonymous": false
2829
+ },
2830
+ {
2831
+ "type": "event",
2832
+ "name": "Swept",
2833
+ "inputs": [
2834
+ {
2835
+ "name": "withdrawal",
2836
+ "type": "address",
2837
+ "indexed": true,
2838
+ "internalType": "address"
2839
+ },
2840
+ {
2841
+ "name": "amount",
2842
+ "type": "uint256",
2843
+ "indexed": false,
2844
+ "internalType": "uint256"
2845
+ },
2846
+ {
2847
+ "name": "by",
2848
+ "type": "address",
2849
+ "indexed": true,
2850
+ "internalType": "address"
2851
+ }
2852
+ ],
2853
+ "anonymous": false
2854
+ },
2855
+ {
2856
+ "type": "event",
2857
+ "name": "WithdrawalLockChangeScheduled",
2858
+ "inputs": [
2859
+ {
2860
+ "name": "withdrawal",
2861
+ "type": "address",
2862
+ "indexed": true,
2863
+ "internalType": "address"
2864
+ },
2865
+ {
2866
+ "name": "delay",
2867
+ "type": "uint32",
2868
+ "indexed": false,
2869
+ "internalType": "uint32"
2870
+ },
2871
+ {
2872
+ "name": "dailyLimit",
2873
+ "type": "uint128",
2874
+ "indexed": false,
2875
+ "internalType": "uint128"
2876
+ },
2877
+ {
2878
+ "name": "effectiveAt",
2879
+ "type": "uint64",
2880
+ "indexed": false,
2881
+ "internalType": "uint64"
2882
+ }
2883
+ ],
2884
+ "anonymous": false
2885
+ },
2886
+ {
2887
+ "type": "event",
2888
+ "name": "WithdrawalLockSet",
2889
+ "inputs": [
2890
+ {
2891
+ "name": "withdrawal",
2892
+ "type": "address",
2893
+ "indexed": true,
2894
+ "internalType": "address"
2895
+ },
2896
+ {
2897
+ "name": "delay",
2898
+ "type": "uint32",
2899
+ "indexed": false,
2900
+ "internalType": "uint32"
2901
+ },
2902
+ {
2903
+ "name": "dailyLimit",
2904
+ "type": "uint128",
2905
+ "indexed": false,
2906
+ "internalType": "uint128"
2907
+ }
2908
+ ],
2909
+ "anonymous": false
2910
+ },
2911
+ {
2912
+ "type": "error",
2913
+ "name": "BadMarket",
2914
+ "inputs": []
2915
+ },
2916
+ {
2917
+ "type": "error",
2918
+ "name": "BadParams",
2919
+ "inputs": []
2920
+ },
2921
+ {
2922
+ "type": "error",
2923
+ "name": "BadVault",
2924
+ "inputs": []
2925
+ },
2926
+ {
2927
+ "type": "error",
2928
+ "name": "InsufficientOutput",
2929
+ "inputs": []
2930
+ },
2931
+ {
2932
+ "type": "error",
2933
+ "name": "Locked",
2934
+ "inputs": []
2935
+ },
2936
+ {
2937
+ "type": "error",
2938
+ "name": "LtvTooHigh",
2939
+ "inputs": []
2940
+ },
2941
+ {
2942
+ "type": "error",
2943
+ "name": "NotLinked",
2944
+ "inputs": []
2945
+ },
2946
+ {
2947
+ "type": "error",
2948
+ "name": "NotOstraVault",
2949
+ "inputs": []
2950
+ },
2951
+ {
2952
+ "type": "error",
2953
+ "name": "OnlyDelegated",
2954
+ "inputs": []
2955
+ },
2956
+ {
2957
+ "type": "error",
2958
+ "name": "OutOfGas",
2959
+ "inputs": []
2960
+ },
2961
+ {
2962
+ "type": "error",
2963
+ "name": "OverDailyLimit",
2964
+ "inputs": [
2965
+ {
2966
+ "name": "available",
2967
+ "type": "uint256",
2968
+ "internalType": "uint256"
2969
+ }
2970
+ ]
2971
+ },
2972
+ {
2973
+ "type": "error",
2974
+ "name": "SafeERC20FailedOperation",
2975
+ "inputs": [
2976
+ {
2977
+ "name": "token",
2978
+ "type": "address",
2979
+ "internalType": "address"
2980
+ }
2981
+ ]
2982
+ },
2983
+ {
2984
+ "type": "error",
2985
+ "name": "WrongToken",
2986
+ "inputs": []
2987
+ },
2988
+ {
2989
+ "type": "error",
2990
+ "name": "ZeroAmount",
2991
+ "inputs": []
2992
+ }
2993
+ ];
2994
+ ostraVaultModuleV4Abi = [
2995
+ {
2996
+ "type": "constructor",
2997
+ "inputs": [
2998
+ {
2999
+ "name": "factory",
3000
+ "type": "address",
3001
+ "internalType": "address"
3002
+ },
3003
+ {
3004
+ "name": "vaultV2Factory",
3005
+ "type": "address",
3006
+ "internalType": "address"
3007
+ },
3008
+ {
3009
+ "name": "identityRegistry",
3010
+ "type": "address",
3011
+ "internalType": "address"
3012
+ }
3013
+ ],
3014
+ "stateMutability": "nonpayable"
3015
+ },
3016
+ {
3017
+ "type": "function",
3018
+ "name": "CODE",
3019
+ "inputs": [],
3020
+ "outputs": [
3021
+ {
3022
+ "name": "",
3023
+ "type": "uint8",
3024
+ "internalType": "uint8"
3025
+ }
3026
+ ],
3027
+ "stateMutability": "view"
3028
+ },
3029
+ {
3030
+ "type": "function",
3031
+ "name": "ERC4626_MIN_GAS",
3032
+ "inputs": [],
3033
+ "outputs": [
3034
+ {
3035
+ "name": "",
3036
+ "type": "uint256",
3037
+ "internalType": "uint256"
3038
+ }
3039
+ ],
3040
+ "stateMutability": "view"
3041
+ },
3042
+ {
3043
+ "type": "function",
3044
+ "name": "FACTORY",
3045
+ "inputs": [],
3046
+ "outputs": [
3047
+ {
3048
+ "name": "",
3049
+ "type": "address",
3050
+ "internalType": "contract IOstraVaultFactory"
3051
+ }
3052
+ ],
3053
+ "stateMutability": "view"
3054
+ },
3055
+ {
3056
+ "type": "function",
3057
+ "name": "GUARD_EXIT_MIN_GAS",
3058
+ "inputs": [],
3059
+ "outputs": [
3060
+ {
3061
+ "name": "",
3062
+ "type": "uint256",
3063
+ "internalType": "uint256"
3064
+ }
3065
+ ],
3066
+ "stateMutability": "view"
3067
+ },
3068
+ {
3069
+ "type": "function",
3070
+ "name": "IDENTITY_REGISTRY",
3071
+ "inputs": [],
3072
+ "outputs": [
3073
+ {
3074
+ "name": "",
3075
+ "type": "address",
3076
+ "internalType": "address"
3077
+ }
3078
+ ],
3079
+ "stateMutability": "view"
3080
+ },
3081
+ {
3082
+ "type": "function",
3083
+ "name": "IMPLEMENTATION",
3084
+ "inputs": [],
3085
+ "outputs": [
3086
+ {
3087
+ "name": "",
3088
+ "type": "uint8",
3089
+ "internalType": "uint8"
3090
+ }
3091
+ ],
3092
+ "stateMutability": "view"
3093
+ },
3094
+ {
3095
+ "type": "function",
3096
+ "name": "LTV",
3097
+ "inputs": [],
3098
+ "outputs": [
3099
+ {
3100
+ "name": "",
3101
+ "type": "uint8",
3102
+ "internalType": "uint8"
3103
+ }
3104
+ ],
3105
+ "stateMutability": "view"
3106
+ },
3107
+ {
3108
+ "type": "function",
3109
+ "name": "MIN_SOURCE_DELAY",
3110
+ "inputs": [],
3111
+ "outputs": [
3112
+ {
3113
+ "name": "",
3114
+ "type": "uint256",
3115
+ "internalType": "uint256"
3116
+ }
3117
+ ],
3118
+ "stateMutability": "view"
3119
+ },
3120
+ {
3121
+ "type": "function",
3122
+ "name": "PRICE_SCALE",
3123
+ "inputs": [],
3124
+ "outputs": [
3125
+ {
3126
+ "name": "",
3127
+ "type": "uint256",
3128
+ "internalType": "uint256"
3129
+ }
3130
+ ],
3131
+ "stateMutability": "view"
3132
+ },
3133
+ {
3134
+ "type": "function",
3135
+ "name": "RAETO_STOCK_MIN_GAS",
3136
+ "inputs": [],
3137
+ "outputs": [
3138
+ {
3139
+ "name": "",
3140
+ "type": "uint256",
3141
+ "internalType": "uint256"
3142
+ }
3143
+ ],
3144
+ "stateMutability": "view"
3145
+ },
3146
+ {
3147
+ "type": "function",
3148
+ "name": "RAETO_USDG_MIN_GAS",
3149
+ "inputs": [],
3150
+ "outputs": [
3151
+ {
3152
+ "name": "",
3153
+ "type": "uint256",
3154
+ "internalType": "uint256"
3155
+ }
3156
+ ],
3157
+ "stateMutability": "view"
3158
+ },
3159
+ {
3160
+ "type": "function",
3161
+ "name": "SOURCE",
3162
+ "inputs": [],
3163
+ "outputs": [
3164
+ {
3165
+ "name": "",
3166
+ "type": "uint8",
3167
+ "internalType": "uint8"
3168
+ }
3169
+ ],
3170
+ "stateMutability": "view"
3171
+ },
3172
+ {
3173
+ "type": "function",
3174
+ "name": "STOCK_TOLERANCE",
3175
+ "inputs": [],
3176
+ "outputs": [
3177
+ {
3178
+ "name": "",
3179
+ "type": "uint256",
3180
+ "internalType": "uint256"
3181
+ }
3182
+ ],
3183
+ "stateMutability": "view"
3184
+ },
3185
+ {
3186
+ "type": "function",
3187
+ "name": "VAULT_V2_FACTORY",
3188
+ "inputs": [],
3189
+ "outputs": [
3190
+ {
3191
+ "name": "",
3192
+ "type": "address",
3193
+ "internalType": "contract IVaultV2Factory"
3194
+ }
3195
+ ],
3196
+ "stateMutability": "view"
3197
+ },
3198
+ {
3199
+ "type": "function",
3200
+ "name": "guard",
3201
+ "inputs": [
3202
+ {
3203
+ "name": "op",
3204
+ "type": "uint8",
3205
+ "internalType": "uint8"
3206
+ },
3207
+ {
3208
+ "name": "params",
3209
+ "type": "bytes",
3210
+ "internalType": "bytes"
3211
+ },
3212
+ {
3213
+ "name": "token",
3214
+ "type": "address",
3215
+ "internalType": "contract IERC20"
3216
+ }
3217
+ ],
3218
+ "outputs": [],
3219
+ "stateMutability": "nonpayable"
3220
+ },
3221
+ {
3222
+ "type": "function",
3223
+ "name": "run",
3224
+ "inputs": [
3225
+ {
3226
+ "name": "action",
3227
+ "type": "uint8",
3228
+ "internalType": "uint8"
3229
+ },
3230
+ {
3231
+ "name": "params",
3232
+ "type": "bytes",
3233
+ "internalType": "bytes"
3234
+ },
3235
+ {
3236
+ "name": "token",
3237
+ "type": "address",
3238
+ "internalType": "contract IERC20"
3239
+ },
3240
+ {
3241
+ "name": "recovering",
3242
+ "type": "bool",
3243
+ "internalType": "bool"
3244
+ }
3245
+ ],
3246
+ "outputs": [],
3247
+ "stateMutability": "nonpayable"
3248
+ },
3249
+ {
3250
+ "type": "function",
3251
+ "name": "runVenue",
3252
+ "inputs": [
3253
+ {
3254
+ "name": "action",
3255
+ "type": "uint8",
3256
+ "internalType": "uint8"
3257
+ },
3258
+ {
3259
+ "name": "params",
3260
+ "type": "bytes",
3261
+ "internalType": "bytes"
3262
+ },
3263
+ {
3264
+ "name": "token",
3265
+ "type": "address",
3266
+ "internalType": "contract IERC20"
3267
+ }
3268
+ ],
3269
+ "outputs": [],
3270
+ "stateMutability": "nonpayable"
3271
+ },
3272
+ {
3273
+ "type": "function",
3274
+ "name": "trip",
2386
3275
  "inputs": [
2387
3276
  {
2388
- "name": "marketId",
2389
- "type": "bytes32",
2390
- "indexed": true,
2391
- "internalType": "bytes32"
3277
+ "name": "kind",
3278
+ "type": "uint8",
3279
+ "internalType": "uint8"
2392
3280
  },
2393
3281
  {
2394
- "name": "assets",
3282
+ "name": "venue",
3283
+ "type": "address",
3284
+ "internalType": "address"
3285
+ },
3286
+ {
3287
+ "name": "amount",
2395
3288
  "type": "uint256",
2396
- "indexed": false,
2397
3289
  "internalType": "uint256"
2398
3290
  },
2399
3291
  {
2400
- "name": "receiver",
3292
+ "name": "token",
2401
3293
  "type": "address",
2402
- "indexed": true,
2403
- "internalType": "address"
3294
+ "internalType": "contract IERC20"
2404
3295
  }
2405
3296
  ],
2406
- "anonymous": false
3297
+ "outputs": [],
3298
+ "stateMutability": "nonpayable"
2407
3299
  },
2408
3300
  {
2409
3301
  "type": "event",
2410
- "name": "CollateralPosted",
3302
+ "name": "Entered",
2411
3303
  "inputs": [
2412
3304
  {
2413
- "name": "marketId",
2414
- "type": "bytes32",
3305
+ "name": "kind",
3306
+ "type": "uint8",
2415
3307
  "indexed": true,
2416
- "internalType": "bytes32"
3308
+ "internalType": "uint8"
2417
3309
  },
2418
3310
  {
2419
- "name": "shares",
3311
+ "name": "venue",
3312
+ "type": "address",
3313
+ "indexed": true,
3314
+ "internalType": "address"
3315
+ },
3316
+ {
3317
+ "name": "amount",
2420
3318
  "type": "uint256",
2421
3319
  "indexed": false,
2422
3320
  "internalType": "uint256"
2423
- }
2424
- ],
2425
- "anonymous": false
2426
- },
2427
- {
2428
- "type": "event",
2429
- "name": "CollateralWithdrawn",
2430
- "inputs": [
2431
- {
2432
- "name": "marketId",
2433
- "type": "bytes32",
2434
- "indexed": true,
2435
- "internalType": "bytes32"
2436
3321
  },
2437
3322
  {
2438
- "name": "shares",
3323
+ "name": "positionGain",
2439
3324
  "type": "uint256",
2440
3325
  "indexed": false,
2441
3326
  "internalType": "uint256"
@@ -2445,63 +3330,31 @@ var init_abi = __esm({
2445
3330
  },
2446
3331
  {
2447
3332
  "type": "event",
2448
- "name": "Guarded",
3333
+ "name": "Exited",
2449
3334
  "inputs": [
2450
3335
  {
2451
- "name": "vault",
2452
- "type": "address",
2453
- "indexed": true,
2454
- "internalType": "address"
2455
- },
2456
- {
2457
- "name": "op",
3336
+ "name": "kind",
2458
3337
  "type": "uint8",
2459
- "indexed": false,
3338
+ "indexed": true,
2460
3339
  "internalType": "uint8"
2461
3340
  },
2462
3341
  {
2463
- "name": "ok",
2464
- "type": "bool",
2465
- "indexed": false,
2466
- "internalType": "bool"
3342
+ "name": "venue",
3343
+ "type": "address",
3344
+ "indexed": true,
3345
+ "internalType": "address"
2467
3346
  },
2468
3347
  {
2469
- "name": "reason",
2470
- "type": "bytes4",
3348
+ "name": "amount",
3349
+ "type": "uint256",
2471
3350
  "indexed": false,
2472
- "internalType": "bytes4"
2473
- }
2474
- ],
2475
- "anonymous": false
2476
- },
2477
- {
2478
- "type": "event",
2479
- "name": "HashApproved",
2480
- "inputs": [
2481
- {
2482
- "name": "hash",
2483
- "type": "bytes32",
2484
- "indexed": true,
2485
- "internalType": "bytes32"
3351
+ "internalType": "uint256"
2486
3352
  },
2487
3353
  {
2488
- "name": "validFrom",
2489
- "type": "uint64",
3354
+ "name": "received",
3355
+ "type": "uint256",
2490
3356
  "indexed": false,
2491
- "internalType": "uint64"
2492
- }
2493
- ],
2494
- "anonymous": false
2495
- },
2496
- {
2497
- "type": "event",
2498
- "name": "HashRevoked",
2499
- "inputs": [
2500
- {
2501
- "name": "hash",
2502
- "type": "bytes32",
2503
- "indexed": true,
2504
- "internalType": "bytes32"
3357
+ "internalType": "uint256"
2505
3358
  },
2506
3359
  {
2507
3360
  "name": "by",
@@ -2514,77 +3367,51 @@ var init_abi = __esm({
2514
3367
  },
2515
3368
  {
2516
3369
  "type": "event",
2517
- "name": "Lent",
3370
+ "name": "Forwarded",
2518
3371
  "inputs": [
2519
3372
  {
2520
- "name": "vault",
3373
+ "name": "token",
2521
3374
  "type": "address",
2522
3375
  "indexed": true,
2523
3376
  "internalType": "address"
2524
3377
  },
2525
3378
  {
2526
- "name": "assets",
2527
- "type": "uint256",
2528
- "indexed": false,
2529
- "internalType": "uint256"
2530
- },
2531
- {
2532
- "name": "shares",
2533
- "type": "uint256",
2534
- "indexed": false,
2535
- "internalType": "uint256"
2536
- },
2537
- {
2538
- "name": "viaBorro",
2539
- "type": "bool",
2540
- "indexed": false,
2541
- "internalType": "bool"
2542
- }
2543
- ],
2544
- "anonymous": false
2545
- },
2546
- {
2547
- "type": "event",
2548
- "name": "LinkedVaultChangeScheduled",
2549
- "inputs": [
2550
- {
2551
- "name": "vault",
3379
+ "name": "to",
2552
3380
  "type": "address",
2553
3381
  "indexed": true,
2554
3382
  "internalType": "address"
2555
3383
  },
2556
3384
  {
2557
- "name": "effectiveAt",
2558
- "type": "uint64",
3385
+ "name": "amount",
3386
+ "type": "uint256",
2559
3387
  "indexed": false,
2560
- "internalType": "uint64"
3388
+ "internalType": "uint256"
2561
3389
  }
2562
3390
  ],
2563
3391
  "anonymous": false
2564
3392
  },
2565
3393
  {
2566
3394
  "type": "event",
2567
- "name": "LinkedVaultSet",
3395
+ "name": "Guarded",
2568
3396
  "inputs": [
2569
3397
  {
2570
3398
  "name": "vault",
2571
3399
  "type": "address",
2572
3400
  "indexed": true,
2573
3401
  "internalType": "address"
2574
- }
2575
- ],
2576
- "anonymous": false
2577
- },
2578
- {
2579
- "type": "event",
2580
- "name": "MorphoFailed",
2581
- "inputs": [
3402
+ },
2582
3403
  {
2583
- "name": "action",
3404
+ "name": "op",
2584
3405
  "type": "uint8",
2585
- "indexed": true,
3406
+ "indexed": false,
2586
3407
  "internalType": "uint8"
2587
3408
  },
3409
+ {
3410
+ "name": "ok",
3411
+ "type": "bool",
3412
+ "indexed": false,
3413
+ "internalType": "bool"
3414
+ },
2588
3415
  {
2589
3416
  "name": "reason",
2590
3417
  "type": "bytes4",
@@ -2628,154 +3455,147 @@ var init_abi = __esm({
2628
3455
  },
2629
3456
  {
2630
3457
  "type": "event",
2631
- "name": "Redeemed",
3458
+ "name": "Swept",
2632
3459
  "inputs": [
2633
3460
  {
2634
- "name": "vault",
3461
+ "name": "withdrawal",
2635
3462
  "type": "address",
2636
3463
  "indexed": true,
2637
3464
  "internalType": "address"
2638
3465
  },
2639
3466
  {
2640
- "name": "shares",
3467
+ "name": "amount",
2641
3468
  "type": "uint256",
2642
3469
  "indexed": false,
2643
3470
  "internalType": "uint256"
2644
3471
  },
2645
3472
  {
2646
- "name": "assets",
2647
- "type": "uint256",
2648
- "indexed": false,
2649
- "internalType": "uint256"
3473
+ "name": "by",
3474
+ "type": "address",
3475
+ "indexed": true,
3476
+ "internalType": "address"
2650
3477
  }
2651
3478
  ],
2652
3479
  "anonymous": false
2653
3480
  },
2654
3481
  {
2655
3482
  "type": "event",
2656
- "name": "Repaid",
3483
+ "name": "VenueFailed",
2657
3484
  "inputs": [
2658
3485
  {
2659
- "name": "marketId",
2660
- "type": "bytes32",
2661
- "indexed": true,
2662
- "internalType": "bytes32"
2663
- },
2664
- {
2665
- "name": "onBehalf",
2666
- "type": "address",
3486
+ "name": "action",
3487
+ "type": "uint8",
2667
3488
  "indexed": true,
2668
- "internalType": "address"
2669
- },
2670
- {
2671
- "name": "assets",
2672
- "type": "uint256",
2673
- "indexed": false,
2674
- "internalType": "uint256"
3489
+ "internalType": "uint8"
2675
3490
  },
2676
3491
  {
2677
- "name": "shares",
2678
- "type": "uint256",
3492
+ "name": "reason",
3493
+ "type": "bytes4",
2679
3494
  "indexed": false,
2680
- "internalType": "uint256"
3495
+ "internalType": "bytes4"
2681
3496
  }
2682
3497
  ],
2683
3498
  "anonymous": false
2684
3499
  },
2685
3500
  {
2686
3501
  "type": "event",
2687
- "name": "Swept",
3502
+ "name": "VenueSet",
2688
3503
  "inputs": [
2689
3504
  {
2690
- "name": "withdrawal",
3505
+ "name": "kind",
3506
+ "type": "uint8",
3507
+ "indexed": true,
3508
+ "internalType": "uint8"
3509
+ },
3510
+ {
3511
+ "name": "venue",
2691
3512
  "type": "address",
2692
3513
  "indexed": true,
2693
3514
  "internalType": "address"
2694
3515
  },
2695
3516
  {
2696
- "name": "amount",
2697
- "type": "uint256",
3517
+ "name": "enabled",
3518
+ "type": "bool",
2698
3519
  "indexed": false,
2699
- "internalType": "uint256"
3520
+ "internalType": "bool"
2700
3521
  },
2701
3522
  {
2702
- "name": "by",
2703
- "type": "address",
2704
- "indexed": true,
2705
- "internalType": "address"
3523
+ "name": "effectiveAt",
3524
+ "type": "uint64",
3525
+ "indexed": false,
3526
+ "internalType": "uint64"
2706
3527
  }
2707
3528
  ],
2708
3529
  "anonymous": false
2709
3530
  },
2710
3531
  {
2711
3532
  "type": "event",
2712
- "name": "WithdrawalLockChangeScheduled",
3533
+ "name": "VenueTripped",
2713
3534
  "inputs": [
2714
3535
  {
2715
- "name": "withdrawal",
3536
+ "name": "kind",
3537
+ "type": "uint8",
3538
+ "indexed": true,
3539
+ "internalType": "uint8"
3540
+ },
3541
+ {
3542
+ "name": "venue",
2716
3543
  "type": "address",
2717
3544
  "indexed": true,
2718
3545
  "internalType": "address"
2719
3546
  },
2720
3547
  {
2721
- "name": "delay",
2722
- "type": "uint32",
3548
+ "name": "reasons",
3549
+ "type": "uint8",
2723
3550
  "indexed": false,
2724
- "internalType": "uint32"
3551
+ "internalType": "uint8"
2725
3552
  },
2726
3553
  {
2727
- "name": "dailyLimit",
2728
- "type": "uint128",
3554
+ "name": "amount",
3555
+ "type": "uint256",
2729
3556
  "indexed": false,
2730
- "internalType": "uint128"
3557
+ "internalType": "uint256"
2731
3558
  },
2732
3559
  {
2733
- "name": "effectiveAt",
2734
- "type": "uint64",
2735
- "indexed": false,
2736
- "internalType": "uint64"
3560
+ "name": "by",
3561
+ "type": "address",
3562
+ "indexed": true,
3563
+ "internalType": "address"
2737
3564
  }
2738
3565
  ],
2739
3566
  "anonymous": false
2740
3567
  },
2741
3568
  {
2742
3569
  "type": "event",
2743
- "name": "WithdrawalLockSet",
3570
+ "name": "WaitingVenuesCancelled",
2744
3571
  "inputs": [
2745
3572
  {
2746
- "name": "withdrawal",
3573
+ "name": "by",
2747
3574
  "type": "address",
2748
3575
  "indexed": true,
2749
3576
  "internalType": "address"
2750
- },
2751
- {
2752
- "name": "delay",
2753
- "type": "uint32",
2754
- "indexed": false,
2755
- "internalType": "uint32"
2756
- },
2757
- {
2758
- "name": "dailyLimit",
2759
- "type": "uint128",
2760
- "indexed": false,
2761
- "internalType": "uint128"
2762
3577
  }
2763
3578
  ],
2764
3579
  "anonymous": false
2765
3580
  },
2766
3581
  {
2767
3582
  "type": "error",
2768
- "name": "BadMarket",
3583
+ "name": "BadParams",
2769
3584
  "inputs": []
2770
3585
  },
2771
3586
  {
2772
3587
  "type": "error",
2773
- "name": "BadParams",
3588
+ "name": "BadVenue",
2774
3589
  "inputs": []
2775
3590
  },
2776
3591
  {
2777
3592
  "type": "error",
2778
- "name": "BadVault",
3593
+ "name": "Healthy",
3594
+ "inputs": []
3595
+ },
3596
+ {
3597
+ "type": "error",
3598
+ "name": "InLoss",
2779
3599
  "inputs": []
2780
3600
  },
2781
3601
  {
@@ -2790,7 +3610,7 @@ var init_abi = __esm({
2790
3610
  },
2791
3611
  {
2792
3612
  "type": "error",
2793
- "name": "LtvTooHigh",
3613
+ "name": "NotEnabled",
2794
3614
  "inputs": []
2795
3615
  },
2796
3616
  {
@@ -2835,6 +3655,17 @@ var init_abi = __esm({
2835
3655
  }
2836
3656
  ]
2837
3657
  },
3658
+ {
3659
+ "type": "error",
3660
+ "name": "VenueChanged",
3661
+ "inputs": [
3662
+ {
3663
+ "name": "reasons",
3664
+ "type": "uint8",
3665
+ "internalType": "uint8"
3666
+ }
3667
+ ]
3668
+ },
2838
3669
  {
2839
3670
  "type": "error",
2840
3671
  "name": "WrongToken",
@@ -13635,7 +14466,7 @@ var init_hash = __esm({
13635
14466
  });
13636
14467
 
13637
14468
  // ../sdk/src/constants.ts
13638
- var ROBINHOOD_CHAIN_ID, ROBINHOOD_PUBLIC_RPC, USDG, USDG_EIP712_DOMAIN, X402_BATCH_SETTLEMENT, X402_BATCH_SETTLEMENT_DOMAIN, X402_MIN_WITHDRAW_DELAY, X402_MAX_WITHDRAW_DELAY, UNISWAP_V4_POOL_MANAGER, CHAINLINK_ETH_USD, CHAINLINK_ETH_USD_DECIMALS, ERC8004_IDENTITY_REGISTRY, WETH, OSTRA, OSTRA_DECIMALS, OSTRA_PONS_CURVE, PONS_HOOK, OSTRA_POOL_FEE, OSTRA_POOL_TICK_SPACING, MULTICALL3, ARBITRUM_NODE_INTERFACE, MAX_FEE_BPS, DEPOSIT_TIMEOUT_SECONDS, VAULT_SWAP_GAS_RESERVE, VAULT_VERSION, VAULT_MAX_URI_LENGTH, VAULT_ACTION, VAULT_V3, VAULT_MAX_LTV_OF_LLTV_BPS, VAULT_MORPHO_MIN_GAS, VAULT_GUARD_MIN_GAS, GUARD_OP, MORPHO_BLUE, MORPHO_VAULT_V2_FACTORY, BORRO_BUILDERS, BORRO_ROUTER, BORRO_USDG_VAULT, BORRO_IRM, MORPHO_ADAPTIVE_CURVE_IRM, MORPHO_MARKET_V1_ADAPTER_V2_FACTORY, BORRO_STOCKS, MIN_RECOVERY_DELAY, MAX_RECOVERY_DELAY, POOL_SETTING, CIRCUIT_BREAKER, VAULT_SWAP_GAS, LAUNCHPAD, DEV_BUY, AIRDROP, CREATOR_SPLIT, DEPOSIT_STATUS, BATCH_STATUS;
14469
+ var ROBINHOOD_CHAIN_ID, ROBINHOOD_PUBLIC_RPC, USDG, USDG_EIP712_DOMAIN, X402_BATCH_SETTLEMENT, X402_BATCH_SETTLEMENT_DOMAIN, X402_MIN_WITHDRAW_DELAY, X402_MAX_WITHDRAW_DELAY, UNISWAP_V4_POOL_MANAGER, CHAINLINK_ETH_USD, CHAINLINK_ETH_USD_DECIMALS, ERC8004_IDENTITY_REGISTRY, WETH, OSTRA, OSTRA_DECIMALS, OSTRA_PONS_CURVE, PONS_HOOK, OSTRA_POOL_FEE, OSTRA_POOL_TICK_SPACING, MULTICALL3, ARBITRUM_NODE_INTERFACE, MAX_FEE_BPS, DEPOSIT_TIMEOUT_SECONDS, VAULT_SWAP_GAS_RESERVE, VAULT_VERSION, VAULT_MAX_URI_LENGTH, VAULT_ACTION, VAULT_V3, VAULT_MAX_LTV_OF_LLTV_BPS, VAULT_MORPHO_MIN_GAS, VAULT_GUARD_MIN_GAS, GUARD_OP, VENUE_KIND, VAULT_RAETO_USDG_MIN_GAS, VAULT_RAETO_STOCK_MIN_GAS, VAULT_ERC4626_MIN_GAS, VAULT_GUARD_EXIT_MIN_GAS, MORPHO_BLUE, MORPHO_VAULT_V2_FACTORY, BORRO_BUILDERS, BORRO_ROUTER, BORRO_USDG_VAULT, BORRO_IRM, MORPHO_ADAPTIVE_CURVE_IRM, MORPHO_MARKET_V1_ADAPTER_V2_FACTORY, BORRO_STOCKS, MIN_RECOVERY_DELAY, MAX_RECOVERY_DELAY, POOL_SETTING, CIRCUIT_BREAKER, VAULT_SWAP_GAS, LAUNCHPAD, DEV_BUY, AIRDROP, CREATOR_SPLIT, DEPOSIT_STATUS, BATCH_STATUS;
13639
14470
  var init_constants = __esm({
13640
14471
  "../sdk/src/constants.ts"() {
13641
14472
  "use strict";
@@ -13697,7 +14528,12 @@ var init_constants = __esm({
13697
14528
  BORROW: 21,
13698
14529
  REPAY: 22,
13699
14530
  APPROVE_HASH: 23,
13700
- GUARD: 24
14531
+ GUARD: 24,
14532
+ // Version 4 (OstraVault.sol notes; OstraVaultModuleV4 runs them, and CancelPendingChanges and a Guard spend with op 5).
14533
+ SET_VENUE: 25,
14534
+ ENTER: 26,
14535
+ EXIT: 27,
14536
+ FORWARD: 28
13701
14537
  };
13702
14538
  VAULT_V3 = 3;
13703
14539
  VAULT_MAX_LTV_OF_LLTV_BPS = 5000n;
@@ -13713,8 +14549,24 @@ var init_constants = __esm({
13713
14549
  /** Redeem Vault V2 shares back into the vault: abi.encode(address vault, uint256 shares). */
13714
14550
  REDEEM: 3,
13715
14551
  /** Take collateral back into the vault: abi.encode(bytes32 marketId, uint256 shares). */
13716
- WITHDRAW_COLLATERAL: 4
14552
+ WITHDRAW_COLLATERAL: 4,
14553
+ /** Version 4: bring a venue position back into the vault: abi.encode(uint8 kind, address venue, uint256 amount), amount 0 for all of it. */
14554
+ EXIT: 5,
14555
+ /** Version 4: EXIT, then SWEEP in the same call: abi.encode(uint8 kind, address venue, uint256 amount, address expected). */
14556
+ EXIT_SWEEP: 6
13717
14557
  };
14558
+ VENUE_KIND = {
14559
+ /** A Raeto USDG vault (RaetoVault): Enter deposit(amount), Exit withdrawTo(principal); position principalOf(vault). */
14560
+ RAETO_USDG: 1,
14561
+ /** A Raeto stock vault (RaetoStockVault): Enter deposit(amount), Exit withdrawTo(shares) (amount 0: claimLiquidation()); position stockOf(vault). */
14562
+ RAETO_STOCK: 2,
14563
+ /** An ERC-4626 vault: Enter deposit(assets), Exit redeem(shares); position convertToAssets(balanceOf(vault)). */
14564
+ ERC4626: 3
14565
+ };
14566
+ VAULT_RAETO_USDG_MIN_GAS = 3e6;
14567
+ VAULT_RAETO_STOCK_MIN_GAS = 24e5;
14568
+ VAULT_ERC4626_MIN_GAS = 6e5;
14569
+ VAULT_GUARD_EXIT_MIN_GAS = 25e5;
13718
14570
  MORPHO_BLUE = "0x9D53d5E3bd5E8d4Cbfa6DB1ca238AEA02E651010";
13719
14571
  MORPHO_VAULT_V2_FACTORY = "0x0FBad98595b0186dA120E41f77C102beb49f803c";
13720
14572
  BORRO_BUILDERS = "0x082Ae609bdC7ccEec0C58B2361a21c49dc2aE291";
@@ -14526,8 +15378,21 @@ function guardParams(vault, c) {
14526
15378
  else if (c.op === GUARD_OP.SWEEP) arg = pad(nonZeroAddr(c.expected, "expected"), { size: 32 });
14527
15379
  else if (c.op === GUARD_OP.REDEEM) [arg, amount] = [pad(nonZeroAddr(c.vault, "vault"), { size: 32 }), positive(c.shares, U256_MAX, "shares")];
14528
15380
  else if (c.op === GUARD_OP.WITHDRAW_COLLATERAL) [arg, amount] = [bytes322(c.marketId, "marketId"), positive(c.shares, U256_MAX, "shares")];
15381
+ else if (c.op === GUARD_OP.EXIT) [arg, amount] = [venueGuardArg(c.kind, c.venue), uint(c.amount, U256_MAX, "amount")];
15382
+ else if (c.op === GUARD_OP.EXIT_SWEEP) {
15383
+ if (c.amount !== 0n) throw new RangeError("a Guard spend with op 6 takes the whole position: amount must be 0");
15384
+ [arg, amount] = [venueGuardArg(c.kind, c.venue), BigInt(nonZeroAddr(c.expected, "expected"))];
15385
+ }
14529
15386
  return encodeAbiParameters2([{ type: "address" }, { type: "uint8" }, { type: "bytes32" }, { type: "uint256" }], [nonZeroAddr(vault, "vault"), c.op, arg, amount]);
14530
15387
  }
15388
+ function venueKind(value, name = "kind") {
15389
+ const kinds = Object.values(VENUE_KIND);
15390
+ if (!kinds.includes(value)) throw new RangeError(`${name} must be a venue kind (${kinds.join(", ")})`);
15391
+ return value;
15392
+ }
15393
+ function venueGuardArg(kind, venue) {
15394
+ return pad(numberToHex(BigInt(venueKind(kind)) << 160n | BigInt(nonZeroAddr(venue, "venue"))), { size: 32 });
15395
+ }
14531
15396
  function vaultSpendMessage(s) {
14532
15397
  return hexToBytes4(
14533
15398
  encodePacked3(
@@ -14786,7 +15651,11 @@ var init_messages = __esm({
14786
15651
  [VAULT_ACTION.BORROW]: [192],
14787
15652
  [VAULT_ACTION.REPAY]: [288],
14788
15653
  [VAULT_ACTION.APPROVE_HASH]: [64],
14789
- [VAULT_ACTION.GUARD]: [128]
15654
+ [VAULT_ACTION.GUARD]: [128],
15655
+ [VAULT_ACTION.SET_VENUE]: [96],
15656
+ [VAULT_ACTION.ENTER]: [128],
15657
+ [VAULT_ACTION.EXIT]: [128],
15658
+ [VAULT_ACTION.FORWARD]: [64]
14790
15659
  };
14791
15660
  URI_PARAMS_HEADS = {
14792
15661
  [VAULT_ACTION.SET_PROFILE]: 1,
@@ -15796,6 +16665,11 @@ function parseDeployment(value) {
15796
16665
  if (v.vaultModule === void 0) throw new Error("a deployment with a breaker has a vaultModule");
15797
16666
  out.breaker = getAddress7(v.breaker);
15798
16667
  }
16668
+ if (v.vaultModuleV4 !== void 0) {
16669
+ if (typeof v.vaultModuleV4 !== "string" || !isAddress3(v.vaultModuleV4, { strict: false })) throw new Error("deployment vaultModuleV4 is not an address");
16670
+ if (v.vaultModule === void 0) throw new Error("a deployment with a vaultModuleV4 has a vaultModule");
16671
+ out.vaultModuleV4 = getAddress7(v.vaultModuleV4);
16672
+ }
15799
16673
  if (v.launchpad !== void 0) {
15800
16674
  if (typeof v.launchpad !== "object" || v.launchpad === null) throw new Error("deployment launchpad must be an object");
15801
16675
  const l = v.launchpad;
@@ -18822,7 +19696,7 @@ var init_pad_rules = __esm({
18822
19696
  });
18823
19697
 
18824
19698
  // ../sdk/src/tide.ts
18825
- import { encodeAbiParameters as encodeAbiParameters7, getAddress as getAddress10, keccak256 as keccak25610 } from "viem";
19699
+ import { encodeAbiParameters as encodeAbiParameters7, getAddress as getAddress10, isAddress as isAddress5, keccak256 as keccak25610 } from "viem";
18826
19700
  function tideWeekAt(t) {
18827
19701
  return t < TIDE_START ? 0 : Math.floor((t - TIDE_START) / TIDE_WEEK) + 1;
18828
19702
  }
@@ -18858,7 +19732,8 @@ function tideMemberDigest(p) {
18858
19732
  function tideSetDigest(p) {
18859
19733
  const vaults = tideSortVaults(p.vaults);
18860
19734
  const payee = p.payee === null ? "0x0000000000000000000000000000000000000000" : getAddress10(p.payee);
18861
- if (p.payee !== null && !vaults.includes(payee)) throw new RangeError("the payee must be one of the linked vaults");
19735
+ if (p.payee !== null && p.outsidePayee !== true && !vaults.includes(payee)) throw new RangeError("the payee must be one of the linked vaults");
19736
+ if (p.outsidePayee === true && (p.payee === null || vaults.includes(payee))) throw new RangeError("a payee outside the list is an address that is not one of the linked vaults");
18862
19737
  const listHash = keccak25610(encodeAbiParameters7([{ type: "address[]" }], [vaults]));
18863
19738
  return keccak25610(
18864
19739
  encodeAbiParameters7(
@@ -18870,12 +19745,25 @@ function tideSetDigest(p) {
18870
19745
  function tideViewKey(secret2) {
18871
19746
  return keccak25610(encodeAbiParameters7([{ type: "string" }, { type: "bytes32" }], ["OSTRA/TIDE/VIEW/v1", secretWord(secret2)]));
18872
19747
  }
19748
+ function tidePayeeCreation(raw) {
19749
+ const c = raw;
19750
+ if (c === null || typeof c !== "object" || Array.isArray(c)) throw new RangeError("a payee's creation params are {token, initialKeyRoot, initialCrank}");
19751
+ if (typeof c.token !== "string" || !isAddress5(c.token, { strict: false }) || getAddress10(c.token) !== OSTRA) throw new RangeError(`a payee created at payout is an OSTRA vault: its token is ${OSTRA}`);
19752
+ if (typeof c.initialKeyRoot !== "string" || !/^0x[0-9a-fA-F]{64}$/.test(c.initialKeyRoot) || BigInt(c.initialKeyRoot) === 0n) throw new RangeError("a payee's initialKeyRoot is 32 bytes of hex, not zero");
19753
+ if (typeof c.initialCrank !== "string" || !isAddress5(c.initialCrank, { strict: false })) throw new RangeError("a payee's initialCrank is an address");
19754
+ return { token: OSTRA, initialKeyRoot: c.initialKeyRoot.toLowerCase(), initialCrank: getAddress10(c.initialCrank) };
19755
+ }
19756
+ function tidePayeeVault(d, c) {
19757
+ const p = tidePayeeCreation(c);
19758
+ return vaultAddress({ factory: d.vaultFactory, beacon: d.vaultBeacon, token: p.token, initialKeyRoot: p.initialKeyRoot, initialCrank: p.initialCrank });
19759
+ }
18873
19760
  var OSTRA_TIDE, TIDE_START, TIDE_WEEK, U256_MAX2, TIDE_MAX_LINKED_VAULTS;
18874
19761
  var init_tide = __esm({
18875
19762
  "../sdk/src/tide.ts"() {
18876
19763
  "use strict";
18877
19764
  init_define_OSTRA_PACKAGED();
18878
19765
  init_constants();
19766
+ init_messages();
18879
19767
  OSTRA_TIDE = "0xDdEA3123A9AA9a43228300A6D06E6E3252556Db9";
18880
19768
  TIDE_START = 1793145600;
18881
19769
  TIDE_WEEK = 604800;
@@ -19035,7 +19923,7 @@ import {
19035
19923
  encodeFunctionData as encodeFunctionData4,
19036
19924
  getAddress as getAddress12,
19037
19925
  hexToBytes as hexToBytes7,
19038
- isAddress as isAddress5,
19926
+ isAddress as isAddress6,
19039
19927
  isHex as isHex2,
19040
19928
  keccak256 as keccak25611,
19041
19929
  toEventSelector,
@@ -19179,17 +20067,28 @@ function floorGasOf(tx) {
19179
20067
  const out = [];
19180
20068
  for (const c of relayedCalls(tx)) {
19181
20069
  if (c.data.slice(0, 10).toLowerCase() !== SPEND_SELECTOR) continue;
19182
- let action;
20070
+ let args;
19183
20071
  try {
19184
- action = Number(decodeFunctionData3({ abi: ostraVaultAbi, data: c.data }).args[0]);
20072
+ args = decodeFunctionData3({ abi: ostraVaultAbi, data: c.data }).args;
19185
20073
  } catch {
19186
20074
  continue;
19187
20075
  }
19188
- if (action >= VAULT_ACTION.LEND && action <= VAULT_ACTION.REPAY) out.push(BigInt(VAULT_MORPHO_MIN_GAS));
19189
- else if (action === VAULT_ACTION.GUARD || action === VAULT_ACTION.SUPPORT_RECOVERY) out.push(BigInt(VAULT_GUARD_MIN_GAS));
20076
+ const floor = spendFloorGas(Number(args[0]), args[2]);
20077
+ if (floor !== 0n) out.push(floor);
19190
20078
  }
19191
20079
  return out;
19192
20080
  }
20081
+ function spendFloorGas(action, params) {
20082
+ const word2 = (i) => params.length >= 2 + 64 * (i + 1) ? BigInt(`0x${params.slice(2 + 64 * i, 2 + 64 * (i + 1))}`) : 0n;
20083
+ if (action >= VAULT_ACTION.LEND && action <= VAULT_ACTION.REPAY) return BigInt(VAULT_MORPHO_MIN_GAS);
20084
+ if (action === VAULT_ACTION.GUARD) return BigInt((word2(1) & 0xffn) >= BigInt(GUARD_OP.EXIT) ? VAULT_GUARD_EXIT_MIN_GAS : VAULT_GUARD_MIN_GAS);
20085
+ if (action === VAULT_ACTION.SUPPORT_RECOVERY) return BigInt(VAULT_GUARD_MIN_GAS);
20086
+ if (action === VAULT_ACTION.ENTER || action === VAULT_ACTION.EXIT) {
20087
+ const kind = word2(0);
20088
+ return BigInt(kind === BigInt(VENUE_KIND.RAETO_USDG) ? VAULT_RAETO_USDG_MIN_GAS : kind === BigInt(VENUE_KIND.RAETO_STOCK) ? VAULT_RAETO_STOCK_MIN_GAS : VAULT_ERC4626_MIN_GAS);
20089
+ }
20090
+ return 0n;
20091
+ }
19193
20092
  function relayedCalls(tx) {
19194
20093
  if (getAddress12(tx.to) !== MULTICALL3) return [{ to: getAddress12(tx.to), data: tx.data }];
19195
20094
  try {
@@ -19275,6 +20174,10 @@ function failedModuleSpends(logs, vaults) {
19275
20174
  const e = decodeEventLog({ abi: ostraVaultModuleAbi, eventName: "Guarded", topics: log2.topics, data: log2.data });
19276
20175
  const args = e.args;
19277
20176
  if (!args.ok) out.push({ vault: getAddress12(log2.address), kind: "guard", action: Number(args.op), reason: args.reason });
20177
+ } else if (topic === VENUE_FAILED_TOPIC.toLowerCase()) {
20178
+ const e = decodeEventLog({ abi: ostraVaultModuleV4Abi, eventName: "VenueFailed", topics: log2.topics, data: log2.data });
20179
+ const args = e.args;
20180
+ out.push({ vault: getAddress12(log2.address), kind: "venue", action: Number(args.action), reason: args.reason });
19278
20181
  }
19279
20182
  }
19280
20183
  return out;
@@ -19283,7 +20186,7 @@ function moduleFailureText(reason) {
19283
20186
  if (reason === "0x" || /^0x0{8}$/.test(reason)) return "a revert without a reason (out of gas, or a call to code that is not there)";
19284
20187
  return VAULT_ERROR_NAMES.get(reason.slice(0, 10).toLowerCase()) ?? `a revert with ${reason.slice(0, 10)}`;
19285
20188
  }
19286
- var RELAYER_MARGIN_BPS, RELAYER_QUOTE_TOLERANCE_BPS, ETH_USD_DEVIATION_BPS, ETH_USD_MAX_AGE_SECONDS, MAX_RELAY_CALLS, BPS2, WEI_PER_ETH_EXP, ceilDiv, RelaySimulationError, OSTRA_ERRORS, EXECUTE_ESCROW_SELECTOR, ESCROW_EXECUTED_TOPIC, ESCROW_GAS_PRECISION_BPS, ESCROW_GAS_MAX_FACTOR, ESCROW_GAS_MAX_EXTRA, MAX_RELAY_GAS, SPEND_SELECTOR, LAUNCH_FROM_VAULT_SELECTOR, SWAP_FAILED_TOPIC, MORPHO_FAILED_TOPIC, GUARDED_TOPIC, VAULT_ERROR_NAMES;
20189
+ var RELAYER_MARGIN_BPS, RELAYER_QUOTE_TOLERANCE_BPS, ETH_USD_DEVIATION_BPS, ETH_USD_MAX_AGE_SECONDS, MAX_RELAY_CALLS, BPS2, WEI_PER_ETH_EXP, ceilDiv, RelaySimulationError, OSTRA_ERRORS, EXECUTE_ESCROW_SELECTOR, ESCROW_EXECUTED_TOPIC, ESCROW_GAS_PRECISION_BPS, ESCROW_GAS_MAX_FACTOR, ESCROW_GAS_MAX_EXTRA, MAX_RELAY_GAS, SPEND_SELECTOR, LAUNCH_FROM_VAULT_SELECTOR, SWAP_FAILED_TOPIC, MORPHO_FAILED_TOPIC, GUARDED_TOPIC, VENUE_FAILED_TOPIC, VAULT_ERROR_NAMES;
19287
20190
  var init_relayer = __esm({
19288
20191
  "../sdk/src/relayer.ts"() {
19289
20192
  "use strict";
@@ -19343,12 +20246,15 @@ var init_relayer = __esm({
19343
20246
  ostraVaultModuleAbi.find((x) => x.type === "event" && x.name === "MorphoFailed")
19344
20247
  );
19345
20248
  GUARDED_TOPIC = toEventSelector(ostraVaultModuleAbi.find((x) => x.type === "event" && x.name === "Guarded"));
20249
+ VENUE_FAILED_TOPIC = toEventSelector(
20250
+ ostraVaultModuleV4Abi.find((x) => x.type === "event" && x.name === "VenueFailed")
20251
+ );
19346
20252
  VAULT_ERROR_NAMES = /* @__PURE__ */ new Map();
19347
- for (const item of [...ostraVaultAbi, ...ostraVaultModuleAbi]) {
20253
+ for (const item of [...ostraVaultAbi, ...ostraVaultModuleAbi, ...ostraVaultModuleV4Abi]) {
19348
20254
  if (item.type !== "error" || item.name === void 0) continue;
19349
20255
  VAULT_ERROR_NAMES.set(toFunctionSelector2(`${item.name}(${(item.inputs ?? []).map((i) => i.type).join(",")})`).toLowerCase(), item.name);
19350
20256
  }
19351
- VAULT_ERROR_NAMES.set("0x08c379a0", "Error(string), a check of Morpho or of the Vault V2");
20257
+ VAULT_ERROR_NAMES.set("0x08c379a0", "Error(string), a check of Morpho, of the Vault V2 or of the venue");
19352
20258
  VAULT_ERROR_NAMES.set("0x4e487b71", "Panic");
19353
20259
  }
19354
20260
  });
@@ -20407,7 +21313,7 @@ var init_config = __esm({
20407
21313
  });
20408
21314
 
20409
21315
  // ../core/src/relay.ts
20410
- import { decodeFunctionData as decodeFunctionData4, getAddress as getAddress18, isAddress as isAddress6 } from "viem";
21316
+ import { decodeFunctionData as decodeFunctionData4, getAddress as getAddress18, isAddress as isAddress7 } from "viem";
20411
21317
  import { x402Client, x402HTTPClient } from "@x402/core/client";
20412
21318
  import { toClientEvmSigner } from "@x402/evm";
20413
21319
  import { BatchSettlementEvmScheme } from "@x402/evm/batch-settlement/client";
@@ -20416,7 +21322,7 @@ function notLandedError(attempts, lastReason) {
20416
21322
  return new Error(`the relayer could not land the request in ${attempts} attempts${reason === "" ? "" : `; it answered last: ${reason}`}`);
20417
21323
  }
20418
21324
  function address(value, what) {
20419
- if (typeof value !== "string" || !isAddress6(value, { strict: false })) throw new Error(`${what} is not an address`);
21325
+ if (typeof value !== "string" || !isAddress7(value, { strict: false })) throw new Error(`${what} is not an address`);
20420
21326
  return getAddress18(value);
20421
21327
  }
20422
21328
  function checkSplits(raw, what) {
@@ -20485,10 +21391,10 @@ function relayerSpendPlan(p) {
20485
21391
  function relayerOfferProblem(r, want) {
20486
21392
  if (r.scheme !== "batch-settlement") return `the offer is ${r.scheme}, not batch-settlement`;
20487
21393
  if (r.network !== want.network) return `the offer is on ${r.network}, not ${want.network}`;
20488
- if (!isAddress6(r.asset, { strict: false }) || getAddress18(r.asset) !== getAddress18(want.config.token)) return `the offer is in ${r.asset}, not ${want.config.token}`;
20489
- if (!isAddress6(r.payTo, { strict: false }) || getAddress18(r.payTo) !== getAddress18(want.config.receiver)) return `the offer pays ${r.payTo}, not the relayer's split ${want.config.receiver}`;
21394
+ if (!isAddress7(r.asset, { strict: false }) || getAddress18(r.asset) !== getAddress18(want.config.token)) return `the offer is in ${r.asset}, not ${want.config.token}`;
21395
+ if (!isAddress7(r.payTo, { strict: false }) || getAddress18(r.payTo) !== getAddress18(want.config.receiver)) return `the offer pays ${r.payTo}, not the relayer's split ${want.config.receiver}`;
20490
21396
  const extra = r.extra ?? {};
20491
- if (typeof extra.receiverAuthorizer !== "string" || !isAddress6(extra.receiverAuthorizer, { strict: false }) || getAddress18(extra.receiverAuthorizer) !== getAddress18(want.config.receiverAuthorizer)) {
21397
+ if (typeof extra.receiverAuthorizer !== "string" || !isAddress7(extra.receiverAuthorizer, { strict: false }) || getAddress18(extra.receiverAuthorizer) !== getAddress18(want.config.receiverAuthorizer)) {
20492
21398
  return `the offer's receiverAuthorizer is ${String(extra.receiverAuthorizer)}, not the relayer's vault ${want.config.receiverAuthorizer}`;
20493
21399
  }
20494
21400
  if (extra.withdrawDelay !== want.config.withdrawDelay) return `the offer's withdrawDelay is ${String(extra.withdrawDelay)}, not the relayer's ${want.config.withdrawDelay} s`;
@@ -21216,7 +22122,7 @@ var init_random = __esm({
21216
22122
  });
21217
22123
 
21218
22124
  // ../core/src/vault.ts
21219
- import { bytesToHex as bytesToHex8, encodeAbiParameters as encodeAbiParameters10, encodeFunctionData as encodeFunctionData7, getAddress as getAddress19, isAddress as isAddress7, keccak256 as keccak25616, zeroAddress as zeroAddress11 } from "viem";
22125
+ import { bytesToHex as bytesToHex8, encodeAbiParameters as encodeAbiParameters10, encodeFunctionData as encodeFunctionData7, getAddress as getAddress19, isAddress as isAddress8, keccak256 as keccak25616, zeroAddress as zeroAddress11 } from "viem";
21220
22126
  function spendGas(calls) {
21221
22127
  return calls.reduce((gas, c) => gas + reservedSwapGas(c), VAULT_SPEND_GAS);
21222
22128
  }
@@ -21279,7 +22185,7 @@ var init_vault = __esm({
21279
22185
  /** Seller vault: the crank it is (or will be) created with, which is part of its address. */
21280
22186
  setInitCrank(crank) {
21281
22187
  if (this.kind !== "seller") throw new Error(`the ${this.kind} vault is created without a crank`);
21282
- if (!isAddress7(crank, { strict: false })) throw new RangeError("a crank is an address");
22188
+ if (!isAddress8(crank, { strict: false })) throw new RangeError("a crank is an address");
21283
22189
  this.#initCrank = getAddress19(crank);
21284
22190
  }
21285
22191
  /** A vault in the deployment's token (USDG); else a token vault or a pair's creator vault, paid for by the buyer vault. */
@@ -21316,7 +22222,7 @@ var init_vault = __esm({
21316
22222
  const text2 = await this.#keys.folder.read(this.#adoptedName());
21317
22223
  if (text2 === void 0) return null;
21318
22224
  const r = JSON.parse(text2);
21319
- if (r.chainId !== this.#config.chainId || typeof r.token !== "string" || getAddress19(r.token) !== this.token || typeof r.vault !== "string" || !isAddress7(r.vault, { strict: false })) {
22225
+ if (r.chainId !== this.#config.chainId || typeof r.token !== "string" || getAddress19(r.token) !== this.token || typeof r.vault !== "string" || !isAddress8(r.vault, { strict: false })) {
21320
22226
  throw new Error(`${this.#adoptedName()} is not a recovered vault of chain ${this.#config.chainId} in ${this.token}`);
21321
22227
  }
21322
22228
  const keyIndexes = Array.isArray(r.keyIndexes) ? r.keyIndexes.filter((x) => typeof x === "string" && /^[0-9]+$/.test(x)).map((x) => BigInt(x)) : [];
@@ -21442,6 +22348,15 @@ var init_vault = __esm({
21442
22348
  const d = this.#config.deployment;
21443
22349
  return { to: d.vaultFactory, data: encodeFunctionData7({ abi: ostraVaultFactoryAbi, functionName: "createVault", args: [this.token, this.#keyRoot(0n), this.#initCrank] }) };
21444
22350
  }
22351
+ /**
22352
+ * The parameters createCall creates this vault with: its token, key 0 of its keychain and its initial crank (the
22353
+ * ones vaultAddress computes it from, unless this seed recovered another vault). Anyone may send them to the factory:
22354
+ * the vault they create answers to this seed's keys alone (Ostra Tide creates an agent's OSTRA vault with them).
22355
+ */
22356
+ creationParams() {
22357
+ if (this.#initCrank === null) throw new Error(this.#missing());
22358
+ return { token: this.token, initialKeyRoot: this.#keyRoot(0n), initialCrank: this.#initCrank };
22359
+ }
21445
22360
  /** Gas the local fee payer needs to create this vault. */
21446
22361
  createGas() {
21447
22362
  return CREATE_VAULT_GAS;
@@ -21847,7 +22762,7 @@ the signed ${op.what} is kept; the next call on this vault sends it again before
21847
22762
  return this.#serial(async () => {
21848
22763
  const amount = parseTokenAmount(amountText2);
21849
22764
  if (amount === 0n) throw new RangeError("amount must be greater than zero");
21850
- if (!isAddress7(destinationText, { strict: false })) throw new RangeError(`${destinationText} is not an address`);
22765
+ if (!isAddress8(destinationText, { strict: false })) throw new RangeError(`${destinationText} is not an address`);
21851
22766
  const destination = getAddress19(destinationText);
21852
22767
  if (destination === zeroAddress11) throw new RangeError("the destination must not be the zero address");
21853
22768
  await this.#checkToken();
@@ -21982,7 +22897,7 @@ the signed channel open is kept; the next open_channel or withdraw call sends it
21982
22897
  */
21983
22898
  setCrankKey(crankText, via) {
21984
22899
  return this.#serial(async () => {
21985
- if (!isAddress7(crankText, { strict: false })) throw new RangeError("a crank is an address");
22900
+ if (!isAddress8(crankText, { strict: false })) throw new RangeError("a crank is an address");
21986
22901
  const crank = getAddress19(crankText);
21987
22902
  const target = crank === zeroAddress11 ? null : crank;
21988
22903
  const vault = await this.vaultAddress();
@@ -22073,7 +22988,7 @@ the signed operation is kept; the next call on this vault sends it again before
22073
22988
  }
22074
22989
  /** Adds (enabled) or removes a guardian of this vault: another Ostra vault keeps the recovery post-quantum. */
22075
22990
  async setGuardian(guardianText, enabled, via) {
22076
- if (!isAddress7(guardianText, { strict: false })) throw new RangeError(`${guardianText} is not an address`);
22991
+ if (!isAddress8(guardianText, { strict: false })) throw new RangeError(`${guardianText} is not an address`);
22077
22992
  const guardian = getAddress19(guardianText);
22078
22993
  if (guardian === zeroAddress11) throw new RangeError("a guardian is not the zero address");
22079
22994
  return this.#recoverySpend(
@@ -22122,7 +23037,7 @@ the signed operation is kept; the next call on this vault sends it again before
22122
23037
  }
22123
23038
  /** As a guardian (this vault), supports moving `vaultText` to `newKeyRootText` (the key root its owner's new device gave). */
22124
23039
  async supportRecovery(vaultText, newKeyRootText, via) {
22125
- if (!isAddress7(vaultText, { strict: false })) throw new RangeError(`${vaultText} is not an address`);
23040
+ if (!isAddress8(vaultText, { strict: false })) throw new RangeError(`${vaultText} is not an address`);
22126
23041
  const target = getAddress19(vaultText);
22127
23042
  if (!/^0x[0-9a-fA-F]{64}$/.test(newKeyRootText) || /^0x0{64}$/.test(newKeyRootText)) throw new RangeError("the new key root is 32 bytes of 0x hex, not zero");
22128
23043
  const newKeyRoot = newKeyRootText.toLowerCase();
@@ -22152,7 +23067,7 @@ the signed operation is kept; the next call on this vault sends it again before
22152
23067
  requestRecovery(vaultText) {
22153
23068
  return this.#serial(async () => {
22154
23069
  if (this.kind === "private") throw new Error("a private vault is recovered with the seed that unshielded it");
22155
- if (!isAddress7(vaultText, { strict: false })) throw new RangeError(`${vaultText} is not an address`);
23070
+ if (!isAddress8(vaultText, { strict: false })) throw new RangeError(`${vaultText} is not an address`);
22156
23071
  const vault = getAddress19(vaultText);
22157
23072
  const v = await readVault(this.#client, this.#config.deployment, vault);
22158
23073
  if (v === null || v.token !== this.token) throw new Error(`${vault} is not an Ostra vault in ${this.token}`);
@@ -22215,7 +23130,7 @@ the signed operation is kept; the next call on this vault sends it again before
22215
23130
  });
22216
23131
 
22217
23132
  // ../core/src/borro.ts
22218
- import { encodeFunctionData as encodeFunctionData8, getAddress as getAddress20, isAddress as isAddress8, keccak256 as keccak25617, toHex as toHex3, zeroAddress as zeroAddress12 } from "viem";
23133
+ import { encodeFunctionData as encodeFunctionData8, getAddress as getAddress20, isAddress as isAddress9, keccak256 as keccak25617, toHex as toHex3, zeroAddress as zeroAddress12 } from "viem";
22219
23134
  function isoTime(unix) {
22220
23135
  return new Date(Number(unix) * 1e3).toISOString();
22221
23136
  }
@@ -22227,8 +23142,8 @@ function amountText(text2, decimals, what) {
22227
23142
  function less(x, bps) {
22228
23143
  return x * (10000n - bps) / 10000n;
22229
23144
  }
22230
- function gasFloor(action) {
22231
- return action >= VAULT_ACTION.LEND && action <= VAULT_ACTION.REPAY ? BigInt(VAULT_MORPHO_MIN_GAS) : action === VAULT_ACTION.GUARD ? BigInt(VAULT_GUARD_MIN_GAS) : 0n;
23145
+ function gasFloor(action, params) {
23146
+ return spendFloorGas(action, params);
22232
23147
  }
22233
23148
  function standInSignature() {
22234
23149
  let out = "";
@@ -22283,7 +23198,7 @@ var init_borro2 = __esm({
22283
23198
  const address6 = await vault.vaultAddress();
22284
23199
  await this.#v3(address6);
22285
23200
  const gasUsed = await this.#simulate(address6, action, params, what);
22286
- const floor = gasFloor(action);
23201
+ const floor = gasFloor(action, params);
22287
23202
  let gas = gasUsed * 5n / 4n + SPEND_GAS_HEADROOM + floor;
22288
23203
  if (gas < VAULT_SPEND_GAS + floor) gas = VAULT_SPEND_GAS + floor;
22289
23204
  return vault.operate({
@@ -22432,7 +23347,7 @@ var init_borro2 = __esm({
22432
23347
  const at = await vault.vaultAddress();
22433
23348
  const data = encodeFunctionData8({ abi: ostraVaultAbi, functionName: "spend", args: [action, keccak25617(toHex3("OSTRA/STRATEGY/NEXT-ROOT")), params, standInSignature()] });
22434
23349
  const [l1, gasPrice] = await Promise.all([l1DataGas(this.#p.client, at, data), this.#p.gasPrice === void 0 ? this.#p.client.getGasPrice() : this.#p.gasPrice()]);
22435
- const gas = gasUsed + gasFloor(action) + l1;
23350
+ const gas = gasUsed + gasFloor(action, params) + l1;
22436
23351
  const ethUsd = await (this.#p.ethUsd ?? chainlinkEthUsd(this.#p.client))();
22437
23352
  return { gas, usdg: weiToTokenUnits(withMargin(gas * gasPrice), ethUsd, TOKEN_DECIMALS) };
22438
23353
  }
@@ -22541,7 +23456,7 @@ var init_borro2 = __esm({
22541
23456
  const { vault } = this.#vaultOf(what);
22542
23457
  at = await this.#address(vault, what.toUpperCase());
22543
23458
  } else {
22544
- if (!isAddress8(otherText, { strict: false })) throw new RangeError(`${otherText} is not an address`);
23459
+ if (!isAddress9(otherText, { strict: false })) throw new RangeError(`${otherText} is not an address`);
22545
23460
  at = getAddress20(otherText);
22546
23461
  if (await readVault(this.#p.client, this.#p.config.deployment, at) === null) throw new Error(`${at} is not an Ostra vault`);
22547
23462
  }
@@ -22572,7 +23487,7 @@ var init_borro2 = __esm({
22572
23487
  const { vault, decimals, stock: stock2 } = this.#vaultOf(what);
22573
23488
  const at = await this.#address(vault, what.toUpperCase());
22574
23489
  const off = withdrawalText === "off";
22575
- if (!off && !isAddress8(withdrawalText, { strict: false })) throw new RangeError(`${withdrawalText} is not an address`);
23490
+ if (!off && !isAddress9(withdrawalText, { strict: false })) throw new RangeError(`${withdrawalText} is not an address`);
22576
23491
  const withdrawal = off ? zeroAddress12 : getAddress20(withdrawalText);
22577
23492
  let warning;
22578
23493
  if (!off) {
@@ -22607,7 +23522,7 @@ var init_borro2 = __esm({
22607
23522
  const { vault } = this.#vaultOf(what);
22608
23523
  const at = await this.#address(vault, what.toUpperCase());
22609
23524
  const none = linkText === "none";
22610
- if (!none && !isAddress8(linkText, { strict: false })) throw new RangeError(`${linkText} is not an address`);
23525
+ if (!none && !isAddress9(linkText, { strict: false })) throw new RangeError(`${linkText} is not an address`);
22611
23526
  const link2 = none ? zeroAddress12 : getAddress20(linkText);
22612
23527
  if (link2 === at) throw new RangeError("a vault does not link to itself");
22613
23528
  return this.#spend(vault, VAULT_ACTION.SET_LINKED_VAULT, setLinkedVaultParams(link2), none ? "unlink" : `link to ${link2}`);
@@ -22626,7 +23541,7 @@ var init_borro2 = __esm({
22626
23541
  * into it (OstraVault.guard through a Guard spend).
22627
23542
  */
22628
23543
  async guardOther(vaultText, call) {
22629
- if (!isAddress8(vaultText, { strict: false })) throw new RangeError(`${vaultText} is not an address`);
23544
+ if (!isAddress9(vaultText, { strict: false })) throw new RangeError(`${vaultText} is not an address`);
22630
23545
  const target = getAddress20(vaultText);
22631
23546
  await this.#v3(target);
22632
23547
  const g = await readVaultGuard(this.#p.client, target);
@@ -22785,7 +23700,7 @@ var init_breaker2 = __esm({
22785
23700
  });
22786
23701
 
22787
23702
  // ../core/src/channels.ts
22788
- import { bytesToHex as bytesToHex9, decodeFunctionData as decodeFunctionData5, encodeFunctionData as encodeFunctionData10, getAddress as getAddress22, isAddress as isAddress9, parseAbiItem as parseAbiItem4 } from "viem";
23703
+ import { bytesToHex as bytesToHex9, decodeFunctionData as decodeFunctionData5, encodeFunctionData as encodeFunctionData10, getAddress as getAddress22, isAddress as isAddress10, parseAbiItem as parseAbiItem4 } from "viem";
22789
23704
  async function channelOpenedLogs(client, vault, channel, fromBlock, toBlock) {
22790
23705
  const out = [];
22791
23706
  for (let from = fromBlock; from <= toBlock; from += LOG_WINDOW_BLOCKS) {
@@ -22800,7 +23715,7 @@ function parseRecipients(input) {
22800
23715
  let sum = 0;
22801
23716
  const out = [];
22802
23717
  for (const r of input) {
22803
- if (!isAddress9(r.recipient, { strict: false })) throw new RangeError(`${r.recipient} is not an address`);
23718
+ if (!isAddress10(r.recipient, { strict: false })) throw new RangeError(`${r.recipient} is not an address`);
22804
23719
  const recipient = getAddress22(r.recipient);
22805
23720
  if (BigInt(recipient) === 0n) throw new RangeError("a recipient must not be the zero address");
22806
23721
  if (!Number.isInteger(r.bps) || r.bps < 1 || r.bps > BPS_DENOMINATOR2) throw new RangeError(`the bps of ${recipient} must be an integer from 1 to ${BPS_DENOMINATOR2}`);
@@ -22946,7 +23861,7 @@ var init_channels = __esm({
22946
23861
  #check(record, name) {
22947
23862
  if (record.version !== 1 || this.#name(record.salt) !== name || !/^0x[0-9a-f]{64}$/.test(record.channel)) throw new Error(`corrupt channel record ${name}`);
22948
23863
  for (const a of [record.vault, record.payee, record.voucherKey, record.token]) {
22949
- if (!isAddress9(a, { strict: false })) throw new Error(`corrupt channel record ${name}`);
23864
+ if (!isAddress10(a, { strict: false })) throw new Error(`corrupt channel record ${name}`);
22950
23865
  }
22951
23866
  return record;
22952
23867
  }
@@ -23023,7 +23938,7 @@ var init_channels = __esm({
23023
23938
  }
23024
23939
  open(input) {
23025
23940
  return this.#serial(async () => {
23026
- if (!isAddress9(input.payee, { strict: false })) throw new RangeError(`${input.payee} is not an address`);
23941
+ if (!isAddress10(input.payee, { strict: false })) throw new RangeError(`${input.payee} is not an address`);
23027
23942
  const payee = getAddress22(input.payee);
23028
23943
  const deposit = parseTokenAmount(input.deposit);
23029
23944
  if (deposit === 0n) throw new RangeError("deposit must be greater than zero");
@@ -23688,12 +24603,12 @@ var init_keys = __esm({
23688
24603
  });
23689
24604
 
23690
24605
  // ../core/src/pools.ts
23691
- import { getAddress as getAddress24, isAddress as isAddress10, zeroAddress as zeroAddress13 } from "viem";
24606
+ import { getAddress as getAddress24, isAddress as isAddress11, zeroAddress as zeroAddress13 } from "viem";
23692
24607
  function iso(seconds) {
23693
24608
  return new Date(Number(seconds) * 1e3).toISOString();
23694
24609
  }
23695
24610
  function launchedTokenAddress(text2, what = "token") {
23696
- if (!isAddress10(text2, { strict: false })) throw new RangeError(`${what} ${text2} is not an address`);
24611
+ if (!isAddress11(text2, { strict: false })) throw new RangeError(`${what} ${text2} is not an address`);
23697
24612
  return getAddress24(text2);
23698
24613
  }
23699
24614
  async function readLaunchedPool(client, lp, tokenText) {
@@ -23866,7 +24781,7 @@ var init_publish = __esm({
23866
24781
  });
23867
24782
 
23868
24783
  // ../core/src/launchpad.ts
23869
- import { bytesToHex as bytesToHex12, decodeEventLog as decodeEventLog3, encodeFunctionData as encodeFunctionData11, getAddress as getAddress25, isAddress as isAddress11, zeroAddress as zeroAddress14 } from "viem";
24784
+ import { bytesToHex as bytesToHex12, decodeEventLog as decodeEventLog3, encodeFunctionData as encodeFunctionData11, getAddress as getAddress25, isAddress as isAddress12, zeroAddress as zeroAddress14 } from "viem";
23870
24785
  async function readIpfsJson(uri) {
23871
24786
  if (uri === null) return null;
23872
24787
  const bytes = await ipfsBytes(uri, METADATA_MAX_BYTES);
@@ -23881,7 +24796,7 @@ function nowIso(seconds) {
23881
24796
  return new Date(Number(seconds) * 1e3).toISOString();
23882
24797
  }
23883
24798
  function address2(text2, what) {
23884
- if (!isAddress11(text2, { strict: false })) throw new RangeError(`${what} ${text2} is not an address`);
24799
+ if (!isAddress12(text2, { strict: false })) throw new RangeError(`${what} ${text2} is not an address`);
23885
24800
  return getAddress25(text2);
23886
24801
  }
23887
24802
  function slippage(bps) {
@@ -25682,14 +26597,14 @@ var init_pad2 = __esm({
25682
26597
  });
25683
26598
 
25684
26599
  // ../core/src/pay.ts
25685
- import { getAddress as getAddress27, isAddress as isAddress12 } from "viem";
26600
+ import { getAddress as getAddress27, isAddress as isAddress13 } from "viem";
25686
26601
  import { x402Client as x402Client2, x402HTTPClient as x402HTTPClient2 } from "@x402/core/client";
25687
26602
  import { toClientEvmSigner as toClientEvmSigner2 } from "@x402/evm";
25688
26603
  import { BatchSettlementEvmScheme as BatchSettlementEvmScheme2 } from "@x402/evm/batch-settlement/client";
25689
26604
  function offerProblem(r, network, token) {
25690
26605
  if (r.scheme !== "batch-settlement") return `${r.scheme} (this agent pays batch-settlement)`;
25691
26606
  if (r.network !== network) return `on ${r.network} (this agent pays on ${network})`;
25692
- if (!isAddress12(r.asset, { strict: false }) || getAddress27(r.asset) !== token) return `in ${r.asset} (this agent pays in ${token})`;
26607
+ if (!isAddress13(r.asset, { strict: false }) || getAddress27(r.asset) !== token) return `in ${r.asset} (this agent pays in ${token})`;
25693
26608
  return null;
25694
26609
  }
25695
26610
  var PAY_CHANNEL_DEPOSIT, PAY_MAX_BODY_CHARS, REQUEST_TIMEOUT_MS3, MIN_LIFE_LEFT_SECONDS, now2, PayService;
@@ -25836,13 +26751,13 @@ var init_pay = __esm({
25836
26751
  const price = BigInt(offer.amount);
25837
26752
  if (price > maxPrice) throw new Error(`${input.url} asks ${formatTokenAmount(price)}, more than maxPrice ${input.maxPrice}; nothing was paid`);
25838
26753
  const extra = offer.extra ?? {};
25839
- if (typeof extra.receiverAuthorizer !== "string" || !isAddress12(extra.receiverAuthorizer, { strict: false })) throw new Error("the offer names no receiverAuthorizer; nothing was paid");
26754
+ if (typeof extra.receiverAuthorizer !== "string" || !isAddress13(extra.receiverAuthorizer, { strict: false })) throw new Error("the offer names no receiverAuthorizer; nothing was paid");
25840
26755
  const payee = getAddress27(extra.receiverAuthorizer);
25841
26756
  const withdrawDelay = extra.withdrawDelay;
25842
26757
  if (typeof withdrawDelay !== "number" || !Number.isInteger(withdrawDelay) || withdrawDelay < 900 || withdrawDelay > BATCH_MAX_WITHDRAW_DELAY_SECONDS) {
25843
26758
  throw new Error(`the offer's withdrawDelay ${String(withdrawDelay)} is not 900..${BATCH_MAX_WITHDRAW_DELAY_SECONDS} s; nothing was paid`);
25844
26759
  }
25845
- if (!isAddress12(offer.payTo, { strict: false })) throw new Error("the offer's payTo is not an address; nothing was paid");
26760
+ if (!isAddress13(offer.payTo, { strict: false })) throw new Error("the offer's payTo is not an address; nothing was paid");
25846
26761
  const receiver = getAddress27(offer.payTo);
25847
26762
  const payeeVault = await readVault(this.#client, this.#config.deployment, payee);
25848
26763
  if (payeeVault === null || payeeVault.token !== token) throw new Error(`the seller's receiverAuthorizer ${payee} is not an Ostra vault in ${token}: this agent pays Ostra sellers from its vault; nothing was paid`);
@@ -25912,7 +26827,7 @@ var init_pay = __esm({
25912
26827
  });
25913
26828
 
25914
26829
  // ../core/src/raeto.ts
25915
- import { getAddress as getAddress28, hashMessage, isAddress as isAddress13, parseAbi as parseAbi6 } from "viem";
26830
+ import { getAddress as getAddress28, hashMessage, isAddress as isAddress14, parseAbi as parseAbi6 } from "viem";
25916
26831
  function netYieldSince(mark, now3, book) {
25917
26832
  if (mark.debts === void 0) return null;
25918
26833
  const high = BigInt(mark.price);
@@ -26023,7 +26938,7 @@ var init_raeto = __esm({
26023
26938
  if (t.chainId !== RAETO_CHAIN_ID) throw new Error(`Raeto's terms name chain ${String(t.chainId)}, not Robinhood Chain (${RAETO_CHAIN_ID}); nothing was sent`);
26024
26939
  const payTo = t.usdg?.payTo;
26025
26940
  const token = t.usdg?.token;
26026
- if (typeof payTo !== "string" || !isAddress13(payTo, { strict: false }) || typeof token !== "string" || !isAddress13(token, { strict: false })) throw new Error("Raeto's terms carry no USDG payTo address; nothing was sent");
26941
+ if (typeof payTo !== "string" || !isAddress14(payTo, { strict: false }) || typeof token !== "string" || !isAddress14(token, { strict: false })) throw new Error("Raeto's terms carry no USDG payTo address; nothing was sent");
26027
26942
  if (getAddress28(token) !== USDG) throw new Error(`Raeto takes ${token}, not USDG; nothing was sent`);
26028
26943
  if (getAddress28(payTo) !== RAETO_PAY_TO) throw new Error(`Raeto's terms name ${payTo} as payTo, not ${RAETO_PAY_TO}: nothing was sent (a changed address is checked before it is used)`);
26029
26944
  return { payTo: RAETO_PAY_TO, token: USDG, chainId: RAETO_CHAIN_ID };
@@ -29589,7 +30504,7 @@ var init_route = __esm({
29589
30504
  });
29590
30505
 
29591
30506
  // ../../../../../../srv/apps/ostra-swap/sdk/src/orders.ts
29592
- import { encodeAbiParameters as encodeAbiParameters13, encodeFunctionData as encodeFunctionData14, getAddress as getAddress32, getContractAddress as getContractAddress4, isAddress as isAddress14, keccak256 as keccak25619, toHex as toHex7 } from "viem";
30507
+ import { encodeAbiParameters as encodeAbiParameters13, encodeFunctionData as encodeFunctionData14, getAddress as getAddress32, getContractAddress as getContractAddress4, isAddress as isAddress15, keccak256 as keccak25619, toHex as toHex7 } from "viem";
29593
30508
  function parseSwapDeployment(json) {
29594
30509
  const r = json;
29595
30510
  if (r === null || typeof r !== "object") throw new Error("the deployment record is not a JSON object");
@@ -29597,7 +30512,7 @@ function parseSwapDeployment(json) {
29597
30512
  if (typeof r.fromBlock !== "string" || !/^[0-9]+$/.test(r.fromBlock)) throw new Error("the deployment record has no fromBlock");
29598
30513
  const addr2 = (name) => {
29599
30514
  const v = r[name];
29600
- if (typeof v !== "string" || !isAddress14(v, { strict: false })) throw new Error(`the deployment record has no ${name} address`);
30515
+ if (typeof v !== "string" || !isAddress15(v, { strict: false })) throw new Error(`the deployment record has no ${name} address`);
29601
30516
  return getAddress32(v);
29602
30517
  };
29603
30518
  return { chainId: r.chainId, fromBlock: r.fromBlock, router: addr2("router"), stake: addr2("stake"), buyback: addr2("buyback"), spendVerifier: addr2("spendVerifier"), privatePool: addr2("privatePool") };
@@ -30854,7 +31769,7 @@ var init_seed_backup = __esm({
30854
31769
  });
30855
31770
 
30856
31771
  // ../core/src/sessions.ts
30857
- import { bytesToHex as bytesToHex14, getAddress as getAddress36, isAddress as isAddress15 } from "viem";
31772
+ import { bytesToHex as bytesToHex14, getAddress as getAddress36, isAddress as isAddress16 } from "viem";
30858
31773
  import { privateKeyToAccount as privateKeyToAccount3 } from "viem/accounts";
30859
31774
  var init_sessions = __esm({
30860
31775
  "../core/src/sessions.ts"() {
@@ -33437,22 +34352,38 @@ var init_tide2 = __esm({
33437
34352
  async #link() {
33438
34353
  const { agentId, vault: identity } = await this.#agent();
33439
34354
  const chainId = this.#p.config.chainId;
34355
+ const services = await this.#p.vaults();
33440
34356
  const members = [];
33441
- for (const vs of await this.#p.vaults()) {
34357
+ for (const vs of services) {
33442
34358
  const vault = await vs.vaultAddress().catch(() => null);
33443
34359
  if (vault === null || getAddress40(vault) === identity || members.some((m) => m.vault === getAddress40(vault))) continue;
33444
34360
  if (!(await vs.state()).exists) continue;
33445
34361
  members.push({ vs, vault: getAddress40(vault), token: getAddress40(vs.token) });
33446
34362
  }
33447
34363
  if (members.length + 1 > TIDE_MAX_LINKED_VAULTS) throw new Error(`the agent has ${members.length + 1} vaults, more than a link lists (${TIDE_MAX_LINKED_VAULTS}); nothing was signed`);
34364
+ let own = null;
34365
+ const ostraVs = services.find((v) => v.kind === "token" && getAddress40(v.token) === OSTRA);
34366
+ if (ostraVs !== void 0) {
34367
+ const creation = ostraVs.creationParams();
34368
+ const payee2 = tidePayeeVault(this.#p.config.deployment, creation);
34369
+ const read = await ostraVs.vaultAddress().catch(() => null);
34370
+ const at = read === null ? null : getAddress40(read);
34371
+ if (at === payee2) own = { payee: payee2, creation };
34372
+ else if (at !== null && !members.some((m) => m.vault === at)) throw new Error(`the agent's OSTRA vault ${at} is not the one its seed creates (${payee2}), and it does not exist; nothing was signed`);
34373
+ }
34374
+ const payeeOf = (listed) => {
34375
+ const m = members.find((x) => x.token === OSTRA && listed.some((a) => a.vault === x.vault));
34376
+ if (m !== void 0) return { payee: m.vault, creation: null };
34377
+ return own === null ? null : { payee: own.payee, creation: own.creation };
34378
+ };
33448
34379
  const secret2 = this.#secret();
33449
- const keep = async (vaults2, payee2, when) => {
33450
- const r = await this.#post("/api/v1/tide/link", { agentId: agentId.toString(), secret: secret2, vaults: vaults2, payee: payee2 });
34380
+ const keep = async (vaults2, p, when) => {
34381
+ const r = await this.#post("/api/v1/tide/link", { agentId: agentId.toString(), secret: secret2, vaults: vaults2, payee: p?.payee ?? null, ...p === null || p.creation === null ? {} : { payeeCreation: p.creation } });
33451
34382
  if (r.status !== 200) throw new Error(`Ostra's index did not keep the link ${when} (${r.status} ${String(r.json.error ?? "")} ${String(r.json.message ?? "")})`);
33452
34383
  return r.json.verified === true;
33453
34384
  };
33454
34385
  const all = tideSortVaults([identity, ...members.map((m) => m.vault)]);
33455
- await keep(all, members.find((m) => m.token === OSTRA)?.vault ?? null, "before the approvals; nothing was signed");
34386
+ await keep(all, payeeOf(members), "before the approvals; nothing was signed");
33456
34387
  const sent = await this.#sent();
33457
34388
  const steps = [];
33458
34389
  const gap = this.#p.gap ?? (() => 4e3 + Math.floor(Math.random() * 16e3));
@@ -33479,16 +34410,19 @@ var init_tide2 = __esm({
33479
34410
  if (step2.status === "sent") approved.push(m);
33480
34411
  }
33481
34412
  const vaults = tideSortVaults([identity, ...approved.map((m) => m.vault)]);
33482
- const payee = approved.find((m) => m.token === OSTRA)?.vault ?? null;
33483
- const setDigest = tideSetDigest({ chainId, agentId, vaults, payee, secret: secret2 });
34413
+ const chosen = payeeOf(approved);
34414
+ const payee = chosen?.payee ?? null;
34415
+ const setDigest = tideSetDigest({ chainId, agentId, vaults, payee, secret: secret2, outsidePayee: chosen !== null && chosen.creation !== null });
33484
34416
  let set;
33485
- if (sent[setDigest] !== void 0 || await this.#approved(identity, setDigest)) set = { vault: identity, tx: sent[setDigest]?.tx ?? "", status: "approved before" };
34417
+ if (chosen === null && members.some((m) => m.token === OSTRA)) {
34418
+ set = { vault: identity, tx: "", status: "not sent: the agent's OSTRA vault is not in the list this time (its approval was not sent): call link again" };
34419
+ } else if (sent[setDigest] !== void 0 || await this.#approved(identity, setDigest)) set = { vault: identity, tx: sent[setDigest]?.tx ?? "", status: "approved before" };
33486
34420
  else {
33487
34421
  if (!first) await sleep(gap());
33488
34422
  set = await this.#approve(this.#p.identityVault, identity, setDigest, "Ostra Tide link (the set of vaults)");
33489
34423
  }
33490
34424
  const linked = set.status === "sent" || set.status === "approved before";
33491
- const verified = linked ? await keep(vaults, payee, "after the approvals (call link again: nothing is signed twice)") : false;
34425
+ const verified = linked ? await keep(vaults, chosen, "after the approvals (call link again: nothing is signed twice)") : false;
33492
34426
  const week = Math.max(1, tideWeekAt(Math.floor(Date.now() / 1e3)));
33493
34427
  const left = steps.filter((s) => s.status.startsWith("not sent")).map((s) => s.vault);
33494
34428
  return {
@@ -33500,7 +34434,8 @@ var init_tide2 = __esm({
33500
34434
  verifiedByIndex: verified,
33501
34435
  ...linked && !verified ? { verifyNote: "Ostra's index could not confirm the set approval yet (a vault's lock delays when an approval takes effect, or the chain could not be read): call link again later; nothing is signed twice" } : {},
33502
34436
  ...left.length === 0 ? {} : { leftOut: left, leftOutNote: "these vaults' approvals were not sent: call link again to add them" },
33503
- note: payee === null ? "no OSTRA vault of this agent is in the link: its share is kept for it until it has one and links again" : "the share is paid to the OSTRA vault named",
34437
+ ...chosen === null || chosen.creation === null ? {} : { payeeCreation: chosen.creation },
34438
+ note: payee === null ? members.some((m) => m.token === OSTRA) ? "the agent's OSTRA vault could not be named this time: the link kept before stays; call link again" : "no OSTRA vault of this agent is in the link: its share is kept for it until it has one and links again" : chosen === null || chosen.creation === null ? "the share is paid to the OSTRA vault named" : members.some((m) => m.vault === payee) ? "the share is paid to the agent's OSTRA vault named (outside the list: its approval was not sent this time, so call link again to count what it holds and pays)" : "the share is paid to the agent's OSTRA vault named, which does not exist yet: Ostra creates it at payout, only when the agent gets a share (nothing to swap or open)",
33504
34439
  countsFor: `week ${week} and on, for approvals in force by ${new Date(tideLinkDeadline(week) * 1e3).toISOString()} (the score checks each on chain)`
33505
34440
  };
33506
34441
  }
@@ -34478,7 +35413,7 @@ var init_wasm_prover = __esm({
34478
35413
  // src/agent.ts
34479
35414
  import { readFile as readFile4, writeFile as writeFile2 } from "node:fs/promises";
34480
35415
  import { join as join5 } from "node:path";
34481
- import { createPublicClient as createPublicClient2, getAddress as getAddress44, http as http2, isAddress as isAddress16 } from "viem";
35416
+ import { createPublicClient as createPublicClient2, getAddress as getAddress44, http as http2, isAddress as isAddress17 } from "viem";
34482
35417
  import { mainnet } from "viem/chains";
34483
35418
  import { privateKeyToAccount as privateKeyToAccount5 } from "viem/accounts";
34484
35419
  function proverOf(c) {
@@ -34773,7 +35708,7 @@ var init_agent = __esm({
34773
35708
  const text2 = await this.keys.folder.read(SELLER_RECORD);
34774
35709
  if (text2 === void 0) return;
34775
35710
  const r = JSON.parse(text2);
34776
- if (r.chainId !== this.config.chainId || typeof r.crank !== "string" || !isAddress16(r.crank, { strict: false })) throw new Error(`${SELLER_RECORD} is not a seller record of chain ${this.config.chainId}`);
35711
+ if (r.chainId !== this.config.chainId || typeof r.crank !== "string" || !isAddress17(r.crank, { strict: false })) throw new Error(`${SELLER_RECORD} is not a seller record of chain ${this.config.chainId}`);
34777
35712
  this.seller.setInitCrank(getAddress44(r.crank));
34778
35713
  }
34779
35714
  /** True once accept_payments set the seller vault up. */
@@ -34803,7 +35738,7 @@ var init_agent = __esm({
34803
35738
  throw new Error(`the keeper at ${keeper} cannot be reached: ${err.message}`);
34804
35739
  }
34805
35740
  const body2 = await res.json().catch(() => null);
34806
- if (res.status !== 200 || typeof body2?.crank !== "string" || !isAddress16(body2.crank, { strict: false })) throw new Error(`the keeper answered ${res.status} without a crank`);
35741
+ if (res.status !== 200 || typeof body2?.crank !== "string" || !isAddress17(body2.crank, { strict: false })) throw new Error(`the keeper answered ${res.status} without a crank`);
34807
35742
  crank = getAddress44(body2.crank);
34808
35743
  this.seller.setInitCrank(crank);
34809
35744
  await this.keys.folder.write(SELLER_RECORD, `${JSON.stringify({ chainId: this.config.chainId, token, crank, merchant })}
@@ -35591,7 +36526,7 @@ function registerTools(server, agent) {
35591
36526
  tool("pad_earnings", "What the agent earned and holds on Ostrapad: its provider record (completed jobs, distinct clients, value, rejections) and limit per job, its bonds, and what OstraPad owes its vault.", {}, () => pad2().earnings());
35592
36527
  tool(
35593
36528
  "tide",
35594
- "Ostra Tide, the weekly OSTRA rewards for agents registered in ERC-8004 through Ostra. link: links the agent's vaults for the score, privately (each vault approves a hash holding a secret from the seed, which only Ostra can match to the agent, so the approvals add no tie between the vaults on chain; Ostra's index checks them): one small relayer spend per vault, call again after a new vault; the share is paid to the agent's OSTRA vault. points: the agent's own points for the latest week (or `week`): by source (fees to Ostra, Raeto credits, balances), multipliers, active days, its estimated share and what was paid. dashboard: a link to the web app's page of these points (whoever holds it sees them).",
36529
+ "Ostra Tide, the weekly OSTRA rewards for agents registered in ERC-8004 through Ostra. link: links the agent's vaults for the score, privately (each vault approves a hash holding a secret from the seed, which only Ostra can match to the agent, so the approvals add no tie between the vaults on chain; Ostra's index checks them): one small relayer spend per vault, call again after a new vault (an agent that linked before 0.1.16 calls it once more: only the set approval is sent again); the share is paid to the agent's OSTRA vault, and an agent without one needs nothing more (no swap, no new vault): Ostra creates that vault at payout, only when the agent gets a share. points: the agent's own points for the latest week (or `week`): by source (fees to Ostra, Raeto credits, balances), multipliers, active days, its estimated share and what was paid. dashboard: a link to the web app's page of these points (whoever holds it sees them).",
35595
36530
  { action: z.enum(["link", "points", "dashboard"]), week: z.number().int().min(1).max(1e3).optional() },
35596
36531
  (a) => {
35597
36532
  if (agent.tide === null) throw new Error("Ostra Tide needs the agent's identity tools (this deployment has no launchpad record)");