@reyaxyz/sdk 0.64.0 → 0.65.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 +1 -1
- package/dist/abis/Periphery.json +90 -236
- package/dist/services/lp/bridgeAndDepositPassivePool.js +1 -1
- package/dist/services/lp/bridgeAndDepositPassivePool.js.map +1 -1
- package/dist/services/lp/encode.js +5 -11
- package/dist/services/lp/encode.js.map +1 -1
- package/dist/services/lp/withdrawPassivePoolAndBridge.js +3 -5
- package/dist/services/lp/withdrawPassivePoolAndBridge.js.map +1 -1
- package/dist/services/margin-accounts/bridgeAndDepositExistingMA.js +1 -1
- package/dist/services/margin-accounts/bridgeAndDepositExistingMA.js.map +1 -1
- package/dist/services/margin-accounts/bridgeAndDepositNewMA.js +1 -1
- package/dist/services/margin-accounts/bridgeAndDepositNewMA.js.map +1 -1
- package/dist/services/margin-accounts/encode.js +6 -19
- package/dist/services/margin-accounts/encode.js.map +1 -1
- package/dist/services/margin-accounts/withdrawMAAndBridge.js +2 -9
- package/dist/services/margin-accounts/withdrawMAAndBridge.js.map +1 -1
- package/dist/services/sign.js +3 -1
- package/dist/services/sign.js.map +1 -1
- package/dist/services/token/getRUSDUnderlyingSignerInfo.js +4 -1
- package/dist/services/token/getRUSDUnderlyingSignerInfo.js.map +1 -1
- package/dist/services/token/types.js.map +1 -1
- package/dist/types/services/lp/bridgeAndDepositPassivePool.d.ts.map +1 -1
- package/dist/types/services/lp/encode.d.ts +2 -2
- package/dist/types/services/lp/encode.d.ts.map +1 -1
- package/dist/types/services/lp/withdrawPassivePoolAndBridge.d.ts.map +1 -1
- package/dist/types/services/margin-accounts/bridgeAndDepositExistingMA.d.ts.map +1 -1
- package/dist/types/services/margin-accounts/bridgeAndDepositNewMA.d.ts.map +1 -1
- package/dist/types/services/margin-accounts/encode.d.ts +3 -3
- package/dist/types/services/margin-accounts/encode.d.ts.map +1 -1
- package/dist/types/services/margin-accounts/withdrawMAAndBridge.d.ts.map +1 -1
- package/dist/types/services/sign.d.ts +1 -1
- package/dist/types/services/sign.d.ts.map +1 -1
- package/dist/types/services/token/getRUSDUnderlyingSignerInfo.d.ts.map +1 -1
- package/dist/types/services/token/types.d.ts +1 -1
- package/dist/types/services/token/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/abis/Periphery.json +90 -236
- package/src/services/lp/bridgeAndDepositPassivePool.ts +0 -3
- package/src/services/lp/encode.ts +5 -15
- package/src/services/lp/withdrawPassivePoolAndBridge.ts +4 -7
- package/src/services/margin-accounts/bridgeAndDepositExistingMA.ts +0 -3
- package/src/services/margin-accounts/bridgeAndDepositNewMA.ts +0 -3
- package/src/services/margin-accounts/encode.ts +6 -26
- package/src/services/margin-accounts/withdrawMAAndBridge.ts +1 -13
- package/src/services/sign.ts +8 -1
- package/src/services/token/getRUSDUnderlyingSignerInfo.ts +4 -1
- package/src/services/token/types.ts +1 -1
package/src/abis/Periphery.json
CHANGED
|
@@ -202,6 +202,10 @@
|
|
|
202
202
|
"name": "ZeroAddress",
|
|
203
203
|
"inputs": []
|
|
204
204
|
},
|
|
205
|
+
{
|
|
206
|
+
"type": "receive",
|
|
207
|
+
"stateMutability": "payable"
|
|
208
|
+
},
|
|
205
209
|
{
|
|
206
210
|
"type": "function",
|
|
207
211
|
"name": "getGlobalConfiguration",
|
|
@@ -232,6 +236,30 @@
|
|
|
232
236
|
],
|
|
233
237
|
"stateMutability": "pure"
|
|
234
238
|
},
|
|
239
|
+
{
|
|
240
|
+
"type": "function",
|
|
241
|
+
"name": "getTokenChainConnector",
|
|
242
|
+
"inputs": [
|
|
243
|
+
{
|
|
244
|
+
"name": "token",
|
|
245
|
+
"type": "address",
|
|
246
|
+
"internalType": "address"
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
"name": "chainId",
|
|
250
|
+
"type": "uint256",
|
|
251
|
+
"internalType": "uint256"
|
|
252
|
+
}
|
|
253
|
+
],
|
|
254
|
+
"outputs": [
|
|
255
|
+
{
|
|
256
|
+
"name": "connector",
|
|
257
|
+
"type": "address",
|
|
258
|
+
"internalType": "address"
|
|
259
|
+
}
|
|
260
|
+
],
|
|
261
|
+
"stateMutability": "view"
|
|
262
|
+
},
|
|
235
263
|
{
|
|
236
264
|
"type": "function",
|
|
237
265
|
"name": "getTokenController",
|
|
@@ -365,6 +393,29 @@
|
|
|
365
393
|
"outputs": [],
|
|
366
394
|
"stateMutability": "nonpayable"
|
|
367
395
|
},
|
|
396
|
+
{
|
|
397
|
+
"type": "function",
|
|
398
|
+
"name": "setTokenChainConnector",
|
|
399
|
+
"inputs": [
|
|
400
|
+
{
|
|
401
|
+
"name": "token",
|
|
402
|
+
"type": "address",
|
|
403
|
+
"internalType": "address"
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
"name": "chainId",
|
|
407
|
+
"type": "uint256",
|
|
408
|
+
"internalType": "uint256"
|
|
409
|
+
},
|
|
410
|
+
{
|
|
411
|
+
"name": "connector",
|
|
412
|
+
"type": "address",
|
|
413
|
+
"internalType": "address"
|
|
414
|
+
}
|
|
415
|
+
],
|
|
416
|
+
"outputs": [],
|
|
417
|
+
"stateMutability": "nonpayable"
|
|
418
|
+
},
|
|
368
419
|
{
|
|
369
420
|
"type": "function",
|
|
370
421
|
"name": "setTokenController",
|
|
@@ -424,6 +475,22 @@
|
|
|
424
475
|
"outputs": [],
|
|
425
476
|
"stateMutability": "nonpayable"
|
|
426
477
|
},
|
|
478
|
+
{
|
|
479
|
+
"type": "error",
|
|
480
|
+
"name": "ConnectorNotRegistered",
|
|
481
|
+
"inputs": [
|
|
482
|
+
{
|
|
483
|
+
"name": "token",
|
|
484
|
+
"type": "address",
|
|
485
|
+
"internalType": "address"
|
|
486
|
+
},
|
|
487
|
+
{
|
|
488
|
+
"name": "chainId",
|
|
489
|
+
"type": "uint256",
|
|
490
|
+
"internalType": "uint256"
|
|
491
|
+
}
|
|
492
|
+
]
|
|
493
|
+
},
|
|
427
494
|
{
|
|
428
495
|
"type": "error",
|
|
429
496
|
"name": "ControllerNotRegistered",
|
|
@@ -490,11 +557,6 @@
|
|
|
490
557
|
"name": "token",
|
|
491
558
|
"type": "address",
|
|
492
559
|
"internalType": "address"
|
|
493
|
-
},
|
|
494
|
-
{
|
|
495
|
-
"name": "tokenAmount",
|
|
496
|
-
"type": "uint256",
|
|
497
|
-
"internalType": "uint256"
|
|
498
560
|
}
|
|
499
561
|
]
|
|
500
562
|
}
|
|
@@ -520,11 +582,6 @@
|
|
|
520
582
|
"name": "token",
|
|
521
583
|
"type": "address",
|
|
522
584
|
"internalType": "address"
|
|
523
|
-
},
|
|
524
|
-
{
|
|
525
|
-
"name": "tokenAmount",
|
|
526
|
-
"type": "uint256",
|
|
527
|
-
"internalType": "uint256"
|
|
528
585
|
}
|
|
529
586
|
]
|
|
530
587
|
}
|
|
@@ -557,11 +614,6 @@
|
|
|
557
614
|
"type": "address",
|
|
558
615
|
"internalType": "address"
|
|
559
616
|
},
|
|
560
|
-
{
|
|
561
|
-
"name": "amount",
|
|
562
|
-
"type": "uint256",
|
|
563
|
-
"internalType": "uint256"
|
|
564
|
-
},
|
|
565
617
|
{
|
|
566
618
|
"name": "minShares",
|
|
567
619
|
"type": "uint256",
|
|
@@ -575,26 +627,15 @@
|
|
|
575
627
|
},
|
|
576
628
|
{
|
|
577
629
|
"type": "error",
|
|
578
|
-
"name": "
|
|
630
|
+
"name": "CallerIsNotExecutionHelper",
|
|
579
631
|
"inputs": [
|
|
580
632
|
{
|
|
581
|
-
"name": "
|
|
582
|
-
"type": "
|
|
583
|
-
"internalType": "
|
|
633
|
+
"name": "caller",
|
|
634
|
+
"type": "address",
|
|
635
|
+
"internalType": "address"
|
|
584
636
|
},
|
|
585
637
|
{
|
|
586
|
-
"name": "
|
|
587
|
-
"type": "uint256",
|
|
588
|
-
"internalType": "uint256"
|
|
589
|
-
}
|
|
590
|
-
]
|
|
591
|
-
},
|
|
592
|
-
{
|
|
593
|
-
"type": "error",
|
|
594
|
-
"name": "CheckSelfCall",
|
|
595
|
-
"inputs": [
|
|
596
|
-
{
|
|
597
|
-
"name": "caller",
|
|
638
|
+
"name": "token",
|
|
598
639
|
"type": "address",
|
|
599
640
|
"internalType": "address"
|
|
600
641
|
}
|
|
@@ -643,199 +684,6 @@
|
|
|
643
684
|
}
|
|
644
685
|
]
|
|
645
686
|
},
|
|
646
|
-
{
|
|
647
|
-
"type": "function",
|
|
648
|
-
"name": "depositExistingMA",
|
|
649
|
-
"inputs": [
|
|
650
|
-
{
|
|
651
|
-
"name": "inputs",
|
|
652
|
-
"type": "tuple",
|
|
653
|
-
"internalType": "struct DepositExistingMAInputs",
|
|
654
|
-
"components": [
|
|
655
|
-
{
|
|
656
|
-
"name": "accountId",
|
|
657
|
-
"type": "uint128",
|
|
658
|
-
"internalType": "uint128"
|
|
659
|
-
},
|
|
660
|
-
{
|
|
661
|
-
"name": "token",
|
|
662
|
-
"type": "address",
|
|
663
|
-
"internalType": "address"
|
|
664
|
-
},
|
|
665
|
-
{
|
|
666
|
-
"name": "tokenAmount",
|
|
667
|
-
"type": "uint256",
|
|
668
|
-
"internalType": "uint256"
|
|
669
|
-
}
|
|
670
|
-
]
|
|
671
|
-
},
|
|
672
|
-
{
|
|
673
|
-
"name": "fallbackData",
|
|
674
|
-
"type": "tuple",
|
|
675
|
-
"internalType": "struct FallbackData",
|
|
676
|
-
"components": [
|
|
677
|
-
{
|
|
678
|
-
"name": "socketMsgGasLimit",
|
|
679
|
-
"type": "uint256",
|
|
680
|
-
"internalType": "uint256"
|
|
681
|
-
},
|
|
682
|
-
{
|
|
683
|
-
"name": "socketPayloadSize",
|
|
684
|
-
"type": "uint256",
|
|
685
|
-
"internalType": "uint256"
|
|
686
|
-
},
|
|
687
|
-
{
|
|
688
|
-
"name": "socketConnector",
|
|
689
|
-
"type": "address",
|
|
690
|
-
"internalType": "address"
|
|
691
|
-
}
|
|
692
|
-
]
|
|
693
|
-
}
|
|
694
|
-
],
|
|
695
|
-
"outputs": [],
|
|
696
|
-
"stateMutability": "nonpayable"
|
|
697
|
-
},
|
|
698
|
-
{
|
|
699
|
-
"type": "function",
|
|
700
|
-
"name": "depositNewMA",
|
|
701
|
-
"inputs": [
|
|
702
|
-
{
|
|
703
|
-
"name": "inputs",
|
|
704
|
-
"type": "tuple",
|
|
705
|
-
"internalType": "struct DepositNewMAInputs",
|
|
706
|
-
"components": [
|
|
707
|
-
{
|
|
708
|
-
"name": "accountOwner",
|
|
709
|
-
"type": "address",
|
|
710
|
-
"internalType": "address"
|
|
711
|
-
},
|
|
712
|
-
{
|
|
713
|
-
"name": "token",
|
|
714
|
-
"type": "address",
|
|
715
|
-
"internalType": "address"
|
|
716
|
-
},
|
|
717
|
-
{
|
|
718
|
-
"name": "tokenAmount",
|
|
719
|
-
"type": "uint256",
|
|
720
|
-
"internalType": "uint256"
|
|
721
|
-
}
|
|
722
|
-
]
|
|
723
|
-
},
|
|
724
|
-
{
|
|
725
|
-
"name": "fallbackData",
|
|
726
|
-
"type": "tuple",
|
|
727
|
-
"internalType": "struct FallbackData",
|
|
728
|
-
"components": [
|
|
729
|
-
{
|
|
730
|
-
"name": "socketMsgGasLimit",
|
|
731
|
-
"type": "uint256",
|
|
732
|
-
"internalType": "uint256"
|
|
733
|
-
},
|
|
734
|
-
{
|
|
735
|
-
"name": "socketPayloadSize",
|
|
736
|
-
"type": "uint256",
|
|
737
|
-
"internalType": "uint256"
|
|
738
|
-
},
|
|
739
|
-
{
|
|
740
|
-
"name": "socketConnector",
|
|
741
|
-
"type": "address",
|
|
742
|
-
"internalType": "address"
|
|
743
|
-
}
|
|
744
|
-
]
|
|
745
|
-
}
|
|
746
|
-
],
|
|
747
|
-
"outputs": [],
|
|
748
|
-
"stateMutability": "nonpayable"
|
|
749
|
-
},
|
|
750
|
-
{
|
|
751
|
-
"type": "function",
|
|
752
|
-
"name": "depositPassivePool",
|
|
753
|
-
"inputs": [
|
|
754
|
-
{
|
|
755
|
-
"name": "inputs",
|
|
756
|
-
"type": "tuple",
|
|
757
|
-
"internalType": "struct DepositPassivePoolInputs",
|
|
758
|
-
"components": [
|
|
759
|
-
{
|
|
760
|
-
"name": "poolId",
|
|
761
|
-
"type": "uint128",
|
|
762
|
-
"internalType": "uint128"
|
|
763
|
-
},
|
|
764
|
-
{
|
|
765
|
-
"name": "owner",
|
|
766
|
-
"type": "address",
|
|
767
|
-
"internalType": "address"
|
|
768
|
-
},
|
|
769
|
-
{
|
|
770
|
-
"name": "amount",
|
|
771
|
-
"type": "uint256",
|
|
772
|
-
"internalType": "uint256"
|
|
773
|
-
},
|
|
774
|
-
{
|
|
775
|
-
"name": "minShares",
|
|
776
|
-
"type": "uint256",
|
|
777
|
-
"internalType": "uint256"
|
|
778
|
-
}
|
|
779
|
-
]
|
|
780
|
-
},
|
|
781
|
-
{
|
|
782
|
-
"name": "fallbackData",
|
|
783
|
-
"type": "tuple",
|
|
784
|
-
"internalType": "struct FallbackData",
|
|
785
|
-
"components": [
|
|
786
|
-
{
|
|
787
|
-
"name": "socketMsgGasLimit",
|
|
788
|
-
"type": "uint256",
|
|
789
|
-
"internalType": "uint256"
|
|
790
|
-
},
|
|
791
|
-
{
|
|
792
|
-
"name": "socketPayloadSize",
|
|
793
|
-
"type": "uint256",
|
|
794
|
-
"internalType": "uint256"
|
|
795
|
-
},
|
|
796
|
-
{
|
|
797
|
-
"name": "socketConnector",
|
|
798
|
-
"type": "address",
|
|
799
|
-
"internalType": "address"
|
|
800
|
-
}
|
|
801
|
-
]
|
|
802
|
-
}
|
|
803
|
-
],
|
|
804
|
-
"outputs": [],
|
|
805
|
-
"stateMutability": "nonpayable"
|
|
806
|
-
},
|
|
807
|
-
{
|
|
808
|
-
"type": "error",
|
|
809
|
-
"name": "CallerIsNotExecutionHelper",
|
|
810
|
-
"inputs": [
|
|
811
|
-
{
|
|
812
|
-
"name": "caller",
|
|
813
|
-
"type": "address",
|
|
814
|
-
"internalType": "address"
|
|
815
|
-
},
|
|
816
|
-
{
|
|
817
|
-
"name": "token",
|
|
818
|
-
"type": "address",
|
|
819
|
-
"internalType": "address"
|
|
820
|
-
}
|
|
821
|
-
]
|
|
822
|
-
},
|
|
823
|
-
{
|
|
824
|
-
"type": "error",
|
|
825
|
-
"name": "NotEnoughFees",
|
|
826
|
-
"inputs": [
|
|
827
|
-
{
|
|
828
|
-
"name": "tokenAmount",
|
|
829
|
-
"type": "uint256",
|
|
830
|
-
"internalType": "uint256"
|
|
831
|
-
},
|
|
832
|
-
{
|
|
833
|
-
"name": "tokenFees",
|
|
834
|
-
"type": "uint256",
|
|
835
|
-
"internalType": "uint256"
|
|
836
|
-
}
|
|
837
|
-
]
|
|
838
|
-
},
|
|
839
687
|
{
|
|
840
688
|
"type": "function",
|
|
841
689
|
"name": "executeMatchOrders",
|
|
@@ -1175,15 +1023,10 @@
|
|
|
1175
1023
|
"internalType": "uint256"
|
|
1176
1024
|
},
|
|
1177
1025
|
{
|
|
1178
|
-
"name": "
|
|
1026
|
+
"name": "chainId",
|
|
1179
1027
|
"type": "uint256",
|
|
1180
1028
|
"internalType": "uint256"
|
|
1181
1029
|
},
|
|
1182
|
-
{
|
|
1183
|
-
"name": "socketConnector",
|
|
1184
|
-
"type": "address",
|
|
1185
|
-
"internalType": "address"
|
|
1186
|
-
},
|
|
1187
1030
|
{
|
|
1188
1031
|
"name": "receiver",
|
|
1189
1032
|
"type": "address",
|
|
@@ -1257,15 +1100,10 @@
|
|
|
1257
1100
|
"internalType": "uint256"
|
|
1258
1101
|
},
|
|
1259
1102
|
{
|
|
1260
|
-
"name": "
|
|
1103
|
+
"name": "chainId",
|
|
1261
1104
|
"type": "uint256",
|
|
1262
1105
|
"internalType": "uint256"
|
|
1263
1106
|
},
|
|
1264
|
-
{
|
|
1265
|
-
"name": "socketConnector",
|
|
1266
|
-
"type": "address",
|
|
1267
|
-
"internalType": "address"
|
|
1268
|
-
},
|
|
1269
1107
|
{
|
|
1270
1108
|
"name": "receiver",
|
|
1271
1109
|
"type": "address",
|
|
@@ -1277,6 +1115,22 @@
|
|
|
1277
1115
|
"outputs": [],
|
|
1278
1116
|
"stateMutability": "nonpayable"
|
|
1279
1117
|
},
|
|
1118
|
+
{
|
|
1119
|
+
"type": "error",
|
|
1120
|
+
"name": "NotEnoughFees",
|
|
1121
|
+
"inputs": [
|
|
1122
|
+
{
|
|
1123
|
+
"name": "tokenAmount",
|
|
1124
|
+
"type": "uint256",
|
|
1125
|
+
"internalType": "uint256"
|
|
1126
|
+
},
|
|
1127
|
+
{
|
|
1128
|
+
"name": "tokenFees",
|
|
1129
|
+
"type": "uint256",
|
|
1130
|
+
"internalType": "uint256"
|
|
1131
|
+
}
|
|
1132
|
+
]
|
|
1133
|
+
},
|
|
1280
1134
|
{
|
|
1281
1135
|
"type": "function",
|
|
1282
1136
|
"name": "onERC721Received",
|
|
@@ -60,8 +60,7 @@ export const encodeWithdrawPassivePoolAndBridge = (
|
|
|
60
60
|
minOut: bigint,
|
|
61
61
|
sig: EIP712Signature,
|
|
62
62
|
socketMsgGasLimit: bigint,
|
|
63
|
-
|
|
64
|
-
socketConnector: string,
|
|
63
|
+
chainId: number,
|
|
65
64
|
receiver: string,
|
|
66
65
|
): MethodParameters => {
|
|
67
66
|
const functionSignature = 'withdrawPassivePool';
|
|
@@ -73,8 +72,7 @@ export const encodeWithdrawPassivePoolAndBridge = (
|
|
|
73
72
|
minOut,
|
|
74
73
|
sig,
|
|
75
74
|
socketMsgGasLimit,
|
|
76
|
-
|
|
77
|
-
socketConnector,
|
|
75
|
+
chainId,
|
|
78
76
|
receiver,
|
|
79
77
|
},
|
|
80
78
|
];
|
|
@@ -93,20 +91,12 @@ export const encodeBridgeAndDepositPassivePool = (
|
|
|
93
91
|
owner: string,
|
|
94
92
|
amount: bigint,
|
|
95
93
|
minShares: bigint,
|
|
96
|
-
fallbackSocketMsgGasLimit: bigint,
|
|
97
|
-
fallbackSocketConnector: string,
|
|
98
|
-
fallbackSocketPayloadSize: bigint,
|
|
99
94
|
): MethodParameters => {
|
|
100
95
|
const PERIPHERY_INTERFACE = new Interface(peripheryAbi);
|
|
101
|
-
const inputs = { poolId, owner,
|
|
102
|
-
const fallbackData = {
|
|
103
|
-
socketMsgGasLimit: fallbackSocketMsgGasLimit,
|
|
104
|
-
socketConnector: fallbackSocketConnector,
|
|
105
|
-
socketPayloadSize: fallbackSocketPayloadSize,
|
|
106
|
-
};
|
|
96
|
+
const inputs = { poolId, owner, minShares };
|
|
107
97
|
const peripheryCalldata = PERIPHERY_INTERFACE.encodeFunctionData(
|
|
108
|
-
'depositPassivePool((uint128,address,uint256
|
|
109
|
-
[inputs
|
|
98
|
+
'depositPassivePool((uint128,address,uint256))',
|
|
99
|
+
[inputs],
|
|
110
100
|
);
|
|
111
101
|
|
|
112
102
|
const functionSignature = 'bridge';
|
|
@@ -9,8 +9,6 @@ import { encodeWithdrawPassivePoolAndBridge } from './encode';
|
|
|
9
9
|
import {
|
|
10
10
|
ReyaChainId,
|
|
11
11
|
getCurrentTimestampInSeconds,
|
|
12
|
-
getRUSDUnderlyingTokenInfo,
|
|
13
|
-
getSocketConnectors,
|
|
14
12
|
scale,
|
|
15
13
|
} from '@reyaxyz/common';
|
|
16
14
|
import { BRIDGE_DEADLINE_IN_SECONDS } from '../../utils/consts';
|
|
@@ -38,6 +36,9 @@ export const withdrawPassivePoolAndBridge = async (
|
|
|
38
36
|
BigInt(0),
|
|
39
37
|
params.owner.poolSigNonce + 1,
|
|
40
38
|
getCurrentTimestampInSeconds() + BRIDGE_DEADLINE_IN_SECONDS,
|
|
39
|
+
BigInt('10000000'), //todo
|
|
40
|
+
params.moneyInOutChainId,
|
|
41
|
+
params.owner.address,
|
|
41
42
|
);
|
|
42
43
|
|
|
43
44
|
const { calldata: data, value } = encodeWithdrawPassivePoolAndBridge(
|
|
@@ -47,11 +48,7 @@ export const withdrawPassivePoolAndBridge = async (
|
|
|
47
48
|
BigInt(0),
|
|
48
49
|
eip712Signature,
|
|
49
50
|
BigInt('10000000'), //todo
|
|
50
|
-
|
|
51
|
-
getSocketConnectors({
|
|
52
|
-
moneyInOutChainId: params.moneyInOutChainId,
|
|
53
|
-
tokenName: getRUSDUnderlyingTokenInfo(params.moneyInOutChainId).name,
|
|
54
|
-
}).withdraw,
|
|
51
|
+
params.moneyInOutChainId,
|
|
55
52
|
params.owner.address,
|
|
56
53
|
);
|
|
57
54
|
|
|
@@ -66,9 +66,6 @@ export const bridgeAndDepositExistingMA = async (
|
|
|
66
66
|
reyaPeripheryTokenInfo.address,
|
|
67
67
|
scale(reyaPeripheryTokenInfo.decimals)(params.amount),
|
|
68
68
|
scale(moneyInOutTokenInfo.decimals)(params.amount),
|
|
69
|
-
BigInt('10000000'),
|
|
70
|
-
socketConnectors.withdraw,
|
|
71
|
-
BigInt(0),
|
|
72
69
|
);
|
|
73
70
|
|
|
74
71
|
const result = await executeTransaction(
|
|
@@ -49,9 +49,6 @@ export const bridgeAndDepositNewMA = async (
|
|
|
49
49
|
reyaPeripheryTokenInfo.address,
|
|
50
50
|
scale(reyaPeripheryTokenInfo.decimals)(params.amount),
|
|
51
51
|
scale(moneyInOutTokenInfo.decimals)(params.amount),
|
|
52
|
-
BigInt('10000000'),
|
|
53
|
-
socketConnectors.withdraw,
|
|
54
|
-
BigInt(0),
|
|
55
52
|
);
|
|
56
53
|
|
|
57
54
|
const result = await executeTransaction(
|
|
@@ -108,8 +108,7 @@ export const encodeWithdrawMAAndBridge = (
|
|
|
108
108
|
corePeripheryTokenAmount: bigint,
|
|
109
109
|
sig: EIP712Signature,
|
|
110
110
|
socketMsgGasLimit: bigint,
|
|
111
|
-
|
|
112
|
-
socketConnector: string,
|
|
111
|
+
chainId: number,
|
|
113
112
|
receiver: string,
|
|
114
113
|
): MethodParameters => {
|
|
115
114
|
const functionSignature = 'withdrawMA';
|
|
@@ -120,8 +119,7 @@ export const encodeWithdrawMAAndBridge = (
|
|
|
120
119
|
tokenAmount: corePeripheryTokenAmount,
|
|
121
120
|
sig,
|
|
122
121
|
socketMsgGasLimit,
|
|
123
|
-
|
|
124
|
-
socketConnector,
|
|
122
|
+
chainId,
|
|
125
123
|
receiver,
|
|
126
124
|
},
|
|
127
125
|
];
|
|
@@ -140,24 +138,15 @@ export const encodeBridgeAndDepositNewMA = (
|
|
|
140
138
|
peripheryTokenAddress: string,
|
|
141
139
|
peripheryTokenAmount: bigint,
|
|
142
140
|
moneyInOutTokenAmount: bigint,
|
|
143
|
-
fallbackSocketMsgGasLimit: bigint,
|
|
144
|
-
fallbackSocketConnector: string,
|
|
145
|
-
fallbackSocketPayloadSize: bigint,
|
|
146
141
|
): MethodParameters => {
|
|
147
142
|
const PERIPHERY_INTERFACE = new Interface(peripheryAbi);
|
|
148
143
|
const inputs = {
|
|
149
144
|
accountOwner,
|
|
150
145
|
token: peripheryTokenAddress,
|
|
151
|
-
tokenAmount: peripheryTokenAmount,
|
|
152
|
-
};
|
|
153
|
-
const fallbackData = {
|
|
154
|
-
socketMsgGasLimit: fallbackSocketMsgGasLimit,
|
|
155
|
-
socketConnector: fallbackSocketConnector,
|
|
156
|
-
socketPayloadSize: fallbackSocketPayloadSize,
|
|
157
146
|
};
|
|
158
147
|
const peripheryCalldata = PERIPHERY_INTERFACE.encodeFunctionData(
|
|
159
|
-
'depositNewMA((address,address
|
|
160
|
-
[inputs
|
|
148
|
+
'depositNewMA((address,address))',
|
|
149
|
+
[inputs],
|
|
161
150
|
);
|
|
162
151
|
|
|
163
152
|
const functionSignature = 'bridge';
|
|
@@ -184,24 +173,15 @@ export const encodeBridgeAndDepositExistingMA = (
|
|
|
184
173
|
peripheryTokenAddress: string,
|
|
185
174
|
peripheryTokenAmount: bigint,
|
|
186
175
|
moneyInOutTokenAmount: bigint,
|
|
187
|
-
fallbackSocketMsgGasLimit: bigint,
|
|
188
|
-
fallbackSocketConnector: string,
|
|
189
|
-
fallbackSocketPayloadSize: bigint,
|
|
190
176
|
): MethodParameters => {
|
|
191
177
|
const PERIPHERY_INTERFACE = new Interface(peripheryAbi);
|
|
192
178
|
const inputs = {
|
|
193
179
|
accountId,
|
|
194
180
|
token: peripheryTokenAddress,
|
|
195
|
-
tokenAmount: peripheryTokenAmount,
|
|
196
|
-
};
|
|
197
|
-
const fallbackData = {
|
|
198
|
-
socketMsgGasLimit: fallbackSocketMsgGasLimit,
|
|
199
|
-
socketConnector: fallbackSocketConnector,
|
|
200
|
-
socketPayloadSize: fallbackSocketPayloadSize,
|
|
201
181
|
};
|
|
202
182
|
const peripheryCalldata = PERIPHERY_INTERFACE.encodeFunctionData(
|
|
203
|
-
'depositExistingMA((uint128,address
|
|
204
|
-
[inputs
|
|
183
|
+
'depositExistingMA((uint128,address))',
|
|
184
|
+
[inputs],
|
|
205
185
|
);
|
|
206
186
|
|
|
207
187
|
const functionSignature = 'bridge';
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getCurrentTimestampInSeconds,
|
|
3
|
-
getSocketConnectors,
|
|
4
3
|
scale,
|
|
5
4
|
ReyaChainId,
|
|
6
5
|
getTokenInfoByAddress,
|
|
7
|
-
getRUSDUnderlyingTokenInfo,
|
|
8
6
|
} from '@reyaxyz/common';
|
|
9
7
|
import { ContractType, getAddress } from '../../utils/contractAddresses';
|
|
10
8
|
import { executeTransaction } from '../executeTransaction';
|
|
@@ -31,10 +29,6 @@ export const withdrawMAAndBridge = async ({
|
|
|
31
29
|
const reyaChainId: ReyaChainId = Number(network?.chainId);
|
|
32
30
|
|
|
33
31
|
const corePeripheryTokenInfo = getTokenInfoByAddress(tokenAddress);
|
|
34
|
-
const bridgeTokenInfo =
|
|
35
|
-
corePeripheryTokenInfo.name === 'RUSD'
|
|
36
|
-
? getRUSDUnderlyingTokenInfo(reyaChainId)
|
|
37
|
-
: corePeripheryTokenInfo;
|
|
38
32
|
|
|
39
33
|
const multiAction = new MultiAction();
|
|
40
34
|
encodeSingleWithdraw(
|
|
@@ -52,19 +46,13 @@ export const withdrawMAAndBridge = async ({
|
|
|
52
46
|
getCurrentTimestampInSeconds() + BRIDGE_DEADLINE_IN_SECONDS,
|
|
53
47
|
);
|
|
54
48
|
|
|
55
|
-
const socketConnectors = getSocketConnectors({
|
|
56
|
-
moneyInOutChainId: moneyInOutChainId,
|
|
57
|
-
tokenName: bridgeTokenInfo.name,
|
|
58
|
-
});
|
|
59
|
-
|
|
60
49
|
const { calldata: data, value } = encodeWithdrawMAAndBridge(
|
|
61
50
|
marginAccountId,
|
|
62
51
|
corePeripheryTokenInfo.address,
|
|
63
52
|
scale(corePeripheryTokenInfo.decimals)(unscaledAmount),
|
|
64
53
|
eip712Signature,
|
|
65
54
|
BigInt('10000000'),
|
|
66
|
-
|
|
67
|
-
socketConnectors.withdraw,
|
|
55
|
+
moneyInOutChainId,
|
|
68
56
|
receiverAddress,
|
|
69
57
|
);
|
|
70
58
|
|
package/src/services/sign.ts
CHANGED
|
@@ -76,8 +76,10 @@ export async function signPoolRemoveLiquidity(
|
|
|
76
76
|
minOut: bigint,
|
|
77
77
|
nonce: number,
|
|
78
78
|
deadline: number,
|
|
79
|
+
socketMsgGasLimit: bigint,
|
|
80
|
+
chainId: number,
|
|
81
|
+
receiver: string,
|
|
79
82
|
): Promise<EIP712Signature> {
|
|
80
|
-
// @todo extend
|
|
81
83
|
const signature = await signReyaTypedData(
|
|
82
84
|
signer,
|
|
83
85
|
getAddress(reyaChainId, ContractType.PASSIVE_POOL_PROXY),
|
|
@@ -91,6 +93,7 @@ export async function signPoolRemoveLiquidity(
|
|
|
91
93
|
{ name: 'minOut', type: 'uint256' },
|
|
92
94
|
{ name: 'nonce', type: 'uint256' },
|
|
93
95
|
{ name: 'deadline', type: 'uint256' },
|
|
96
|
+
{ name: 'extraSignatureData', type: 'bytes' },
|
|
94
97
|
],
|
|
95
98
|
},
|
|
96
99
|
{
|
|
@@ -102,6 +105,10 @@ export async function signPoolRemoveLiquidity(
|
|
|
102
105
|
minOut: minOut,
|
|
103
106
|
nonce: nonce,
|
|
104
107
|
deadline: deadline,
|
|
108
|
+
extraSignatureData: ethers.AbiCoder.defaultAbiCoder().encode(
|
|
109
|
+
['address', 'uint256', 'uint256'],
|
|
110
|
+
[receiver, chainId, socketMsgGasLimit],
|
|
111
|
+
),
|
|
105
112
|
},
|
|
106
113
|
);
|
|
107
114
|
|
|
@@ -18,7 +18,10 @@ export const getRUSDUnderlyingSignerInfo = async ({
|
|
|
18
18
|
|
|
19
19
|
const result: GetRUSDUnderlyingSignerInfoResult = {
|
|
20
20
|
balance,
|
|
21
|
-
|
|
21
|
+
rusdUnderlying: {
|
|
22
|
+
id: rusdUnderlyingInfo.name,
|
|
23
|
+
address: rusdUnderlyingInfo.address,
|
|
24
|
+
},
|
|
22
25
|
};
|
|
23
26
|
|
|
24
27
|
return result;
|