@reyaxyz/common 0.344.0 → 0.344.1-perpob.135

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/README.md +1 -1
  2. package/dist/commands/exposure/command.js +8 -22
  3. package/dist/commands/exposure/command.js.map +1 -1
  4. package/dist/incentives-api-types.js.map +1 -1
  5. package/dist/rest/helpers/constants.js +12 -0
  6. package/dist/rest/helpers/constants.js.map +1 -1
  7. package/dist/trading-api-types.js.map +1 -1
  8. package/dist/transactions/abis/Errors.json +276 -1
  9. package/dist/transactions/abis/OrdersGateway.json +691 -119
  10. package/dist/transactions/abis/PassivePerpProxy.json +537 -0
  11. package/dist/transactions/buildMulticallTx.js.map +1 -1
  12. package/dist/transactions/contractAddresses.js +33 -4
  13. package/dist/transactions/contractAddresses.js.map +1 -1
  14. package/dist/transactions/executeTransaction.js +8 -123
  15. package/dist/transactions/executeTransaction.js.map +1 -1
  16. package/dist/transactions/sign.js +234 -1
  17. package/dist/transactions/sign.js.map +1 -1
  18. package/dist/types/commands/exposure/command.d.ts +8 -7
  19. package/dist/types/commands/exposure/command.d.ts.map +1 -1
  20. package/dist/types/incentives-api-types.d.ts +6 -2
  21. package/dist/types/incentives-api-types.d.ts.map +1 -1
  22. package/dist/types/rest/helpers/constants.d.ts +1 -1
  23. package/dist/types/rest/helpers/constants.d.ts.map +1 -1
  24. package/dist/types/trading-api-types.d.ts +123 -31
  25. package/dist/types/trading-api-types.d.ts.map +1 -1
  26. package/dist/types/transactions/buildMulticallTx.d.ts +1 -0
  27. package/dist/types/transactions/buildMulticallTx.d.ts.map +1 -1
  28. package/dist/types/transactions/contractAddresses.d.ts +1 -1
  29. package/dist/types/transactions/contractAddresses.d.ts.map +1 -1
  30. package/dist/types/transactions/executeTransaction.d.ts +2 -15
  31. package/dist/types/transactions/executeTransaction.d.ts.map +1 -1
  32. package/dist/types/transactions/sign.d.ts +38 -1
  33. package/dist/types/transactions/sign.d.ts.map +1 -1
  34. package/dist/types/types.d.ts +44 -18
  35. package/dist/types/types.d.ts.map +1 -1
  36. package/dist/types/utils/calculate.d.ts +14 -2
  37. package/dist/types/utils/calculate.d.ts.map +1 -1
  38. package/dist/types/utils/layerzero.d.ts +22 -0
  39. package/dist/types/utils/layerzero.d.ts.map +1 -0
  40. package/dist/types/utils/token/batch-token-getters.d.ts +0 -5
  41. package/dist/types/utils/token/batch-token-getters.d.ts.map +1 -1
  42. package/dist/types/utils/token/token-getters.d.ts +0 -2
  43. package/dist/types/utils/token/token-getters.d.ts.map +1 -1
  44. package/dist/types.js +51 -7
  45. package/dist/types.js.map +1 -1
  46. package/dist/utils/calculate.js +137 -16
  47. package/dist/utils/calculate.js.map +1 -1
  48. package/dist/utils/layerzero.js +31 -0
  49. package/dist/utils/layerzero.js.map +1 -0
  50. package/dist/utils/token/batch-token-getters.js +13 -64
  51. package/dist/utils/token/batch-token-getters.js.map +1 -1
  52. package/dist/utils/token/token-getters.js +1 -42
  53. package/dist/utils/token/token-getters.js.map +1 -1
  54. package/package.json +2 -2
  55. package/src/commands/exposure/command.ts +8 -38
  56. package/src/incentives-api-types.ts +11 -5
  57. package/src/rest/helpers/constants.ts +22 -0
  58. package/src/trading-api-types.ts +128 -47
  59. package/src/transactions/abis/Errors.json +4148 -3873
  60. package/src/transactions/abis/OrdersGateway.json +692 -120
  61. package/src/transactions/abis/PassivePerpProxy.json +537 -0
  62. package/src/transactions/buildMulticallTx.ts +4 -0
  63. package/src/transactions/contractAddresses.ts +34 -4
  64. package/src/transactions/executeTransaction.ts +2 -130
  65. package/src/transactions/sign.ts +302 -0
  66. package/src/types.ts +70 -19
  67. package/src/utils/calculate.ts +181 -21
  68. package/src/utils/layerzero.ts +66 -0
  69. package/src/utils/token/batch-token-getters.ts +0 -28
  70. package/src/utils/token/token-getters.ts +0 -29
  71. package/dist/types/utils/layerzero/index.d.ts +0 -3
  72. package/dist/types/utils/layerzero/index.d.ts.map +0 -1
  73. package/dist/types/utils/layerzero/oft-config.d.ts +0 -4
  74. package/dist/types/utils/layerzero/oft-config.d.ts.map +0 -1
  75. package/dist/types/utils/layerzero/types.d.ts +0 -23
  76. package/dist/types/utils/layerzero/types.d.ts.map +0 -1
  77. package/dist/utils/layerzero/index.js +0 -19
  78. package/dist/utils/layerzero/index.js.map +0 -1
  79. package/dist/utils/layerzero/oft-config.js +0 -29
  80. package/dist/utils/layerzero/oft-config.js.map +0 -1
  81. package/dist/utils/layerzero/types.js +0 -3
  82. package/dist/utils/layerzero/types.js.map +0 -1
  83. package/src/utils/layerzero/index.ts +0 -2
  84. package/src/utils/layerzero/oft-config.ts +0 -32
  85. package/src/utils/layerzero/types.ts +0 -25
