@affluent-org/sdk 0.0.2 → 0.0.3
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/build/Account.compiled.json +1 -0
- package/dist/build/Receipt.compiled.json +1 -0
- package/dist/build/WTONWallet.compiled.json +1 -0
- package/dist/common/cache.d.ts +16 -0
- package/dist/common/cache.js +96 -0
- package/dist/common/service.d.ts +20 -0
- package/dist/common/service.js +69 -0
- package/dist/common/type.d.ts +14 -0
- package/dist/common/type.js +2 -0
- package/dist/common/unknown-contract.d.ts +14 -0
- package/dist/common/unknown-contract.js +18 -0
- package/dist/common/versions.d.ts +14 -0
- package/dist/common/versions.js +22 -0
- package/dist/constants/pool.d.ts +1 -0
- package/dist/constants/pool.js +2 -0
- package/dist/contracts/_mock/simple-oracle.d.ts +34 -0
- package/dist/contracts/_mock/simple-oracle.js +73 -0
- package/dist/contracts/vault/share-vault/type.d.ts +30 -0
- package/dist/contracts/vault/share-vault/type.js +2 -0
- package/dist/contracts/vault/strategy-vault/utils.d.ts +6 -0
- package/dist/contracts/vault/strategy-vault/utils.js +32 -0
- package/dist/factorial.d.ts +14 -0
- package/dist/factorial.js +20 -0
- package/dist/farm.d.ts +92 -0
- package/dist/farm.js +209 -0
- package/dist/monitor.d.ts +57 -0
- package/dist/monitor.js +527 -0
- package/dist/monitorCacheV1.d.ts +52 -0
- package/dist/monitorCacheV1.js +504 -0
- package/dist/oracle/oracle-v2.d.ts +39 -0
- package/dist/oracle/oracle-v2.js +151 -0
- package/dist/oracle/oracle.d.ts +107 -0
- package/dist/oracle/oracle.js +392 -0
- package/dist/periphery.d.ts +259 -0
- package/dist/periphery.js +1087 -0
- package/dist/pool.d.ts +216 -0
- package/dist/pool.js +2298 -0
- package/dist/poolCacheV1.d.ts +139 -0
- package/dist/poolCacheV1.js +1841 -0
- package/dist/rfq-auction.d.ts +75 -0
- package/dist/rfq-auction.js +220 -0
- package/dist/rfq-batch.d.ts +112 -0
- package/dist/rfq-batch.js +284 -0
- package/dist/services/share-vault/computation.d.ts +14 -17
- package/dist/services/share-vault/computation.js +39 -0
- package/dist/services/share-vault/index.js +6 -3
- package/dist/services/share-vault/query.d.ts +38 -8
- package/dist/services/share-vault/query.js +20 -27
- package/dist/services/share-vault/type.d.ts +19 -0
- package/dist/services/share-vault/type.js +2 -0
- package/dist/services/share-vault/user/index.js +3 -1
- package/dist/services/strategy-vault/computation.d.ts +1 -0
- package/dist/services/strategy-vault/computation.js +15 -0
- package/dist/services/strategy-vault/query.d.ts +147 -0
- package/dist/services/strategy-vault/query.js +67 -0
- package/dist/services/strategy-vault/type.d.ts +2 -0
- package/dist/services/strategy-vault/type.js +2 -0
- package/dist/share-vault.d.ts +91 -0
- package/dist/share-vault.js +747 -0
- package/dist/stonfi.d.ts +18 -0
- package/dist/stonfi.js +76 -0
- package/dist/strategy_vault/base.d.ts +399 -0
- package/dist/strategy_vault/base.js +1199 -0
- package/dist/strategy_vault/index.d.ts +3 -0
- package/dist/strategy_vault/index.js +7 -0
- package/dist/strategy_vault/steps.d.ts +49 -0
- package/dist/strategy_vault/steps.js +170 -0
- package/dist/types/action.d.ts +55 -0
- package/dist/types/action.js +2 -0
- package/dist/types/messages.d.ts +7 -0
- package/dist/types/messages.js +2 -0
- package/dist/types/params.d.ts +19 -0
- package/dist/types/params.js +2 -0
- package/dist/types/pool.d.ts +83 -0
- package/dist/types/pool.js +2 -0
- package/dist/types/transaction.d.ts +40 -0
- package/dist/types/transaction.js +2 -0
- package/dist/utils/_parse_temp/JumpIRM.d.ts +37 -0
- package/dist/utils/_parse_temp/JumpIRM.js +71 -0
- package/dist/utils/_parse_temp/Pool.d.ts +559 -0
- package/dist/utils/_parse_temp/Pool.js +1023 -0
- package/dist/utils/_parse_temp/ShareVault.d.ts +264 -0
- package/dist/utils/_parse_temp/ShareVault.js +479 -0
- package/dist/utils/_parse_temp/StrategyVault.d.ts +729 -0
- package/dist/utils/_parse_temp/StrategyVault.js +1865 -0
- package/dist/utils/_parse_temp/parseMsgBody.d.ts +13 -0
- package/dist/utils/_parse_temp/parseMsgBody.js +313 -0
- package/dist/utils/assert.d.ts +1 -0
- package/dist/utils/assert.js +9 -0
- package/dist/utils/client-for-parameter.d.ts +12 -0
- package/dist/utils/client-for-parameter.js +97 -0
- package/dist/utils/oracle/index.d.ts +4 -0
- package/dist/utils/oracle/index.js +19 -0
- package/dist/utils/oracle/redstone/helper.d.ts +22 -0
- package/dist/utils/oracle/redstone/helper.js +186 -0
- package/dist/utils/tracer.d.ts +13 -0
- package/dist/utils/tracer.js +137 -0
- package/dist/utils/tracker/index.d.ts +5 -0
- package/dist/utils/tracker/index.js +118 -0
- package/dist/utils/tracker/query-id-generactor.d.ts +2 -0
- package/dist/utils/tracker/query-id-generactor.js +12 -0
- package/dist/utils/tracker/type.d.ts +34 -0
- package/dist/utils/tracker/type.js +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Cell } from '@ton/core';
|
|
2
|
+
export interface ParsedMessage {
|
|
3
|
+
contractType: 'Pool' | 'ShareVault' | 'StrategyVault' | 'Unknown';
|
|
4
|
+
opName: string;
|
|
5
|
+
opCode: number;
|
|
6
|
+
data: any;
|
|
7
|
+
}
|
|
8
|
+
export declare function parseMsgBody(cell: Cell): ParsedMessage | null;
|
|
9
|
+
export declare function getSupportedOpcodes(): {
|
|
10
|
+
contractType: string;
|
|
11
|
+
opName: string;
|
|
12
|
+
opCode: number;
|
|
13
|
+
}[];
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseMsgBody = parseMsgBody;
|
|
4
|
+
exports.getSupportedOpcodes = getSupportedOpcodes;
|
|
5
|
+
const Pool_1 = require("./Pool");
|
|
6
|
+
const ShareVault_1 = require("./ShareVault");
|
|
7
|
+
const StrategyVault_1 = require("./StrategyVault");
|
|
8
|
+
function parseMsgBody(cell) {
|
|
9
|
+
try {
|
|
10
|
+
const slice = cell.beginParse();
|
|
11
|
+
if (slice.remainingBits < 32) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
const opCode = slice.loadUint(32);
|
|
15
|
+
// Check Pool opcodes
|
|
16
|
+
const poolOpName = Pool_1.Pool.getOpName(opCode);
|
|
17
|
+
if (poolOpName !== `UnknownOp(${opCode.toString(16)})`) {
|
|
18
|
+
return parsePoolMessage(cell, opCode, poolOpName);
|
|
19
|
+
}
|
|
20
|
+
// Check ShareVault opcodes
|
|
21
|
+
const shareVaultOpName = ShareVault_1.ShareVault.getOpName(opCode);
|
|
22
|
+
if (shareVaultOpName !== `UnknownOp(${opCode.toString(16)})`) {
|
|
23
|
+
return parseShareVaultMessage(cell, opCode, shareVaultOpName);
|
|
24
|
+
}
|
|
25
|
+
// Check StrategyVault opcodes
|
|
26
|
+
const strategyVaultOpName = StrategyVault_1.StrategyVault.getOpName(opCode);
|
|
27
|
+
if (strategyVaultOpName !== `UnknownOp(${opCode.toString(16)})`) {
|
|
28
|
+
return parseStrategyVaultMessage(cell, opCode, strategyVaultOpName);
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function parsePoolMessage(cell, opCode, opName) {
|
|
37
|
+
let data;
|
|
38
|
+
try {
|
|
39
|
+
switch (opCode) {
|
|
40
|
+
case Pool_1.Pool.Op.SetOwner:
|
|
41
|
+
data = Pool_1.Pool.parseSetOwnerMsgBody(cell);
|
|
42
|
+
break;
|
|
43
|
+
case Pool_1.Pool.Op.SetFeeConfigurer:
|
|
44
|
+
data = Pool_1.Pool.parseSetFeeConfigurerMsgBody(cell);
|
|
45
|
+
break;
|
|
46
|
+
case Pool_1.Pool.Op.SetRiskFactor:
|
|
47
|
+
data = Pool_1.Pool.parseSetRiskFactorMsgBody(cell);
|
|
48
|
+
break;
|
|
49
|
+
case Pool_1.Pool.Op.SetOracle:
|
|
50
|
+
data = Pool_1.Pool.parseSetOracleMsgBody(cell);
|
|
51
|
+
break;
|
|
52
|
+
case Pool_1.Pool.Op.SetOracleConfig:
|
|
53
|
+
data = Pool_1.Pool.parseSetOracleConfigMsgBody(cell);
|
|
54
|
+
break;
|
|
55
|
+
case Pool_1.Pool.Op.SetGasFee:
|
|
56
|
+
data = Pool_1.Pool.parseSetGasFeeMsgBody(cell);
|
|
57
|
+
break;
|
|
58
|
+
case Pool_1.Pool.Op.SetProtocolFeeRate:
|
|
59
|
+
data = Pool_1.Pool.parseSetProtocolFeeRateMsgBody(cell);
|
|
60
|
+
break;
|
|
61
|
+
case Pool_1.Pool.Op.AddAsset:
|
|
62
|
+
data = Pool_1.Pool.parseAddAssetMsgBody(cell);
|
|
63
|
+
break;
|
|
64
|
+
case Pool_1.Pool.Op.SetIsBorrowable:
|
|
65
|
+
data = Pool_1.Pool.parseSetIsBorrowableMsgBody(cell);
|
|
66
|
+
break;
|
|
67
|
+
case Pool_1.Pool.Op.SetLiquidationIncentiveRate:
|
|
68
|
+
data = Pool_1.Pool.parseSetLiquidationIncentiveRateMsgBody(cell);
|
|
69
|
+
break;
|
|
70
|
+
case Pool_1.Pool.Op.SetMaxLoanLeverageRatio:
|
|
71
|
+
data = Pool_1.Pool.parseSetMaxLoanLeverageRatioMsgBody(cell);
|
|
72
|
+
break;
|
|
73
|
+
case Pool_1.Pool.Op.SetMaxLoanVarRatio:
|
|
74
|
+
data = Pool_1.Pool.parseSetMaxLoanVarRatioMsgBody(cell);
|
|
75
|
+
break;
|
|
76
|
+
case Pool_1.Pool.Op.SetLiquidateLeverageRatio:
|
|
77
|
+
data = Pool_1.Pool.parseSetLiquidateLeverageRatioMsgBody(cell);
|
|
78
|
+
break;
|
|
79
|
+
case Pool_1.Pool.Op.SetLiquidateVarRatio:
|
|
80
|
+
data = Pool_1.Pool.parseSetLiquidateVarRatioMsgBody(cell);
|
|
81
|
+
break;
|
|
82
|
+
case Pool_1.Pool.Op.SetLiquidateCloseRatio:
|
|
83
|
+
data = Pool_1.Pool.parseSetLiquidateCloseRatioMsgBody(cell);
|
|
84
|
+
break;
|
|
85
|
+
case Pool_1.Pool.Op.SetIrmConfig:
|
|
86
|
+
data = Pool_1.Pool.parseSetIrmConfigMsgBody(cell);
|
|
87
|
+
break;
|
|
88
|
+
case Pool_1.Pool.Op.SetWalletAddress:
|
|
89
|
+
data = Pool_1.Pool.parseSetWalletAddressMsgBody(cell);
|
|
90
|
+
break;
|
|
91
|
+
case Pool_1.Pool.Op.CollectFee:
|
|
92
|
+
data = Pool_1.Pool.parseCollectFeeMsgBody(cell);
|
|
93
|
+
break;
|
|
94
|
+
case Pool_1.Pool.Op.UpgradeCode:
|
|
95
|
+
data = Pool_1.Pool.parseUpgradeCodeMsgBody(cell);
|
|
96
|
+
break;
|
|
97
|
+
case Pool_1.Pool.Op.SetIsCollateral:
|
|
98
|
+
data = Pool_1.Pool.parseSetIsCollateralMsgBody(cell);
|
|
99
|
+
break;
|
|
100
|
+
case Pool_1.Pool.Op.SetNewAccountCode:
|
|
101
|
+
data = Pool_1.Pool.parseSetNewAccountCodeMsgBody(cell);
|
|
102
|
+
break;
|
|
103
|
+
case Pool_1.Pool.Op.SetVersion:
|
|
104
|
+
data = Pool_1.Pool.parseSetVersionMsgBody(cell);
|
|
105
|
+
break;
|
|
106
|
+
default:
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
return {
|
|
110
|
+
contractType: 'Pool',
|
|
111
|
+
opName,
|
|
112
|
+
opCode,
|
|
113
|
+
data
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
function parseShareVaultMessage(cell, opCode, opName) {
|
|
121
|
+
let data;
|
|
122
|
+
try {
|
|
123
|
+
switch (opCode) {
|
|
124
|
+
case ShareVault_1.ShareVault.Op.RequestAssetWalletAddress:
|
|
125
|
+
data = ShareVault_1.ShareVault.parseRequestAssetWalletAddressMsgBody(cell);
|
|
126
|
+
break;
|
|
127
|
+
case ShareVault_1.ShareVault.Op.SetWhitelistPools:
|
|
128
|
+
data = ShareVault_1.ShareVault.parseSetWhitelistPoolsMsgBody(cell);
|
|
129
|
+
break;
|
|
130
|
+
case ShareVault_1.ShareVault.Op.SetTargetWeight:
|
|
131
|
+
data = ShareVault_1.ShareVault.parseSetTargetWeightMsgBody(cell);
|
|
132
|
+
break;
|
|
133
|
+
case ShareVault_1.ShareVault.Op.SupplyToPool:
|
|
134
|
+
data = ShareVault_1.ShareVault.parseSupplyToPoolMsgBody(cell);
|
|
135
|
+
break;
|
|
136
|
+
case ShareVault_1.ShareVault.Op.WithdrawFromPool:
|
|
137
|
+
data = ShareVault_1.ShareVault.parseWithdrawFromPoolMsgBody(cell);
|
|
138
|
+
break;
|
|
139
|
+
case ShareVault_1.ShareVault.Op.ChangeManager:
|
|
140
|
+
data = ShareVault_1.ShareVault.parseChangeManagerMsgBody(cell);
|
|
141
|
+
break;
|
|
142
|
+
case ShareVault_1.ShareVault.Op.ChangeAdmin:
|
|
143
|
+
data = ShareVault_1.ShareVault.parseChangeAdminMsgBody(cell);
|
|
144
|
+
break;
|
|
145
|
+
case ShareVault_1.ShareVault.Op.ActionNotification:
|
|
146
|
+
data = ShareVault_1.ShareVault.parseActionNotificationMsgBody(cell);
|
|
147
|
+
break;
|
|
148
|
+
case ShareVault_1.ShareVault.Op.TakeAggregatedPool:
|
|
149
|
+
data = ShareVault_1.ShareVault.parseTakeAggregatedPoolMsgBody(cell);
|
|
150
|
+
break;
|
|
151
|
+
case ShareVault_1.ShareVault.Op.UpgradeCode:
|
|
152
|
+
data = ShareVault_1.ShareVault.parseUpgradeCodeMsgBody(cell);
|
|
153
|
+
break;
|
|
154
|
+
case ShareVault_1.ShareVault.Op.SetGasFee:
|
|
155
|
+
data = ShareVault_1.ShareVault.parseSetGasFeeMsgBody(cell);
|
|
156
|
+
break;
|
|
157
|
+
default:
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
return {
|
|
161
|
+
contractType: 'ShareVault',
|
|
162
|
+
opName,
|
|
163
|
+
opCode,
|
|
164
|
+
data
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
catch (error) {
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
function parseStrategyVaultMessage(cell, opCode, opName) {
|
|
172
|
+
let data;
|
|
173
|
+
try {
|
|
174
|
+
switch (opCode) {
|
|
175
|
+
case StrategyVault_1.StrategyVault.Op.Initialize:
|
|
176
|
+
data = StrategyVault_1.StrategyVault.parseInitializeMsgBody(cell);
|
|
177
|
+
break;
|
|
178
|
+
case StrategyVault_1.StrategyVault.Op.ExecuteStrategy:
|
|
179
|
+
data = StrategyVault_1.StrategyVault.parseExecuteStrategyMsgBody(cell);
|
|
180
|
+
break;
|
|
181
|
+
case StrategyVault_1.StrategyVault.Op.LiquidateToFactorial:
|
|
182
|
+
data = StrategyVault_1.StrategyVault.parseLiquidateToFactorialMsgBody(cell);
|
|
183
|
+
break;
|
|
184
|
+
case StrategyVault_1.StrategyVault.Op.SupplyToFactorial:
|
|
185
|
+
data = StrategyVault_1.StrategyVault.parseSupplyToFactorialMsgBody(cell);
|
|
186
|
+
break;
|
|
187
|
+
case StrategyVault_1.StrategyVault.Op.WithdrawFromFactorial:
|
|
188
|
+
data = StrategyVault_1.StrategyVault.parseWithdrawFromFactorialMsgBody(cell);
|
|
189
|
+
break;
|
|
190
|
+
case StrategyVault_1.StrategyVault.Op.BorrowFromFactorial:
|
|
191
|
+
data = StrategyVault_1.StrategyVault.parseBorrowFromFactorialMsgBody(cell);
|
|
192
|
+
break;
|
|
193
|
+
case StrategyVault_1.StrategyVault.Op.RepayToFactorial:
|
|
194
|
+
data = StrategyVault_1.StrategyVault.parseRepayToFactorialMsgBody(cell);
|
|
195
|
+
break;
|
|
196
|
+
case StrategyVault_1.StrategyVault.Op.CreateRfq:
|
|
197
|
+
data = StrategyVault_1.StrategyVault.parseCreateRFQMsgBody(cell);
|
|
198
|
+
break;
|
|
199
|
+
case StrategyVault_1.StrategyVault.Op.CancelRfq:
|
|
200
|
+
data = StrategyVault_1.StrategyVault.parseCancelRFQMsgBody(cell);
|
|
201
|
+
break;
|
|
202
|
+
case StrategyVault_1.StrategyVault.Op.SetAssetConfig:
|
|
203
|
+
data = StrategyVault_1.StrategyVault.parseSetAssetConfigMsgBody(cell);
|
|
204
|
+
break;
|
|
205
|
+
case StrategyVault_1.StrategyVault.Op.SetFactorialPoolConfig:
|
|
206
|
+
data = StrategyVault_1.StrategyVault.parseSetFactorialPoolConfigMsgBody(cell);
|
|
207
|
+
break;
|
|
208
|
+
case StrategyVault_1.StrategyVault.Op.ClaimManagementFee:
|
|
209
|
+
data = StrategyVault_1.StrategyVault.parseClaimManagementFeeMsgBody(cell);
|
|
210
|
+
break;
|
|
211
|
+
case StrategyVault_1.StrategyVault.Op.ClaimProtocolFee:
|
|
212
|
+
data = StrategyVault_1.StrategyVault.parseClaimProtocolFeeMsgBody(cell);
|
|
213
|
+
break;
|
|
214
|
+
case StrategyVault_1.StrategyVault.Op.SetOwnerAddress:
|
|
215
|
+
data = StrategyVault_1.StrategyVault.parseSetOwnerAddressMsgBody(cell);
|
|
216
|
+
break;
|
|
217
|
+
case StrategyVault_1.StrategyVault.Op.SetManagementFeeRatePerYear:
|
|
218
|
+
data = StrategyVault_1.StrategyVault.parseSetManagementFeeRatePerYearMsgBody(cell);
|
|
219
|
+
break;
|
|
220
|
+
case StrategyVault_1.StrategyVault.Op.SetMaxLeverageRatio:
|
|
221
|
+
data = StrategyVault_1.StrategyVault.parseSetMaxLeverageRatioMsgBody(cell);
|
|
222
|
+
break;
|
|
223
|
+
case StrategyVault_1.StrategyVault.Op.SetRfqConfig:
|
|
224
|
+
data = StrategyVault_1.StrategyVault.parseSetRFQConfigMsgBody(cell);
|
|
225
|
+
break;
|
|
226
|
+
case StrategyVault_1.StrategyVault.Op.SetOracleConfig:
|
|
227
|
+
data = StrategyVault_1.StrategyVault.parseSetOracleConfigMsgBody(cell);
|
|
228
|
+
break;
|
|
229
|
+
case StrategyVault_1.StrategyVault.Op.SetWalletCode:
|
|
230
|
+
data = StrategyVault_1.StrategyVault.parseSetWalletCodeMsgBody(cell);
|
|
231
|
+
break;
|
|
232
|
+
case StrategyVault_1.StrategyVault.Op.SetDataAggregatorCode:
|
|
233
|
+
data = StrategyVault_1.StrategyVault.parseSetDataAggregatorCodeMsgBody(cell);
|
|
234
|
+
break;
|
|
235
|
+
case StrategyVault_1.StrategyVault.Op.SetRfqCode:
|
|
236
|
+
data = StrategyVault_1.StrategyVault.parseSetRFQCodeMsgBody(cell);
|
|
237
|
+
break;
|
|
238
|
+
case StrategyVault_1.StrategyVault.Op.SetContent:
|
|
239
|
+
data = StrategyVault_1.StrategyVault.parseSetContentMsgBody(cell);
|
|
240
|
+
break;
|
|
241
|
+
case StrategyVault_1.StrategyVault.Op.UpgradeCode:
|
|
242
|
+
data = StrategyVault_1.StrategyVault.parseUpgradeCodeMsgBody(cell);
|
|
243
|
+
break;
|
|
244
|
+
case StrategyVault_1.StrategyVault.Op.SetManagerAddress:
|
|
245
|
+
data = StrategyVault_1.StrategyVault.parseSetManagerAddressMsgBody(cell);
|
|
246
|
+
break;
|
|
247
|
+
case StrategyVault_1.StrategyVault.Op.SetPrivateVault:
|
|
248
|
+
data = StrategyVault_1.StrategyVault.parseSetPrivateVaultMsgBody(cell);
|
|
249
|
+
break;
|
|
250
|
+
case StrategyVault_1.StrategyVault.Op.SetDepositCloseTimestamp:
|
|
251
|
+
data = StrategyVault_1.StrategyVault.parseSetDepositCloseTimestampMsgBody(cell);
|
|
252
|
+
break;
|
|
253
|
+
case StrategyVault_1.StrategyVault.Op.SetWithdrawOpenTimestamp:
|
|
254
|
+
data = StrategyVault_1.StrategyVault.parseSetWithdrawOpenTimestampMsgBody(cell);
|
|
255
|
+
break;
|
|
256
|
+
case StrategyVault_1.StrategyVault.Op.SetWhitelistedMinters:
|
|
257
|
+
data = StrategyVault_1.StrategyVault.parseSetWhitelistedMintersMsgBody(cell);
|
|
258
|
+
break;
|
|
259
|
+
case StrategyVault_1.StrategyVault.Op.SetGasConfig:
|
|
260
|
+
data = StrategyVault_1.StrategyVault.parseSetGasConfigMsgBody(cell);
|
|
261
|
+
break;
|
|
262
|
+
case StrategyVault_1.StrategyVault.Op.ExecuteOwnerAction:
|
|
263
|
+
data = StrategyVault_1.StrategyVault.parseExecuteOwnerActionMsgBody(cell);
|
|
264
|
+
break;
|
|
265
|
+
case StrategyVault_1.StrategyVault.Op.RevertOwnerAction:
|
|
266
|
+
data = StrategyVault_1.StrategyVault.parseRevertOwnerActionMsgBody(cell);
|
|
267
|
+
break;
|
|
268
|
+
case StrategyVault_1.StrategyVault.Op.SetGuardianAddress:
|
|
269
|
+
data = StrategyVault_1.StrategyVault.parseSetGuardianAddressMsgBody(cell);
|
|
270
|
+
break;
|
|
271
|
+
case StrategyVault_1.StrategyVault.Op.SetTimelock:
|
|
272
|
+
data = StrategyVault_1.StrategyVault.parseSetTimelockMsgBody(cell);
|
|
273
|
+
break;
|
|
274
|
+
case StrategyVault_1.StrategyVault.Op.SetManagementFeeRecipientAddress:
|
|
275
|
+
data = StrategyVault_1.StrategyVault.parseSetManagementFeeRecipientAddressMsgBody(cell);
|
|
276
|
+
break;
|
|
277
|
+
case StrategyVault_1.StrategyVault.Op.SetProtocolFeeRatePerYear:
|
|
278
|
+
data = StrategyVault_1.StrategyVault.parseSetProtocolFeeRatePerYearMsgBody(cell);
|
|
279
|
+
break;
|
|
280
|
+
case StrategyVault_1.StrategyVault.Op.SetProtocolFeeManagerAddress:
|
|
281
|
+
data = StrategyVault_1.StrategyVault.parseSetProtocolFeeManagerAddressMsgBody(cell);
|
|
282
|
+
break;
|
|
283
|
+
default:
|
|
284
|
+
return null;
|
|
285
|
+
}
|
|
286
|
+
return {
|
|
287
|
+
contractType: 'StrategyVault',
|
|
288
|
+
opName,
|
|
289
|
+
opCode,
|
|
290
|
+
data
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
catch (error) {
|
|
294
|
+
return null;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
// Export helper function to get all supported opcodes
|
|
298
|
+
function getSupportedOpcodes() {
|
|
299
|
+
const opcodes = [];
|
|
300
|
+
// Pool opcodes
|
|
301
|
+
Object.entries(Pool_1.Pool.Op).forEach(([name, code]) => {
|
|
302
|
+
opcodes.push({ contractType: 'Pool', opName: name, opCode: code });
|
|
303
|
+
});
|
|
304
|
+
// ShareVault opcodes
|
|
305
|
+
Object.entries(ShareVault_1.ShareVault.Op).forEach(([name, code]) => {
|
|
306
|
+
opcodes.push({ contractType: 'ShareVault', opName: name, opCode: code });
|
|
307
|
+
});
|
|
308
|
+
// StrategyVault opcodes
|
|
309
|
+
Object.entries(StrategyVault_1.StrategyVault.Op).forEach(([name, code]) => {
|
|
310
|
+
opcodes.push({ contractType: 'StrategyVault', opName: name, opCode: code });
|
|
311
|
+
});
|
|
312
|
+
return opcodes;
|
|
313
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function assert(condition: boolean, message?: string): asserts condition;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.assert = assert;
|
|
4
|
+
// Browser-compatible assert function to replace Node.js assert module for webpack5 compatibility
|
|
5
|
+
function assert(condition, message) {
|
|
6
|
+
if (!condition) {
|
|
7
|
+
throw new Error(message || "Assertion failed");
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Contract, StateInit, TonClient, Address } from "@ton/ton";
|
|
2
|
+
export declare class TonClientForParameter extends TonClient {
|
|
3
|
+
constructor(params: any);
|
|
4
|
+
open<T extends Contract>(src: T): OpenedContract<T>;
|
|
5
|
+
}
|
|
6
|
+
export type OpenedContract<F> = {
|
|
7
|
+
[P in keyof F]: P extends `${'get' | 'send' | 'is'}${string}` ? (F[P] extends (x: any, ...args: infer P) => infer R ? (...args: P) => R : never) : F[P];
|
|
8
|
+
};
|
|
9
|
+
export declare function openContract<T extends Contract>(src: T, factory: (params: {
|
|
10
|
+
address: Address;
|
|
11
|
+
init: StateInit | null;
|
|
12
|
+
}) => any): OpenedContract<T>;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TonClientForParameter = void 0;
|
|
4
|
+
exports.openContract = openContract;
|
|
5
|
+
const ton_1 = require("@ton/ton");
|
|
6
|
+
// import { Maybe, ExtraCurrency } from "@ton/core";
|
|
7
|
+
class TonClientForParameter extends ton_1.TonClient {
|
|
8
|
+
constructor(params) {
|
|
9
|
+
super(params);
|
|
10
|
+
}
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
open(src) {
|
|
13
|
+
return openContract(src, (args) => createProvider(this, args.address, args.init));
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.TonClientForParameter = TonClientForParameter;
|
|
17
|
+
function createProvider(client, address, init) {
|
|
18
|
+
return {
|
|
19
|
+
async internal(via, message) {
|
|
20
|
+
// Resolve init
|
|
21
|
+
let neededInit = null;
|
|
22
|
+
if (init && (!await client.isContractDeployed(address))) {
|
|
23
|
+
neededInit = init;
|
|
24
|
+
}
|
|
25
|
+
// Resolve bounce
|
|
26
|
+
let bounce = true;
|
|
27
|
+
if (message.bounce !== null && message.bounce !== undefined) {
|
|
28
|
+
bounce = message.bounce;
|
|
29
|
+
}
|
|
30
|
+
// Resolve value
|
|
31
|
+
let value;
|
|
32
|
+
if (typeof message.value === 'string') {
|
|
33
|
+
value = (0, ton_1.toNano)(message.value);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
value = message.value;
|
|
37
|
+
}
|
|
38
|
+
// Resolve body
|
|
39
|
+
let body = null;
|
|
40
|
+
if (typeof message.body === 'string') {
|
|
41
|
+
body = (0, ton_1.comment)(message.body);
|
|
42
|
+
}
|
|
43
|
+
else if (message.body) {
|
|
44
|
+
body = message.body;
|
|
45
|
+
}
|
|
46
|
+
throw {
|
|
47
|
+
to: address,
|
|
48
|
+
value,
|
|
49
|
+
bounce,
|
|
50
|
+
sendMode: message.sendMode,
|
|
51
|
+
extracurrency: message.extracurrency,
|
|
52
|
+
init: neededInit,
|
|
53
|
+
body
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function openContract(src, factory) {
|
|
59
|
+
// Resolve parameters
|
|
60
|
+
let address;
|
|
61
|
+
let init = null;
|
|
62
|
+
if (!ton_1.Address.isAddress(src.address)) {
|
|
63
|
+
throw Error('Invalid address');
|
|
64
|
+
}
|
|
65
|
+
address = src.address;
|
|
66
|
+
if (src.init) {
|
|
67
|
+
if (!(src.init.code instanceof ton_1.Cell)) {
|
|
68
|
+
throw Error('Invalid init.code');
|
|
69
|
+
}
|
|
70
|
+
if (!(src.init.data instanceof ton_1.Cell)) {
|
|
71
|
+
throw Error('Invalid init.data');
|
|
72
|
+
}
|
|
73
|
+
init = src.init;
|
|
74
|
+
}
|
|
75
|
+
// Create executor
|
|
76
|
+
let executor = factory({ address, init });
|
|
77
|
+
// Create proxy
|
|
78
|
+
return new Proxy(src, {
|
|
79
|
+
get(target, prop) {
|
|
80
|
+
const value = target[prop];
|
|
81
|
+
if (typeof prop === 'string' && (prop.startsWith('get') || prop.startsWith('send') || prop.startsWith('is'))) {
|
|
82
|
+
if (typeof value === 'function') {
|
|
83
|
+
return (...args) => new Promise(async (r) => {
|
|
84
|
+
try {
|
|
85
|
+
await value.apply(target, [executor, ...args]);
|
|
86
|
+
r(true);
|
|
87
|
+
}
|
|
88
|
+
catch (e) {
|
|
89
|
+
r(e);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return value;
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Cell } from "@ton/core";
|
|
2
|
+
import { RedstonOracleConfig } from "../../contracts/oracle/redstone-oracle/type";
|
|
3
|
+
export declare function getOracleParams(assets: string[]): Cell;
|
|
4
|
+
export declare function getOraclePrices(redstonOracleConfig: RedstonOracleConfig, assets: string[], prices: Record<string, bigint>): Record<string, bigint>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getOracleParams = getOracleParams;
|
|
4
|
+
exports.getOraclePrices = getOraclePrices;
|
|
5
|
+
const core_1 = require("@ton/core");
|
|
6
|
+
function getOracleParams(assets) {
|
|
7
|
+
return (0, core_1.beginCell)().endCell();
|
|
8
|
+
}
|
|
9
|
+
function getOraclePrices(redstonOracleConfig, assets, prices) {
|
|
10
|
+
const result = {};
|
|
11
|
+
Object.keys(prices).forEach((key) => {
|
|
12
|
+
const assetInfo = redstonOracleConfig.assetInfo[key];
|
|
13
|
+
if (assetInfo) {
|
|
14
|
+
result[assetInfo.address.toString()] =
|
|
15
|
+
(prices[key] * BigInt(1e8)) / assetInfo.precision;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
return result;
|
|
19
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Builder } from "@ton/core";
|
|
2
|
+
export declare function storeMetadata(metadataHex: string, builder: Builder): void;
|
|
3
|
+
export declare class RedstoneHelper {
|
|
4
|
+
private dataServiceId;
|
|
5
|
+
private uniqueSignersCount;
|
|
6
|
+
constructor(type: "demo" | "prod");
|
|
7
|
+
createPayload(assets: string[]): Promise<import("@ton/core").Cell>;
|
|
8
|
+
getPrices(assets: string[]): Promise<any[]>;
|
|
9
|
+
getHexlifiedFeedIds(assets: string[]): string[];
|
|
10
|
+
getDataFeedIdTuples(assets: string[]): import("@ton/core").Cell;
|
|
11
|
+
}
|
|
12
|
+
export declare function splitPayloadHex(payloadHex: string): {
|
|
13
|
+
dataPackageChunks: string[];
|
|
14
|
+
metadata: string;
|
|
15
|
+
};
|
|
16
|
+
export declare function stringToBytes(value: string): Buffer<ArrayBuffer>;
|
|
17
|
+
export declare function storeSignatureAndData(dataPackageHex: string, builder: Builder): void;
|
|
18
|
+
export declare function parseDataPackageHex(dataPackageHex: string): {
|
|
19
|
+
timestamp: bigint;
|
|
20
|
+
price: bigint;
|
|
21
|
+
feedId: bigint;
|
|
22
|
+
};
|