@dimes-dot-fi/sdk 2.5.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 +6 -0
- package/dist/{aliases-lNsFUKPA.d.cts → aliases-BI1c3Yt0.d.cts} +887 -830
- package/dist/{aliases-lNsFUKPA.d.ts → aliases-BI1c3Yt0.d.ts} +887 -830
- package/dist/contract/index.cjs +880 -19
- package/dist/contract/index.cjs.map +1 -1
- package/dist/contract/index.d.cts +80 -14
- package/dist/contract/index.d.ts +80 -14
- package/dist/contract/index.mjs +879 -18
- package/dist/contract/index.mjs.map +1 -1
- package/dist/{dimes-client-BUAeOsgL.d.cts → dimes-client-C4SsCNrZ.d.cts} +1 -1
- package/dist/{dimes-client-DDF-f8yA.d.ts → dimes-client-Ckn8yRG6.d.ts} +1 -1
- package/dist/{dimes-error-I7lEZ2V5.d.cts → dimes-error-BRysMNV_.d.cts} +2 -2
- package/dist/{dimes-error-CkcjExUy.d.ts → dimes-error-Ke7yuX1m.d.ts} +2 -2
- package/dist/index.d.cts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/{quote-Z88cryAN.d.ts → quote-06n723we.d.ts} +2 -2
- package/dist/{quote-B_cMLw7P.d.cts → quote-CcIqLwKb.d.cts} +2 -2
- package/dist/react/index.d.cts +4 -4
- package/dist/react/index.d.ts +4 -4
- package/dist/{types-F2rHf2Qv.d.cts → types-B881zrxm.d.cts} +1 -1
- package/dist/{types-BvZf3uFL.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/contract/index.cjs
CHANGED
|
@@ -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",
|
|
@@ -325,6 +330,11 @@ var vault_abi_default = {
|
|
|
325
330
|
name: "OverlappingAdminRoles",
|
|
326
331
|
inputs: []
|
|
327
332
|
},
|
|
333
|
+
{
|
|
334
|
+
type: "error",
|
|
335
|
+
name: "PartialCloseAboveMaxSlice",
|
|
336
|
+
inputs: []
|
|
337
|
+
},
|
|
328
338
|
{
|
|
329
339
|
type: "error",
|
|
330
340
|
name: "PartialCloseBelowMinCollateral",
|
|
@@ -335,6 +345,11 @@ var vault_abi_default = {
|
|
|
335
345
|
name: "PartialCloseBelowMinSlice",
|
|
336
346
|
inputs: []
|
|
337
347
|
},
|
|
348
|
+
{
|
|
349
|
+
type: "error",
|
|
350
|
+
name: "PartialCloseSharesOutMismatch",
|
|
351
|
+
inputs: []
|
|
352
|
+
},
|
|
338
353
|
{
|
|
339
354
|
type: "error",
|
|
340
355
|
name: "PartialFillBelowMinCollateral",
|
|
@@ -355,6 +370,11 @@ var vault_abi_default = {
|
|
|
355
370
|
name: "PositionNotFound",
|
|
356
371
|
inputs: []
|
|
357
372
|
},
|
|
373
|
+
{
|
|
374
|
+
type: "error",
|
|
375
|
+
name: "ProceedsExceedTokenValue",
|
|
376
|
+
inputs: []
|
|
377
|
+
},
|
|
358
378
|
{
|
|
359
379
|
type: "error",
|
|
360
380
|
name: "PushDepositAlreadyLocked",
|
|
@@ -380,6 +400,11 @@ var vault_abi_default = {
|
|
|
380
400
|
name: "ReentrancyGuardReentrantCall",
|
|
381
401
|
inputs: []
|
|
382
402
|
},
|
|
403
|
+
{
|
|
404
|
+
type: "error",
|
|
405
|
+
name: "RefundReductionExceedsPending",
|
|
406
|
+
inputs: []
|
|
407
|
+
},
|
|
383
408
|
{
|
|
384
409
|
type: "error",
|
|
385
410
|
name: "SafeCastOverflowedUintDowncast",
|
|
@@ -417,11 +442,26 @@ var vault_abi_default = {
|
|
|
417
442
|
name: "ServerHalted",
|
|
418
443
|
inputs: []
|
|
419
444
|
},
|
|
445
|
+
{
|
|
446
|
+
type: "error",
|
|
447
|
+
name: "ShareContractAlreadySet",
|
|
448
|
+
inputs: []
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
type: "error",
|
|
452
|
+
name: "ShareContractHasNoCode",
|
|
453
|
+
inputs: []
|
|
454
|
+
},
|
|
420
455
|
{
|
|
421
456
|
type: "error",
|
|
422
457
|
name: "SignatureExpired",
|
|
423
458
|
inputs: []
|
|
424
459
|
},
|
|
460
|
+
{
|
|
461
|
+
type: "error",
|
|
462
|
+
name: "StalePendingRefund",
|
|
463
|
+
inputs: []
|
|
464
|
+
},
|
|
425
465
|
{
|
|
426
466
|
type: "error",
|
|
427
467
|
name: "StaleRecoveryNonce",
|
|
@@ -442,6 +482,11 @@ var vault_abi_default = {
|
|
|
442
482
|
name: "TokenIdMismatch",
|
|
443
483
|
inputs: []
|
|
444
484
|
},
|
|
485
|
+
{
|
|
486
|
+
type: "error",
|
|
487
|
+
name: "TokenIdProtocolVersionMismatch",
|
|
488
|
+
inputs: []
|
|
489
|
+
},
|
|
445
490
|
{
|
|
446
491
|
type: "error",
|
|
447
492
|
name: "TotalCapitalExceeded",
|
|
@@ -468,6 +513,11 @@ var vault_abi_default = {
|
|
|
468
513
|
name: "UnauthorizedTokenSender",
|
|
469
514
|
inputs: []
|
|
470
515
|
},
|
|
516
|
+
{
|
|
517
|
+
type: "error",
|
|
518
|
+
name: "UnmappedProtocolVersion",
|
|
519
|
+
inputs: []
|
|
520
|
+
},
|
|
471
521
|
{
|
|
472
522
|
type: "error",
|
|
473
523
|
name: "UserActionsPaused",
|
|
@@ -1564,6 +1614,61 @@ var vault_abi_default = {
|
|
|
1564
1614
|
],
|
|
1565
1615
|
anonymous: false
|
|
1566
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
|
+
},
|
|
1567
1672
|
{
|
|
1568
1673
|
type: "event",
|
|
1569
1674
|
name: "PartialCloseAborted",
|
|
@@ -1641,6 +1746,18 @@ var vault_abi_default = {
|
|
|
1641
1746
|
indexed: false,
|
|
1642
1747
|
internalType: "uint256"
|
|
1643
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
|
+
},
|
|
1644
1761
|
{
|
|
1645
1762
|
name: "collectedLifetimeFeeUsdcUnits",
|
|
1646
1763
|
type: "uint256",
|
|
@@ -1744,6 +1861,18 @@ var vault_abi_default = {
|
|
|
1744
1861
|
indexed: false,
|
|
1745
1862
|
internalType: "uint256"
|
|
1746
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
|
+
},
|
|
1747
1876
|
{
|
|
1748
1877
|
name: "collectedLifetimeFeeUsdcUnits",
|
|
1749
1878
|
type: "uint256",
|
|
@@ -1841,6 +1970,18 @@ var vault_abi_default = {
|
|
|
1841
1970
|
indexed: false,
|
|
1842
1971
|
internalType: "uint256"
|
|
1843
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
|
+
},
|
|
1844
1985
|
{
|
|
1845
1986
|
name: "collectedLifetimeFeeUsdcUnits",
|
|
1846
1987
|
type: "uint256",
|
|
@@ -2295,6 +2436,109 @@ var vault_abi_default = {
|
|
|
2295
2436
|
],
|
|
2296
2437
|
anonymous: false
|
|
2297
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
|
+
},
|
|
2298
2542
|
{
|
|
2299
2543
|
type: "event",
|
|
2300
2544
|
name: "PositionForceUnwound",
|
|
@@ -3240,6 +3484,31 @@ var vault_abi_default = {
|
|
|
3240
3484
|
],
|
|
3241
3485
|
anonymous: false
|
|
3242
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
|
+
},
|
|
3243
3512
|
{
|
|
3244
3513
|
type: "event",
|
|
3245
3514
|
name: "TimelockUpdated",
|
|
@@ -3553,32 +3822,352 @@ var vault_abi_default = {
|
|
|
3553
3822
|
},
|
|
3554
3823
|
{
|
|
3555
3824
|
type: "function",
|
|
3556
|
-
name: "
|
|
3825
|
+
name: "correctOverCreditedRefund",
|
|
3557
3826
|
inputs: [
|
|
3558
3827
|
{
|
|
3559
|
-
name: "
|
|
3560
|
-
type: "bytes16",
|
|
3561
|
-
internalType: "bytes16"
|
|
3562
|
-
},
|
|
3563
|
-
{
|
|
3564
|
-
name: "marketId",
|
|
3828
|
+
name: "positionKey",
|
|
3565
3829
|
type: "bytes32",
|
|
3566
3830
|
internalType: "bytes32"
|
|
3567
3831
|
},
|
|
3568
3832
|
{
|
|
3569
|
-
name: "
|
|
3833
|
+
name: "expectedRecoveryNonce",
|
|
3570
3834
|
type: "uint256",
|
|
3571
3835
|
internalType: "uint256"
|
|
3572
3836
|
},
|
|
3573
3837
|
{
|
|
3574
|
-
name: "
|
|
3838
|
+
name: "expectedPendingRefundUsdcUnits",
|
|
3575
3839
|
type: "uint256",
|
|
3576
3840
|
internalType: "uint256"
|
|
3577
3841
|
},
|
|
3578
3842
|
{
|
|
3579
|
-
name: "
|
|
3580
|
-
type: "
|
|
3581
|
-
internalType: "
|
|
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
|
+
},
|
|
3856
|
+
{
|
|
3857
|
+
type: "function",
|
|
3858
|
+
name: "createPosition",
|
|
3859
|
+
inputs: [
|
|
3860
|
+
{
|
|
3861
|
+
name: "positionSeed",
|
|
3862
|
+
type: "bytes16",
|
|
3863
|
+
internalType: "bytes16"
|
|
3864
|
+
},
|
|
3865
|
+
{
|
|
3866
|
+
name: "marketId",
|
|
3867
|
+
type: "bytes32",
|
|
3868
|
+
internalType: "bytes32"
|
|
3869
|
+
},
|
|
3870
|
+
{
|
|
3871
|
+
name: "tokenId",
|
|
3872
|
+
type: "uint256",
|
|
3873
|
+
internalType: "uint256"
|
|
3874
|
+
},
|
|
3875
|
+
{
|
|
3876
|
+
name: "collateralUsdcUnits",
|
|
3877
|
+
type: "uint256",
|
|
3878
|
+
internalType: "uint256"
|
|
3879
|
+
},
|
|
3880
|
+
{
|
|
3881
|
+
name: "leverageBps",
|
|
3882
|
+
type: "uint32",
|
|
3883
|
+
internalType: "uint32"
|
|
3884
|
+
},
|
|
3885
|
+
{
|
|
3886
|
+
name: "notionalUsdcUnits",
|
|
3887
|
+
type: "uint256",
|
|
3888
|
+
internalType: "uint256"
|
|
3889
|
+
},
|
|
3890
|
+
{
|
|
3891
|
+
name: "originationFeeBps",
|
|
3892
|
+
type: "uint16",
|
|
3893
|
+
internalType: "uint16"
|
|
3894
|
+
},
|
|
3895
|
+
{
|
|
3896
|
+
name: "lifetimeFeeAprBps",
|
|
3897
|
+
type: "uint16",
|
|
3898
|
+
internalType: "uint16"
|
|
3899
|
+
},
|
|
3900
|
+
{
|
|
3901
|
+
name: "liquidationFeeBps",
|
|
3902
|
+
type: "uint16",
|
|
3903
|
+
internalType: "uint16"
|
|
3904
|
+
},
|
|
3905
|
+
{
|
|
3906
|
+
name: "venueFeeUsdcUnits",
|
|
3907
|
+
type: "uint256",
|
|
3908
|
+
internalType: "uint256"
|
|
3909
|
+
},
|
|
3910
|
+
{
|
|
3911
|
+
name: "signature",
|
|
3912
|
+
type: "bytes",
|
|
3913
|
+
internalType: "bytes"
|
|
3914
|
+
},
|
|
3915
|
+
{
|
|
3916
|
+
name: "signatureExpiry",
|
|
3917
|
+
type: "uint256",
|
|
3918
|
+
internalType: "uint256"
|
|
3919
|
+
}
|
|
3920
|
+
],
|
|
3921
|
+
outputs: [],
|
|
3922
|
+
stateMutability: "nonpayable"
|
|
3923
|
+
},
|
|
3924
|
+
{
|
|
3925
|
+
type: "function",
|
|
3926
|
+
name: "createPositionPushFunded",
|
|
3927
|
+
inputs: [
|
|
3928
|
+
{
|
|
3929
|
+
name: "positionSeed",
|
|
3930
|
+
type: "bytes16",
|
|
3931
|
+
internalType: "bytes16"
|
|
3932
|
+
},
|
|
3933
|
+
{
|
|
3934
|
+
name: "marketId",
|
|
3935
|
+
type: "bytes32",
|
|
3936
|
+
internalType: "bytes32"
|
|
3937
|
+
},
|
|
3938
|
+
{
|
|
3939
|
+
name: "tokenId",
|
|
3940
|
+
type: "uint256",
|
|
3941
|
+
internalType: "uint256"
|
|
3942
|
+
},
|
|
3943
|
+
{
|
|
3944
|
+
name: "collateralUsdcUnits",
|
|
3945
|
+
type: "uint256",
|
|
3946
|
+
internalType: "uint256"
|
|
3947
|
+
},
|
|
3948
|
+
{
|
|
3949
|
+
name: "leverageBps",
|
|
3950
|
+
type: "uint32",
|
|
3951
|
+
internalType: "uint32"
|
|
3952
|
+
},
|
|
3953
|
+
{
|
|
3954
|
+
name: "notionalUsdcUnits",
|
|
3955
|
+
type: "uint256",
|
|
3956
|
+
internalType: "uint256"
|
|
3957
|
+
},
|
|
3958
|
+
{
|
|
3959
|
+
name: "originationFeeBps",
|
|
3960
|
+
type: "uint16",
|
|
3961
|
+
internalType: "uint16"
|
|
3962
|
+
},
|
|
3963
|
+
{
|
|
3964
|
+
name: "lifetimeFeeAprBps",
|
|
3965
|
+
type: "uint16",
|
|
3966
|
+
internalType: "uint16"
|
|
3967
|
+
},
|
|
3968
|
+
{
|
|
3969
|
+
name: "liquidationFeeBps",
|
|
3970
|
+
type: "uint16",
|
|
3971
|
+
internalType: "uint16"
|
|
3972
|
+
},
|
|
3973
|
+
{
|
|
3974
|
+
name: "venueFeeUsdcUnits",
|
|
3975
|
+
type: "uint256",
|
|
3976
|
+
internalType: "uint256"
|
|
3977
|
+
},
|
|
3978
|
+
{
|
|
3979
|
+
name: "signature",
|
|
3980
|
+
type: "bytes",
|
|
3981
|
+
internalType: "bytes"
|
|
3982
|
+
},
|
|
3983
|
+
{
|
|
3984
|
+
name: "signatureExpiry",
|
|
3985
|
+
type: "uint256",
|
|
3986
|
+
internalType: "uint256"
|
|
3987
|
+
}
|
|
3988
|
+
],
|
|
3989
|
+
outputs: [],
|
|
3990
|
+
stateMutability: "nonpayable"
|
|
3991
|
+
},
|
|
3992
|
+
{
|
|
3993
|
+
type: "function",
|
|
3994
|
+
name: "createPositionPushFundedWithMargin",
|
|
3995
|
+
inputs: [
|
|
3996
|
+
{
|
|
3997
|
+
name: "positionSeed",
|
|
3998
|
+
type: "bytes16",
|
|
3999
|
+
internalType: "bytes16"
|
|
4000
|
+
},
|
|
4001
|
+
{
|
|
4002
|
+
name: "marketId",
|
|
4003
|
+
type: "bytes32",
|
|
4004
|
+
internalType: "bytes32"
|
|
4005
|
+
},
|
|
4006
|
+
{
|
|
4007
|
+
name: "tokenId",
|
|
4008
|
+
type: "uint256",
|
|
4009
|
+
internalType: "uint256"
|
|
4010
|
+
},
|
|
4011
|
+
{
|
|
4012
|
+
name: "collateralUsdcUnits",
|
|
4013
|
+
type: "uint256",
|
|
4014
|
+
internalType: "uint256"
|
|
4015
|
+
},
|
|
4016
|
+
{
|
|
4017
|
+
name: "leverageBps",
|
|
4018
|
+
type: "uint32",
|
|
4019
|
+
internalType: "uint32"
|
|
4020
|
+
},
|
|
4021
|
+
{
|
|
4022
|
+
name: "notionalUsdcUnits",
|
|
4023
|
+
type: "uint256",
|
|
4024
|
+
internalType: "uint256"
|
|
4025
|
+
},
|
|
4026
|
+
{
|
|
4027
|
+
name: "originationFeeBps",
|
|
4028
|
+
type: "uint16",
|
|
4029
|
+
internalType: "uint16"
|
|
4030
|
+
},
|
|
4031
|
+
{
|
|
4032
|
+
name: "lifetimeFeeAprBps",
|
|
4033
|
+
type: "uint16",
|
|
4034
|
+
internalType: "uint16"
|
|
4035
|
+
},
|
|
4036
|
+
{
|
|
4037
|
+
name: "liquidationFeeBps",
|
|
4038
|
+
type: "uint16",
|
|
4039
|
+
internalType: "uint16"
|
|
4040
|
+
},
|
|
4041
|
+
{
|
|
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"
|
|
3582
4171
|
},
|
|
3583
4172
|
{
|
|
3584
4173
|
name: "notionalUsdcUnits",
|
|
@@ -3605,6 +4194,11 @@ var vault_abi_default = {
|
|
|
3605
4194
|
type: "uint256",
|
|
3606
4195
|
internalType: "uint256"
|
|
3607
4196
|
},
|
|
4197
|
+
{
|
|
4198
|
+
name: "protocolVersion",
|
|
4199
|
+
type: "uint8",
|
|
4200
|
+
internalType: "uint8"
|
|
4201
|
+
},
|
|
3608
4202
|
{
|
|
3609
4203
|
name: "signature",
|
|
3610
4204
|
type: "bytes",
|
|
@@ -3621,7 +4215,7 @@ var vault_abi_default = {
|
|
|
3621
4215
|
},
|
|
3622
4216
|
{
|
|
3623
4217
|
type: "function",
|
|
3624
|
-
name: "
|
|
4218
|
+
name: "createPositionWithMargin",
|
|
3625
4219
|
inputs: [
|
|
3626
4220
|
{
|
|
3627
4221
|
name: "positionSeed",
|
|
@@ -3673,6 +4267,11 @@ var vault_abi_default = {
|
|
|
3673
4267
|
type: "uint256",
|
|
3674
4268
|
internalType: "uint256"
|
|
3675
4269
|
},
|
|
4270
|
+
{
|
|
4271
|
+
name: "marginUsdcUnits",
|
|
4272
|
+
type: "uint256",
|
|
4273
|
+
internalType: "uint256"
|
|
4274
|
+
},
|
|
3676
4275
|
{
|
|
3677
4276
|
name: "signature",
|
|
3678
4277
|
type: "bytes",
|
|
@@ -3689,7 +4288,7 @@ var vault_abi_default = {
|
|
|
3689
4288
|
},
|
|
3690
4289
|
{
|
|
3691
4290
|
type: "function",
|
|
3692
|
-
name: "
|
|
4291
|
+
name: "createPositionWithMarginAndVersion",
|
|
3693
4292
|
inputs: [
|
|
3694
4293
|
{
|
|
3695
4294
|
name: "positionSeed",
|
|
@@ -3746,6 +4345,11 @@ var vault_abi_default = {
|
|
|
3746
4345
|
type: "uint256",
|
|
3747
4346
|
internalType: "uint256"
|
|
3748
4347
|
},
|
|
4348
|
+
{
|
|
4349
|
+
name: "protocolVersion",
|
|
4350
|
+
type: "uint8",
|
|
4351
|
+
internalType: "uint8"
|
|
4352
|
+
},
|
|
3749
4353
|
{
|
|
3750
4354
|
name: "signature",
|
|
3751
4355
|
type: "bytes",
|
|
@@ -3762,7 +4366,7 @@ var vault_abi_default = {
|
|
|
3762
4366
|
},
|
|
3763
4367
|
{
|
|
3764
4368
|
type: "function",
|
|
3765
|
-
name: "
|
|
4369
|
+
name: "createPositionWithVersion",
|
|
3766
4370
|
inputs: [
|
|
3767
4371
|
{
|
|
3768
4372
|
name: "positionSeed",
|
|
@@ -3815,9 +4419,9 @@ var vault_abi_default = {
|
|
|
3815
4419
|
internalType: "uint256"
|
|
3816
4420
|
},
|
|
3817
4421
|
{
|
|
3818
|
-
name: "
|
|
3819
|
-
type: "
|
|
3820
|
-
internalType: "
|
|
4422
|
+
name: "protocolVersion",
|
|
4423
|
+
type: "uint8",
|
|
4424
|
+
internalType: "uint8"
|
|
3821
4425
|
},
|
|
3822
4426
|
{
|
|
3823
4427
|
name: "signature",
|
|
@@ -4444,6 +5048,11 @@ var vault_abi_default = {
|
|
|
4444
5048
|
name: "saleReceivedUsdcUnits",
|
|
4445
5049
|
type: "uint256",
|
|
4446
5050
|
internalType: "uint256"
|
|
5051
|
+
},
|
|
5052
|
+
{
|
|
5053
|
+
name: "expectedPendingTokenUnits",
|
|
5054
|
+
type: "uint256",
|
|
5055
|
+
internalType: "uint256"
|
|
4447
5056
|
}
|
|
4448
5057
|
],
|
|
4449
5058
|
outputs: [],
|
|
@@ -4467,6 +5076,11 @@ var vault_abi_default = {
|
|
|
4467
5076
|
name: "returnedTokenUnits",
|
|
4468
5077
|
type: "uint256",
|
|
4469
5078
|
internalType: "uint256"
|
|
5079
|
+
},
|
|
5080
|
+
{
|
|
5081
|
+
name: "expectedPendingTokenUnits",
|
|
5082
|
+
type: "uint256",
|
|
5083
|
+
internalType: "uint256"
|
|
4470
5084
|
}
|
|
4471
5085
|
],
|
|
4472
5086
|
outputs: [],
|
|
@@ -4485,6 +5099,11 @@ var vault_abi_default = {
|
|
|
4485
5099
|
name: "saleReceivedUsdcUnits",
|
|
4486
5100
|
type: "uint256",
|
|
4487
5101
|
internalType: "uint256"
|
|
5102
|
+
},
|
|
5103
|
+
{
|
|
5104
|
+
name: "expectedPendingTokenUnits",
|
|
5105
|
+
type: "uint256",
|
|
5106
|
+
internalType: "uint256"
|
|
4488
5107
|
}
|
|
4489
5108
|
],
|
|
4490
5109
|
outputs: [],
|
|
@@ -5614,6 +6233,24 @@ var vault_abi_default = {
|
|
|
5614
6233
|
],
|
|
5615
6234
|
stateMutability: "view"
|
|
5616
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
|
+
},
|
|
5617
6254
|
{
|
|
5618
6255
|
type: "function",
|
|
5619
6256
|
name: "setTimelock",
|
|
@@ -5663,6 +6300,44 @@ var vault_abi_default = {
|
|
|
5663
6300
|
outputs: [],
|
|
5664
6301
|
stateMutability: "nonpayable"
|
|
5665
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
|
+
},
|
|
5666
6341
|
{
|
|
5667
6342
|
type: "function",
|
|
5668
6343
|
name: "supportsInterface",
|
|
@@ -5695,6 +6370,25 @@ var vault_abi_default = {
|
|
|
5695
6370
|
],
|
|
5696
6371
|
stateMutability: "view"
|
|
5697
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
|
+
},
|
|
5698
6392
|
{
|
|
5699
6393
|
type: "function",
|
|
5700
6394
|
name: "tokenTotalBorrowedUsdcUnits",
|
|
@@ -6014,6 +6708,15 @@ function toAddress(value) {
|
|
|
6014
6708
|
return _viem.getAddress.call(void 0, value);
|
|
6015
6709
|
}
|
|
6016
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
|
+
|
|
6017
6720
|
// src/contract/risk-mode.ts
|
|
6018
6721
|
function isCommittedQuote(quote) {
|
|
6019
6722
|
return quote.riskMode === "committed";
|
|
@@ -6034,6 +6737,33 @@ function buildCreatePositionTx(quote) {
|
|
|
6034
6737
|
quote.liquidationFeeBps,
|
|
6035
6738
|
BigInt(quote.expectedOpenTradingFeeUsdcUnits)
|
|
6036
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
|
+
}
|
|
6037
6767
|
if (isCommittedQuote(quote)) {
|
|
6038
6768
|
return {
|
|
6039
6769
|
address,
|
|
@@ -6150,6 +6880,53 @@ var createPositionPushFundedWithMarginAbi = [
|
|
|
6150
6880
|
outputs: []
|
|
6151
6881
|
}
|
|
6152
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
|
+
];
|
|
6153
6930
|
var erc20TransferAbi = [
|
|
6154
6931
|
{
|
|
6155
6932
|
type: "function",
|
|
@@ -6175,6 +6952,31 @@ function buildPushFundedCreateData(quote) {
|
|
|
6175
6952
|
quote.liquidationFeeBps,
|
|
6176
6953
|
BigInt(quote.expectedOpenTradingFeeUsdcUnits)
|
|
6177
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
|
+
}
|
|
6178
6980
|
if (isCommittedQuote(quote)) {
|
|
6179
6981
|
return _viem.encodeFunctionData.call(void 0, {
|
|
6180
6982
|
abi: createPositionPushFundedWithMarginAbi,
|
|
@@ -6342,6 +7144,41 @@ var createPositionWithMarginTypes = {
|
|
|
6342
7144
|
{ name: "signatureExpiry", type: "uint256" }
|
|
6343
7145
|
]
|
|
6344
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
|
+
};
|
|
6345
7182
|
function buildDomain(quote) {
|
|
6346
7183
|
return {
|
|
6347
7184
|
name: "LeveragedPredictionVaultV1",
|
|
@@ -6367,6 +7204,28 @@ function buildMessage(quote, userAddress) {
|
|
|
6367
7204
|
};
|
|
6368
7205
|
}
|
|
6369
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
|
+
}
|
|
6370
7229
|
if (isCommittedQuote(quote)) {
|
|
6371
7230
|
return _viem.recoverTypedDataAddress.call(void 0, {
|
|
6372
7231
|
domain: buildDomain(quote),
|
|
@@ -6584,5 +7443,7 @@ function formatContractError(err) {
|
|
|
6584
7443
|
|
|
6585
7444
|
|
|
6586
7445
|
|
|
6587
|
-
|
|
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;
|
|
6588
7449
|
//# sourceMappingURL=index.cjs.map
|