@affluent-org/sdk 0.0.4 → 0.0.6
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/dist/affluent.d.ts +3 -3
- package/dist/affluent.js +3 -3
- package/dist/common/computation.d.ts +6 -0
- package/dist/common/computation.js +54 -0
- package/dist/common/helper.d.ts +5 -0
- package/dist/common/helper.js +29 -0
- package/dist/common/service.d.ts +10 -2
- package/dist/common/service.js +56 -3
- package/dist/common/trace-action.d.ts +92 -0
- package/dist/common/trace-action.js +187 -0
- package/dist/common/transform.d.ts +87 -0
- package/dist/common/transform.js +264 -0
- package/dist/common/types.d.ts +140 -0
- package/dist/common/types.js +11 -0
- package/dist/context.d.ts +3 -0
- package/dist/context.js +9 -0
- package/dist/contracts/oracle/redstone-onchain-oracle/index.js +2 -0
- package/dist/contracts/oracle/redstone-onchain-oracle/type.d.ts +1 -1
- package/dist/contracts/vault/strategy-vault/index.d.ts +2 -1
- package/dist/contracts/vault/strategy-vault/index.js +1 -0
- package/dist/factorial.d.ts +18 -8
- package/dist/factorial.js +26 -14
- package/dist/index.d.ts +4 -2
- package/dist/index.js +18 -2
- package/dist/lib/send-msg.d.ts +16 -2
- package/dist/lib/send-msg.js +23 -2
- package/dist/monitor.js +2 -0
- package/dist/monitorCacheV1.js +3 -2
- package/dist/oracle/oracle.d.ts +3 -2
- package/dist/oracle/oracle.js +25 -2
- package/dist/pool.d.ts +41 -0
- package/dist/pool.js +146 -178
- package/dist/poolCacheV1.js +1 -0
- package/dist/rfq-auction.d.ts +2 -2
- package/dist/rfq-auction.js +6 -6
- package/dist/rfq-batch.d.ts +21 -11
- package/dist/rfq-batch.js +81 -9
- package/dist/services/composite-oracle/codec.d.ts +76 -0
- package/dist/services/composite-oracle/codec.js +281 -0
- package/dist/services/composite-oracle/computation.d.ts +8 -19
- package/dist/services/composite-oracle/computation.js +119 -76
- package/dist/services/composite-oracle/index.d.ts +2 -2
- package/dist/services/composite-oracle/index.js +5 -6
- package/dist/services/composite-oracle/query.d.ts +6 -6
- package/dist/services/composite-oracle/query.js +6 -47
- package/dist/services/pool/computation.d.ts +3 -9
- package/dist/services/pool/computation.js +12 -78
- package/dist/services/pool/index.d.ts +10 -59
- package/dist/services/pool/index.js +55 -8
- package/dist/services/pool/oracle.d.ts +2 -2
- package/dist/services/pool/query.d.ts +1 -1
- package/dist/services/pool/query.js +1 -1
- package/dist/services/pool/user/trace.d.ts +90 -0
- package/dist/services/pool/user/trace.js +168 -0
- package/dist/services/rfq-auction/index.d.ts +7 -23
- package/dist/services/rfq-auction/index.js +45 -6
- package/dist/services/rfq-auction/oracle.d.ts +2 -2
- package/dist/services/rfq-auction/user/index.js +1 -1
- package/dist/services/rfq-auction/user/trace.d.ts +53 -0
- package/dist/services/rfq-auction/user/trace.js +68 -0
- package/dist/services/rfq-batch/index.d.ts +16 -13
- package/dist/services/rfq-batch/index.js +34 -10
- package/dist/services/rfq-batch/oracle.d.ts +2 -2
- package/dist/services/rfq-batch/user/trace.d.ts +49 -0
- package/dist/services/rfq-batch/user/trace.js +67 -0
- package/dist/services/share-vault/index.d.ts +14 -88
- package/dist/services/share-vault/index.js +37 -10
- package/dist/services/share-vault/query.d.ts +5 -32
- package/dist/services/share-vault/query.js +25 -12
- package/dist/services/share-vault/user/trace.d.ts +54 -0
- package/dist/services/share-vault/user/trace.js +84 -0
- package/dist/services/strategy-vault/index.d.ts +77 -2115
- package/dist/services/strategy-vault/index.js +119 -54
- package/dist/services/strategy-vault/oracle.d.ts +3 -3
- package/dist/services/strategy-vault/oracle.js +1 -0
- package/dist/services/strategy-vault/owner/index.d.ts +2 -2
- package/dist/services/strategy-vault/owner/index.js +1 -1
- package/dist/services/strategy-vault/owner/types.d.ts +4 -0
- package/dist/services/strategy-vault/query.d.ts +14 -143
- package/dist/services/strategy-vault/query.js +28 -40
- package/dist/services/strategy-vault/user/trace.d.ts +156 -0
- package/dist/services/strategy-vault/user/trace.js +264 -0
- package/dist/share-vault.d.ts +164 -8
- package/dist/share-vault.js +222 -67
- package/dist/strategy_vault/base.d.ts +521 -105
- package/dist/strategy_vault/base.js +493 -41
- package/dist/strategy_vault/steps.d.ts +120 -3
- package/dist/strategy_vault/steps.js +161 -0
- package/dist/types/sender.d.ts +1 -0
- package/dist/utils/_parse_temp/StrategyVault.d.ts +9 -9
- package/dist/utils/_parse_temp/StrategyVault.js +48 -40
- package/dist/utils/_parse_temp/parseMsgBody.d.ts +2 -2
- package/dist/utils/_parse_temp/parseMsgBody.js +84 -84
- package/dist/utils/external-message-hash.d.ts +7 -3
- package/dist/utils/external-message-hash.js +20 -7
- package/dist/utils/oracle/redstone/helper.js +2 -0
- package/dist/utils/oracle/redstone/redstoneHelper.d.ts +7 -0
- package/dist/utils/oracle/redstone/redstoneHelper.js +103 -1
- package/dist/utils/pending-tracker/trackable-sender.d.ts +37 -4
- package/dist/utils/pending-tracker/trackable-sender.js +47 -8
- package/dist/utils/pending-tracker/v3-client.d.ts +16 -0
- package/dist/utils/pending-tracker/v3-client.js +80 -2
- package/dist/utils/risk_calculator/risk_calculator.d.ts +3 -3
- package/dist/utils/toncenter/index.d.ts +1 -0
- package/dist/utils/toncenter/index.js +17 -0
- package/dist/utils/toncenter/transform.d.ts +11 -0
- package/dist/utils/toncenter/transform.js +40 -0
- package/dist/utils/toncenter/type.d.ts +227 -0
- package/dist/utils/toncenter/type.js +2 -0
- package/package.json +3 -3
|
@@ -14,7 +14,8 @@ function strategyVaultConfigToCell(config) {
|
|
|
14
14
|
.storeCoins(config.collectedManagementFee) // 6: collected_management_fee
|
|
15
15
|
.storeCoins(config.collectedProtocolFee) // 7: collected_protocol_fee
|
|
16
16
|
.storeBit(config.isExecutingStrategy) // 8: is_executing_strategy
|
|
17
|
-
.storeRef(
|
|
17
|
+
.storeRef(
|
|
18
|
+
// 9: config_cell
|
|
18
19
|
(0, core_1.beginCell)()
|
|
19
20
|
.storeAddress(config.config.protocolFeeManagerAddress) // 11: protocol_fee_manager_address
|
|
20
21
|
.storeAddress(config.config.managerAddress) // 12: manager_address
|
|
@@ -40,7 +41,8 @@ function strategyVaultConfigToCell(config) {
|
|
|
40
41
|
.storeMaybeRef(null) // 31: pending_owner_action
|
|
41
42
|
.endCell())
|
|
42
43
|
.endCell())
|
|
43
|
-
.storeRef(
|
|
44
|
+
.storeRef(
|
|
45
|
+
// 10: code_cell
|
|
44
46
|
(0, core_1.beginCell)()
|
|
45
47
|
.storeRef(config.code.walletCode) // 32: wallet_code
|
|
46
48
|
.storeRef(config.code.poolAggregatorCode) // 33: data_aggregator_code
|
|
@@ -70,12 +72,12 @@ class StrategyVault {
|
|
|
70
72
|
SetWhitelistedMinters: 0x7ebd9169,
|
|
71
73
|
SetManagementFeeRatePerYear: 0x3b11dcb0,
|
|
72
74
|
SetMaxLeverageRatio: 0x4a59e8d2,
|
|
73
|
-
|
|
75
|
+
SetRFQConfig: 0xf82a09b0,
|
|
74
76
|
SetGasConfig: 0x1fe929a8,
|
|
75
77
|
SetOracleConfig: 0xd93126de,
|
|
76
78
|
SetWalletCode: 0x6ffb2c4b,
|
|
77
79
|
SetDataAggregatorCode: 0x265fba0d,
|
|
78
|
-
|
|
80
|
+
SetRFQCode: 0x13ea2a91,
|
|
79
81
|
SetContent: 0xfadc0412,
|
|
80
82
|
UpgradeCode: 0x61bddf8b,
|
|
81
83
|
SetGuardianAddress: 0xc2aefefb,
|
|
@@ -98,10 +100,10 @@ class StrategyVault {
|
|
|
98
100
|
LiquidateToFactorial: 0xfe4f47ab,
|
|
99
101
|
Deposit: 0xf9471134,
|
|
100
102
|
Withdraw: 0xcb03bfaf,
|
|
101
|
-
|
|
103
|
+
CreateRFQ: 0xc54dd764,
|
|
102
104
|
ExecuteStrategy: 0x66e7f212,
|
|
103
105
|
TakeAggregatedData: 0x77c65602,
|
|
104
|
-
|
|
106
|
+
CancelRFQ: 0x5f6f17e0,
|
|
105
107
|
Excesses: 0xd53276db,
|
|
106
108
|
};
|
|
107
109
|
static Error = {
|
|
@@ -131,7 +133,7 @@ class StrategyVault {
|
|
|
131
133
|
NotEnoughGas: 1999,
|
|
132
134
|
InvalidOp: 2000,
|
|
133
135
|
ExceededExposureCap: 2001,
|
|
134
|
-
|
|
136
|
+
InvalidRFQPeriod: 2009,
|
|
135
137
|
InvalidConfig: 2010,
|
|
136
138
|
InvalidPendingOwnerActionIndex: 2011,
|
|
137
139
|
NotYetExecutable: 2012,
|
|
@@ -143,7 +145,7 @@ class StrategyVault {
|
|
|
143
145
|
IncreaseBalance: 2,
|
|
144
146
|
FactorialTransferIn: 3,
|
|
145
147
|
FactorialTransferOut: 4,
|
|
146
|
-
|
|
148
|
+
CreateRFQ: 5,
|
|
147
149
|
FactorialLiquidate: 6,
|
|
148
150
|
RFQInitialize: 7,
|
|
149
151
|
RFQNotification: 8,
|
|
@@ -287,7 +289,7 @@ class StrategyVault {
|
|
|
287
289
|
body: (0, core_1.beginCell)()
|
|
288
290
|
.storeUint(StrategyVault.Op.ExecuteStrategy, 32)
|
|
289
291
|
.storeUint(opts.queryID ?? 0, 64)
|
|
290
|
-
.storeUint(StrategyVault.Op.
|
|
292
|
+
.storeUint(StrategyVault.Op.CreateRFQ, 32)
|
|
291
293
|
.storeMaybeRef(opts.oracleParams)
|
|
292
294
|
.storeCoins(opts.rfqIndex)
|
|
293
295
|
.storeAddress(opts.sellAsset)
|
|
@@ -313,7 +315,7 @@ class StrategyVault {
|
|
|
313
315
|
body: (0, core_1.beginCell)()
|
|
314
316
|
.storeUint(StrategyVault.Op.ExecuteStrategy, 32)
|
|
315
317
|
.storeUint(opts.queryID ?? 0, 64)
|
|
316
|
-
.storeUint(StrategyVault.Op.
|
|
318
|
+
.storeUint(StrategyVault.Op.CancelRFQ, 32)
|
|
317
319
|
.storeCoins(opts.rfqIndex)
|
|
318
320
|
.endCell(),
|
|
319
321
|
});
|
|
@@ -372,13 +374,16 @@ class StrategyVault {
|
|
|
372
374
|
return await provider.getState();
|
|
373
375
|
}
|
|
374
376
|
async getWalletAddress(provider, address) {
|
|
375
|
-
const params1 = {
|
|
376
|
-
|
|
377
|
+
const params1 = {
|
|
378
|
+
type: "slice",
|
|
379
|
+
cell: (0, core_1.beginCell)().storeAddress(address).endCell(),
|
|
380
|
+
};
|
|
381
|
+
const result = await provider.get("get_wallet_address", [params1]);
|
|
377
382
|
return result.stack.readAddress();
|
|
378
383
|
}
|
|
379
|
-
async
|
|
384
|
+
async getRFQAddress(provider, index) {
|
|
380
385
|
const params1 = { type: "int", value: index };
|
|
381
|
-
const result = await provider.get(
|
|
386
|
+
const result = await provider.get("get_rfq_address", [params1]);
|
|
382
387
|
return result.stack.readAddress();
|
|
383
388
|
}
|
|
384
389
|
static createFactorialPoolConfig(params) {
|
|
@@ -392,7 +397,7 @@ class StrategyVault {
|
|
|
392
397
|
borrow: 0n,
|
|
393
398
|
isSupplyable: isSupplyable,
|
|
394
399
|
isBorrowable: isBorrowable,
|
|
395
|
-
}
|
|
400
|
+
},
|
|
396
401
|
});
|
|
397
402
|
}
|
|
398
403
|
return poolDictionary;
|
|
@@ -406,7 +411,7 @@ class StrategyVault {
|
|
|
406
411
|
[assetAddress.toString()]: {
|
|
407
412
|
isSupplyable: isSupplyable,
|
|
408
413
|
isBorrowable: isBorrowable,
|
|
409
|
-
}
|
|
414
|
+
},
|
|
410
415
|
});
|
|
411
416
|
}
|
|
412
417
|
return poolDictionary;
|
|
@@ -414,7 +419,7 @@ class StrategyVault {
|
|
|
414
419
|
static createAssetConfig(params) {
|
|
415
420
|
const assetDictionary = core_1.Dictionary.empty(core_1.Dictionary.Keys.Address(), StrategyVault.Dictionary.Values.Asset());
|
|
416
421
|
for (let param of params) {
|
|
417
|
-
const [assetAddress, isWhitelisted, isDepositable, isWithdrawable, exposureCap] = param;
|
|
422
|
+
const [assetAddress, isWhitelisted, isDepositable, isWithdrawable, exposureCap,] = param;
|
|
418
423
|
assetDictionary.set(assetAddress, {
|
|
419
424
|
isWhitelisted: isWhitelisted,
|
|
420
425
|
isDepositable: isDepositable,
|
|
@@ -485,10 +490,12 @@ class StrategyVault {
|
|
|
485
490
|
}
|
|
486
491
|
const configCs2 = configCs.loadRef().beginParse();
|
|
487
492
|
const _rfqConfig = configCs2.loadMaybeRef()?.beginParse();
|
|
488
|
-
const rfqConfig = _rfqConfig
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
493
|
+
const rfqConfig = _rfqConfig
|
|
494
|
+
? {
|
|
495
|
+
priceDeviationTolerance: _rfqConfig.loadUint(14),
|
|
496
|
+
eventEmitter: _rfqConfig.loadMaybeAddress(),
|
|
497
|
+
}
|
|
498
|
+
: null;
|
|
492
499
|
const gasConfig = configCs2.loadMaybeRef();
|
|
493
500
|
const oracleConfig = configCs2.loadMaybeRef();
|
|
494
501
|
const managementFeeRecipientAddress = configCs2.loadMaybeAddress();
|
|
@@ -499,7 +506,9 @@ class StrategyVault {
|
|
|
499
506
|
const _pendingOwnerAction = configCs2.loadMaybeRef();
|
|
500
507
|
const pendingOwnerAction = {};
|
|
501
508
|
if (_pendingOwnerAction) {
|
|
502
|
-
const pendingOwnerActionData = _pendingOwnerAction
|
|
509
|
+
const pendingOwnerActionData = _pendingOwnerAction
|
|
510
|
+
.beginParse()
|
|
511
|
+
.loadDictDirect(core_1.Dictionary.Keys.Uint(128), StrategyVault.Dictionary.Values.PendingOwnerAction());
|
|
503
512
|
for (const key of pendingOwnerActionData.keys()) {
|
|
504
513
|
const ownerAction = pendingOwnerActionData.get(key);
|
|
505
514
|
if (ownerAction) {
|
|
@@ -559,7 +568,7 @@ class StrategyVault {
|
|
|
559
568
|
},
|
|
560
569
|
getAsset: (assetAddress) => {
|
|
561
570
|
return assets[assetAddress.toString()];
|
|
562
|
-
}
|
|
571
|
+
},
|
|
563
572
|
};
|
|
564
573
|
}
|
|
565
574
|
static Dictionary = {
|
|
@@ -648,9 +657,7 @@ class StrategyVault {
|
|
|
648
657
|
}),
|
|
649
658
|
UpdateFactorialPoolAsset: () => ({
|
|
650
659
|
serialize: (src, builder) => {
|
|
651
|
-
return builder
|
|
652
|
-
.storeBit(src.isSupplyable)
|
|
653
|
-
.storeBit(src.isBorrowable);
|
|
660
|
+
return builder.storeBit(src.isSupplyable).storeBit(src.isBorrowable);
|
|
654
661
|
},
|
|
655
662
|
parse: (src) => {
|
|
656
663
|
const isSupplyable = src.loadBoolean();
|
|
@@ -682,7 +689,7 @@ class StrategyVault {
|
|
|
682
689
|
};
|
|
683
690
|
},
|
|
684
691
|
}),
|
|
685
|
-
}
|
|
692
|
+
},
|
|
686
693
|
};
|
|
687
694
|
async sendSetOwnerAddress(provider, via, value, opts) {
|
|
688
695
|
await provider.internal(via, {
|
|
@@ -727,7 +734,7 @@ class StrategyVault {
|
|
|
727
734
|
body: (0, core_1.beginCell)()
|
|
728
735
|
.storeUint(StrategyVault.Op.QueueOwnerAction, 32)
|
|
729
736
|
.storeUint(opts.queryID ?? 0, 64)
|
|
730
|
-
.storeUint(StrategyVault.Op.
|
|
737
|
+
.storeUint(StrategyVault.Op.SetRFQConfig, 32)
|
|
731
738
|
.storeMaybeRef(opts.rfqConfig)
|
|
732
739
|
.endCell(),
|
|
733
740
|
});
|
|
@@ -775,7 +782,7 @@ class StrategyVault {
|
|
|
775
782
|
body: (0, core_1.beginCell)()
|
|
776
783
|
.storeUint(StrategyVault.Op.QueueOwnerAction, 32)
|
|
777
784
|
.storeUint(opts.queryID ?? 0, 64)
|
|
778
|
-
.storeUint(StrategyVault.Op.
|
|
785
|
+
.storeUint(StrategyVault.Op.SetRFQCode, 32)
|
|
779
786
|
.storeRef(opts.rfqCode)
|
|
780
787
|
.endCell(),
|
|
781
788
|
});
|
|
@@ -939,7 +946,8 @@ class StrategyVault {
|
|
|
939
946
|
.storeUint(StrategyVault.Op.Deposit, 32)
|
|
940
947
|
.storeMaybeRef(oracleParams)
|
|
941
948
|
.storeCoins(forwardTonAmount ?? 0n)
|
|
942
|
-
.storeMaybeRef(forwardPayload)
|
|
949
|
+
.storeMaybeRef(forwardPayload)
|
|
950
|
+
.endCell();
|
|
943
951
|
}
|
|
944
952
|
static createWithdrawPayload(assetAddress, oracleParams, forwardTonAmount, forwardPayload) {
|
|
945
953
|
return (0, core_1.beginCell)()
|
|
@@ -981,13 +989,13 @@ class StrategyVault {
|
|
|
981
989
|
static getOpName(opCode) {
|
|
982
990
|
const opEntries = Object.entries(StrategyVault.Op);
|
|
983
991
|
const opMap = Object.fromEntries(opEntries);
|
|
984
|
-
const opName = Object.keys(opMap).find(key => opMap[key] === opCode);
|
|
992
|
+
const opName = Object.keys(opMap).find((key) => opMap[key] === opCode);
|
|
985
993
|
return opName || `UnknownOp(${opCode.toString(16)})`;
|
|
986
994
|
}
|
|
987
995
|
static getErrorName(errorCode) {
|
|
988
996
|
const errorEntries = Object.entries(StrategyVault.Error);
|
|
989
997
|
const errorMap = Object.fromEntries(errorEntries);
|
|
990
|
-
const errorName = Object.keys(errorMap).find(key => errorMap[key] === errorCode);
|
|
998
|
+
const errorName = Object.keys(errorMap).find((key) => errorMap[key] === errorCode);
|
|
991
999
|
return errorName || `UnknownError(${errorCode})`;
|
|
992
1000
|
}
|
|
993
1001
|
static getGasKeyName(gasKey) {
|
|
@@ -1009,12 +1017,12 @@ class StrategyVault {
|
|
|
1009
1017
|
"SetWhitelistedMinters",
|
|
1010
1018
|
"SetManagementFeeRatePerYear",
|
|
1011
1019
|
"SetMaxLeverageRatio",
|
|
1012
|
-
"
|
|
1020
|
+
"SetRFQConfig",
|
|
1013
1021
|
"SetGasConfig",
|
|
1014
1022
|
"SetOracleConfig",
|
|
1015
1023
|
"SetWalletCode",
|
|
1016
1024
|
"SetDataAggregatorCode",
|
|
1017
|
-
"
|
|
1025
|
+
"SetRFQCode",
|
|
1018
1026
|
"SetContent",
|
|
1019
1027
|
"UpgradeCode",
|
|
1020
1028
|
"SetGuardianAddress",
|
|
@@ -1033,8 +1041,8 @@ class StrategyVault {
|
|
|
1033
1041
|
"BorrowFromFactorial",
|
|
1034
1042
|
"RepayToFactorial",
|
|
1035
1043
|
"LiquidateToFactorial",
|
|
1036
|
-
"
|
|
1037
|
-
"
|
|
1044
|
+
"CreateRFQ",
|
|
1045
|
+
"CancelRFQ",
|
|
1038
1046
|
"TakeAggregatedData",
|
|
1039
1047
|
"Excesses",
|
|
1040
1048
|
];
|
|
@@ -1123,7 +1131,7 @@ class StrategyVault {
|
|
|
1123
1131
|
return (0, core_1.beginCell)()
|
|
1124
1132
|
.storeUint(StrategyVault.Op.ExecuteStrategy, 32)
|
|
1125
1133
|
.storeUint(queryID ?? 0, 64)
|
|
1126
|
-
.storeUint(StrategyVault.Op.
|
|
1134
|
+
.storeUint(StrategyVault.Op.CreateRFQ, 32)
|
|
1127
1135
|
.storeCoins(rfqIndex)
|
|
1128
1136
|
.storeAddress(sellAsset)
|
|
1129
1137
|
.storeAddress(buyAsset)
|
|
@@ -1143,7 +1151,7 @@ class StrategyVault {
|
|
|
1143
1151
|
return (0, core_1.beginCell)()
|
|
1144
1152
|
.storeUint(StrategyVault.Op.ExecuteStrategy, 32)
|
|
1145
1153
|
.storeUint(queryID ?? 0, 64)
|
|
1146
|
-
.storeUint(StrategyVault.Op.
|
|
1154
|
+
.storeUint(StrategyVault.Op.CancelRFQ, 32)
|
|
1147
1155
|
.storeCoins(rfqIndex)
|
|
1148
1156
|
.endCell();
|
|
1149
1157
|
}
|
|
@@ -1209,7 +1217,7 @@ class StrategyVault {
|
|
|
1209
1217
|
return (0, core_1.beginCell)()
|
|
1210
1218
|
.storeUint(StrategyVault.Op.QueueOwnerAction, 32)
|
|
1211
1219
|
.storeUint(queryID ?? 0, 64)
|
|
1212
|
-
.storeUint(StrategyVault.Op.
|
|
1220
|
+
.storeUint(StrategyVault.Op.SetRFQConfig, 32)
|
|
1213
1221
|
.storeMaybeRef(rfqConfig)
|
|
1214
1222
|
.endCell();
|
|
1215
1223
|
}
|
|
@@ -1241,7 +1249,7 @@ class StrategyVault {
|
|
|
1241
1249
|
return (0, core_1.beginCell)()
|
|
1242
1250
|
.storeUint(StrategyVault.Op.QueueOwnerAction, 32)
|
|
1243
1251
|
.storeUint(queryID ?? 0, 64)
|
|
1244
|
-
.storeUint(StrategyVault.Op.
|
|
1252
|
+
.storeUint(StrategyVault.Op.SetRFQCode, 32)
|
|
1245
1253
|
.storeRef(rfqCode)
|
|
1246
1254
|
.endCell();
|
|
1247
1255
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Cell } from
|
|
1
|
+
import { Cell } from "@ton/core";
|
|
2
2
|
export interface ParsedMessage {
|
|
3
|
-
contractType:
|
|
3
|
+
contractType: "Pool" | "ShareVault" | "StrategyVault" | "Unknown";
|
|
4
4
|
opName: string;
|
|
5
5
|
opCode: number;
|
|
6
6
|
data: any;
|
|
@@ -4,7 +4,7 @@ exports.parseMsgBody = parseMsgBody;
|
|
|
4
4
|
exports.getSupportedOpcodes = getSupportedOpcodes;
|
|
5
5
|
const Pool_1 = require("./Pool");
|
|
6
6
|
const ShareVault_1 = require("./ShareVault");
|
|
7
|
-
const
|
|
7
|
+
const strategy_vault_1 = require("../../contracts/vault/strategy-vault");
|
|
8
8
|
function parseMsgBody(cell) {
|
|
9
9
|
try {
|
|
10
10
|
const slice = cell.beginParse();
|
|
@@ -23,7 +23,7 @@ function parseMsgBody(cell) {
|
|
|
23
23
|
return parseShareVaultMessage(cell, opCode, shareVaultOpName);
|
|
24
24
|
}
|
|
25
25
|
// Check StrategyVault opcodes
|
|
26
|
-
const strategyVaultOpName =
|
|
26
|
+
const strategyVaultOpName = strategy_vault_1.StrategyVault.getOpName(opCode);
|
|
27
27
|
if (strategyVaultOpName !== `UnknownOp(${opCode.toString(16)})`) {
|
|
28
28
|
return parseStrategyVaultMessage(cell, opCode, strategyVaultOpName);
|
|
29
29
|
}
|
|
@@ -107,10 +107,10 @@ function parsePoolMessage(cell, opCode, opName) {
|
|
|
107
107
|
return null;
|
|
108
108
|
}
|
|
109
109
|
return {
|
|
110
|
-
contractType:
|
|
110
|
+
contractType: "Pool",
|
|
111
111
|
opName,
|
|
112
112
|
opCode,
|
|
113
|
-
data
|
|
113
|
+
data,
|
|
114
114
|
};
|
|
115
115
|
}
|
|
116
116
|
catch (error) {
|
|
@@ -158,10 +158,10 @@ function parseShareVaultMessage(cell, opCode, opName) {
|
|
|
158
158
|
return null;
|
|
159
159
|
}
|
|
160
160
|
return {
|
|
161
|
-
contractType:
|
|
161
|
+
contractType: "ShareVault",
|
|
162
162
|
opName,
|
|
163
163
|
opCode,
|
|
164
|
-
data
|
|
164
|
+
data,
|
|
165
165
|
};
|
|
166
166
|
}
|
|
167
167
|
catch (error) {
|
|
@@ -172,122 +172,122 @@ function parseStrategyVaultMessage(cell, opCode, opName) {
|
|
|
172
172
|
let data;
|
|
173
173
|
try {
|
|
174
174
|
switch (opCode) {
|
|
175
|
-
case
|
|
176
|
-
data =
|
|
175
|
+
case strategy_vault_1.StrategyVault.Op.Initialize:
|
|
176
|
+
data = strategy_vault_1.StrategyVault.parseInitializeMsgBody(cell);
|
|
177
177
|
break;
|
|
178
|
-
case
|
|
179
|
-
data =
|
|
178
|
+
case strategy_vault_1.StrategyVault.Op.ExecuteStrategy:
|
|
179
|
+
data = strategy_vault_1.StrategyVault.parseExecuteStrategyMsgBody(cell);
|
|
180
180
|
break;
|
|
181
|
-
case
|
|
182
|
-
data =
|
|
181
|
+
case strategy_vault_1.StrategyVault.Op.SetAssetConfig:
|
|
182
|
+
data = strategy_vault_1.StrategyVault.parseSetAssetConfigMsgBody(cell);
|
|
183
183
|
break;
|
|
184
|
-
case
|
|
185
|
-
data =
|
|
184
|
+
case strategy_vault_1.StrategyVault.Op.SetFactorialPoolConfig:
|
|
185
|
+
data = strategy_vault_1.StrategyVault.parseSetFactorialPoolConfigMsgBody(cell);
|
|
186
186
|
break;
|
|
187
|
-
case
|
|
188
|
-
data =
|
|
187
|
+
case strategy_vault_1.StrategyVault.Op.ClaimManagementFee:
|
|
188
|
+
data = strategy_vault_1.StrategyVault.parseClaimManagementFeeMsgBody(cell);
|
|
189
189
|
break;
|
|
190
|
-
case
|
|
191
|
-
data =
|
|
190
|
+
case strategy_vault_1.StrategyVault.Op.ClaimProtocolFee:
|
|
191
|
+
data = strategy_vault_1.StrategyVault.parseClaimProtocolFeeMsgBody(cell);
|
|
192
192
|
break;
|
|
193
|
-
case
|
|
194
|
-
data =
|
|
193
|
+
case strategy_vault_1.StrategyVault.Op.SetOwnerAddress:
|
|
194
|
+
data = strategy_vault_1.StrategyVault.parseSetOwnerAddressMsgBody(cell);
|
|
195
195
|
break;
|
|
196
|
-
case
|
|
197
|
-
data =
|
|
196
|
+
case strategy_vault_1.StrategyVault.Op.SetManagementFeeRatePerYear:
|
|
197
|
+
data = strategy_vault_1.StrategyVault.parseSetManagementFeeRatePerYearMsgBody(cell);
|
|
198
198
|
break;
|
|
199
|
-
case
|
|
200
|
-
data =
|
|
199
|
+
case strategy_vault_1.StrategyVault.Op.SetMaxLeverageRatio:
|
|
200
|
+
data = strategy_vault_1.StrategyVault.parseSetMaxLeverageRatioMsgBody(cell);
|
|
201
201
|
break;
|
|
202
|
-
case
|
|
203
|
-
data =
|
|
202
|
+
case strategy_vault_1.StrategyVault.Op.SetRFQConfig:
|
|
203
|
+
data = strategy_vault_1.StrategyVault.parseSetRFQConfigMsgBody(cell);
|
|
204
204
|
break;
|
|
205
|
-
case
|
|
206
|
-
data =
|
|
205
|
+
case strategy_vault_1.StrategyVault.Op.SetOracleConfig:
|
|
206
|
+
data = strategy_vault_1.StrategyVault.parseSetOracleConfigMsgBody(cell);
|
|
207
207
|
break;
|
|
208
|
-
case
|
|
209
|
-
data =
|
|
208
|
+
case strategy_vault_1.StrategyVault.Op.SetWalletCode:
|
|
209
|
+
data = strategy_vault_1.StrategyVault.parseSetWalletCodeMsgBody(cell);
|
|
210
210
|
break;
|
|
211
|
-
case
|
|
212
|
-
data =
|
|
211
|
+
case strategy_vault_1.StrategyVault.Op.SetDataAggregatorCode:
|
|
212
|
+
data = strategy_vault_1.StrategyVault.parseSetDataAggregatorCodeMsgBody(cell);
|
|
213
213
|
break;
|
|
214
|
-
case
|
|
215
|
-
data =
|
|
214
|
+
case strategy_vault_1.StrategyVault.Op.SetRFQCode:
|
|
215
|
+
data = strategy_vault_1.StrategyVault.parseSetRFQCodeMsgBody(cell);
|
|
216
216
|
break;
|
|
217
|
-
case
|
|
218
|
-
data =
|
|
217
|
+
case strategy_vault_1.StrategyVault.Op.SetContent:
|
|
218
|
+
data = strategy_vault_1.StrategyVault.parseSetContentMsgBody(cell);
|
|
219
219
|
break;
|
|
220
|
-
case
|
|
221
|
-
data =
|
|
220
|
+
case strategy_vault_1.StrategyVault.Op.UpgradeCode:
|
|
221
|
+
data = strategy_vault_1.StrategyVault.parseUpgradeCodeMsgBody(cell);
|
|
222
222
|
break;
|
|
223
|
-
case
|
|
224
|
-
data =
|
|
223
|
+
case strategy_vault_1.StrategyVault.Op.SetManagerAddress:
|
|
224
|
+
data = strategy_vault_1.StrategyVault.parseSetManagerAddressMsgBody(cell);
|
|
225
225
|
break;
|
|
226
|
-
case
|
|
227
|
-
data =
|
|
226
|
+
case strategy_vault_1.StrategyVault.Op.SetPrivateVault:
|
|
227
|
+
data = strategy_vault_1.StrategyVault.parseSetPrivateVaultMsgBody(cell);
|
|
228
228
|
break;
|
|
229
|
-
case
|
|
230
|
-
data =
|
|
229
|
+
case strategy_vault_1.StrategyVault.Op.SetDepositCloseTimestamp:
|
|
230
|
+
data = strategy_vault_1.StrategyVault.parseSetDepositCloseTimestampMsgBody(cell);
|
|
231
231
|
break;
|
|
232
|
-
case
|
|
233
|
-
data =
|
|
232
|
+
case strategy_vault_1.StrategyVault.Op.SetWithdrawOpenTimestamp:
|
|
233
|
+
data = strategy_vault_1.StrategyVault.parseSetWithdrawOpenTimestampMsgBody(cell);
|
|
234
234
|
break;
|
|
235
|
-
case
|
|
236
|
-
data =
|
|
235
|
+
case strategy_vault_1.StrategyVault.Op.SetWhitelistedMinters:
|
|
236
|
+
data = strategy_vault_1.StrategyVault.parseSetWhitelistedMintersMsgBody(cell);
|
|
237
237
|
break;
|
|
238
|
-
case
|
|
239
|
-
data =
|
|
238
|
+
case strategy_vault_1.StrategyVault.Op.SetGasConfig:
|
|
239
|
+
data = strategy_vault_1.StrategyVault.parseSetGasConfigMsgBody(cell);
|
|
240
240
|
break;
|
|
241
|
-
case
|
|
242
|
-
data =
|
|
241
|
+
case strategy_vault_1.StrategyVault.Op.ExecuteOwnerAction:
|
|
242
|
+
data = strategy_vault_1.StrategyVault.parseExecuteOwnerActionMsgBody(cell);
|
|
243
243
|
break;
|
|
244
|
-
case
|
|
245
|
-
data =
|
|
244
|
+
case strategy_vault_1.StrategyVault.Op.RevertOwnerAction:
|
|
245
|
+
data = strategy_vault_1.StrategyVault.parseRevertOwnerActionMsgBody(cell);
|
|
246
246
|
break;
|
|
247
|
-
case
|
|
248
|
-
data =
|
|
247
|
+
case strategy_vault_1.StrategyVault.Op.SetGuardianAddress:
|
|
248
|
+
data = strategy_vault_1.StrategyVault.parseSetGuardianAddressMsgBody(cell);
|
|
249
249
|
break;
|
|
250
|
-
case
|
|
251
|
-
data =
|
|
250
|
+
case strategy_vault_1.StrategyVault.Op.SetTimelock:
|
|
251
|
+
data = strategy_vault_1.StrategyVault.parseSetTimelockMsgBody(cell);
|
|
252
252
|
break;
|
|
253
|
-
case
|
|
254
|
-
data =
|
|
253
|
+
case strategy_vault_1.StrategyVault.Op.SetManagementFeeRecipientAddress:
|
|
254
|
+
data = strategy_vault_1.StrategyVault.parseSetManagementFeeRecipientAddressMsgBody(cell);
|
|
255
255
|
break;
|
|
256
|
-
case
|
|
257
|
-
data =
|
|
256
|
+
case strategy_vault_1.StrategyVault.Op.SetProtocolFeeRatePerYear:
|
|
257
|
+
data = strategy_vault_1.StrategyVault.parseSetProtocolFeeRatePerYearMsgBody(cell);
|
|
258
258
|
break;
|
|
259
|
-
case
|
|
260
|
-
data =
|
|
259
|
+
case strategy_vault_1.StrategyVault.Op.SetProtocolFeeManagerAddress:
|
|
260
|
+
data = strategy_vault_1.StrategyVault.parseSetProtocolFeeManagerAddressMsgBody(cell);
|
|
261
261
|
break;
|
|
262
|
-
case
|
|
263
|
-
data =
|
|
262
|
+
case strategy_vault_1.StrategyVault.Op.DepositQueue:
|
|
263
|
+
data = strategy_vault_1.StrategyVault.parseUserQueueLog(cell);
|
|
264
264
|
break;
|
|
265
|
-
case
|
|
266
|
-
data =
|
|
265
|
+
case strategy_vault_1.StrategyVault.Op.CancelDepositQueue:
|
|
266
|
+
data = strategy_vault_1.StrategyVault.parseUserQueueLog(cell);
|
|
267
267
|
break;
|
|
268
|
-
case
|
|
269
|
-
data =
|
|
268
|
+
case strategy_vault_1.StrategyVault.Op.ExecuteDepositQueue:
|
|
269
|
+
data = strategy_vault_1.StrategyVault.parseQueueBatchExecuteLog(cell);
|
|
270
270
|
break;
|
|
271
|
-
case
|
|
272
|
-
data =
|
|
271
|
+
case strategy_vault_1.StrategyVault.Op.WithdrawQueue:
|
|
272
|
+
data = strategy_vault_1.StrategyVault.parseUserQueueLog(cell);
|
|
273
273
|
break;
|
|
274
|
-
case
|
|
275
|
-
data =
|
|
274
|
+
case strategy_vault_1.StrategyVault.Op.CancelWithdrawQueue:
|
|
275
|
+
data = strategy_vault_1.StrategyVault.parseUserQueueLog(cell);
|
|
276
276
|
break;
|
|
277
|
-
case
|
|
278
|
-
data =
|
|
277
|
+
case strategy_vault_1.StrategyVault.Op.ExecuteWithdrawQueue:
|
|
278
|
+
data = strategy_vault_1.StrategyVault.parseQueueBatchExecuteLog(cell);
|
|
279
279
|
break;
|
|
280
|
-
case
|
|
281
|
-
data =
|
|
280
|
+
case strategy_vault_1.StrategyVault.Op.ConfirmQueue:
|
|
281
|
+
data = strategy_vault_1.StrategyVault.parseConfirmQueueLog(cell);
|
|
282
282
|
break;
|
|
283
283
|
default:
|
|
284
284
|
return null;
|
|
285
285
|
}
|
|
286
286
|
return {
|
|
287
|
-
contractType:
|
|
287
|
+
contractType: "StrategyVault",
|
|
288
288
|
opName,
|
|
289
289
|
opCode,
|
|
290
|
-
data
|
|
290
|
+
data,
|
|
291
291
|
};
|
|
292
292
|
}
|
|
293
293
|
catch (error) {
|
|
@@ -299,15 +299,15 @@ function getSupportedOpcodes() {
|
|
|
299
299
|
const opcodes = [];
|
|
300
300
|
// Pool opcodes
|
|
301
301
|
Object.entries(Pool_1.Pool.Op).forEach(([name, code]) => {
|
|
302
|
-
opcodes.push({ contractType:
|
|
302
|
+
opcodes.push({ contractType: "Pool", opName: name, opCode: code });
|
|
303
303
|
});
|
|
304
304
|
// ShareVault opcodes
|
|
305
305
|
Object.entries(ShareVault_1.ShareVault.Op).forEach(([name, code]) => {
|
|
306
|
-
opcodes.push({ contractType:
|
|
306
|
+
opcodes.push({ contractType: "ShareVault", opName: name, opCode: code });
|
|
307
307
|
});
|
|
308
308
|
// StrategyVault opcodes
|
|
309
|
-
Object.entries(
|
|
310
|
-
opcodes.push({ contractType:
|
|
309
|
+
Object.entries(strategy_vault_1.StrategyVault.Op).forEach(([name, code]) => {
|
|
310
|
+
opcodes.push({ contractType: "StrategyVault", opName: name, opCode: code });
|
|
311
311
|
});
|
|
312
312
|
return opcodes;
|
|
313
313
|
}
|
|
@@ -39,7 +39,11 @@ import { Address, Cell } from "@ton/core";
|
|
|
39
39
|
* ```
|
|
40
40
|
*/
|
|
41
41
|
export declare function computeExternalMessageHash(walletAddress: Address, signedBody: Cell): {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
ext: MessageHash;
|
|
43
|
+
norm: MessageHash;
|
|
44
|
+
};
|
|
45
|
+
export type MessageHash = {
|
|
46
|
+
hash: Buffer<ArrayBufferLike>;
|
|
47
|
+
hex: string;
|
|
48
|
+
base64: string;
|
|
45
49
|
};
|
|
@@ -42,24 +42,37 @@ const core_1 = require("@ton/core");
|
|
|
42
42
|
* ```
|
|
43
43
|
*/
|
|
44
44
|
function computeExternalMessageHash(walletAddress, signedBody) {
|
|
45
|
+
const extHash = (0, core_1.beginCell)()
|
|
46
|
+
.store((0, core_1.storeMessage)((0, core_1.external)({
|
|
47
|
+
to: walletAddress,
|
|
48
|
+
init: null,
|
|
49
|
+
body: signedBody,
|
|
50
|
+
})))
|
|
51
|
+
.endCell()
|
|
52
|
+
.hash();
|
|
45
53
|
// TEP-467 normalized external-in message
|
|
46
54
|
const normalizedMessage = {
|
|
47
55
|
info: {
|
|
48
56
|
type: "external-in",
|
|
49
57
|
dest: walletAddress,
|
|
50
|
-
src: undefined,
|
|
51
58
|
importFee: 0n,
|
|
52
59
|
},
|
|
53
|
-
init: null,
|
|
54
60
|
body: signedBody,
|
|
55
61
|
};
|
|
56
|
-
const
|
|
57
|
-
.store((0, core_1.storeMessage)(normalizedMessage
|
|
62
|
+
const normHash = (0, core_1.beginCell)()
|
|
63
|
+
.store((0, core_1.storeMessage)(normalizedMessage))
|
|
58
64
|
.endCell()
|
|
59
65
|
.hash();
|
|
60
66
|
return {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
67
|
+
ext: {
|
|
68
|
+
hash: extHash,
|
|
69
|
+
hex: extHash.toString("hex"),
|
|
70
|
+
base64: extHash.toString("base64"),
|
|
71
|
+
},
|
|
72
|
+
norm: {
|
|
73
|
+
hash: normHash,
|
|
74
|
+
hex: normHash.toString("hex"),
|
|
75
|
+
base64: normHash.toString("base64"),
|
|
76
|
+
},
|
|
64
77
|
};
|
|
65
78
|
}
|
|
@@ -33,6 +33,8 @@ class RedstoneHelper {
|
|
|
33
33
|
/////////////////////////////////////////////
|
|
34
34
|
/////////////// CREATE PAYLOAD //////////////
|
|
35
35
|
async createPayload(assets) {
|
|
36
|
+
if (assets.length === 0)
|
|
37
|
+
return (0, core_1.beginCell)().storeUint(0, 2).endCell();
|
|
36
38
|
const paramsProvider = new sdk_1.ContractParamsProvider({
|
|
37
39
|
dataServiceId: this.dataServiceId,
|
|
38
40
|
uniqueSignersCount: this.uniqueSignersCount,
|
|
@@ -12,10 +12,17 @@ export declare function createRedstoneHelper(type: "demo" | "prod"): {
|
|
|
12
12
|
getDataFeedIdTuples: (assets: string[]) => import("@ton/core").Cell;
|
|
13
13
|
getPrices: (assets: string[]) => Promise<any>;
|
|
14
14
|
};
|
|
15
|
+
export declare function createRedstoneCustomHelper(baseUrl: string): {
|
|
16
|
+
createPayload: (assets: string[]) => Promise<import("@ton/core").Cell>;
|
|
17
|
+
getHexlifiedFeedIds: (assets: string[]) => string[];
|
|
18
|
+
getDataFeedIdTuples: (assets: string[]) => import("@ton/core").Cell;
|
|
19
|
+
getPrices: (assets: string[]) => Promise<any>;
|
|
20
|
+
};
|
|
15
21
|
declare const _default: {
|
|
16
22
|
getDataFeedIdTuples: typeof getDataFeedIdTuples;
|
|
17
23
|
getHexlifiedFeedIds: typeof getHexlifiedFeedIds;
|
|
18
24
|
createPayload: typeof createPayload;
|
|
19
25
|
createRedstoneHelper: typeof createRedstoneHelper;
|
|
26
|
+
createRedstoneCustomHelper: typeof createRedstoneCustomHelper;
|
|
20
27
|
};
|
|
21
28
|
export default _default;
|