@@ -331,6 +331,543 @@
331
331
  ],
332
332
  "outputs": [],
333
333
  "stateMutability": "nonpayable"
334
+ },
335
+ {
336
+ "type": "event",
337
+ "name": "PassivePerpExecutionV3",
338
+ "inputs": [
339
+ {
340
+ "name": "marketId",
341
+ "type": "uint128",
342
+ "indexed": true,
343
+ "internalType": "uint128"
344
+ },
345
+ {
346
+ "name": "exchangeId",
347
+ "type": "uint128",
348
+ "indexed": false,
349
+ "internalType": "uint128"
350
+ },
351
+ {
352
+ "name": "accountId",
353
+ "type": "uint128",
354
+ "indexed": true,
355
+ "internalType": "uint128"
356
+ },
357
+ {
358
+ "name": "counterpartyAccountId",
359
+ "type": "uint128",
360
+ "indexed": false,
361
+ "internalType": "uint128"
362
+ },
363
+ {
364
+ "name": "eventSequenceNumber",
365
+ "type": "uint128",
366
+ "indexed": true,
367
+ "internalType": "uint128"
368
+ },
369
+ {
370
+ "name": "blockTimestamp",
371
+ "type": "uint256",
372
+ "indexed": false,
373
+ "internalType": "uint256"
374
+ },
375
+ {
376
+ "name": "data",
377
+ "type": "tuple",
378
+ "indexed": false,
379
+ "internalType": "struct PassivePerpExecutionEventDataV3",
380
+ "components": [
381
+ {
382
+ "name": "executedBase",
383
+ "type": "int256",
384
+ "internalType": "SD59x18"
385
+ },
386
+ {
387
+ "name": "perpFillFees",
388
+ "type": "tuple",
389
+ "internalType": "struct PerpFillFees",
390
+ "components": [
391
+ {
392
+ "name": "protocolFeeCredit",
393
+ "type": "uint256",
394
+ "internalType": "uint256"
395
+ },
396
+ {
397
+ "name": "exchangeFeeCredit",
398
+ "type": "uint256",
399
+ "internalType": "uint256"
400
+ },
401
+ {
402
+ "name": "makerFeeCredit",
403
+ "type": "uint256",
404
+ "internalType": "uint256"
405
+ },
406
+ {
407
+ "name": "makerFeeDebit",
408
+ "type": "uint256",
409
+ "internalType": "uint256"
410
+ },
411
+ {
412
+ "name": "referrerFeeCredit",
413
+ "type": "uint256",
414
+ "internalType": "uint256"
415
+ }
416
+ ]
417
+ },
418
+ {
419
+ "name": "executedPrice",
420
+ "type": "uint256",
421
+ "internalType": "UD60x18"
422
+ },
423
+ {
424
+ "name": "referrerAccountId",
425
+ "type": "uint128",
426
+ "internalType": "uint128"
427
+ },
428
+ {
429
+ "name": "executionType",
430
+ "type": "uint8",
431
+ "internalType": "enum ExecutionType"
432
+ },
433
+ {
434
+ "name": "positionData",
435
+ "type": "tuple",
436
+ "internalType": "struct PerpPosition",
437
+ "components": [
438
+ {
439
+ "name": "base",
440
+ "type": "int256",
441
+ "internalType": "SD59x18"
442
+ },
443
+ {
444
+ "name": "realizedPnL",
445
+ "type": "int256",
446
+ "internalType": "SD59x18"
447
+ },
448
+ {
449
+ "name": "lastPriceData",
450
+ "type": "tuple",
451
+ "internalType": "struct PriceData",
452
+ "components": [
453
+ {
454
+ "name": "price",
455
+ "type": "uint256",
456
+ "internalType": "UD60x18"
457
+ },
458
+ {
459
+ "name": "timestamp",
460
+ "type": "uint256",
461
+ "internalType": "uint256"
462
+ }
463
+ ]
464
+ },
465
+ {
466
+ "name": "trackers",
467
+ "type": "tuple",
468
+ "internalType": "struct FundingAndADLTrackers",
469
+ "components": [
470
+ {
471
+ "name": "fundingValue",
472
+ "type": "int256",
473
+ "internalType": "SD59x18"
474
+ },
475
+ {
476
+ "name": "baseMultiplier",
477
+ "type": "uint256",
478
+ "internalType": "UD60x18"
479
+ },
480
+ {
481
+ "name": "adlUnwindPrice",
482
+ "type": "uint256",
483
+ "internalType": "UD60x18"
484
+ }
485
+ ]
486
+ },
487
+ {
488
+ "name": "averageEntryFundingValue",
489
+ "type": "int256",
490
+ "internalType": "SD59x18"
491
+ },
492
+ {
493
+ "name": "session",
494
+ "type": "uint128",
495
+ "internalType": "uint128"
496
+ }
497
+ ]
498
+ },
499
+ {
500
+ "name": "counterpartyPositionData",
501
+ "type": "tuple",
502
+ "internalType": "struct PerpPosition",
503
+ "components": [
504
+ {
505
+ "name": "base",
506
+ "type": "int256",
507
+ "internalType": "SD59x18"
508
+ },
509
+ {
510
+ "name": "realizedPnL",
511
+ "type": "int256",
512
+ "internalType": "SD59x18"
513
+ },
514
+ {
515
+ "name": "lastPriceData",
516
+ "type": "tuple",
517
+ "internalType": "struct PriceData",
518
+ "components": [
519
+ {
520
+ "name": "price",
521
+ "type": "uint256",
522
+ "internalType": "UD60x18"
523
+ },
524
+ {
525
+ "name": "timestamp",
526
+ "type": "uint256",
527
+ "internalType": "uint256"
528
+ }
529
+ ]
530
+ },
531
+ {
532
+ "name": "trackers",
533
+ "type": "tuple",
534
+ "internalType": "struct FundingAndADLTrackers",
535
+ "components": [
536
+ {
537
+ "name": "fundingValue",
538
+ "type": "int256",
539
+ "internalType": "SD59x18"
540
+ },
541
+ {
542
+ "name": "baseMultiplier",
543
+ "type": "uint256",
544
+ "internalType": "UD60x18"
545
+ },
546
+ {
547
+ "name": "adlUnwindPrice",
548
+ "type": "uint256",
549
+ "internalType": "UD60x18"
550
+ }
551
+ ]
552
+ },
553
+ {
554
+ "name": "averageEntryFundingValue",
555
+ "type": "int256",
556
+ "internalType": "SD59x18"
557
+ },
558
+ {
559
+ "name": "session",
560
+ "type": "uint128",
561
+ "internalType": "uint128"
562
+ }
563
+ ]
564
+ },
565
+ {
566
+ "name": "preOrderPositionData",
567
+ "type": "tuple",
568
+ "internalType": "struct PerpPosition",
569
+ "components": [
570
+ {
571
+ "name": "base",
572
+ "type": "int256",
573
+ "internalType": "SD59x18"
574
+ },
575
+ {
576
+ "name": "realizedPnL",
577
+ "type": "int256",
578
+ "internalType": "SD59x18"
579
+ },
580
+ {
581
+ "name": "lastPriceData",
582
+ "type": "tuple",
583
+ "internalType": "struct PriceData",
584
+ "components": [
585
+ {
586
+ "name": "price",
587
+ "type": "uint256",
588
+ "internalType": "UD60x18"
589
+ },
590
+ {
591
+ "name": "timestamp",
592
+ "type": "uint256",
593
+ "internalType": "uint256"
594
+ }
595
+ ]
596
+ },
597
+ {
598
+ "name": "trackers",
599
+ "type": "tuple",
600
+ "internalType": "struct FundingAndADLTrackers",
601
+ "components": [
602
+ {
603
+ "name": "fundingValue",
604
+ "type": "int256",
605
+ "internalType": "SD59x18"
606
+ },
607
+ {
608
+ "name": "baseMultiplier",
609
+ "type": "uint256",
610
+ "internalType": "UD60x18"
611
+ },
612
+ {
613
+ "name": "adlUnwindPrice",
614
+ "type": "uint256",
615
+ "internalType": "UD60x18"
616
+ }
617
+ ]
618
+ },
619
+ {
620
+ "name": "averageEntryFundingValue",
621
+ "type": "int256",
622
+ "internalType": "SD59x18"
623
+ },
624
+ {
625
+ "name": "session",
626
+ "type": "uint128",
627
+ "internalType": "uint128"
628
+ }
629
+ ]
630
+ },
631
+ {
632
+ "name": "preOrderCounterpartyPositionData",
633
+ "type": "tuple",
634
+ "internalType": "struct PerpPosition",
635
+ "components": [
636
+ {
637
+ "name": "base",
638
+ "type": "int256",
639
+ "internalType": "SD59x18"
640
+ },
641
+ {
642
+ "name": "realizedPnL",
643
+ "type": "int256",
644
+ "internalType": "SD59x18"
645
+ },
646
+ {
647
+ "name": "lastPriceData",
648
+ "type": "tuple",
649
+ "internalType": "struct PriceData",
650
+ "components": [
651
+ {
652
+ "name": "price",
653
+ "type": "uint256",
654
+ "internalType": "UD60x18"
655
+ },
656
+ {
657
+ "name": "timestamp",
658
+ "type": "uint256",
659
+ "internalType": "uint256"
660
+ }
661
+ ]
662
+ },
663
+ {
664
+ "name": "trackers",
665
+ "type": "tuple",
666
+ "internalType": "struct FundingAndADLTrackers",
667
+ "components": [
668
+ {
669
+ "name": "fundingValue",
670
+ "type": "int256",
671
+ "internalType": "SD59x18"
672
+ },
673
+ {
674
+ "name": "baseMultiplier",
675
+ "type": "uint256",
676
+ "internalType": "UD60x18"
677
+ },
678
+ {
679
+ "name": "adlUnwindPrice",
680
+ "type": "uint256",
681
+ "internalType": "UD60x18"
682
+ }
683
+ ]
684
+ },
685
+ {
686
+ "name": "averageEntryFundingValue",
687
+ "type": "int256",
688
+ "internalType": "SD59x18"
689
+ },
690
+ {
691
+ "name": "session",
692
+ "type": "uint128",
693
+ "internalType": "uint128"
694
+ }
695
+ ]
696
+ },
697
+ {
698
+ "name": "positionAccountOwner",
699
+ "type": "address",
700
+ "internalType": "address"
701
+ },
702
+ {
703
+ "name": "counterpartyAccountOwner",
704
+ "type": "address",
705
+ "internalType": "address"
706
+ },
707
+ {
708
+ "name": "accountOrderId",
709
+ "type": "uint64",
710
+ "internalType": "uint64"
711
+ },
712
+ {
713
+ "name": "counterpartyOrderId",
714
+ "type": "uint64",
715
+ "internalType": "uint64"
716
+ },
717
+ {
718
+ "name": "counterpartyExchangeId",
719
+ "type": "uint128",
720
+ "internalType": "uint128"
721
+ }
722
+ ]
723
+ }
724
+ ],
725
+ "anonymous": false
726
+ },
727
+ {
728
+ "type": "event",
729
+ "name": "FeeTierParametersUpdated",
730
+ "inputs": [
731
+ {
732
+ "name": "tierId",
733
+ "type": "uint256",
734
+ "indexed": true,
735
+ "internalType": "uint256"
736
+ },
737
+ {
738
+ "name": "feeTierParameters",
739
+ "type": "tuple",
740
+ "indexed": false,
741
+ "internalType": "struct FeeTierParameters",
742
+ "components": [
743
+ {
744
+ "name": "takerFee",
745
+ "type": "uint256",
746
+ "internalType": "UD60x18"
747
+ },
748
+ {
749
+ "name": "makerFee",
750
+ "type": "uint256",
751
+ "internalType": "UD60x18"
752
+ },
753
+ {
754
+ "name": "makerRebate",
755
+ "type": "uint256",
756
+ "internalType": "UD60x18"
757
+ }
758
+ ]
759
+ },
760
+ {
761
+ "name": "blockTimestamp",
762
+ "type": "uint256",
763
+ "indexed": false,
764
+ "internalType": "uint256"
765
+ }
766
+ ],
767
+ "anonymous": false
768
+ },
769
+ {
770
+ "type": "event",
771
+ "name": "GlobalFeeParametersUpdated",
772
+ "inputs": [
773
+ {
774
+ "name": "globalFeeParameters",
775
+ "type": "tuple",
776
+ "indexed": false,
777
+ "internalType": "struct GlobalFeeParameters",
778
+ "components": [
779
+ {
780
+ "name": "ogDiscount",
781
+ "type": "uint256",
782
+ "internalType": "UD60x18"
783
+ },
784
+ {
785
+ "name": "refereeDiscount",
786
+ "type": "uint256",
787
+ "internalType": "UD60x18"
788
+ },
789
+ {
790
+ "name": "referrerRebate",
791
+ "type": "uint256",
792
+ "internalType": "UD60x18"
793
+ },
794
+ {
795
+ "name": "affiliateReferrerRebate",
796
+ "type": "uint256",
797
+ "internalType": "UD60x18"
798
+ },
799
+ {
800
+ "name": "vltzDiscount",
801
+ "type": "uint256",
802
+ "internalType": "UD60x18"
803
+ },
804
+ {
805
+ "name": "spreadDiscount",
806
+ "type": "uint256",
807
+ "internalType": "UD60x18"
808
+ }
809
+ ]
810
+ },
811
+ {
812
+ "name": "blockTimestamp",
813
+ "type": "uint256",
814
+ "indexed": false,
815
+ "internalType": "uint256"
816
+ }
817
+ ],
818
+ "anonymous": false
819
+ },
820
+ {
821
+ "type": "event",
822
+ "name": "AccountOwnerFeeConfigurationUpdated",
823
+ "inputs": [
824
+ {
825
+ "name": "accountOwner",
826
+ "type": "address",
827
+ "indexed": true,
828
+ "internalType": "address"
829
+ },
830
+ {
831
+ "name": "accountOwnerFeeConfig",
832
+ "type": "tuple",
833
+ "indexed": false,
834
+ "internalType": "struct AccountOwnerFeeConfig",
835
+ "components": [
836
+ {
837
+ "name": "tierId",
838
+ "type": "uint256",
839
+ "internalType": "uint256"
840
+ },
841
+ {
842
+ "name": "ogStatus",
843
+ "type": "bool",
844
+ "internalType": "bool"
845
+ },
846
+ {
847
+ "name": "affiliateStatus",
848
+ "type": "bool",
849
+ "internalType": "bool"
850
+ },
851
+ {
852
+ "name": "vltzStatus",
853
+ "type": "bool",
854
+ "internalType": "bool"
855
+ },
856
+ {
857
+ "name": "spreadDiscountStatus",
858
+ "type": "bool",
859
+ "internalType": "bool"
860
+ }
861
+ ]
862
+ },
863
+ {
864
+ "name": "blockTimestamp",
865
+ "type": "uint256",
866
+ "indexed": false,
867
+ "internalType": "uint256"
868
+ }
869
+ ],
870
+ "anonymous": false
334
871
  }
