@reyaxyz/sdk 0.64.1 → 0.66.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/transferFromMAToPool.js +5 -3
- package/dist/services/lp/transferFromMAToPool.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 +18 -27
- package/dist/services/margin-accounts/encode.js.map +1 -1
- package/dist/services/margin-accounts/transferMarginBetweenAccounts.js +1 -1
- package/dist/services/margin-accounts/transferMarginBetweenAccounts.js.map +1 -1
- package/dist/services/margin-accounts/withdrawMAAndBridge.js +6 -11
- package/dist/services/margin-accounts/withdrawMAAndBridge.js.map +1 -1
- package/dist/services/orders/encode.js +2 -1
- package/dist/services/orders/encode.js.map +1 -1
- package/dist/services/sign.js +5 -3
- package/dist/services/sign.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/transferFromMAToPool.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/orders/encode.d.ts.map +1 -1
- package/dist/types/services/sign.d.ts +2 -2
- package/dist/types/services/sign.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/transferFromMAToPool.ts +8 -1
- 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 +18 -33
- package/src/services/margin-accounts/transferMarginBetweenAccounts.ts +1 -1
- package/src/services/margin-accounts/withdrawMAAndBridge.ts +12 -16
- package/src/services/orders/encode.ts +2 -0
- package/src/services/sign.ts +10 -2
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';
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
import { BRIDGE_DEADLINE_IN_SECONDS } from '../../utils/consts';
|
|
16
16
|
import { MultiAction } from '../../utils/action';
|
|
17
17
|
import { encodeSingleWithdraw } from '../encode';
|
|
18
|
+
import { ethers } from 'ethers';
|
|
18
19
|
|
|
19
20
|
export const transferFromMAToPool = async (
|
|
20
21
|
params: TransferFromMAToPoolParams,
|
|
@@ -25,6 +26,8 @@ export const transferFromMAToPool = async (
|
|
|
25
26
|
const tokenInfo = getTokenInfoByAddress(params.pool.tokenAddress);
|
|
26
27
|
const amount = scale(tokenInfo.decimals)(params.amount);
|
|
27
28
|
|
|
29
|
+
const minShares = BigInt(0);
|
|
30
|
+
|
|
28
31
|
// transfer from MA to pool involves a core withdrawal
|
|
29
32
|
const multiAction = new MultiAction();
|
|
30
33
|
encodeSingleWithdraw(params.pool.tokenAddress, amount, multiAction);
|
|
@@ -36,6 +39,10 @@ export const transferFromMAToPool = async (
|
|
|
36
39
|
multiAction.commands,
|
|
37
40
|
params.owner.coreSigNonce + 1,
|
|
38
41
|
getCurrentTimestampInSeconds() + BRIDGE_DEADLINE_IN_SECONDS,
|
|
42
|
+
ethers.AbiCoder.defaultAbiCoder().encode(
|
|
43
|
+
['uint128', 'address', 'uint256'],
|
|
44
|
+
[params.pool.id, params.owner.address, minShares],
|
|
45
|
+
),
|
|
39
46
|
);
|
|
40
47
|
|
|
41
48
|
const { calldata: data, value } = encodeTransferFromMAToPool(
|
|
@@ -43,7 +50,7 @@ export const transferFromMAToPool = async (
|
|
|
43
50
|
amount,
|
|
44
51
|
eip712Signature,
|
|
45
52
|
params.pool.id,
|
|
46
|
-
|
|
53
|
+
minShares,
|
|
47
54
|
params.owner.address,
|
|
48
55
|
);
|
|
49
56
|
|
|
@@ -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(
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
} from '../encode';
|
|
9
9
|
|
|
10
10
|
import { abi } from '../../abis/CoreProxy.json';
|
|
11
|
-
import { abi as coreAbi } from '../../abis/CoreProxy.json';
|
|
12
11
|
import { abi as peripheryAbi } from '../../abis/Periphery.json';
|
|
13
12
|
import { abi as Socket_VaultWithPayloadAbi } from '../../abis/socket/VaultWithPayload.json';
|
|
14
13
|
import { EIP712Signature, signCoreCommands } from '../sign';
|
|
@@ -83,18 +82,24 @@ export const encodeTransferMargin = async (
|
|
|
83
82
|
multiAction.commands,
|
|
84
83
|
coreSigNonce + 1,
|
|
85
84
|
getCurrentTimestampInSeconds() + CORE_DEADLINE_IN_SECONDS,
|
|
85
|
+
ethers.AbiCoder.defaultAbiCoder().encode([], []),
|
|
86
86
|
);
|
|
87
87
|
|
|
88
88
|
const value = BigInt(0);
|
|
89
|
-
const functionSignature = '
|
|
89
|
+
const functionSignature = 'transferFromMAToMA';
|
|
90
90
|
const parameters = [
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
91
|
+
{
|
|
92
|
+
accountId: fromMarginAccountId,
|
|
93
|
+
transfer: {
|
|
94
|
+
destAccountId: toMarginAccountId,
|
|
95
|
+
collateral: token,
|
|
96
|
+
collateralAmount: amount,
|
|
97
|
+
},
|
|
98
|
+
sig: eip712Signature,
|
|
99
|
+
},
|
|
95
100
|
];
|
|
96
101
|
|
|
97
|
-
const INTERFACE = new Interface(
|
|
102
|
+
const INTERFACE = new Interface(peripheryAbi);
|
|
98
103
|
const calldata = INTERFACE.encodeFunctionData(functionSignature, parameters);
|
|
99
104
|
return {
|
|
100
105
|
calldata: calldata,
|
|
@@ -108,8 +113,7 @@ export const encodeWithdrawMAAndBridge = (
|
|
|
108
113
|
corePeripheryTokenAmount: bigint,
|
|
109
114
|
sig: EIP712Signature,
|
|
110
115
|
socketMsgGasLimit: bigint,
|
|
111
|
-
|
|
112
|
-
socketConnector: string,
|
|
116
|
+
chainId: number,
|
|
113
117
|
receiver: string,
|
|
114
118
|
): MethodParameters => {
|
|
115
119
|
const functionSignature = 'withdrawMA';
|
|
@@ -120,8 +124,7 @@ export const encodeWithdrawMAAndBridge = (
|
|
|
120
124
|
tokenAmount: corePeripheryTokenAmount,
|
|
121
125
|
sig,
|
|
122
126
|
socketMsgGasLimit,
|
|
123
|
-
|
|
124
|
-
socketConnector,
|
|
127
|
+
chainId,
|
|
125
128
|
receiver,
|
|
126
129
|
},
|
|
127
130
|
];
|
|
@@ -140,24 +143,15 @@ export const encodeBridgeAndDepositNewMA = (
|
|
|
140
143
|
peripheryTokenAddress: string,
|
|
141
144
|
peripheryTokenAmount: bigint,
|
|
142
145
|
moneyInOutTokenAmount: bigint,
|
|
143
|
-
fallbackSocketMsgGasLimit: bigint,
|
|
144
|
-
fallbackSocketConnector: string,
|
|
145
|
-
fallbackSocketPayloadSize: bigint,
|
|
146
146
|
): MethodParameters => {
|
|
147
147
|
const PERIPHERY_INTERFACE = new Interface(peripheryAbi);
|
|
148
148
|
const inputs = {
|
|
149
149
|
accountOwner,
|
|
150
150
|
token: peripheryTokenAddress,
|
|
151
|
-
tokenAmount: peripheryTokenAmount,
|
|
152
|
-
};
|
|
153
|
-
const fallbackData = {
|
|
154
|
-
socketMsgGasLimit: fallbackSocketMsgGasLimit,
|
|
155
|
-
socketConnector: fallbackSocketConnector,
|
|
156
|
-
socketPayloadSize: fallbackSocketPayloadSize,
|
|
157
151
|
};
|
|
158
152
|
const peripheryCalldata = PERIPHERY_INTERFACE.encodeFunctionData(
|
|
159
|
-
'depositNewMA((address,address
|
|
160
|
-
[inputs
|
|
153
|
+
'depositNewMA((address,address))',
|
|
154
|
+
[inputs],
|
|
161
155
|
);
|
|
162
156
|
|
|
163
157
|
const functionSignature = 'bridge';
|
|
@@ -184,24 +178,15 @@ export const encodeBridgeAndDepositExistingMA = (
|
|
|
184
178
|
peripheryTokenAddress: string,
|
|
185
179
|
peripheryTokenAmount: bigint,
|
|
186
180
|
moneyInOutTokenAmount: bigint,
|
|
187
|
-
fallbackSocketMsgGasLimit: bigint,
|
|
188
|
-
fallbackSocketConnector: string,
|
|
189
|
-
fallbackSocketPayloadSize: bigint,
|
|
190
181
|
): MethodParameters => {
|
|
191
182
|
const PERIPHERY_INTERFACE = new Interface(peripheryAbi);
|
|
192
183
|
const inputs = {
|
|
193
184
|
accountId,
|
|
194
185
|
token: peripheryTokenAddress,
|
|
195
|
-
tokenAmount: peripheryTokenAmount,
|
|
196
|
-
};
|
|
197
|
-
const fallbackData = {
|
|
198
|
-
socketMsgGasLimit: fallbackSocketMsgGasLimit,
|
|
199
|
-
socketConnector: fallbackSocketConnector,
|
|
200
|
-
socketPayloadSize: fallbackSocketPayloadSize,
|
|
201
186
|
};
|
|
202
187
|
const peripheryCalldata = PERIPHERY_INTERFACE.encodeFunctionData(
|
|
203
|
-
'depositExistingMA((uint128,address
|
|
204
|
-
[inputs
|
|
188
|
+
'depositExistingMA((uint128,address))',
|
|
189
|
+
[inputs],
|
|
205
190
|
);
|
|
206
191
|
|
|
207
192
|
const functionSignature = 'bridge';
|