@dimes-dot-fi/sdk 2.4.0 → 2.7.0
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.
- package/README.md +16 -0
- package/dist/{aliases-Dne14KBa.d.cts → aliases-BI1c3Yt0.d.cts} +981 -787
- package/dist/{aliases-Dne14KBa.d.ts → aliases-BI1c3Yt0.d.ts} +981 -787
- package/dist/{chunk-KNGEIWFR.cjs → chunk-ERM4WP6D.cjs} +8 -4
- package/dist/chunk-ERM4WP6D.cjs.map +1 -0
- package/dist/{chunk-LXZAXWLO.mjs → chunk-GA7ZBK6W.mjs} +8 -4
- package/dist/chunk-GA7ZBK6W.mjs.map +1 -0
- package/dist/{chunk-Q34TMZ5J.mjs → chunk-HJ5EVO5A.mjs} +11 -6
- package/dist/chunk-HJ5EVO5A.mjs.map +1 -0
- package/dist/{chunk-IZI65LZF.cjs → chunk-L273PAD4.cjs} +14 -9
- package/dist/chunk-L273PAD4.cjs.map +1 -0
- package/dist/contract/index.cjs +1487 -136
- package/dist/contract/index.cjs.map +1 -1
- package/dist/contract/index.d.cts +135 -8
- package/dist/contract/index.d.ts +135 -8
- package/dist/contract/index.mjs +1470 -119
- package/dist/contract/index.mjs.map +1 -1
- package/dist/{dimes-client-DJ1d_p31.d.ts → dimes-client-C4SsCNrZ.d.cts} +48 -3
- package/dist/{dimes-client-D9tohawC.d.cts → dimes-client-Ckn8yRG6.d.ts} +48 -3
- package/dist/{dimes-error-E9yPAZb-.d.cts → dimes-error-BRysMNV_.d.cts} +2 -2
- package/dist/{dimes-error-hSoOierP.d.ts → dimes-error-Ke7yuX1m.d.ts} +2 -2
- package/dist/index.cjs +78 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -9
- package/dist/index.d.ts +10 -9
- package/dist/index.mjs +74 -4
- package/dist/index.mjs.map +1 -1
- package/dist/{quote-sWguOcoJ.d.cts → quote-06n723we.d.ts} +7 -2
- package/dist/{quote-D4QunMtN.d.ts → quote-CcIqLwKb.d.cts} +7 -2
- package/dist/react/index.cjs +34 -33
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +12 -8
- package/dist/react/index.d.ts +12 -8
- package/dist/react/index.mjs +7 -6
- package/dist/react/index.mjs.map +1 -1
- package/dist/{types-Bvj_WDbX.d.cts → types-B881zrxm.d.cts} +1 -1
- package/dist/{types-BHU4Qq7e.d.ts → types-CcoiGMbT.d.ts} +1 -1
- package/dist/ws/index.d.cts +3 -3
- package/dist/ws/index.d.ts +3 -3
- package/package.json +1 -1
- package/dist/chunk-IZI65LZF.cjs.map +0 -1
- package/dist/chunk-KNGEIWFR.cjs.map +0 -1
- package/dist/chunk-LXZAXWLO.mjs.map +0 -1
- package/dist/chunk-Q34TMZ5J.mjs.map +0 -1
package/dist/contract/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkERM4WP6Dcjs = require('../chunk-ERM4WP6D.cjs');
|
|
5
5
|
|
|
6
6
|
// src/contract/vault-abi.json
|
|
7
7
|
var vault_abi_default = {
|
|
@@ -250,6 +250,11 @@ var vault_abi_default = {
|
|
|
250
250
|
name: "InvalidProceeds",
|
|
251
251
|
inputs: []
|
|
252
252
|
},
|
|
253
|
+
{
|
|
254
|
+
type: "error",
|
|
255
|
+
name: "InvalidProtocolVersion",
|
|
256
|
+
inputs: []
|
|
257
|
+
},
|
|
253
258
|
{
|
|
254
259
|
type: "error",
|
|
255
260
|
name: "InvalidSignature",
|
|
@@ -285,6 +290,11 @@ var vault_abi_default = {
|
|
|
285
290
|
name: "LockedByPushDeposit",
|
|
286
291
|
inputs: []
|
|
287
292
|
},
|
|
293
|
+
{
|
|
294
|
+
type: "error",
|
|
295
|
+
name: "MarginAboveMaximum",
|
|
296
|
+
inputs: []
|
|
297
|
+
},
|
|
288
298
|
{
|
|
289
299
|
type: "error",
|
|
290
300
|
name: "MarketCapitalExceeded",
|
|
@@ -320,6 +330,11 @@ var vault_abi_default = {
|
|
|
320
330
|
name: "OverlappingAdminRoles",
|
|
321
331
|
inputs: []
|
|
322
332
|
},
|
|
333
|
+
{
|
|
334
|
+
type: "error",
|
|
335
|
+
name: "PartialCloseAboveMaxSlice",
|
|
336
|
+
inputs: []
|
|
337
|
+
},
|
|
323
338
|
{
|
|
324
339
|
type: "error",
|
|
325
340
|
name: "PartialCloseBelowMinCollateral",
|
|
@@ -330,6 +345,11 @@ var vault_abi_default = {
|
|
|
330
345
|
name: "PartialCloseBelowMinSlice",
|
|
331
346
|
inputs: []
|
|
332
347
|
},
|
|
348
|
+
{
|
|
349
|
+
type: "error",
|
|
350
|
+
name: "PartialCloseSharesOutMismatch",
|
|
351
|
+
inputs: []
|
|
352
|
+
},
|
|
333
353
|
{
|
|
334
354
|
type: "error",
|
|
335
355
|
name: "PartialFillBelowMinCollateral",
|
|
@@ -350,6 +370,11 @@ var vault_abi_default = {
|
|
|
350
370
|
name: "PositionNotFound",
|
|
351
371
|
inputs: []
|
|
352
372
|
},
|
|
373
|
+
{
|
|
374
|
+
type: "error",
|
|
375
|
+
name: "ProceedsExceedTokenValue",
|
|
376
|
+
inputs: []
|
|
377
|
+
},
|
|
353
378
|
{
|
|
354
379
|
type: "error",
|
|
355
380
|
name: "PushDepositAlreadyLocked",
|
|
@@ -375,6 +400,11 @@ var vault_abi_default = {
|
|
|
375
400
|
name: "ReentrancyGuardReentrantCall",
|
|
376
401
|
inputs: []
|
|
377
402
|
},
|
|
403
|
+
{
|
|
404
|
+
type: "error",
|
|
405
|
+
name: "RefundReductionExceedsPending",
|
|
406
|
+
inputs: []
|
|
407
|
+
},
|
|
378
408
|
{
|
|
379
409
|
type: "error",
|
|
380
410
|
name: "SafeCastOverflowedUintDowncast",
|
|
@@ -412,11 +442,26 @@ var vault_abi_default = {
|
|
|
412
442
|
name: "ServerHalted",
|
|
413
443
|
inputs: []
|
|
414
444
|
},
|
|
445
|
+
{
|
|
446
|
+
type: "error",
|
|
447
|
+
name: "ShareContractAlreadySet",
|
|
448
|
+
inputs: []
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
type: "error",
|
|
452
|
+
name: "ShareContractHasNoCode",
|
|
453
|
+
inputs: []
|
|
454
|
+
},
|
|
415
455
|
{
|
|
416
456
|
type: "error",
|
|
417
457
|
name: "SignatureExpired",
|
|
418
458
|
inputs: []
|
|
419
459
|
},
|
|
460
|
+
{
|
|
461
|
+
type: "error",
|
|
462
|
+
name: "StalePendingRefund",
|
|
463
|
+
inputs: []
|
|
464
|
+
},
|
|
420
465
|
{
|
|
421
466
|
type: "error",
|
|
422
467
|
name: "StaleRecoveryNonce",
|
|
@@ -437,6 +482,11 @@ var vault_abi_default = {
|
|
|
437
482
|
name: "TokenIdMismatch",
|
|
438
483
|
inputs: []
|
|
439
484
|
},
|
|
485
|
+
{
|
|
486
|
+
type: "error",
|
|
487
|
+
name: "TokenIdProtocolVersionMismatch",
|
|
488
|
+
inputs: []
|
|
489
|
+
},
|
|
440
490
|
{
|
|
441
491
|
type: "error",
|
|
442
492
|
name: "TotalCapitalExceeded",
|
|
@@ -463,6 +513,11 @@ var vault_abi_default = {
|
|
|
463
513
|
name: "UnauthorizedTokenSender",
|
|
464
514
|
inputs: []
|
|
465
515
|
},
|
|
516
|
+
{
|
|
517
|
+
type: "error",
|
|
518
|
+
name: "UnmappedProtocolVersion",
|
|
519
|
+
inputs: []
|
|
520
|
+
},
|
|
466
521
|
{
|
|
467
522
|
type: "error",
|
|
468
523
|
name: "UserActionsPaused",
|
|
@@ -1559,6 +1614,61 @@ var vault_abi_default = {
|
|
|
1559
1614
|
],
|
|
1560
1615
|
anonymous: false
|
|
1561
1616
|
},
|
|
1617
|
+
{
|
|
1618
|
+
type: "event",
|
|
1619
|
+
name: "OverCreditedRefundCorrected",
|
|
1620
|
+
inputs: [
|
|
1621
|
+
{
|
|
1622
|
+
name: "positionKey",
|
|
1623
|
+
type: "bytes32",
|
|
1624
|
+
indexed: true,
|
|
1625
|
+
internalType: "bytes32"
|
|
1626
|
+
},
|
|
1627
|
+
{
|
|
1628
|
+
name: "admin",
|
|
1629
|
+
type: "address",
|
|
1630
|
+
indexed: true,
|
|
1631
|
+
internalType: "address"
|
|
1632
|
+
},
|
|
1633
|
+
{
|
|
1634
|
+
name: "refundReductionUsdcUnits",
|
|
1635
|
+
type: "uint256",
|
|
1636
|
+
indexed: false,
|
|
1637
|
+
internalType: "uint256"
|
|
1638
|
+
},
|
|
1639
|
+
{
|
|
1640
|
+
name: "pendingRefundUsdcUnitsAfter",
|
|
1641
|
+
type: "uint256",
|
|
1642
|
+
indexed: false,
|
|
1643
|
+
internalType: "uint256"
|
|
1644
|
+
},
|
|
1645
|
+
{
|
|
1646
|
+
name: "capitalPoolBalanceUsdcUnitsAfter",
|
|
1647
|
+
type: "uint256",
|
|
1648
|
+
indexed: false,
|
|
1649
|
+
internalType: "uint256"
|
|
1650
|
+
},
|
|
1651
|
+
{
|
|
1652
|
+
name: "consumedRecoveryNonce",
|
|
1653
|
+
type: "uint256",
|
|
1654
|
+
indexed: false,
|
|
1655
|
+
internalType: "uint256"
|
|
1656
|
+
},
|
|
1657
|
+
{
|
|
1658
|
+
name: "reason",
|
|
1659
|
+
type: "string",
|
|
1660
|
+
indexed: false,
|
|
1661
|
+
internalType: "string"
|
|
1662
|
+
},
|
|
1663
|
+
{
|
|
1664
|
+
name: "timestamp",
|
|
1665
|
+
type: "uint256",
|
|
1666
|
+
indexed: false,
|
|
1667
|
+
internalType: "uint256"
|
|
1668
|
+
}
|
|
1669
|
+
],
|
|
1670
|
+
anonymous: false
|
|
1671
|
+
},
|
|
1562
1672
|
{
|
|
1563
1673
|
type: "event",
|
|
1564
1674
|
name: "PartialCloseAborted",
|
|
@@ -1636,6 +1746,18 @@ var vault_abi_default = {
|
|
|
1636
1746
|
indexed: false,
|
|
1637
1747
|
internalType: "uint256"
|
|
1638
1748
|
},
|
|
1749
|
+
{
|
|
1750
|
+
name: "deleverageCapitalAppliedUsdcUnits",
|
|
1751
|
+
type: "uint256",
|
|
1752
|
+
indexed: false,
|
|
1753
|
+
internalType: "uint256"
|
|
1754
|
+
},
|
|
1755
|
+
{
|
|
1756
|
+
name: "capitalShortfallUsdcUnits",
|
|
1757
|
+
type: "uint256",
|
|
1758
|
+
indexed: false,
|
|
1759
|
+
internalType: "uint256"
|
|
1760
|
+
},
|
|
1639
1761
|
{
|
|
1640
1762
|
name: "collectedLifetimeFeeUsdcUnits",
|
|
1641
1763
|
type: "uint256",
|
|
@@ -1739,6 +1861,18 @@ var vault_abi_default = {
|
|
|
1739
1861
|
indexed: false,
|
|
1740
1862
|
internalType: "uint256"
|
|
1741
1863
|
},
|
|
1864
|
+
{
|
|
1865
|
+
name: "deleverageCapitalAppliedUsdcUnits",
|
|
1866
|
+
type: "uint256",
|
|
1867
|
+
indexed: false,
|
|
1868
|
+
internalType: "uint256"
|
|
1869
|
+
},
|
|
1870
|
+
{
|
|
1871
|
+
name: "capitalShortfallUsdcUnits",
|
|
1872
|
+
type: "uint256",
|
|
1873
|
+
indexed: false,
|
|
1874
|
+
internalType: "uint256"
|
|
1875
|
+
},
|
|
1742
1876
|
{
|
|
1743
1877
|
name: "collectedLifetimeFeeUsdcUnits",
|
|
1744
1878
|
type: "uint256",
|
|
@@ -1836,6 +1970,18 @@ var vault_abi_default = {
|
|
|
1836
1970
|
indexed: false,
|
|
1837
1971
|
internalType: "uint256"
|
|
1838
1972
|
},
|
|
1973
|
+
{
|
|
1974
|
+
name: "deleverageCapitalAppliedUsdcUnits",
|
|
1975
|
+
type: "uint256",
|
|
1976
|
+
indexed: false,
|
|
1977
|
+
internalType: "uint256"
|
|
1978
|
+
},
|
|
1979
|
+
{
|
|
1980
|
+
name: "capitalShortfallUsdcUnits",
|
|
1981
|
+
type: "uint256",
|
|
1982
|
+
indexed: false,
|
|
1983
|
+
internalType: "uint256"
|
|
1984
|
+
},
|
|
1839
1985
|
{
|
|
1840
1986
|
name: "collectedLifetimeFeeUsdcUnits",
|
|
1841
1987
|
type: "uint256",
|
|
@@ -2290,6 +2436,109 @@ var vault_abi_default = {
|
|
|
2290
2436
|
],
|
|
2291
2437
|
anonymous: false
|
|
2292
2438
|
},
|
|
2439
|
+
{
|
|
2440
|
+
type: "event",
|
|
2441
|
+
name: "PositionCreatedWithVersion",
|
|
2442
|
+
inputs: [
|
|
2443
|
+
{
|
|
2444
|
+
name: "positionKey",
|
|
2445
|
+
type: "bytes32",
|
|
2446
|
+
indexed: true,
|
|
2447
|
+
internalType: "bytes32"
|
|
2448
|
+
},
|
|
2449
|
+
{
|
|
2450
|
+
name: "positionSeed",
|
|
2451
|
+
type: "bytes16",
|
|
2452
|
+
indexed: false,
|
|
2453
|
+
internalType: "bytes16"
|
|
2454
|
+
},
|
|
2455
|
+
{
|
|
2456
|
+
name: "owner",
|
|
2457
|
+
type: "address",
|
|
2458
|
+
indexed: true,
|
|
2459
|
+
internalType: "address"
|
|
2460
|
+
},
|
|
2461
|
+
{
|
|
2462
|
+
name: "marketId",
|
|
2463
|
+
type: "bytes32",
|
|
2464
|
+
indexed: true,
|
|
2465
|
+
internalType: "bytes32"
|
|
2466
|
+
},
|
|
2467
|
+
{
|
|
2468
|
+
name: "tokenId",
|
|
2469
|
+
type: "uint256",
|
|
2470
|
+
indexed: false,
|
|
2471
|
+
internalType: "uint256"
|
|
2472
|
+
},
|
|
2473
|
+
{
|
|
2474
|
+
name: "collateralUsdcUnits",
|
|
2475
|
+
type: "uint256",
|
|
2476
|
+
indexed: false,
|
|
2477
|
+
internalType: "uint256"
|
|
2478
|
+
},
|
|
2479
|
+
{
|
|
2480
|
+
name: "leverageBps",
|
|
2481
|
+
type: "uint32",
|
|
2482
|
+
indexed: false,
|
|
2483
|
+
internalType: "uint32"
|
|
2484
|
+
},
|
|
2485
|
+
{
|
|
2486
|
+
name: "notionalUsdcUnits",
|
|
2487
|
+
type: "uint256",
|
|
2488
|
+
indexed: false,
|
|
2489
|
+
internalType: "uint256"
|
|
2490
|
+
},
|
|
2491
|
+
{
|
|
2492
|
+
name: "originationFeeUsdcUnits",
|
|
2493
|
+
type: "uint256",
|
|
2494
|
+
indexed: false,
|
|
2495
|
+
internalType: "uint256"
|
|
2496
|
+
},
|
|
2497
|
+
{
|
|
2498
|
+
name: "venueFeeUsdcUnits",
|
|
2499
|
+
type: "uint256",
|
|
2500
|
+
indexed: false,
|
|
2501
|
+
internalType: "uint256"
|
|
2502
|
+
},
|
|
2503
|
+
{
|
|
2504
|
+
name: "originationFeeBps",
|
|
2505
|
+
type: "uint16",
|
|
2506
|
+
indexed: false,
|
|
2507
|
+
internalType: "uint16"
|
|
2508
|
+
},
|
|
2509
|
+
{
|
|
2510
|
+
name: "lifetimeFeeAprBps",
|
|
2511
|
+
type: "uint16",
|
|
2512
|
+
indexed: false,
|
|
2513
|
+
internalType: "uint16"
|
|
2514
|
+
},
|
|
2515
|
+
{
|
|
2516
|
+
name: "liquidationFeeBps",
|
|
2517
|
+
type: "uint16",
|
|
2518
|
+
indexed: false,
|
|
2519
|
+
internalType: "uint16"
|
|
2520
|
+
},
|
|
2521
|
+
{
|
|
2522
|
+
name: "state",
|
|
2523
|
+
type: "uint8",
|
|
2524
|
+
indexed: false,
|
|
2525
|
+
internalType: "uint8"
|
|
2526
|
+
},
|
|
2527
|
+
{
|
|
2528
|
+
name: "protocolVersion",
|
|
2529
|
+
type: "uint8",
|
|
2530
|
+
indexed: false,
|
|
2531
|
+
internalType: "uint8"
|
|
2532
|
+
},
|
|
2533
|
+
{
|
|
2534
|
+
name: "timestamp",
|
|
2535
|
+
type: "uint256",
|
|
2536
|
+
indexed: false,
|
|
2537
|
+
internalType: "uint256"
|
|
2538
|
+
}
|
|
2539
|
+
],
|
|
2540
|
+
anonymous: false
|
|
2541
|
+
},
|
|
2293
2542
|
{
|
|
2294
2543
|
type: "event",
|
|
2295
2544
|
name: "PositionForceUnwound",
|
|
@@ -2504,7 +2753,7 @@ var vault_abi_default = {
|
|
|
2504
2753
|
},
|
|
2505
2754
|
{
|
|
2506
2755
|
type: "event",
|
|
2507
|
-
name: "
|
|
2756
|
+
name: "PositionMarginLocked",
|
|
2508
2757
|
inputs: [
|
|
2509
2758
|
{
|
|
2510
2759
|
name: "positionKey",
|
|
@@ -2513,43 +2762,123 @@ var vault_abi_default = {
|
|
|
2513
2762
|
internalType: "bytes32"
|
|
2514
2763
|
},
|
|
2515
2764
|
{
|
|
2516
|
-
name: "
|
|
2765
|
+
name: "owner",
|
|
2517
2766
|
type: "address",
|
|
2518
2767
|
indexed: true,
|
|
2519
2768
|
internalType: "address"
|
|
2520
2769
|
},
|
|
2521
2770
|
{
|
|
2522
|
-
name: "
|
|
2771
|
+
name: "marginUsdcUnits",
|
|
2523
2772
|
type: "uint256",
|
|
2524
2773
|
indexed: false,
|
|
2525
2774
|
internalType: "uint256"
|
|
2526
2775
|
},
|
|
2527
2776
|
{
|
|
2528
|
-
name: "
|
|
2777
|
+
name: "totalLockedMarginUsdcUnits",
|
|
2529
2778
|
type: "uint256",
|
|
2530
2779
|
indexed: false,
|
|
2531
2780
|
internalType: "uint256"
|
|
2532
2781
|
},
|
|
2533
2782
|
{
|
|
2534
|
-
name: "
|
|
2783
|
+
name: "timestamp",
|
|
2535
2784
|
type: "uint256",
|
|
2536
2785
|
indexed: false,
|
|
2537
2786
|
internalType: "uint256"
|
|
2787
|
+
}
|
|
2788
|
+
],
|
|
2789
|
+
anonymous: false
|
|
2790
|
+
},
|
|
2791
|
+
{
|
|
2792
|
+
type: "event",
|
|
2793
|
+
name: "PositionMarginReleased",
|
|
2794
|
+
inputs: [
|
|
2795
|
+
{
|
|
2796
|
+
name: "positionKey",
|
|
2797
|
+
type: "bytes32",
|
|
2798
|
+
indexed: true,
|
|
2799
|
+
internalType: "bytes32"
|
|
2538
2800
|
},
|
|
2539
2801
|
{
|
|
2540
|
-
name: "
|
|
2802
|
+
name: "owner",
|
|
2803
|
+
type: "address",
|
|
2804
|
+
indexed: true,
|
|
2805
|
+
internalType: "address"
|
|
2806
|
+
},
|
|
2807
|
+
{
|
|
2808
|
+
name: "marginUsdcUnits",
|
|
2541
2809
|
type: "uint256",
|
|
2542
2810
|
indexed: false,
|
|
2543
2811
|
internalType: "uint256"
|
|
2544
2812
|
},
|
|
2545
2813
|
{
|
|
2546
|
-
name: "
|
|
2547
|
-
type: "
|
|
2814
|
+
name: "foldedIntoWaterfall",
|
|
2815
|
+
type: "bool",
|
|
2548
2816
|
indexed: false,
|
|
2549
|
-
internalType: "
|
|
2817
|
+
internalType: "bool"
|
|
2550
2818
|
},
|
|
2551
2819
|
{
|
|
2552
|
-
name: "
|
|
2820
|
+
name: "totalLockedMarginUsdcUnits",
|
|
2821
|
+
type: "uint256",
|
|
2822
|
+
indexed: false,
|
|
2823
|
+
internalType: "uint256"
|
|
2824
|
+
},
|
|
2825
|
+
{
|
|
2826
|
+
name: "timestamp",
|
|
2827
|
+
type: "uint256",
|
|
2828
|
+
indexed: false,
|
|
2829
|
+
internalType: "uint256"
|
|
2830
|
+
}
|
|
2831
|
+
],
|
|
2832
|
+
anonymous: false
|
|
2833
|
+
},
|
|
2834
|
+
{
|
|
2835
|
+
type: "event",
|
|
2836
|
+
name: "PositionOpened",
|
|
2837
|
+
inputs: [
|
|
2838
|
+
{
|
|
2839
|
+
name: "positionKey",
|
|
2840
|
+
type: "bytes32",
|
|
2841
|
+
indexed: true,
|
|
2842
|
+
internalType: "bytes32"
|
|
2843
|
+
},
|
|
2844
|
+
{
|
|
2845
|
+
name: "signer",
|
|
2846
|
+
type: "address",
|
|
2847
|
+
indexed: true,
|
|
2848
|
+
internalType: "address"
|
|
2849
|
+
},
|
|
2850
|
+
{
|
|
2851
|
+
name: "tokenId",
|
|
2852
|
+
type: "uint256",
|
|
2853
|
+
indexed: false,
|
|
2854
|
+
internalType: "uint256"
|
|
2855
|
+
},
|
|
2856
|
+
{
|
|
2857
|
+
name: "positionTokenUnits",
|
|
2858
|
+
type: "uint256",
|
|
2859
|
+
indexed: false,
|
|
2860
|
+
internalType: "uint256"
|
|
2861
|
+
},
|
|
2862
|
+
{
|
|
2863
|
+
name: "notionalUsdcUnits",
|
|
2864
|
+
type: "uint256",
|
|
2865
|
+
indexed: false,
|
|
2866
|
+
internalType: "uint256"
|
|
2867
|
+
},
|
|
2868
|
+
{
|
|
2869
|
+
name: "entryPriceUsdPips",
|
|
2870
|
+
type: "uint256",
|
|
2871
|
+
indexed: false,
|
|
2872
|
+
internalType: "uint256"
|
|
2873
|
+
},
|
|
2874
|
+
{
|
|
2875
|
+
name: "unusedUsdcUnits",
|
|
2876
|
+
type: "uint256",
|
|
2877
|
+
indexed: false,
|
|
2878
|
+
internalType: "uint256"
|
|
2879
|
+
},
|
|
2880
|
+
{
|
|
2881
|
+
name: "originationFeeUsdcUnits",
|
|
2553
2882
|
type: "uint256",
|
|
2554
2883
|
indexed: false,
|
|
2555
2884
|
internalType: "uint256"
|
|
@@ -3045,6 +3374,73 @@ var vault_abi_default = {
|
|
|
3045
3374
|
],
|
|
3046
3375
|
anonymous: false
|
|
3047
3376
|
},
|
|
3377
|
+
{
|
|
3378
|
+
type: "event",
|
|
3379
|
+
name: "SettlePositionFinalizedWithReturn",
|
|
3380
|
+
inputs: [
|
|
3381
|
+
{
|
|
3382
|
+
name: "positionKey",
|
|
3383
|
+
type: "bytes32",
|
|
3384
|
+
indexed: true,
|
|
3385
|
+
internalType: "bytes32"
|
|
3386
|
+
},
|
|
3387
|
+
{
|
|
3388
|
+
name: "signer",
|
|
3389
|
+
type: "address",
|
|
3390
|
+
indexed: true,
|
|
3391
|
+
internalType: "address"
|
|
3392
|
+
},
|
|
3393
|
+
{
|
|
3394
|
+
name: "saleReceivedUsdcUnits",
|
|
3395
|
+
type: "uint256",
|
|
3396
|
+
indexed: false,
|
|
3397
|
+
internalType: "uint256"
|
|
3398
|
+
},
|
|
3399
|
+
{
|
|
3400
|
+
name: "tokensSoldUnits",
|
|
3401
|
+
type: "uint256",
|
|
3402
|
+
indexed: false,
|
|
3403
|
+
internalType: "uint256"
|
|
3404
|
+
},
|
|
3405
|
+
{
|
|
3406
|
+
name: "returnedTokenUnits",
|
|
3407
|
+
type: "uint256",
|
|
3408
|
+
indexed: false,
|
|
3409
|
+
internalType: "uint256"
|
|
3410
|
+
},
|
|
3411
|
+
{
|
|
3412
|
+
name: "positionTokenUnits",
|
|
3413
|
+
type: "uint256",
|
|
3414
|
+
indexed: false,
|
|
3415
|
+
internalType: "uint256"
|
|
3416
|
+
},
|
|
3417
|
+
{
|
|
3418
|
+
name: "marketOutcome",
|
|
3419
|
+
type: "uint8",
|
|
3420
|
+
indexed: false,
|
|
3421
|
+
internalType: "uint8"
|
|
3422
|
+
},
|
|
3423
|
+
{
|
|
3424
|
+
name: "settledInFavor",
|
|
3425
|
+
type: "bool",
|
|
3426
|
+
indexed: false,
|
|
3427
|
+
internalType: "bool"
|
|
3428
|
+
},
|
|
3429
|
+
{
|
|
3430
|
+
name: "sanityCheckPassed",
|
|
3431
|
+
type: "bool",
|
|
3432
|
+
indexed: false,
|
|
3433
|
+
internalType: "bool"
|
|
3434
|
+
},
|
|
3435
|
+
{
|
|
3436
|
+
name: "timestamp",
|
|
3437
|
+
type: "uint256",
|
|
3438
|
+
indexed: false,
|
|
3439
|
+
internalType: "uint256"
|
|
3440
|
+
}
|
|
3441
|
+
],
|
|
3442
|
+
anonymous: false
|
|
3443
|
+
},
|
|
3048
3444
|
{
|
|
3049
3445
|
type: "event",
|
|
3050
3446
|
name: "SettlePositionInitiated",
|
|
@@ -3088,6 +3484,31 @@ var vault_abi_default = {
|
|
|
3088
3484
|
],
|
|
3089
3485
|
anonymous: false
|
|
3090
3486
|
},
|
|
3487
|
+
{
|
|
3488
|
+
type: "event",
|
|
3489
|
+
name: "ShareContractSet",
|
|
3490
|
+
inputs: [
|
|
3491
|
+
{
|
|
3492
|
+
name: "protocolVersion",
|
|
3493
|
+
type: "uint8",
|
|
3494
|
+
indexed: true,
|
|
3495
|
+
internalType: "uint8"
|
|
3496
|
+
},
|
|
3497
|
+
{
|
|
3498
|
+
name: "shareContract",
|
|
3499
|
+
type: "address",
|
|
3500
|
+
indexed: true,
|
|
3501
|
+
internalType: "address"
|
|
3502
|
+
},
|
|
3503
|
+
{
|
|
3504
|
+
name: "timestamp",
|
|
3505
|
+
type: "uint256",
|
|
3506
|
+
indexed: false,
|
|
3507
|
+
internalType: "uint256"
|
|
3508
|
+
}
|
|
3509
|
+
],
|
|
3510
|
+
anonymous: false
|
|
3511
|
+
},
|
|
3091
3512
|
{
|
|
3092
3513
|
type: "event",
|
|
3093
3514
|
name: "TimelockUpdated",
|
|
@@ -3399,6 +3820,39 @@ var vault_abi_default = {
|
|
|
3399
3820
|
],
|
|
3400
3821
|
stateMutability: "view"
|
|
3401
3822
|
},
|
|
3823
|
+
{
|
|
3824
|
+
type: "function",
|
|
3825
|
+
name: "correctOverCreditedRefund",
|
|
3826
|
+
inputs: [
|
|
3827
|
+
{
|
|
3828
|
+
name: "positionKey",
|
|
3829
|
+
type: "bytes32",
|
|
3830
|
+
internalType: "bytes32"
|
|
3831
|
+
},
|
|
3832
|
+
{
|
|
3833
|
+
name: "expectedRecoveryNonce",
|
|
3834
|
+
type: "uint256",
|
|
3835
|
+
internalType: "uint256"
|
|
3836
|
+
},
|
|
3837
|
+
{
|
|
3838
|
+
name: "expectedPendingRefundUsdcUnits",
|
|
3839
|
+
type: "uint256",
|
|
3840
|
+
internalType: "uint256"
|
|
3841
|
+
},
|
|
3842
|
+
{
|
|
3843
|
+
name: "refundReductionUsdcUnits",
|
|
3844
|
+
type: "uint256",
|
|
3845
|
+
internalType: "uint256"
|
|
3846
|
+
},
|
|
3847
|
+
{
|
|
3848
|
+
name: "reason",
|
|
3849
|
+
type: "string",
|
|
3850
|
+
internalType: "string"
|
|
3851
|
+
}
|
|
3852
|
+
],
|
|
3853
|
+
outputs: [],
|
|
3854
|
+
stateMutability: "nonpayable"
|
|
3855
|
+
},
|
|
3402
3856
|
{
|
|
3403
3857
|
type: "function",
|
|
3404
3858
|
name: "createPosition",
|
|
@@ -3537,82 +3991,530 @@ var vault_abi_default = {
|
|
|
3537
3991
|
},
|
|
3538
3992
|
{
|
|
3539
3993
|
type: "function",
|
|
3540
|
-
name: "
|
|
3541
|
-
inputs: [],
|
|
3542
|
-
outputs: [],
|
|
3543
|
-
stateMutability: "nonpayable"
|
|
3544
|
-
},
|
|
3545
|
-
{
|
|
3546
|
-
type: "function",
|
|
3547
|
-
name: "drainLiquidatedPositionTokens",
|
|
3994
|
+
name: "createPositionPushFundedWithMargin",
|
|
3548
3995
|
inputs: [
|
|
3549
3996
|
{
|
|
3550
|
-
name: "
|
|
3997
|
+
name: "positionSeed",
|
|
3998
|
+
type: "bytes16",
|
|
3999
|
+
internalType: "bytes16"
|
|
4000
|
+
},
|
|
4001
|
+
{
|
|
4002
|
+
name: "marketId",
|
|
3551
4003
|
type: "bytes32",
|
|
3552
4004
|
internalType: "bytes32"
|
|
3553
4005
|
},
|
|
3554
4006
|
{
|
|
3555
|
-
name: "
|
|
4007
|
+
name: "tokenId",
|
|
3556
4008
|
type: "uint256",
|
|
3557
4009
|
internalType: "uint256"
|
|
3558
|
-
}
|
|
3559
|
-
],
|
|
3560
|
-
outputs: [],
|
|
3561
|
-
stateMutability: "nonpayable"
|
|
3562
|
-
},
|
|
3563
|
-
{
|
|
3564
|
-
type: "function",
|
|
3565
|
-
name: "eip712Domain",
|
|
3566
|
-
inputs: [],
|
|
3567
|
-
outputs: [
|
|
3568
|
-
{
|
|
3569
|
-
name: "fields",
|
|
3570
|
-
type: "bytes1",
|
|
3571
|
-
internalType: "bytes1"
|
|
3572
4010
|
},
|
|
3573
4011
|
{
|
|
3574
|
-
name: "
|
|
3575
|
-
type: "
|
|
3576
|
-
internalType: "
|
|
4012
|
+
name: "collateralUsdcUnits",
|
|
4013
|
+
type: "uint256",
|
|
4014
|
+
internalType: "uint256"
|
|
3577
4015
|
},
|
|
3578
4016
|
{
|
|
3579
|
-
name: "
|
|
3580
|
-
type: "
|
|
3581
|
-
internalType: "
|
|
4017
|
+
name: "leverageBps",
|
|
4018
|
+
type: "uint32",
|
|
4019
|
+
internalType: "uint32"
|
|
3582
4020
|
},
|
|
3583
4021
|
{
|
|
3584
|
-
name: "
|
|
4022
|
+
name: "notionalUsdcUnits",
|
|
3585
4023
|
type: "uint256",
|
|
3586
4024
|
internalType: "uint256"
|
|
3587
4025
|
},
|
|
3588
4026
|
{
|
|
3589
|
-
name: "
|
|
3590
|
-
type: "
|
|
3591
|
-
internalType: "
|
|
4027
|
+
name: "originationFeeBps",
|
|
4028
|
+
type: "uint16",
|
|
4029
|
+
internalType: "uint16"
|
|
3592
4030
|
},
|
|
3593
4031
|
{
|
|
3594
|
-
name: "
|
|
3595
|
-
type: "
|
|
3596
|
-
internalType: "
|
|
4032
|
+
name: "lifetimeFeeAprBps",
|
|
4033
|
+
type: "uint16",
|
|
4034
|
+
internalType: "uint16"
|
|
3597
4035
|
},
|
|
3598
4036
|
{
|
|
3599
|
-
name: "
|
|
3600
|
-
type: "
|
|
3601
|
-
internalType: "
|
|
3602
|
-
}
|
|
3603
|
-
],
|
|
3604
|
-
stateMutability: "view"
|
|
3605
|
-
},
|
|
3606
|
-
{
|
|
3607
|
-
type: "function",
|
|
3608
|
-
name: "emergencyAdmin",
|
|
3609
|
-
inputs: [],
|
|
3610
|
-
outputs: [
|
|
4037
|
+
name: "liquidationFeeBps",
|
|
4038
|
+
type: "uint16",
|
|
4039
|
+
internalType: "uint16"
|
|
4040
|
+
},
|
|
3611
4041
|
{
|
|
3612
|
-
name: "",
|
|
3613
|
-
type: "
|
|
3614
|
-
internalType: "
|
|
3615
|
-
}
|
|
4042
|
+
name: "venueFeeUsdcUnits",
|
|
4043
|
+
type: "uint256",
|
|
4044
|
+
internalType: "uint256"
|
|
4045
|
+
},
|
|
4046
|
+
{
|
|
4047
|
+
name: "marginUsdcUnits",
|
|
4048
|
+
type: "uint256",
|
|
4049
|
+
internalType: "uint256"
|
|
4050
|
+
},
|
|
4051
|
+
{
|
|
4052
|
+
name: "signature",
|
|
4053
|
+
type: "bytes",
|
|
4054
|
+
internalType: "bytes"
|
|
4055
|
+
},
|
|
4056
|
+
{
|
|
4057
|
+
name: "signatureExpiry",
|
|
4058
|
+
type: "uint256",
|
|
4059
|
+
internalType: "uint256"
|
|
4060
|
+
}
|
|
4061
|
+
],
|
|
4062
|
+
outputs: [],
|
|
4063
|
+
stateMutability: "nonpayable"
|
|
4064
|
+
},
|
|
4065
|
+
{
|
|
4066
|
+
type: "function",
|
|
4067
|
+
name: "createPositionPushFundedWithMarginAndVersion",
|
|
4068
|
+
inputs: [
|
|
4069
|
+
{
|
|
4070
|
+
name: "positionSeed",
|
|
4071
|
+
type: "bytes16",
|
|
4072
|
+
internalType: "bytes16"
|
|
4073
|
+
},
|
|
4074
|
+
{
|
|
4075
|
+
name: "marketId",
|
|
4076
|
+
type: "bytes32",
|
|
4077
|
+
internalType: "bytes32"
|
|
4078
|
+
},
|
|
4079
|
+
{
|
|
4080
|
+
name: "tokenId",
|
|
4081
|
+
type: "uint256",
|
|
4082
|
+
internalType: "uint256"
|
|
4083
|
+
},
|
|
4084
|
+
{
|
|
4085
|
+
name: "collateralUsdcUnits",
|
|
4086
|
+
type: "uint256",
|
|
4087
|
+
internalType: "uint256"
|
|
4088
|
+
},
|
|
4089
|
+
{
|
|
4090
|
+
name: "leverageBps",
|
|
4091
|
+
type: "uint32",
|
|
4092
|
+
internalType: "uint32"
|
|
4093
|
+
},
|
|
4094
|
+
{
|
|
4095
|
+
name: "notionalUsdcUnits",
|
|
4096
|
+
type: "uint256",
|
|
4097
|
+
internalType: "uint256"
|
|
4098
|
+
},
|
|
4099
|
+
{
|
|
4100
|
+
name: "originationFeeBps",
|
|
4101
|
+
type: "uint16",
|
|
4102
|
+
internalType: "uint16"
|
|
4103
|
+
},
|
|
4104
|
+
{
|
|
4105
|
+
name: "lifetimeFeeAprBps",
|
|
4106
|
+
type: "uint16",
|
|
4107
|
+
internalType: "uint16"
|
|
4108
|
+
},
|
|
4109
|
+
{
|
|
4110
|
+
name: "liquidationFeeBps",
|
|
4111
|
+
type: "uint16",
|
|
4112
|
+
internalType: "uint16"
|
|
4113
|
+
},
|
|
4114
|
+
{
|
|
4115
|
+
name: "venueFeeUsdcUnits",
|
|
4116
|
+
type: "uint256",
|
|
4117
|
+
internalType: "uint256"
|
|
4118
|
+
},
|
|
4119
|
+
{
|
|
4120
|
+
name: "marginUsdcUnits",
|
|
4121
|
+
type: "uint256",
|
|
4122
|
+
internalType: "uint256"
|
|
4123
|
+
},
|
|
4124
|
+
{
|
|
4125
|
+
name: "protocolVersion",
|
|
4126
|
+
type: "uint8",
|
|
4127
|
+
internalType: "uint8"
|
|
4128
|
+
},
|
|
4129
|
+
{
|
|
4130
|
+
name: "signature",
|
|
4131
|
+
type: "bytes",
|
|
4132
|
+
internalType: "bytes"
|
|
4133
|
+
},
|
|
4134
|
+
{
|
|
4135
|
+
name: "signatureExpiry",
|
|
4136
|
+
type: "uint256",
|
|
4137
|
+
internalType: "uint256"
|
|
4138
|
+
}
|
|
4139
|
+
],
|
|
4140
|
+
outputs: [],
|
|
4141
|
+
stateMutability: "nonpayable"
|
|
4142
|
+
},
|
|
4143
|
+
{
|
|
4144
|
+
type: "function",
|
|
4145
|
+
name: "createPositionPushFundedWithVersion",
|
|
4146
|
+
inputs: [
|
|
4147
|
+
{
|
|
4148
|
+
name: "positionSeed",
|
|
4149
|
+
type: "bytes16",
|
|
4150
|
+
internalType: "bytes16"
|
|
4151
|
+
},
|
|
4152
|
+
{
|
|
4153
|
+
name: "marketId",
|
|
4154
|
+
type: "bytes32",
|
|
4155
|
+
internalType: "bytes32"
|
|
4156
|
+
},
|
|
4157
|
+
{
|
|
4158
|
+
name: "tokenId",
|
|
4159
|
+
type: "uint256",
|
|
4160
|
+
internalType: "uint256"
|
|
4161
|
+
},
|
|
4162
|
+
{
|
|
4163
|
+
name: "collateralUsdcUnits",
|
|
4164
|
+
type: "uint256",
|
|
4165
|
+
internalType: "uint256"
|
|
4166
|
+
},
|
|
4167
|
+
{
|
|
4168
|
+
name: "leverageBps",
|
|
4169
|
+
type: "uint32",
|
|
4170
|
+
internalType: "uint32"
|
|
4171
|
+
},
|
|
4172
|
+
{
|
|
4173
|
+
name: "notionalUsdcUnits",
|
|
4174
|
+
type: "uint256",
|
|
4175
|
+
internalType: "uint256"
|
|
4176
|
+
},
|
|
4177
|
+
{
|
|
4178
|
+
name: "originationFeeBps",
|
|
4179
|
+
type: "uint16",
|
|
4180
|
+
internalType: "uint16"
|
|
4181
|
+
},
|
|
4182
|
+
{
|
|
4183
|
+
name: "lifetimeFeeAprBps",
|
|
4184
|
+
type: "uint16",
|
|
4185
|
+
internalType: "uint16"
|
|
4186
|
+
},
|
|
4187
|
+
{
|
|
4188
|
+
name: "liquidationFeeBps",
|
|
4189
|
+
type: "uint16",
|
|
4190
|
+
internalType: "uint16"
|
|
4191
|
+
},
|
|
4192
|
+
{
|
|
4193
|
+
name: "venueFeeUsdcUnits",
|
|
4194
|
+
type: "uint256",
|
|
4195
|
+
internalType: "uint256"
|
|
4196
|
+
},
|
|
4197
|
+
{
|
|
4198
|
+
name: "protocolVersion",
|
|
4199
|
+
type: "uint8",
|
|
4200
|
+
internalType: "uint8"
|
|
4201
|
+
},
|
|
4202
|
+
{
|
|
4203
|
+
name: "signature",
|
|
4204
|
+
type: "bytes",
|
|
4205
|
+
internalType: "bytes"
|
|
4206
|
+
},
|
|
4207
|
+
{
|
|
4208
|
+
name: "signatureExpiry",
|
|
4209
|
+
type: "uint256",
|
|
4210
|
+
internalType: "uint256"
|
|
4211
|
+
}
|
|
4212
|
+
],
|
|
4213
|
+
outputs: [],
|
|
4214
|
+
stateMutability: "nonpayable"
|
|
4215
|
+
},
|
|
4216
|
+
{
|
|
4217
|
+
type: "function",
|
|
4218
|
+
name: "createPositionWithMargin",
|
|
4219
|
+
inputs: [
|
|
4220
|
+
{
|
|
4221
|
+
name: "positionSeed",
|
|
4222
|
+
type: "bytes16",
|
|
4223
|
+
internalType: "bytes16"
|
|
4224
|
+
},
|
|
4225
|
+
{
|
|
4226
|
+
name: "marketId",
|
|
4227
|
+
type: "bytes32",
|
|
4228
|
+
internalType: "bytes32"
|
|
4229
|
+
},
|
|
4230
|
+
{
|
|
4231
|
+
name: "tokenId",
|
|
4232
|
+
type: "uint256",
|
|
4233
|
+
internalType: "uint256"
|
|
4234
|
+
},
|
|
4235
|
+
{
|
|
4236
|
+
name: "collateralUsdcUnits",
|
|
4237
|
+
type: "uint256",
|
|
4238
|
+
internalType: "uint256"
|
|
4239
|
+
},
|
|
4240
|
+
{
|
|
4241
|
+
name: "leverageBps",
|
|
4242
|
+
type: "uint32",
|
|
4243
|
+
internalType: "uint32"
|
|
4244
|
+
},
|
|
4245
|
+
{
|
|
4246
|
+
name: "notionalUsdcUnits",
|
|
4247
|
+
type: "uint256",
|
|
4248
|
+
internalType: "uint256"
|
|
4249
|
+
},
|
|
4250
|
+
{
|
|
4251
|
+
name: "originationFeeBps",
|
|
4252
|
+
type: "uint16",
|
|
4253
|
+
internalType: "uint16"
|
|
4254
|
+
},
|
|
4255
|
+
{
|
|
4256
|
+
name: "lifetimeFeeAprBps",
|
|
4257
|
+
type: "uint16",
|
|
4258
|
+
internalType: "uint16"
|
|
4259
|
+
},
|
|
4260
|
+
{
|
|
4261
|
+
name: "liquidationFeeBps",
|
|
4262
|
+
type: "uint16",
|
|
4263
|
+
internalType: "uint16"
|
|
4264
|
+
},
|
|
4265
|
+
{
|
|
4266
|
+
name: "venueFeeUsdcUnits",
|
|
4267
|
+
type: "uint256",
|
|
4268
|
+
internalType: "uint256"
|
|
4269
|
+
},
|
|
4270
|
+
{
|
|
4271
|
+
name: "marginUsdcUnits",
|
|
4272
|
+
type: "uint256",
|
|
4273
|
+
internalType: "uint256"
|
|
4274
|
+
},
|
|
4275
|
+
{
|
|
4276
|
+
name: "signature",
|
|
4277
|
+
type: "bytes",
|
|
4278
|
+
internalType: "bytes"
|
|
4279
|
+
},
|
|
4280
|
+
{
|
|
4281
|
+
name: "signatureExpiry",
|
|
4282
|
+
type: "uint256",
|
|
4283
|
+
internalType: "uint256"
|
|
4284
|
+
}
|
|
4285
|
+
],
|
|
4286
|
+
outputs: [],
|
|
4287
|
+
stateMutability: "nonpayable"
|
|
4288
|
+
},
|
|
4289
|
+
{
|
|
4290
|
+
type: "function",
|
|
4291
|
+
name: "createPositionWithMarginAndVersion",
|
|
4292
|
+
inputs: [
|
|
4293
|
+
{
|
|
4294
|
+
name: "positionSeed",
|
|
4295
|
+
type: "bytes16",
|
|
4296
|
+
internalType: "bytes16"
|
|
4297
|
+
},
|
|
4298
|
+
{
|
|
4299
|
+
name: "marketId",
|
|
4300
|
+
type: "bytes32",
|
|
4301
|
+
internalType: "bytes32"
|
|
4302
|
+
},
|
|
4303
|
+
{
|
|
4304
|
+
name: "tokenId",
|
|
4305
|
+
type: "uint256",
|
|
4306
|
+
internalType: "uint256"
|
|
4307
|
+
},
|
|
4308
|
+
{
|
|
4309
|
+
name: "collateralUsdcUnits",
|
|
4310
|
+
type: "uint256",
|
|
4311
|
+
internalType: "uint256"
|
|
4312
|
+
},
|
|
4313
|
+
{
|
|
4314
|
+
name: "leverageBps",
|
|
4315
|
+
type: "uint32",
|
|
4316
|
+
internalType: "uint32"
|
|
4317
|
+
},
|
|
4318
|
+
{
|
|
4319
|
+
name: "notionalUsdcUnits",
|
|
4320
|
+
type: "uint256",
|
|
4321
|
+
internalType: "uint256"
|
|
4322
|
+
},
|
|
4323
|
+
{
|
|
4324
|
+
name: "originationFeeBps",
|
|
4325
|
+
type: "uint16",
|
|
4326
|
+
internalType: "uint16"
|
|
4327
|
+
},
|
|
4328
|
+
{
|
|
4329
|
+
name: "lifetimeFeeAprBps",
|
|
4330
|
+
type: "uint16",
|
|
4331
|
+
internalType: "uint16"
|
|
4332
|
+
},
|
|
4333
|
+
{
|
|
4334
|
+
name: "liquidationFeeBps",
|
|
4335
|
+
type: "uint16",
|
|
4336
|
+
internalType: "uint16"
|
|
4337
|
+
},
|
|
4338
|
+
{
|
|
4339
|
+
name: "venueFeeUsdcUnits",
|
|
4340
|
+
type: "uint256",
|
|
4341
|
+
internalType: "uint256"
|
|
4342
|
+
},
|
|
4343
|
+
{
|
|
4344
|
+
name: "marginUsdcUnits",
|
|
4345
|
+
type: "uint256",
|
|
4346
|
+
internalType: "uint256"
|
|
4347
|
+
},
|
|
4348
|
+
{
|
|
4349
|
+
name: "protocolVersion",
|
|
4350
|
+
type: "uint8",
|
|
4351
|
+
internalType: "uint8"
|
|
4352
|
+
},
|
|
4353
|
+
{
|
|
4354
|
+
name: "signature",
|
|
4355
|
+
type: "bytes",
|
|
4356
|
+
internalType: "bytes"
|
|
4357
|
+
},
|
|
4358
|
+
{
|
|
4359
|
+
name: "signatureExpiry",
|
|
4360
|
+
type: "uint256",
|
|
4361
|
+
internalType: "uint256"
|
|
4362
|
+
}
|
|
4363
|
+
],
|
|
4364
|
+
outputs: [],
|
|
4365
|
+
stateMutability: "nonpayable"
|
|
4366
|
+
},
|
|
4367
|
+
{
|
|
4368
|
+
type: "function",
|
|
4369
|
+
name: "createPositionWithVersion",
|
|
4370
|
+
inputs: [
|
|
4371
|
+
{
|
|
4372
|
+
name: "positionSeed",
|
|
4373
|
+
type: "bytes16",
|
|
4374
|
+
internalType: "bytes16"
|
|
4375
|
+
},
|
|
4376
|
+
{
|
|
4377
|
+
name: "marketId",
|
|
4378
|
+
type: "bytes32",
|
|
4379
|
+
internalType: "bytes32"
|
|
4380
|
+
},
|
|
4381
|
+
{
|
|
4382
|
+
name: "tokenId",
|
|
4383
|
+
type: "uint256",
|
|
4384
|
+
internalType: "uint256"
|
|
4385
|
+
},
|
|
4386
|
+
{
|
|
4387
|
+
name: "collateralUsdcUnits",
|
|
4388
|
+
type: "uint256",
|
|
4389
|
+
internalType: "uint256"
|
|
4390
|
+
},
|
|
4391
|
+
{
|
|
4392
|
+
name: "leverageBps",
|
|
4393
|
+
type: "uint32",
|
|
4394
|
+
internalType: "uint32"
|
|
4395
|
+
},
|
|
4396
|
+
{
|
|
4397
|
+
name: "notionalUsdcUnits",
|
|
4398
|
+
type: "uint256",
|
|
4399
|
+
internalType: "uint256"
|
|
4400
|
+
},
|
|
4401
|
+
{
|
|
4402
|
+
name: "originationFeeBps",
|
|
4403
|
+
type: "uint16",
|
|
4404
|
+
internalType: "uint16"
|
|
4405
|
+
},
|
|
4406
|
+
{
|
|
4407
|
+
name: "lifetimeFeeAprBps",
|
|
4408
|
+
type: "uint16",
|
|
4409
|
+
internalType: "uint16"
|
|
4410
|
+
},
|
|
4411
|
+
{
|
|
4412
|
+
name: "liquidationFeeBps",
|
|
4413
|
+
type: "uint16",
|
|
4414
|
+
internalType: "uint16"
|
|
4415
|
+
},
|
|
4416
|
+
{
|
|
4417
|
+
name: "venueFeeUsdcUnits",
|
|
4418
|
+
type: "uint256",
|
|
4419
|
+
internalType: "uint256"
|
|
4420
|
+
},
|
|
4421
|
+
{
|
|
4422
|
+
name: "protocolVersion",
|
|
4423
|
+
type: "uint8",
|
|
4424
|
+
internalType: "uint8"
|
|
4425
|
+
},
|
|
4426
|
+
{
|
|
4427
|
+
name: "signature",
|
|
4428
|
+
type: "bytes",
|
|
4429
|
+
internalType: "bytes"
|
|
4430
|
+
},
|
|
4431
|
+
{
|
|
4432
|
+
name: "signatureExpiry",
|
|
4433
|
+
type: "uint256",
|
|
4434
|
+
internalType: "uint256"
|
|
4435
|
+
}
|
|
4436
|
+
],
|
|
4437
|
+
outputs: [],
|
|
4438
|
+
stateMutability: "nonpayable"
|
|
4439
|
+
},
|
|
4440
|
+
{
|
|
4441
|
+
type: "function",
|
|
4442
|
+
name: "disableEmergencyOnlyMode",
|
|
4443
|
+
inputs: [],
|
|
4444
|
+
outputs: [],
|
|
4445
|
+
stateMutability: "nonpayable"
|
|
4446
|
+
},
|
|
4447
|
+
{
|
|
4448
|
+
type: "function",
|
|
4449
|
+
name: "drainLiquidatedPositionTokens",
|
|
4450
|
+
inputs: [
|
|
4451
|
+
{
|
|
4452
|
+
name: "positionKey",
|
|
4453
|
+
type: "bytes32",
|
|
4454
|
+
internalType: "bytes32"
|
|
4455
|
+
},
|
|
4456
|
+
{
|
|
4457
|
+
name: "tokenUnits",
|
|
4458
|
+
type: "uint256",
|
|
4459
|
+
internalType: "uint256"
|
|
4460
|
+
}
|
|
4461
|
+
],
|
|
4462
|
+
outputs: [],
|
|
4463
|
+
stateMutability: "nonpayable"
|
|
4464
|
+
},
|
|
4465
|
+
{
|
|
4466
|
+
type: "function",
|
|
4467
|
+
name: "eip712Domain",
|
|
4468
|
+
inputs: [],
|
|
4469
|
+
outputs: [
|
|
4470
|
+
{
|
|
4471
|
+
name: "fields",
|
|
4472
|
+
type: "bytes1",
|
|
4473
|
+
internalType: "bytes1"
|
|
4474
|
+
},
|
|
4475
|
+
{
|
|
4476
|
+
name: "name",
|
|
4477
|
+
type: "string",
|
|
4478
|
+
internalType: "string"
|
|
4479
|
+
},
|
|
4480
|
+
{
|
|
4481
|
+
name: "version",
|
|
4482
|
+
type: "string",
|
|
4483
|
+
internalType: "string"
|
|
4484
|
+
},
|
|
4485
|
+
{
|
|
4486
|
+
name: "chainId",
|
|
4487
|
+
type: "uint256",
|
|
4488
|
+
internalType: "uint256"
|
|
4489
|
+
},
|
|
4490
|
+
{
|
|
4491
|
+
name: "verifyingContract",
|
|
4492
|
+
type: "address",
|
|
4493
|
+
internalType: "address"
|
|
4494
|
+
},
|
|
4495
|
+
{
|
|
4496
|
+
name: "salt",
|
|
4497
|
+
type: "bytes32",
|
|
4498
|
+
internalType: "bytes32"
|
|
4499
|
+
},
|
|
4500
|
+
{
|
|
4501
|
+
name: "extensions",
|
|
4502
|
+
type: "uint256[]",
|
|
4503
|
+
internalType: "uint256[]"
|
|
4504
|
+
}
|
|
4505
|
+
],
|
|
4506
|
+
stateMutability: "view"
|
|
4507
|
+
},
|
|
4508
|
+
{
|
|
4509
|
+
type: "function",
|
|
4510
|
+
name: "emergencyAdmin",
|
|
4511
|
+
inputs: [],
|
|
4512
|
+
outputs: [
|
|
4513
|
+
{
|
|
4514
|
+
name: "",
|
|
4515
|
+
type: "address",
|
|
4516
|
+
internalType: "address"
|
|
4517
|
+
}
|
|
3616
4518
|
],
|
|
3617
4519
|
stateMutability: "view"
|
|
3618
4520
|
},
|
|
@@ -4146,6 +5048,11 @@ var vault_abi_default = {
|
|
|
4146
5048
|
name: "saleReceivedUsdcUnits",
|
|
4147
5049
|
type: "uint256",
|
|
4148
5050
|
internalType: "uint256"
|
|
5051
|
+
},
|
|
5052
|
+
{
|
|
5053
|
+
name: "expectedPendingTokenUnits",
|
|
5054
|
+
type: "uint256",
|
|
5055
|
+
internalType: "uint256"
|
|
4149
5056
|
}
|
|
4150
5057
|
],
|
|
4151
5058
|
outputs: [],
|
|
@@ -4169,6 +5076,11 @@ var vault_abi_default = {
|
|
|
4169
5076
|
name: "returnedTokenUnits",
|
|
4170
5077
|
type: "uint256",
|
|
4171
5078
|
internalType: "uint256"
|
|
5079
|
+
},
|
|
5080
|
+
{
|
|
5081
|
+
name: "expectedPendingTokenUnits",
|
|
5082
|
+
type: "uint256",
|
|
5083
|
+
internalType: "uint256"
|
|
4172
5084
|
}
|
|
4173
5085
|
],
|
|
4174
5086
|
outputs: [],
|
|
@@ -4179,12 +5091,93 @@ var vault_abi_default = {
|
|
|
4179
5091
|
name: "finalizePartialCloseWithUnwind",
|
|
4180
5092
|
inputs: [
|
|
4181
5093
|
{
|
|
4182
|
-
name: "positionKey",
|
|
4183
|
-
type: "bytes32",
|
|
4184
|
-
internalType: "bytes32"
|
|
5094
|
+
name: "positionKey",
|
|
5095
|
+
type: "bytes32",
|
|
5096
|
+
internalType: "bytes32"
|
|
5097
|
+
},
|
|
5098
|
+
{
|
|
5099
|
+
name: "saleReceivedUsdcUnits",
|
|
5100
|
+
type: "uint256",
|
|
5101
|
+
internalType: "uint256"
|
|
5102
|
+
},
|
|
5103
|
+
{
|
|
5104
|
+
name: "expectedPendingTokenUnits",
|
|
5105
|
+
type: "uint256",
|
|
5106
|
+
internalType: "uint256"
|
|
5107
|
+
}
|
|
5108
|
+
],
|
|
5109
|
+
outputs: [],
|
|
5110
|
+
stateMutability: "nonpayable"
|
|
5111
|
+
},
|
|
5112
|
+
{
|
|
5113
|
+
type: "function",
|
|
5114
|
+
name: "finalizeSettle",
|
|
5115
|
+
inputs: [
|
|
5116
|
+
{
|
|
5117
|
+
name: "positionKey",
|
|
5118
|
+
type: "bytes32",
|
|
5119
|
+
internalType: "bytes32"
|
|
5120
|
+
},
|
|
5121
|
+
{
|
|
5122
|
+
name: "saleReceivedUsdcUnits",
|
|
5123
|
+
type: "uint256",
|
|
5124
|
+
internalType: "uint256"
|
|
5125
|
+
},
|
|
5126
|
+
{
|
|
5127
|
+
name: "marketOutcome",
|
|
5128
|
+
type: "uint8",
|
|
5129
|
+
internalType: "uint8"
|
|
5130
|
+
},
|
|
5131
|
+
{
|
|
5132
|
+
name: "settledInFavor",
|
|
5133
|
+
type: "bool",
|
|
5134
|
+
internalType: "bool"
|
|
5135
|
+
},
|
|
5136
|
+
{
|
|
5137
|
+
name: "signature",
|
|
5138
|
+
type: "bytes",
|
|
5139
|
+
internalType: "bytes"
|
|
5140
|
+
},
|
|
5141
|
+
{
|
|
5142
|
+
name: "signatureExpiry",
|
|
5143
|
+
type: "uint256",
|
|
5144
|
+
internalType: "uint256"
|
|
5145
|
+
}
|
|
5146
|
+
],
|
|
5147
|
+
outputs: [],
|
|
5148
|
+
stateMutability: "nonpayable"
|
|
5149
|
+
},
|
|
5150
|
+
{
|
|
5151
|
+
type: "function",
|
|
5152
|
+
name: "finalizeSettlePushFunded",
|
|
5153
|
+
inputs: [
|
|
5154
|
+
{
|
|
5155
|
+
name: "positionKey",
|
|
5156
|
+
type: "bytes32",
|
|
5157
|
+
internalType: "bytes32"
|
|
5158
|
+
},
|
|
5159
|
+
{
|
|
5160
|
+
name: "saleReceivedUsdcUnits",
|
|
5161
|
+
type: "uint256",
|
|
5162
|
+
internalType: "uint256"
|
|
5163
|
+
},
|
|
5164
|
+
{
|
|
5165
|
+
name: "marketOutcome",
|
|
5166
|
+
type: "uint8",
|
|
5167
|
+
internalType: "uint8"
|
|
4185
5168
|
},
|
|
4186
5169
|
{
|
|
4187
|
-
name: "
|
|
5170
|
+
name: "settledInFavor",
|
|
5171
|
+
type: "bool",
|
|
5172
|
+
internalType: "bool"
|
|
5173
|
+
},
|
|
5174
|
+
{
|
|
5175
|
+
name: "signature",
|
|
5176
|
+
type: "bytes",
|
|
5177
|
+
internalType: "bytes"
|
|
5178
|
+
},
|
|
5179
|
+
{
|
|
5180
|
+
name: "signatureExpiry",
|
|
4188
5181
|
type: "uint256",
|
|
4189
5182
|
internalType: "uint256"
|
|
4190
5183
|
}
|
|
@@ -4194,7 +5187,7 @@ var vault_abi_default = {
|
|
|
4194
5187
|
},
|
|
4195
5188
|
{
|
|
4196
5189
|
type: "function",
|
|
4197
|
-
name: "
|
|
5190
|
+
name: "finalizeSettleWithReturn",
|
|
4198
5191
|
inputs: [
|
|
4199
5192
|
{
|
|
4200
5193
|
name: "positionKey",
|
|
@@ -4216,6 +5209,11 @@ var vault_abi_default = {
|
|
|
4216
5209
|
type: "bool",
|
|
4217
5210
|
internalType: "bool"
|
|
4218
5211
|
},
|
|
5212
|
+
{
|
|
5213
|
+
name: "returnedTokenUnits",
|
|
5214
|
+
type: "uint256",
|
|
5215
|
+
internalType: "uint256"
|
|
5216
|
+
},
|
|
4219
5217
|
{
|
|
4220
5218
|
name: "signature",
|
|
4221
5219
|
type: "bytes",
|
|
@@ -4232,7 +5230,7 @@ var vault_abi_default = {
|
|
|
4232
5230
|
},
|
|
4233
5231
|
{
|
|
4234
5232
|
type: "function",
|
|
4235
|
-
name: "
|
|
5233
|
+
name: "finalizeSettleWithReturnPushFunded",
|
|
4236
5234
|
inputs: [
|
|
4237
5235
|
{
|
|
4238
5236
|
name: "positionKey",
|
|
@@ -4254,6 +5252,11 @@ var vault_abi_default = {
|
|
|
4254
5252
|
type: "bool",
|
|
4255
5253
|
internalType: "bool"
|
|
4256
5254
|
},
|
|
5255
|
+
{
|
|
5256
|
+
name: "returnedTokenUnits",
|
|
5257
|
+
type: "uint256",
|
|
5258
|
+
internalType: "uint256"
|
|
5259
|
+
},
|
|
4257
5260
|
{
|
|
4258
5261
|
name: "signature",
|
|
4259
5262
|
type: "bytes",
|
|
@@ -4873,6 +5876,11 @@ var vault_abi_default = {
|
|
|
4873
5876
|
name: "originalPositionTokenUnits",
|
|
4874
5877
|
type: "uint256",
|
|
4875
5878
|
internalType: "uint256"
|
|
5879
|
+
},
|
|
5880
|
+
{
|
|
5881
|
+
name: "lockedMarginUsdcUnits",
|
|
5882
|
+
type: "uint256",
|
|
5883
|
+
internalType: "uint256"
|
|
4876
5884
|
}
|
|
4877
5885
|
],
|
|
4878
5886
|
stateMutability: "view"
|
|
@@ -5225,6 +6233,24 @@ var vault_abi_default = {
|
|
|
5225
6233
|
],
|
|
5226
6234
|
stateMutability: "view"
|
|
5227
6235
|
},
|
|
6236
|
+
{
|
|
6237
|
+
type: "function",
|
|
6238
|
+
name: "setShareContract",
|
|
6239
|
+
inputs: [
|
|
6240
|
+
{
|
|
6241
|
+
name: "protocolVersion",
|
|
6242
|
+
type: "uint8",
|
|
6243
|
+
internalType: "uint8"
|
|
6244
|
+
},
|
|
6245
|
+
{
|
|
6246
|
+
name: "shareContract",
|
|
6247
|
+
type: "address",
|
|
6248
|
+
internalType: "address"
|
|
6249
|
+
}
|
|
6250
|
+
],
|
|
6251
|
+
outputs: [],
|
|
6252
|
+
stateMutability: "nonpayable"
|
|
6253
|
+
},
|
|
5228
6254
|
{
|
|
5229
6255
|
type: "function",
|
|
5230
6256
|
name: "setTimelock",
|
|
@@ -5274,6 +6300,44 @@ var vault_abi_default = {
|
|
|
5274
6300
|
outputs: [],
|
|
5275
6301
|
stateMutability: "nonpayable"
|
|
5276
6302
|
},
|
|
6303
|
+
{
|
|
6304
|
+
type: "function",
|
|
6305
|
+
name: "shareContractForPosition",
|
|
6306
|
+
inputs: [
|
|
6307
|
+
{
|
|
6308
|
+
name: "positionKey",
|
|
6309
|
+
type: "bytes32",
|
|
6310
|
+
internalType: "bytes32"
|
|
6311
|
+
}
|
|
6312
|
+
],
|
|
6313
|
+
outputs: [
|
|
6314
|
+
{
|
|
6315
|
+
name: "",
|
|
6316
|
+
type: "address",
|
|
6317
|
+
internalType: "address"
|
|
6318
|
+
}
|
|
6319
|
+
],
|
|
6320
|
+
stateMutability: "view"
|
|
6321
|
+
},
|
|
6322
|
+
{
|
|
6323
|
+
type: "function",
|
|
6324
|
+
name: "shareContractForVersion",
|
|
6325
|
+
inputs: [
|
|
6326
|
+
{
|
|
6327
|
+
name: "protocolVersion",
|
|
6328
|
+
type: "uint8",
|
|
6329
|
+
internalType: "uint8"
|
|
6330
|
+
}
|
|
6331
|
+
],
|
|
6332
|
+
outputs: [
|
|
6333
|
+
{
|
|
6334
|
+
name: "",
|
|
6335
|
+
type: "address",
|
|
6336
|
+
internalType: "address"
|
|
6337
|
+
}
|
|
6338
|
+
],
|
|
6339
|
+
stateMutability: "view"
|
|
6340
|
+
},
|
|
5277
6341
|
{
|
|
5278
6342
|
type: "function",
|
|
5279
6343
|
name: "supportsInterface",
|
|
@@ -5306,6 +6370,25 @@ var vault_abi_default = {
|
|
|
5306
6370
|
],
|
|
5307
6371
|
stateMutability: "view"
|
|
5308
6372
|
},
|
|
6373
|
+
{
|
|
6374
|
+
type: "function",
|
|
6375
|
+
name: "tokenIdProtocolVersion",
|
|
6376
|
+
inputs: [
|
|
6377
|
+
{
|
|
6378
|
+
name: "tokenId",
|
|
6379
|
+
type: "uint256",
|
|
6380
|
+
internalType: "uint256"
|
|
6381
|
+
}
|
|
6382
|
+
],
|
|
6383
|
+
outputs: [
|
|
6384
|
+
{
|
|
6385
|
+
name: "",
|
|
6386
|
+
type: "uint8",
|
|
6387
|
+
internalType: "uint8"
|
|
6388
|
+
}
|
|
6389
|
+
],
|
|
6390
|
+
stateMutability: "view"
|
|
6391
|
+
},
|
|
5309
6392
|
{
|
|
5310
6393
|
type: "function",
|
|
5311
6394
|
name: "tokenTotalBorrowedUsdcUnits",
|
|
@@ -5344,6 +6427,19 @@ var vault_abi_default = {
|
|
|
5344
6427
|
],
|
|
5345
6428
|
stateMutability: "view"
|
|
5346
6429
|
},
|
|
6430
|
+
{
|
|
6431
|
+
type: "function",
|
|
6432
|
+
name: "totalLockedMarginUsdcUnits",
|
|
6433
|
+
inputs: [],
|
|
6434
|
+
outputs: [
|
|
6435
|
+
{
|
|
6436
|
+
name: "",
|
|
6437
|
+
type: "uint256",
|
|
6438
|
+
internalType: "uint256"
|
|
6439
|
+
}
|
|
6440
|
+
],
|
|
6441
|
+
stateMutability: "view"
|
|
6442
|
+
},
|
|
5347
6443
|
{
|
|
5348
6444
|
type: "function",
|
|
5349
6445
|
name: "totalProtocolBorrowedUsdcUnits",
|
|
@@ -5598,7 +6694,7 @@ var _viem = require('viem');
|
|
|
5598
6694
|
function toHex(value) {
|
|
5599
6695
|
if (!_viem.isHex.call(void 0, value)) {
|
|
5600
6696
|
const HEX_PREVIEW_LENGTH = 10;
|
|
5601
|
-
throw new (0,
|
|
6697
|
+
throw new (0, _chunkERM4WP6Dcjs.DimesError)(
|
|
5602
6698
|
"invalid_hex",
|
|
5603
6699
|
`Expected hex string starting with 0x, got: ${value.slice(0, HEX_PREVIEW_LENGTH)}`
|
|
5604
6700
|
);
|
|
@@ -5607,31 +6703,85 @@ function toHex(value) {
|
|
|
5607
6703
|
}
|
|
5608
6704
|
function toAddress(value) {
|
|
5609
6705
|
if (!_viem.isAddress.call(void 0, value)) {
|
|
5610
|
-
throw new (0,
|
|
6706
|
+
throw new (0, _chunkERM4WP6Dcjs.DimesError)("invalid_address", `Invalid EVM address: ${value}`);
|
|
5611
6707
|
}
|
|
5612
6708
|
return _viem.getAddress.call(void 0, value);
|
|
5613
6709
|
}
|
|
5614
6710
|
|
|
6711
|
+
// src/contract/protocol-version.ts
|
|
6712
|
+
var polymarketProtocolVersions = {
|
|
6713
|
+
ctf: 1,
|
|
6714
|
+
positionManager: 2
|
|
6715
|
+
};
|
|
6716
|
+
function isProtocolV2Quote(quote) {
|
|
6717
|
+
return quote.polymarketProtocolVersion === polymarketProtocolVersions.positionManager;
|
|
6718
|
+
}
|
|
6719
|
+
|
|
6720
|
+
// src/contract/risk-mode.ts
|
|
6721
|
+
function isCommittedQuote(quote) {
|
|
6722
|
+
return quote.riskMode === "committed";
|
|
6723
|
+
}
|
|
6724
|
+
|
|
5615
6725
|
// src/contract/build-tx.ts
|
|
5616
6726
|
function buildCreatePositionTx(quote) {
|
|
6727
|
+
const address = toAddress(quote.polygonVaultContractAddress);
|
|
6728
|
+
const commonArgs = [
|
|
6729
|
+
toHex(quote.positionSeedHex),
|
|
6730
|
+
toHex(quote.polymarketMarketId),
|
|
6731
|
+
BigInt(quote.polymarketTokenId),
|
|
6732
|
+
BigInt(quote.collateralUsdcUnits),
|
|
6733
|
+
quote.leverageBps,
|
|
6734
|
+
BigInt(quote.notionalUsdcUnits),
|
|
6735
|
+
quote.originationFeeBps,
|
|
6736
|
+
quote.lifetimeFeeAprBps,
|
|
6737
|
+
quote.liquidationFeeBps,
|
|
6738
|
+
BigInt(quote.expectedOpenTradingFeeUsdcUnits)
|
|
6739
|
+
];
|
|
6740
|
+
if (isProtocolV2Quote(quote)) {
|
|
6741
|
+
if (isCommittedQuote(quote)) {
|
|
6742
|
+
return {
|
|
6743
|
+
address,
|
|
6744
|
+
abi: vaultAbi,
|
|
6745
|
+
functionName: "createPositionWithMarginAndVersion",
|
|
6746
|
+
args: [
|
|
6747
|
+
...commonArgs,
|
|
6748
|
+
BigInt(quote.marginUsdcUnits),
|
|
6749
|
+
quote.polymarketProtocolVersion,
|
|
6750
|
+
toHex(quote.contractSignature),
|
|
6751
|
+
BigInt(quote.signatureExpiry)
|
|
6752
|
+
]
|
|
6753
|
+
};
|
|
6754
|
+
}
|
|
6755
|
+
return {
|
|
6756
|
+
address,
|
|
6757
|
+
abi: vaultAbi,
|
|
6758
|
+
functionName: "createPositionWithVersion",
|
|
6759
|
+
args: [
|
|
6760
|
+
...commonArgs,
|
|
6761
|
+
quote.polymarketProtocolVersion,
|
|
6762
|
+
toHex(quote.contractSignature),
|
|
6763
|
+
BigInt(quote.signatureExpiry)
|
|
6764
|
+
]
|
|
6765
|
+
};
|
|
6766
|
+
}
|
|
6767
|
+
if (isCommittedQuote(quote)) {
|
|
6768
|
+
return {
|
|
6769
|
+
address,
|
|
6770
|
+
abi: vaultAbi,
|
|
6771
|
+
functionName: "createPositionWithMargin",
|
|
6772
|
+
args: [
|
|
6773
|
+
...commonArgs,
|
|
6774
|
+
BigInt(quote.marginUsdcUnits),
|
|
6775
|
+
toHex(quote.contractSignature),
|
|
6776
|
+
BigInt(quote.signatureExpiry)
|
|
6777
|
+
]
|
|
6778
|
+
};
|
|
6779
|
+
}
|
|
5617
6780
|
return {
|
|
5618
|
-
address
|
|
6781
|
+
address,
|
|
5619
6782
|
abi: vaultAbi,
|
|
5620
6783
|
functionName: "createPosition",
|
|
5621
|
-
args: [
|
|
5622
|
-
toHex(quote.positionSeedHex),
|
|
5623
|
-
toHex(quote.polymarketMarketId),
|
|
5624
|
-
BigInt(quote.polymarketTokenId),
|
|
5625
|
-
BigInt(quote.collateralUsdcUnits),
|
|
5626
|
-
quote.leverageBps,
|
|
5627
|
-
BigInt(quote.notionalUsdcUnits),
|
|
5628
|
-
quote.originationFeeBps,
|
|
5629
|
-
quote.lifetimeFeeAprBps,
|
|
5630
|
-
quote.liquidationFeeBps,
|
|
5631
|
-
BigInt(quote.expectedOpenTradingFeeUsdcUnits),
|
|
5632
|
-
toHex(quote.contractSignature),
|
|
5633
|
-
BigInt(quote.signatureExpiry)
|
|
5634
|
-
]
|
|
6784
|
+
args: [...commonArgs, toHex(quote.contractSignature), BigInt(quote.signatureExpiry)]
|
|
5635
6785
|
};
|
|
5636
6786
|
}
|
|
5637
6787
|
function buildApproveTx(usdcAddress, spender, amount) {
|
|
@@ -5707,6 +6857,76 @@ var createPositionPushFundedAbi = [
|
|
|
5707
6857
|
outputs: []
|
|
5708
6858
|
}
|
|
5709
6859
|
];
|
|
6860
|
+
var createPositionPushFundedWithMarginAbi = [
|
|
6861
|
+
{
|
|
6862
|
+
type: "function",
|
|
6863
|
+
name: "createPositionPushFundedWithMargin",
|
|
6864
|
+
stateMutability: "nonpayable",
|
|
6865
|
+
inputs: [
|
|
6866
|
+
{ name: "positionSeed", type: "bytes16" },
|
|
6867
|
+
{ name: "marketId", type: "bytes32" },
|
|
6868
|
+
{ name: "tokenId", type: "uint256" },
|
|
6869
|
+
{ name: "collateralUsdcUnits", type: "uint256" },
|
|
6870
|
+
{ name: "leverageBps", type: "uint32" },
|
|
6871
|
+
{ name: "notionalUsdcUnits", type: "uint256" },
|
|
6872
|
+
{ name: "originationFeeBps", type: "uint16" },
|
|
6873
|
+
{ name: "lifetimeFeeAprBps", type: "uint16" },
|
|
6874
|
+
{ name: "liquidationFeeBps", type: "uint16" },
|
|
6875
|
+
{ name: "venueFeeUsdcUnits", type: "uint256" },
|
|
6876
|
+
{ name: "marginUsdcUnits", type: "uint256" },
|
|
6877
|
+
{ name: "signature", type: "bytes" },
|
|
6878
|
+
{ name: "signatureExpiry", type: "uint256" }
|
|
6879
|
+
],
|
|
6880
|
+
outputs: []
|
|
6881
|
+
}
|
|
6882
|
+
];
|
|
6883
|
+
var createPositionPushFundedWithVersionAbi = [
|
|
6884
|
+
{
|
|
6885
|
+
type: "function",
|
|
6886
|
+
name: "createPositionPushFundedWithVersion",
|
|
6887
|
+
stateMutability: "nonpayable",
|
|
6888
|
+
inputs: [
|
|
6889
|
+
{ name: "positionSeed", type: "bytes16" },
|
|
6890
|
+
{ name: "marketId", type: "bytes32" },
|
|
6891
|
+
{ name: "tokenId", type: "uint256" },
|
|
6892
|
+
{ name: "collateralUsdcUnits", type: "uint256" },
|
|
6893
|
+
{ name: "leverageBps", type: "uint32" },
|
|
6894
|
+
{ name: "notionalUsdcUnits", type: "uint256" },
|
|
6895
|
+
{ name: "originationFeeBps", type: "uint16" },
|
|
6896
|
+
{ name: "lifetimeFeeAprBps", type: "uint16" },
|
|
6897
|
+
{ name: "liquidationFeeBps", type: "uint16" },
|
|
6898
|
+
{ name: "venueFeeUsdcUnits", type: "uint256" },
|
|
6899
|
+
{ name: "protocolVersion", type: "uint8" },
|
|
6900
|
+
{ name: "signature", type: "bytes" },
|
|
6901
|
+
{ name: "signatureExpiry", type: "uint256" }
|
|
6902
|
+
],
|
|
6903
|
+
outputs: []
|
|
6904
|
+
}
|
|
6905
|
+
];
|
|
6906
|
+
var createPositionPushFundedWithMarginAndVersionAbi = [
|
|
6907
|
+
{
|
|
6908
|
+
type: "function",
|
|
6909
|
+
name: "createPositionPushFundedWithMarginAndVersion",
|
|
6910
|
+
stateMutability: "nonpayable",
|
|
6911
|
+
inputs: [
|
|
6912
|
+
{ name: "positionSeed", type: "bytes16" },
|
|
6913
|
+
{ name: "marketId", type: "bytes32" },
|
|
6914
|
+
{ name: "tokenId", type: "uint256" },
|
|
6915
|
+
{ name: "collateralUsdcUnits", type: "uint256" },
|
|
6916
|
+
{ name: "leverageBps", type: "uint32" },
|
|
6917
|
+
{ name: "notionalUsdcUnits", type: "uint256" },
|
|
6918
|
+
{ name: "originationFeeBps", type: "uint16" },
|
|
6919
|
+
{ name: "lifetimeFeeAprBps", type: "uint16" },
|
|
6920
|
+
{ name: "liquidationFeeBps", type: "uint16" },
|
|
6921
|
+
{ name: "venueFeeUsdcUnits", type: "uint256" },
|
|
6922
|
+
{ name: "marginUsdcUnits", type: "uint256" },
|
|
6923
|
+
{ name: "protocolVersion", type: "uint8" },
|
|
6924
|
+
{ name: "signature", type: "bytes" },
|
|
6925
|
+
{ name: "signatureExpiry", type: "uint256" }
|
|
6926
|
+
],
|
|
6927
|
+
outputs: []
|
|
6928
|
+
}
|
|
6929
|
+
];
|
|
5710
6930
|
var erc20TransferAbi = [
|
|
5711
6931
|
{
|
|
5712
6932
|
type: "function",
|
|
@@ -5719,6 +6939,62 @@ var erc20TransferAbi = [
|
|
|
5719
6939
|
outputs: [{ name: "", type: "bool" }]
|
|
5720
6940
|
}
|
|
5721
6941
|
];
|
|
6942
|
+
function buildPushFundedCreateData(quote) {
|
|
6943
|
+
const commonArgs = [
|
|
6944
|
+
toHex(quote.positionSeedHex),
|
|
6945
|
+
toHex(quote.polymarketMarketId),
|
|
6946
|
+
BigInt(quote.polymarketTokenId),
|
|
6947
|
+
BigInt(quote.collateralUsdcUnits),
|
|
6948
|
+
quote.leverageBps,
|
|
6949
|
+
BigInt(quote.notionalUsdcUnits),
|
|
6950
|
+
quote.originationFeeBps,
|
|
6951
|
+
quote.lifetimeFeeAprBps,
|
|
6952
|
+
quote.liquidationFeeBps,
|
|
6953
|
+
BigInt(quote.expectedOpenTradingFeeUsdcUnits)
|
|
6954
|
+
];
|
|
6955
|
+
if (isProtocolV2Quote(quote)) {
|
|
6956
|
+
if (isCommittedQuote(quote)) {
|
|
6957
|
+
return _viem.encodeFunctionData.call(void 0, {
|
|
6958
|
+
abi: createPositionPushFundedWithMarginAndVersionAbi,
|
|
6959
|
+
functionName: "createPositionPushFundedWithMarginAndVersion",
|
|
6960
|
+
args: [
|
|
6961
|
+
...commonArgs,
|
|
6962
|
+
BigInt(quote.marginUsdcUnits),
|
|
6963
|
+
quote.polymarketProtocolVersion,
|
|
6964
|
+
toHex(quote.contractSignature),
|
|
6965
|
+
BigInt(quote.signatureExpiry)
|
|
6966
|
+
]
|
|
6967
|
+
});
|
|
6968
|
+
}
|
|
6969
|
+
return _viem.encodeFunctionData.call(void 0, {
|
|
6970
|
+
abi: createPositionPushFundedWithVersionAbi,
|
|
6971
|
+
functionName: "createPositionPushFundedWithVersion",
|
|
6972
|
+
args: [
|
|
6973
|
+
...commonArgs,
|
|
6974
|
+
quote.polymarketProtocolVersion,
|
|
6975
|
+
toHex(quote.contractSignature),
|
|
6976
|
+
BigInt(quote.signatureExpiry)
|
|
6977
|
+
]
|
|
6978
|
+
});
|
|
6979
|
+
}
|
|
6980
|
+
if (isCommittedQuote(quote)) {
|
|
6981
|
+
return _viem.encodeFunctionData.call(void 0, {
|
|
6982
|
+
abi: createPositionPushFundedWithMarginAbi,
|
|
6983
|
+
functionName: "createPositionPushFundedWithMargin",
|
|
6984
|
+
args: [
|
|
6985
|
+
...commonArgs,
|
|
6986
|
+
BigInt(quote.marginUsdcUnits),
|
|
6987
|
+
toHex(quote.contractSignature),
|
|
6988
|
+
BigInt(quote.signatureExpiry)
|
|
6989
|
+
]
|
|
6990
|
+
});
|
|
6991
|
+
}
|
|
6992
|
+
return _viem.encodeFunctionData.call(void 0, {
|
|
6993
|
+
abi: createPositionPushFundedAbi,
|
|
6994
|
+
functionName: "createPositionPushFunded",
|
|
6995
|
+
args: [...commonArgs, toHex(quote.contractSignature), BigInt(quote.signatureExpiry)]
|
|
6996
|
+
});
|
|
6997
|
+
}
|
|
5722
6998
|
function buildPushFundedCreateCalls(quote, pUsdAddress) {
|
|
5723
6999
|
const vaultAddress = toAddress(quote.polygonVaultContractAddress);
|
|
5724
7000
|
const totalUserAmountUsdcUnits = BigInt(quote.totalUserAmountUsdcUnits);
|
|
@@ -5732,24 +7008,7 @@ function buildPushFundedCreateCalls(quote, pUsdAddress) {
|
|
|
5732
7008
|
functionName: "transfer",
|
|
5733
7009
|
args: [vaultAddress, totalUserAmountUsdcUnits]
|
|
5734
7010
|
});
|
|
5735
|
-
const createPositionData =
|
|
5736
|
-
abi: createPositionPushFundedAbi,
|
|
5737
|
-
functionName: "createPositionPushFunded",
|
|
5738
|
-
args: [
|
|
5739
|
-
toHex(quote.positionSeedHex),
|
|
5740
|
-
toHex(quote.polymarketMarketId),
|
|
5741
|
-
BigInt(quote.polymarketTokenId),
|
|
5742
|
-
BigInt(quote.collateralUsdcUnits),
|
|
5743
|
-
quote.leverageBps,
|
|
5744
|
-
BigInt(quote.notionalUsdcUnits),
|
|
5745
|
-
quote.originationFeeBps,
|
|
5746
|
-
quote.lifetimeFeeAprBps,
|
|
5747
|
-
quote.liquidationFeeBps,
|
|
5748
|
-
BigInt(quote.expectedOpenTradingFeeUsdcUnits),
|
|
5749
|
-
toHex(quote.contractSignature),
|
|
5750
|
-
BigInt(quote.signatureExpiry)
|
|
5751
|
-
]
|
|
5752
|
-
});
|
|
7011
|
+
const createPositionData = buildPushFundedCreateData(quote);
|
|
5753
7012
|
return [
|
|
5754
7013
|
{ target: vaultAddress, value: 0n, data: reserveDepositData },
|
|
5755
7014
|
{ target: toAddress(pUsdAddress), value: 0n, data: transferData },
|
|
@@ -5868,30 +7127,119 @@ var createPositionTypes = {
|
|
|
5868
7127
|
{ name: "signatureExpiry", type: "uint256" }
|
|
5869
7128
|
]
|
|
5870
7129
|
};
|
|
7130
|
+
var createPositionWithMarginTypes = {
|
|
7131
|
+
CreatePositionWithMargin: [
|
|
7132
|
+
{ name: "positionSeed", type: "bytes16" },
|
|
7133
|
+
{ name: "user", type: "address" },
|
|
7134
|
+
{ name: "marketId", type: "bytes32" },
|
|
7135
|
+
{ name: "tokenId", type: "uint256" },
|
|
7136
|
+
{ name: "collateralUsdcUnits", type: "uint256" },
|
|
7137
|
+
{ name: "leverageBps", type: "uint32" },
|
|
7138
|
+
{ name: "notionalUsdcUnits", type: "uint256" },
|
|
7139
|
+
{ name: "originationFeeBps", type: "uint16" },
|
|
7140
|
+
{ name: "lifetimeFeeAprBps", type: "uint16" },
|
|
7141
|
+
{ name: "liquidationFeeBps", type: "uint16" },
|
|
7142
|
+
{ name: "venueFeeUsdcUnits", type: "uint256" },
|
|
7143
|
+
{ name: "marginUsdcUnits", type: "uint256" },
|
|
7144
|
+
{ name: "signatureExpiry", type: "uint256" }
|
|
7145
|
+
]
|
|
7146
|
+
};
|
|
7147
|
+
var createPositionWithVersionTypes = {
|
|
7148
|
+
CreatePositionWithVersion: [
|
|
7149
|
+
{ name: "positionSeed", type: "bytes16" },
|
|
7150
|
+
{ name: "user", type: "address" },
|
|
7151
|
+
{ name: "marketId", type: "bytes32" },
|
|
7152
|
+
{ name: "tokenId", type: "uint256" },
|
|
7153
|
+
{ name: "collateralUsdcUnits", type: "uint256" },
|
|
7154
|
+
{ name: "leverageBps", type: "uint32" },
|
|
7155
|
+
{ name: "notionalUsdcUnits", type: "uint256" },
|
|
7156
|
+
{ name: "originationFeeBps", type: "uint16" },
|
|
7157
|
+
{ name: "lifetimeFeeAprBps", type: "uint16" },
|
|
7158
|
+
{ name: "liquidationFeeBps", type: "uint16" },
|
|
7159
|
+
{ name: "venueFeeUsdcUnits", type: "uint256" },
|
|
7160
|
+
{ name: "protocolVersion", type: "uint8" },
|
|
7161
|
+
{ name: "signatureExpiry", type: "uint256" }
|
|
7162
|
+
]
|
|
7163
|
+
};
|
|
7164
|
+
var createPositionWithMarginAndVersionTypes = {
|
|
7165
|
+
CreatePositionWithMarginAndVersion: [
|
|
7166
|
+
{ name: "positionSeed", type: "bytes16" },
|
|
7167
|
+
{ name: "user", type: "address" },
|
|
7168
|
+
{ name: "marketId", type: "bytes32" },
|
|
7169
|
+
{ name: "tokenId", type: "uint256" },
|
|
7170
|
+
{ name: "collateralUsdcUnits", type: "uint256" },
|
|
7171
|
+
{ name: "leverageBps", type: "uint32" },
|
|
7172
|
+
{ name: "notionalUsdcUnits", type: "uint256" },
|
|
7173
|
+
{ name: "originationFeeBps", type: "uint16" },
|
|
7174
|
+
{ name: "lifetimeFeeAprBps", type: "uint16" },
|
|
7175
|
+
{ name: "liquidationFeeBps", type: "uint16" },
|
|
7176
|
+
{ name: "venueFeeUsdcUnits", type: "uint256" },
|
|
7177
|
+
{ name: "marginUsdcUnits", type: "uint256" },
|
|
7178
|
+
{ name: "protocolVersion", type: "uint8" },
|
|
7179
|
+
{ name: "signatureExpiry", type: "uint256" }
|
|
7180
|
+
]
|
|
7181
|
+
};
|
|
7182
|
+
function buildDomain(quote) {
|
|
7183
|
+
return {
|
|
7184
|
+
name: "LeveragedPredictionVaultV1",
|
|
7185
|
+
version: "1",
|
|
7186
|
+
chainId: Number(quote.evmChainId),
|
|
7187
|
+
verifyingContract: toAddress(quote.polygonVaultContractAddress)
|
|
7188
|
+
};
|
|
7189
|
+
}
|
|
7190
|
+
function buildMessage(quote, userAddress) {
|
|
7191
|
+
return {
|
|
7192
|
+
positionSeed: toHex(quote.positionSeedHex),
|
|
7193
|
+
user: userAddress,
|
|
7194
|
+
marketId: toHex(quote.polymarketMarketId),
|
|
7195
|
+
tokenId: BigInt(quote.polymarketTokenId),
|
|
7196
|
+
collateralUsdcUnits: BigInt(quote.collateralUsdcUnits),
|
|
7197
|
+
leverageBps: quote.leverageBps,
|
|
7198
|
+
notionalUsdcUnits: BigInt(quote.notionalUsdcUnits),
|
|
7199
|
+
originationFeeBps: quote.originationFeeBps,
|
|
7200
|
+
lifetimeFeeAprBps: quote.lifetimeFeeAprBps,
|
|
7201
|
+
liquidationFeeBps: quote.liquidationFeeBps,
|
|
7202
|
+
venueFeeUsdcUnits: BigInt(quote.expectedOpenTradingFeeUsdcUnits),
|
|
7203
|
+
signatureExpiry: BigInt(quote.signatureExpiry)
|
|
7204
|
+
};
|
|
7205
|
+
}
|
|
5871
7206
|
async function recoverCreatePositionSigner(quote, userAddress) {
|
|
7207
|
+
if (isProtocolV2Quote(quote)) {
|
|
7208
|
+
if (isCommittedQuote(quote)) {
|
|
7209
|
+
return _viem.recoverTypedDataAddress.call(void 0, {
|
|
7210
|
+
domain: buildDomain(quote),
|
|
7211
|
+
types: createPositionWithMarginAndVersionTypes,
|
|
7212
|
+
primaryType: "CreatePositionWithMarginAndVersion",
|
|
7213
|
+
message: {
|
|
7214
|
+
...buildMessage(quote, userAddress),
|
|
7215
|
+
marginUsdcUnits: BigInt(quote.marginUsdcUnits),
|
|
7216
|
+
protocolVersion: quote.polymarketProtocolVersion
|
|
7217
|
+
},
|
|
7218
|
+
signature: toHex(quote.contractSignature)
|
|
7219
|
+
});
|
|
7220
|
+
}
|
|
7221
|
+
return _viem.recoverTypedDataAddress.call(void 0, {
|
|
7222
|
+
domain: buildDomain(quote),
|
|
7223
|
+
types: createPositionWithVersionTypes,
|
|
7224
|
+
primaryType: "CreatePositionWithVersion",
|
|
7225
|
+
message: { ...buildMessage(quote, userAddress), protocolVersion: quote.polymarketProtocolVersion },
|
|
7226
|
+
signature: toHex(quote.contractSignature)
|
|
7227
|
+
});
|
|
7228
|
+
}
|
|
7229
|
+
if (isCommittedQuote(quote)) {
|
|
7230
|
+
return _viem.recoverTypedDataAddress.call(void 0, {
|
|
7231
|
+
domain: buildDomain(quote),
|
|
7232
|
+
types: createPositionWithMarginTypes,
|
|
7233
|
+
primaryType: "CreatePositionWithMargin",
|
|
7234
|
+
message: { ...buildMessage(quote, userAddress), marginUsdcUnits: BigInt(quote.marginUsdcUnits) },
|
|
7235
|
+
signature: toHex(quote.contractSignature)
|
|
7236
|
+
});
|
|
7237
|
+
}
|
|
5872
7238
|
return _viem.recoverTypedDataAddress.call(void 0, {
|
|
5873
|
-
domain:
|
|
5874
|
-
name: "LeveragedPredictionVaultV1",
|
|
5875
|
-
version: "1",
|
|
5876
|
-
chainId: Number(quote.evmChainId),
|
|
5877
|
-
verifyingContract: toAddress(quote.polygonVaultContractAddress)
|
|
5878
|
-
},
|
|
7239
|
+
domain: buildDomain(quote),
|
|
5879
7240
|
types: createPositionTypes,
|
|
5880
7241
|
primaryType: "CreatePosition",
|
|
5881
|
-
message:
|
|
5882
|
-
positionSeed: toHex(quote.positionSeedHex),
|
|
5883
|
-
user: userAddress,
|
|
5884
|
-
marketId: toHex(quote.polymarketMarketId),
|
|
5885
|
-
tokenId: BigInt(quote.polymarketTokenId),
|
|
5886
|
-
collateralUsdcUnits: BigInt(quote.collateralUsdcUnits),
|
|
5887
|
-
leverageBps: quote.leverageBps,
|
|
5888
|
-
notionalUsdcUnits: BigInt(quote.notionalUsdcUnits),
|
|
5889
|
-
originationFeeBps: quote.originationFeeBps,
|
|
5890
|
-
lifetimeFeeAprBps: quote.lifetimeFeeAprBps,
|
|
5891
|
-
liquidationFeeBps: quote.liquidationFeeBps,
|
|
5892
|
-
venueFeeUsdcUnits: BigInt(quote.expectedOpenTradingFeeUsdcUnits),
|
|
5893
|
-
signatureExpiry: BigInt(quote.signatureExpiry)
|
|
5894
|
-
},
|
|
7242
|
+
message: buildMessage(quote, userAddress),
|
|
5895
7243
|
signature: toHex(quote.contractSignature)
|
|
5896
7244
|
});
|
|
5897
7245
|
}
|
|
@@ -5902,7 +7250,7 @@ async function assertQuoteSigner(quote, userAddress, expectedSigner) {
|
|
|
5902
7250
|
const recoveredSigner = await recoverCreatePositionSigner(quote, userAddress);
|
|
5903
7251
|
const expected = _viem.getAddress.call(void 0, expectedSigner);
|
|
5904
7252
|
if (recoveredSigner !== expected) {
|
|
5905
|
-
throw new (0,
|
|
7253
|
+
throw new (0, _chunkERM4WP6Dcjs.DimesContractError)(
|
|
5906
7254
|
"invalid_signer",
|
|
5907
7255
|
`Recovered signer ${recoveredSigner} does not match expected authority ${expected}`
|
|
5908
7256
|
);
|
|
@@ -6025,12 +7373,12 @@ function firstLine(s) {
|
|
|
6025
7373
|
}
|
|
6026
7374
|
function formatContractError(err) {
|
|
6027
7375
|
if (!err) {
|
|
6028
|
-
return new (0,
|
|
7376
|
+
return new (0, _chunkERM4WP6Dcjs.DimesContractError)("unknown", "Transaction failed.");
|
|
6029
7377
|
}
|
|
6030
7378
|
if (err instanceof _viem.BaseError) {
|
|
6031
7379
|
const rejected = err.walk((e) => e instanceof _viem.UserRejectedRequestError);
|
|
6032
7380
|
if (rejected) {
|
|
6033
|
-
return new (0,
|
|
7381
|
+
return new (0, _chunkERM4WP6Dcjs.DimesContractError)("UserRejected", "Transaction rejected in wallet.");
|
|
6034
7382
|
}
|
|
6035
7383
|
const reverted = err.walk(
|
|
6036
7384
|
(e) => e instanceof _viem.ContractFunctionRevertedError
|
|
@@ -6041,12 +7389,12 @@ function formatContractError(err) {
|
|
|
6041
7389
|
if (errorName) {
|
|
6042
7390
|
const fmt = friendlyByErrorName[errorName];
|
|
6043
7391
|
const message = fmt ? fmt(args) : humanizeName(errorName);
|
|
6044
|
-
return new (0,
|
|
7392
|
+
return new (0, _chunkERM4WP6Dcjs.DimesContractError)(errorName, message);
|
|
6045
7393
|
}
|
|
6046
7394
|
const raw = reverted.raw;
|
|
6047
7395
|
const selector = raw && raw.length >= HEX_SELECTOR_LENGTH ? raw.slice(0, HEX_SELECTOR_LENGTH) : void 0;
|
|
6048
7396
|
const selectorMessage = selector ? friendlyBySelector[selector] : void 0;
|
|
6049
|
-
return new (0,
|
|
7397
|
+
return new (0, _chunkERM4WP6Dcjs.DimesContractError)(
|
|
6050
7398
|
_nullishCoalesce(selector, () => ( "unknown_revert")),
|
|
6051
7399
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
6052
7400
|
_nullishCoalesce(_nullishCoalesce(selectorMessage, () => ( reverted.shortMessage)), () => ( "Contract reverted."))
|
|
@@ -6054,17 +7402,17 @@ function formatContractError(err) {
|
|
|
6054
7402
|
}
|
|
6055
7403
|
const exec = err.walk((e) => e instanceof _viem.ContractFunctionExecutionError);
|
|
6056
7404
|
if (_optionalChain([exec, 'optionalAccess', _5 => _5.shortMessage])) {
|
|
6057
|
-
return new (0,
|
|
7405
|
+
return new (0, _chunkERM4WP6Dcjs.DimesContractError)("execution_error", firstLine(exec.shortMessage));
|
|
6058
7406
|
}
|
|
6059
7407
|
if (err.shortMessage) {
|
|
6060
|
-
return new (0,
|
|
7408
|
+
return new (0, _chunkERM4WP6Dcjs.DimesContractError)("base_error", firstLine(err.shortMessage));
|
|
6061
7409
|
}
|
|
6062
|
-
return new (0,
|
|
7410
|
+
return new (0, _chunkERM4WP6Dcjs.DimesContractError)("base_error", firstLine(err.message));
|
|
6063
7411
|
}
|
|
6064
7412
|
if (err instanceof Error) {
|
|
6065
|
-
return new (0,
|
|
7413
|
+
return new (0, _chunkERM4WP6Dcjs.DimesContractError)("error", firstLine(err.message));
|
|
6066
7414
|
}
|
|
6067
|
-
return new (0,
|
|
7415
|
+
return new (0, _chunkERM4WP6Dcjs.DimesContractError)("unknown", "Transaction failed.");
|
|
6068
7416
|
}
|
|
6069
7417
|
|
|
6070
7418
|
|
|
@@ -6094,5 +7442,8 @@ function formatContractError(err) {
|
|
|
6094
7442
|
|
|
6095
7443
|
|
|
6096
7444
|
|
|
6097
|
-
|
|
7445
|
+
|
|
7446
|
+
|
|
7447
|
+
|
|
7448
|
+
exports.assertQuoteSigner = assertQuoteSigner; exports.buildApproveTx = buildApproveTx; exports.buildCreatePositionTx = buildCreatePositionTx; exports.buildDepositWalletBatch = buildDepositWalletBatch; exports.buildPushFundedCreateCalls = buildPushFundedCreateCalls; exports.buildRelayerAuthHeaders = buildRelayerAuthHeaders; exports.buildRelayerSubmitPayload = buildRelayerSubmitPayload; exports.buildRequestCloseCalls = buildRequestCloseCalls; exports.buildRequestCloseTx = buildRequestCloseTx; exports.buildRequestPartialCloseCalls = buildRequestPartialCloseCalls; exports.buildRequestPartialCloseTx = buildRequestPartialCloseTx; exports.buildVerifiedCreatePositionTx = buildVerifiedCreatePositionTx; exports.buildVerifiedPushFundedCreateCalls = buildVerifiedPushFundedCreateCalls; exports.depositWalletBatchTypes = depositWalletBatchTypes; exports.depositWalletFactoryAddress = depositWalletFactoryAddress; exports.erc20Abi = erc20Abi; exports.formatContractError = formatContractError; exports.getCachedContractInfo = getCachedContractInfo; exports.getDepositWalletBatchTypedData = getDepositWalletBatchTypedData; exports.isCommittedQuote = isCommittedQuote; exports.isProtocolV2Quote = isProtocolV2Quote; exports.polymarketProtocolVersions = polymarketProtocolVersions; exports.polymarketRelayerBaseUrl = polymarketRelayerBaseUrl; exports.recoverCreatePositionSigner = recoverCreatePositionSigner; exports.resolveExpectedSigner = resolveExpectedSigner; exports.toAddress = toAddress; exports.toHex = toHex; exports.vaultAbi = vaultAbi; exports.verifyOfferSignature = verifyOfferSignature; exports.verifyQuoteSignature = verifyQuoteSignature;
|
|
6098
7449
|
//# sourceMappingURL=index.cjs.map
|