335
872
  ]
336
873
  }
@@ -1 +1 @@
1
- {"version":3,"file":"buildMulticallTx.js","sourceRoot":"/","sources":["transactions/buildMulticallTx.ts"],"names":[],"mappings":";;;AAAA,iCAAgC;AAChC,wDAAuD;AACvD,sEAAmE;AAO5D,IAAM,mBAAmB,GAAG,UAAC,SAAmB;IACrD,IAAM,iBAAiB,GAAG,cAAc,CAAC;IACzC,IAAM,UAAU,GAAwB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAC3D,IAAM,SAAS,GAAG,IAAI,eAAM,CAAC,SAAS,CAAC,oBAAO,CAAC,CAAC;IAChD,IAAM,QAAQ,GAAG,SAAS,CAAC,kBAAkB,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC;IAC7E,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AANW,QAAA,mBAAmB,uBAM9B;AAEF,IAAM,eAAe,GAAG,UAAC,cAAuB,EAAE,KAAa;IAC7D,IAAM,iBAAiB,GAAG,6BAA6B,CAAC;IACxD,IAAM,UAAU,GAAsB,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IAC9D,IAAM,SAAS,GAAG,IAAI,eAAM,CAAC,SAAS,CAAC,2BAAY,CAAC,CAAC;IACrD,IAAM,QAAQ,GAAG,SAAS,CAAC,kBAAkB,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC;IAC7E,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAEK,IAAM,qBAAqB,GAAG,UAAC,KAAa;IACjD,OAAA,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC;AAA5B,CAA4B,CAAC;AADlB,QAAA,qBAAqB,yBACH;AAExB,IAAM,uBAAuB,GAAG,UAAC,KAAa;IACnD,OAAA,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC;AAA7B,CAA6B,CAAC;AADnB,QAAA,uBAAuB,2BACJ","sourcesContent":["import { ethers } from 'ethers';\nimport { abi as CoreAbi } from './abis/CoreProxy.json';\nimport { abi as MulticallAbi } from './abis/CustomMulticall3.json';\n\nexport type Call = {\n target: string;\n callData: string;\n};\n\nexport const encodeCoreMulticall = (calldatas: string[]): string => {\n const functionSignature = 'tryAggregate';\n const parameters: [boolean, string[]] = [false, calldatas];\n const INTERFACE = new ethers.Interface(CoreAbi);\n const calldata = INTERFACE.encodeFunctionData(functionSignature, parameters);\n return calldata;\n};\n\nconst encodeMulticall = (requireSuccess: boolean, calls: Call[]): string => {\n const functionSignature = 'tryAggregatePreservingError';\n const parameters: [boolean, Call[]] = [requireSuccess, calls];\n const INTERFACE = new ethers.Interface(MulticallAbi);\n const calldata = INTERFACE.encodeFunctionData(functionSignature, parameters);\n return calldata;\n};\n\nexport const encodeStrictMulticall = (calls: Call[]) =>\n encodeMulticall(true, calls);\n\nexport const encodeOptionalMulticall = (calls: Call[]) =>\n encodeMulticall(false, calls);\n"]}
1
+ {"version":3,"file":"buildMulticallTx.js","sourceRoot":"/","sources":["transactions/buildMulticallTx.ts"],"names":[],"mappings":";;;AAAA,iCAAgC;AAChC,wDAAuD;AACvD,sEAAmE;AAW5D,IAAM,mBAAmB,GAAG,UAAC,SAAmB;IACrD,IAAM,iBAAiB,GAAG,cAAc,CAAC;IACzC,IAAM,UAAU,GAAwB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAC3D,IAAM,SAAS,GAAG,IAAI,eAAM,CAAC,SAAS,CAAC,oBAAO,CAAC,CAAC;IAChD,IAAM,QAAQ,GAAG,SAAS,CAAC,kBAAkB,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC;IAC7E,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AANW,QAAA,mBAAmB,uBAM9B;AAEF,IAAM,eAAe,GAAG,UAAC,cAAuB,EAAE,KAAa;IAC7D,IAAM,iBAAiB,GAAG,6BAA6B,CAAC;IACxD,IAAM,UAAU,GAAsB,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IAC9D,IAAM,SAAS,GAAG,IAAI,eAAM,CAAC,SAAS,CAAC,2BAAY,CAAC,CAAC;IACrD,IAAM,QAAQ,GAAG,SAAS,CAAC,kBAAkB,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC;IAC7E,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAEK,IAAM,qBAAqB,GAAG,UAAC,KAAa;IACjD,OAAA,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC;AAA5B,CAA4B,CAAC;AADlB,QAAA,qBAAqB,yBACH;AAExB,IAAM,uBAAuB,GAAG,UAAC,KAAa;IACnD,OAAA,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC;AAA7B,CAA6B,CAAC;AADnB,QAAA,uBAAuB,2BACJ","sourcesContent":["import { ethers } from 'ethers';\nimport { abi as CoreAbi } from './abis/CoreProxy.json';\nimport { abi as MulticallAbi } from './abis/CustomMulticall3.json';\n\nexport type Call = {\n target: string;\n callData: string;\n // Optional gas-limit override used by the off-chain transaction relay.\n // Ignored by on-chain Multicall3 struct encoding (ethers skips unknown\n // fields when matching the Solidity tuple).\n gasLimit?: number;\n};\n\nexport const encodeCoreMulticall = (calldatas: string[]): string => {\n const functionSignature = 'tryAggregate';\n const parameters: [boolean, string[]] = [false, calldatas];\n const INTERFACE = new ethers.Interface(CoreAbi);\n const calldata = INTERFACE.encodeFunctionData(functionSignature, parameters);\n return calldata;\n};\n\nconst encodeMulticall = (requireSuccess: boolean, calls: Call[]): string => {\n const functionSignature = 'tryAggregatePreservingError';\n const parameters: [boolean, Call[]] = [requireSuccess, calls];\n const INTERFACE = new ethers.Interface(MulticallAbi);\n const calldata = INTERFACE.encodeFunctionData(functionSignature, parameters);\n return calldata;\n};\n\nexport const encodeStrictMulticall = (calls: Call[]) =>\n encodeMulticall(true, calls);\n\nexport const encodeOptionalMulticall = (calls: Call[]) =>\n encodeMulticall(false, calls);\n"]}
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- var _a, _b, _c;
2
+ var _a, _b, _c, _d;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.getAddress = exports.ContractType = void 0;
5
5
  var types_1 = require("../types");
@@ -14,7 +14,7 @@ var ContractType;
14
14
  ContractType["ORACLE_ADAPTERS_PROXY"] = "oracle_adapters_proxy";
15
15
  ContractType["MULTICALL"] = "multicall";
16
16
  ContractType["REYA_SBTS"] = "reya_sbts";
17
- ContractType["TGE_DISTRIBUTOR"] = "tge_distributor";
17
+ ContractType["REYA_TGE_DISTRIBUTION"] = "reya_tge_distribution";
18
18
  })(ContractType || (exports.ContractType = ContractType = {}));
19
19
  var addresses = (_a = {},
20
20
  _a[types_1.ReyaChainId.reyaCronos] = (_b = {},
@@ -27,7 +27,7 @@ var addresses = (_a = {},
27
27
  _b[ContractType.ORACLE_ADAPTERS_PROXY] = '0xc501a2356703cd351703d68963c6f4136120f7cf',
28
28
  _b[ContractType.MULTICALL] = '0x5abde4f0af8eaf3c9967f7fa126e59a103357b5c',
29
29
  _b[ContractType.REYA_SBTS] = '0xc0092ea9179ace93b0cd8910958e335575562722',
30
- _b[ContractType.TGE_DISTRIBUTOR] = '0x95375788a8137958dc8d93f774f4795bf28b0143',
30
+ _b[ContractType.REYA_TGE_DISTRIBUTION] = '0x16917248669fa64340e6517538e419588e9684c3',
31
31
  _b),
32
32
  _a[types_1.ReyaChainId.reyaNetwork] = (_c = {},
33
33
  _c[ContractType.CORE_PROXY] = '0xa763b6a5e09378434406c003dae6487fbbdc1a80',
@@ -39,10 +39,39 @@ var addresses = (_a = {},
39
39
  _c[ContractType.ORACLE_ADAPTERS_PROXY] = '0x32edabc058c1207fe0ec5f8557643c28e4ff379e',
40
40
  _c[ContractType.MULTICALL] = '0xed28d27dfca47ad2513c9f2e2d3c098c2ea5a47f',
41
41
  _c[ContractType.REYA_SBTS] = '0x14d7c1efc024e118df70b241afbd2447d37f1ed6',
42
- _c[ContractType.TGE_DISTRIBUTOR] = '0x0000000000000000000000000000000000000000',
42
+ _c[ContractType.REYA_TGE_DISTRIBUTION] = '0x0000000000000000000000000000000000000000',
43
43
  _c),
44
44
  _a);
45
+ // Map stores the resolved env-var VALUES (not the var names) so that
46
+ // webpack / Next.js `DefinePlugin` can statically inline them into
47
+ // browser bundles.
48
+ //
49
+ // DefinePlugin only inlines literal `process.env.NAME` access — a
50
+ // dynamic `process.env[varName]` lookup is opaque to its source-text
51
+ // pass and stays `undefined` in the browser. Keeping the four
52
+ // `process.env.*` accesses as static literals in this object literal
53
+ // is what makes the override work in both Node (real `process.env` at
54
+ // runtime) and browser (DefinePlugin-substituted constants at build
55
+ // time). See PR #2660 / Daniel's comment for the discovery context.
56
+ //
57
+ // New entries must use the same static-literal pattern; do NOT
58
+ // introduce a dynamic `process.env[someVar]` lookup downstream.
59
+ var CONTRACT_ADDRESS_ENV_OVERRIDES = (_d = {},
60
+ _d[ContractType.CORE_PROXY] = process.env.CORE_PROXY_ADDRESS,
61
+ _d[ContractType.PASSIVE_PERP_PROXY] = process.env.PASSIVE_PERP_PROXY_ADDRESS,
62
+ _d[ContractType.ORDERS_GATEWAY_PROXY] = process.env.ORDERS_GATEWAY_PROXY_ADDRESS,
63
+ _d[ContractType.PERIPHERY_PROXY] = process.env.PERIPHERY_PROXY_ADDRESS,
64
+ _d);
45
65
  var getAddress = function (chainId, contractName) {
66
+ // Normalize env-overridden addresses to lowercase. The hardcoded fallback
67
+ // map below stores lowercased values, and downstream comparisons (e.g.
68
+ // transaction-whitelist.ts uses `convertToAddress(target) === OG_ADDRESS`,
69
+ // which lowercases the runtime target) assume that invariant. Without
70
+ // this, a checksummed env value silently fails every comparison and the
71
+ // OG-aware settlement path gets bypassed.
72
+ var override = CONTRACT_ADDRESS_ENV_OVERRIDES[contractName];
73
+ if (override)
74
+ return override.toLowerCase();
46
75
  var keyChainId = chainId.toString();
47
76
  if (!Object.keys(addresses).includes(keyChainId)) {
48
77
  throw new Error("Unspecified addresses for chain id ".concat(keyChainId));
@@ -1 +1 @@
1
- {"version":3,"file":"contractAddresses.js","sourceRoot":"/","sources":["transactions/contractAddresses.ts"],"names":[],"mappings":";;;;AAAA,kCAAgD;AAEhD,IAAY,YAWX;AAXD,WAAY,YAAY;IACtB,yCAAyB,CAAA;IACzB,yDAAyC,CAAA;IACzC,mDAAmC,CAAA;IACnC,qEAAqD,CAAA;IACrD,6DAA6C,CAAA;IAC7C,yDAAyC,CAAA;IACzC,+DAA+C,CAAA;IAC/C,uCAAuB,CAAA;IACvB,uCAAuB,CAAA;IACvB,mDAAmC,CAAA;AACrC,CAAC,EAXW,YAAY,4BAAZ,YAAY,QAWvB;AAED,IAAM,SAAS;IACb,GAAC,mBAAW,CAAC,UAAU;QACrB,GAAC,YAAY,CAAC,UAAU,IAAG,4CAA4C;QACvE,GAAC,YAAY,CAAC,kBAAkB,IAC9B,4CAA4C;QAC9C,GAAC,YAAY,CAAC,eAAe,IAC3B,4CAA4C;QAC9C,GAAC,YAAY,CAAC,wBAAwB,IACpC,4CAA4C;QAC9C,GAAC,YAAY,CAAC,oBAAoB,IAChC,4CAA4C;QAC9C,GAAC,YAAY,CAAC,kBAAkB,IAC9B,4CAA4C;QAC9C,GAAC,YAAY,CAAC,qBAAqB,IACjC,4CAA4C;QAC9C,GAAC,YAAY,CAAC,SAAS,IAAG,4CAA4C;QACtE,GAAC,YAAY,CAAC,SAAS,IAAG,4CAA4C;QACtE,GAAC,YAAY,CAAC,eAAe,IAC3B,4CAA4C;WAC/C;IACD,GAAC,mBAAW,CAAC,WAAW;QACtB,GAAC,YAAY,CAAC,UAAU,IAAG,4CAA4C;QACvE,GAAC,YAAY,CAAC,kBAAkB,IAC9B,4CAA4C;QAC9C,GAAC,YAAY,CAAC,eAAe,IAC3B,4CAA4C;QAC9C,GAAC,YAAY,CAAC,wBAAwB,IACpC,4CAA4C;QAC9C,GAAC,YAAY,CAAC,oBAAoB,IAChC,4CAA4C;QAC9C,GAAC,YAAY,CAAC,kBAAkB,IAC9B,4CAA4C;QAC9C,GAAC,YAAY,CAAC,qBAAqB,IACjC,4CAA4C;QAC9C,GAAC,YAAY,CAAC,SAAS,IAAG,4CAA4C;QACtE,GAAC,YAAY,CAAC,SAAS,IAAG,4CAA4C;QACtE,GAAC,YAAY,CAAC,eAAe,IAC3B,4CAA4C;WAC/C;OACF,CAAC;AACK,IAAM,UAAU,GAAG,UACxB,OAAe,EACf,YAA0B;IAE1B,IAAM,UAAU,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAEtC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QACjD,MAAM,IAAI,KAAK,CAAC,6CAAsC,UAAU,CAAE,CAAC,CAAC;IACtE,CAAC;IAED,IAAM,gBAAgB,GAAG,SAAS,CAAC,OAAsB,CAAC,CAAC;IAC3D,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;QAC1D,MAAM,IAAI,KAAK,CAAC,kCAA2B,YAAY,cAAW,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,gBAAgB,CAAC,YAAY,CAAC,CAAC;AACxC,CAAC,CAAC;AAhBW,QAAA,UAAU,cAgBrB","sourcesContent":["import { Address, ReyaChainId } from '../types';\n\nexport enum ContractType {\n CORE_PROXY = 'core_proxy',\n PASSIVE_POOL_PROXY = 'passive_pool_proxy',\n PERIPHERY_PROXY = 'periphery_proxy',\n CONDITIONAL_ORDERS_PROXY = 'conditional_orders_proxy',\n ORDERS_GATEWAY_PROXY = 'orders_gateway_proxy',\n PASSIVE_PERP_PROXY = 'passive_perp_proxy',\n ORACLE_ADAPTERS_PROXY = 'oracle_adapters_proxy',\n MULTICALL = 'multicall',\n REYA_SBTS = 'reya_sbts',\n TGE_DISTRIBUTOR = 'tge_distributor',\n}\n\nconst addresses: Record<ReyaChainId, Record<ContractType, Address>> = {\n [ReyaChainId.reyaCronos]: {\n [ContractType.CORE_PROXY]: '0xc6fb022962e1426f4e0ec9d2f8861c57926e9f72',\n [ContractType.PASSIVE_POOL_PROXY]:\n '0x9a3a664987b88790a6fdc1632e3b607813fd94ff',\n [ContractType.PERIPHERY_PROXY]:\n '0x94ccae812f1647696754412082dd6684c2366a7f',\n [ContractType.CONDITIONAL_ORDERS_PROXY]:\n '0x5a0ac2f89e0bdeafc5c549e354842210a3e87ca5',\n [ContractType.ORDERS_GATEWAY_PROXY]:\n '0x5a0ac2f89e0bdeafc5c549e354842210a3e87ca5',\n [ContractType.PASSIVE_PERP_PROXY]:\n '0x9ec177fed042ef2307928be2f5cdbf663b20244b',\n [ContractType.ORACLE_ADAPTERS_PROXY]:\n '0xc501a2356703cd351703d68963c6f4136120f7cf',\n [ContractType.MULTICALL]: '0x5abde4f0af8eaf3c9967f7fa126e59a103357b5c',\n [ContractType.REYA_SBTS]: '0xc0092ea9179ace93b0cd8910958e335575562722',\n [ContractType.TGE_DISTRIBUTOR]:\n '0x95375788a8137958dc8d93f774f4795bf28b0143',\n },\n [ReyaChainId.reyaNetwork]: {\n [ContractType.CORE_PROXY]: '0xa763b6a5e09378434406c003dae6487fbbdc1a80',\n [ContractType.PASSIVE_POOL_PROXY]:\n '0xb4b77d6180cc14472a9a7bdff01cc2459368d413',\n [ContractType.PERIPHERY_PROXY]:\n '0xcd2869d1eb1bc8991bc55de9e9b779e912faf736',\n [ContractType.CONDITIONAL_ORDERS_PROXY]:\n '0xfc8c96be87da63cecddbf54abfa7b13ee8044739',\n [ContractType.ORDERS_GATEWAY_PROXY]:\n '0xfc8c96be87da63cecddbf54abfa7b13ee8044739',\n [ContractType.PASSIVE_PERP_PROXY]:\n '0x27e5cb712334e101b3c232eb0be198baaa595f5f',\n [ContractType.ORACLE_ADAPTERS_PROXY]:\n '0x32edabc058c1207fe0ec5f8557643c28e4ff379e',\n [ContractType.MULTICALL]: '0xed28d27dfca47ad2513c9f2e2d3c098c2ea5a47f',\n [ContractType.REYA_SBTS]: '0x14d7c1efc024e118df70b241afbd2447d37f1ed6',\n [ContractType.TGE_DISTRIBUTOR]:\n '0x0000000000000000000000000000000000000000',\n },\n};\nexport const getAddress = (\n chainId: number,\n contractName: ContractType,\n): Address => {\n const keyChainId = chainId.toString();\n\n if (!Object.keys(addresses).includes(keyChainId)) {\n throw new Error(`Unspecified addresses for chain id ${keyChainId}`);\n }\n\n const networkAddresses = addresses[chainId as ReyaChainId];\n if (!Object.keys(networkAddresses).includes(contractName)) {\n throw new Error(`Unspecified address for ${contractName} contract`);\n }\n\n return networkAddresses[contractName];\n};\n"]}
1
+ {"version":3,"file":"contractAddresses.js","sourceRoot":"/","sources":["transactions/contractAddresses.ts"],"names":[],"mappings":"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","sourcesContent":["import { Address, ReyaChainId } from '../types';\n\nexport enum ContractType {\n CORE_PROXY = 'core_proxy',\n PASSIVE_POOL_PROXY = 'passive_pool_proxy',\n PERIPHERY_PROXY = 'periphery_proxy',\n CONDITIONAL_ORDERS_PROXY = 'conditional_orders_proxy',\n ORDERS_GATEWAY_PROXY = 'orders_gateway_proxy',\n PASSIVE_PERP_PROXY = 'passive_perp_proxy',\n ORACLE_ADAPTERS_PROXY = 'oracle_adapters_proxy',\n MULTICALL = 'multicall',\n REYA_SBTS = 'reya_sbts',\n REYA_TGE_DISTRIBUTION = 'reya_tge_distribution',\n}\n\nconst addresses: Record<ReyaChainId, Record<ContractType, Address>> = {\n [ReyaChainId.reyaCronos]: {\n [ContractType.CORE_PROXY]: '0xc6fb022962e1426f4e0ec9d2f8861c57926e9f72',\n [ContractType.PASSIVE_POOL_PROXY]:\n '0x9a3a664987b88790a6fdc1632e3b607813fd94ff',\n [ContractType.PERIPHERY_PROXY]:\n '0x94ccae812f1647696754412082dd6684c2366a7f',\n [ContractType.CONDITIONAL_ORDERS_PROXY]:\n '0x5a0ac2f89e0bdeafc5c549e354842210a3e87ca5',\n [ContractType.ORDERS_GATEWAY_PROXY]:\n '0x5a0ac2f89e0bdeafc5c549e354842210a3e87ca5',\n [ContractType.PASSIVE_PERP_PROXY]:\n '0x9ec177fed042ef2307928be2f5cdbf663b20244b',\n [ContractType.ORACLE_ADAPTERS_PROXY]:\n '0xc501a2356703cd351703d68963c6f4136120f7cf',\n [ContractType.MULTICALL]: '0x5abde4f0af8eaf3c9967f7fa126e59a103357b5c',\n [ContractType.REYA_SBTS]: '0xc0092ea9179ace93b0cd8910958e335575562722',\n [ContractType.REYA_TGE_DISTRIBUTION]:\n '0x16917248669fa64340e6517538e419588e9684c3',\n },\n [ReyaChainId.reyaNetwork]: {\n [ContractType.CORE_PROXY]: '0xa763b6a5e09378434406c003dae6487fbbdc1a80',\n [ContractType.PASSIVE_POOL_PROXY]:\n '0xb4b77d6180cc14472a9a7bdff01cc2459368d413',\n [ContractType.PERIPHERY_PROXY]:\n '0xcd2869d1eb1bc8991bc55de9e9b779e912faf736',\n [ContractType.CONDITIONAL_ORDERS_PROXY]:\n '0xfc8c96be87da63cecddbf54abfa7b13ee8044739',\n [ContractType.ORDERS_GATEWAY_PROXY]:\n '0xfc8c96be87da63cecddbf54abfa7b13ee8044739',\n [ContractType.PASSIVE_PERP_PROXY]:\n '0x27e5cb712334e101b3c232eb0be198baaa595f5f',\n [ContractType.ORACLE_ADAPTERS_PROXY]:\n '0x32edabc058c1207fe0ec5f8557643c28e4ff379e',\n [ContractType.MULTICALL]: '0xed28d27dfca47ad2513c9f2e2d3c098c2ea5a47f',\n [ContractType.REYA_SBTS]: '0x14d7c1efc024e118df70b241afbd2447d37f1ed6',\n [ContractType.REYA_TGE_DISTRIBUTION]:\n '0x0000000000000000000000000000000000000000',\n },\n};\n// Map stores the resolved env-var VALUES (not the var names) so that\n// webpack / Next.js `DefinePlugin` can statically inline them into\n// browser bundles.\n//\n// DefinePlugin only inlines literal `process.env.NAME` access — a\n// dynamic `process.env[varName]` lookup is opaque to its source-text\n// pass and stays `undefined` in the browser. Keeping the four\n// `process.env.*` accesses as static literals in this object literal\n// is what makes the override work in both Node (real `process.env` at\n// runtime) and browser (DefinePlugin-substituted constants at build\n// time). See PR #2660 / Daniel's comment for the discovery context.\n//\n// New entries must use the same static-literal pattern; do NOT\n// introduce a dynamic `process.env[someVar]` lookup downstream.\nconst CONTRACT_ADDRESS_ENV_OVERRIDES: Partial<Record<ContractType, string>> = {\n [ContractType.CORE_PROXY]: process.env.CORE_PROXY_ADDRESS,\n [ContractType.PASSIVE_PERP_PROXY]: process.env.PASSIVE_PERP_PROXY_ADDRESS,\n [ContractType.ORDERS_GATEWAY_PROXY]: process.env.ORDERS_GATEWAY_PROXY_ADDRESS,\n [ContractType.PERIPHERY_PROXY]: process.env.PERIPHERY_PROXY_ADDRESS,\n};\n\nexport const getAddress = (\n chainId: number,\n contractName: ContractType,\n): Address => {\n // Normalize env-overridden addresses to lowercase. The hardcoded fallback\n // map below stores lowercased values, and downstream comparisons (e.g.\n // transaction-whitelist.ts uses `convertToAddress(target) === OG_ADDRESS`,\n // which lowercases the runtime target) assume that invariant. Without\n // this, a checksummed env value silently fails every comparison and the\n // OG-aware settlement path gets bypassed.\n const override = CONTRACT_ADDRESS_ENV_OVERRIDES[contractName];\n if (override) return override.toLowerCase() as Address;\n\n const keyChainId = chainId.toString();\n\n if (!Object.keys(addresses).includes(keyChainId)) {\n throw new Error(`Unspecified addresses for chain id ${keyChainId}`);\n }\n\n const networkAddresses = addresses[chainId as ReyaChainId];\n if (!Object.keys(networkAddresses).includes(contractName)) {\n throw new Error(`Unspecified address for ${contractName} contract`);\n }\n\n return networkAddresses[contractName];\n};\n"]}