@typus/typus-sdk 0.1.9 → 0.2.1
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/lib/constants.d.ts +5 -5
- package/lib/constants.js +5 -5
- package/lib/scripts/coveredCall/getDeliveryTx.js +4 -2
- package/lib/scripts/coveredCall/getNewAuctionWithNextCoveredCallVaultTx.js +1 -1
- package/lib/test/testOracle.js +8 -4
- package/lib/test/testSettle.js +210 -16
- package/lib/utils/coveredCall/getDeliveryTx.d.ts +1 -1
- package/lib/utils/coveredCall/getDeliveryTx.js +3 -1
- package/lib/utils/coveredCall/getNewAuctionWithNextCoveredCallVaultTx.d.ts +1 -1
- package/lib/utils/coveredCall/getNewAuctionWithNextCoveredCallVaultTx.js +1 -2
- package/lib/utils/loadUsersDepositData.js +1 -1
- package/package.json +1 -1
package/lib/constants.d.ts
CHANGED
|
@@ -2,11 +2,11 @@ export declare const TOKEN_PACKAGE = "0x04aed544785e606bbda1100b7af9aaefb1db60b3
|
|
|
2
2
|
export declare const TOKEN_REGISTRY_BTC = "0x1d41542c9bcbb3427e80afb6cd7f05b304feb149";
|
|
3
3
|
export declare const TOKEN_REGISTRY_ETH = "0x97da9ec6f9842025480b73a2249e8670491c37d6";
|
|
4
4
|
export declare const TOKEN_REGISTRY_SUI = "0xa0b7b5fc89ee0fa8a1f3355f9370c9651f7611b6";
|
|
5
|
-
export declare const ORACLE_PACKAGE = "
|
|
6
|
-
export declare const COVERED_CALL_PACKAGE = "
|
|
7
|
-
export declare const COVERED_CALL_REGISTRY = "
|
|
8
|
-
export declare const COVERED_CALL_MANAGER = "
|
|
9
|
-
export declare const DOV_PACKAGE = "
|
|
5
|
+
export declare const ORACLE_PACKAGE = "0xe450380f9abda5ef5a7d8674f36d60caeb5a5b22";
|
|
6
|
+
export declare const COVERED_CALL_PACKAGE = "0xf98dbb57fde46c6c42fd199404037c9f5cfb6cbd";
|
|
7
|
+
export declare const COVERED_CALL_REGISTRY = "0x060ef5e7d31e578eece3b69fb7f933ad1f34cbf9";
|
|
8
|
+
export declare const COVERED_CALL_MANAGER = "0xcee379cd9be9e99baf441039d8d874126615ccdd";
|
|
9
|
+
export declare const DOV_PACKAGE = "0xfaadf1d975ed3dec39cbe93a1f44c034966f6747";
|
|
10
10
|
export declare const DEFAULT_TYPE_ARGUMENT = "0x2::sui::SUI";
|
|
11
11
|
export declare const FAKE_TOKEN_TYPE_ARGUMENT = "0x27b3674c685046f66cad1d5496d2967894fa5329::token::USDC";
|
|
12
12
|
export declare const TEST_MNEMONIC = "plug grain matter asthma aware critic can lottery blouse uncover sauce speak";
|
package/lib/constants.js
CHANGED
|
@@ -7,13 +7,13 @@ exports.TOKEN_REGISTRY_BTC = "0x1d41542c9bcbb3427e80afb6cd7f05b304feb149"; //fak
|
|
|
7
7
|
exports.TOKEN_REGISTRY_ETH = "0x97da9ec6f9842025480b73a2249e8670491c37d6"; //fake eth registry
|
|
8
8
|
exports.TOKEN_REGISTRY_SUI = "0xa0b7b5fc89ee0fa8a1f3355f9370c9651f7611b6"; //fake usdc registry
|
|
9
9
|
//publish from typus-oracle
|
|
10
|
-
exports.ORACLE_PACKAGE = "
|
|
10
|
+
exports.ORACLE_PACKAGE = "0xe450380f9abda5ef5a7d8674f36d60caeb5a5b22";
|
|
11
11
|
//publish from typus-dov/cover_call
|
|
12
|
-
exports.COVERED_CALL_PACKAGE = "
|
|
13
|
-
exports.COVERED_CALL_REGISTRY = "
|
|
14
|
-
exports.COVERED_CALL_MANAGER = "
|
|
12
|
+
exports.COVERED_CALL_PACKAGE = "0xf98dbb57fde46c6c42fd199404037c9f5cfb6cbd";
|
|
13
|
+
exports.COVERED_CALL_REGISTRY = "0x060ef5e7d31e578eece3b69fb7f933ad1f34cbf9";
|
|
14
|
+
exports.COVERED_CALL_MANAGER = "0xcee379cd9be9e99baf441039d8d874126615ccdd";
|
|
15
15
|
//publish from typus-dov/typus-dov
|
|
16
|
-
exports.DOV_PACKAGE = "
|
|
16
|
+
exports.DOV_PACKAGE = "0xfaadf1d975ed3dec39cbe93a1f44c034966f6747";
|
|
17
17
|
exports.DEFAULT_TYPE_ARGUMENT = "0x2::sui::SUI";
|
|
18
18
|
exports.FAKE_TOKEN_TYPE_ARGUMENT = "0x27b3674c685046f66cad1d5496d2967894fa5329::token::USDC";
|
|
19
19
|
exports.TEST_MNEMONIC = "plug grain matter asthma aware critic can lottery blouse uncover sauce speak";
|
|
@@ -39,13 +39,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
var getDeliveryTx_1 = require("../../utils/coveredCall/getDeliveryTx");
|
|
40
40
|
var constants_1 = require("../../constants");
|
|
41
41
|
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
42
|
-
var index, deliveryTx;
|
|
42
|
+
var index, size, timeOracle, deliveryTx;
|
|
43
43
|
return __generator(this, function (_a) {
|
|
44
44
|
switch (_a.label) {
|
|
45
45
|
case 0:
|
|
46
46
|
console.log("test for getSubscribeTx()");
|
|
47
47
|
index = 0;
|
|
48
|
-
|
|
48
|
+
size = 0;
|
|
49
|
+
timeOracle = "";
|
|
50
|
+
return [4 /*yield*/, (0, getDeliveryTx_1.getDeliveryTx)(constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_MANAGER, constants_1.COVERED_CALL_REGISTRY, constants_1.DEFAULT_TYPE_ARGUMENT, index, size, timeOracle)];
|
|
49
51
|
case 1:
|
|
50
52
|
deliveryTx = _a.sent();
|
|
51
53
|
console.log(deliveryTx);
|
|
@@ -53,7 +53,7 @@ var constants_1 = require("../../constants");
|
|
|
53
53
|
expiration = 2000;
|
|
54
54
|
assetName = "BTC";
|
|
55
55
|
strikeOtmPct = 2000;
|
|
56
|
-
return [4 /*yield*/, (0, getNewAuctionWithNextCoveredCallVaultTx_1.getNewAuctionWithNextCoveredCallVaultTx)(constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_MANAGER, constants_1.COVERED_CALL_REGISTRY, constants_1.DEFAULT_TYPE_ARGUMENT, index, start, end, decay, initialPrice, finalPrice, expiration,
|
|
56
|
+
return [4 /*yield*/, (0, getNewAuctionWithNextCoveredCallVaultTx_1.getNewAuctionWithNextCoveredCallVaultTx)(constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_MANAGER, constants_1.COVERED_CALL_REGISTRY, constants_1.DEFAULT_TYPE_ARGUMENT, index, start, end, decay, initialPrice, finalPrice, expiration, strikeOtmPct)];
|
|
57
57
|
case 1:
|
|
58
58
|
newAuctionWithNextCoveredCallVaultTx = _a.sent();
|
|
59
59
|
console.log(newAuctionWithNextCoveredCallVaultTx);
|
package/lib/test/testOracle.js
CHANGED
|
@@ -62,10 +62,14 @@ var signer = new sui_js_1.RawSigner(keypair, provider);
|
|
|
62
62
|
return [4 /*yield*/, provider.getTransactionWithEffects(digest)];
|
|
63
63
|
case 3:
|
|
64
64
|
txn = _a.sent();
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
if (txn.effects.created[0].owner["AddressOwner"] == undefined) {
|
|
66
|
+
newOracle = txn.effects.created[0].reference.objectId;
|
|
67
|
+
managerCap = txn.effects.created[1].reference.objectId;
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
newOracle = txn.effects.created[1].reference.objectId;
|
|
71
|
+
managerCap = txn.effects.created[0].reference.objectId;
|
|
72
|
+
}
|
|
69
73
|
console.log("update oracle...");
|
|
70
74
|
return [4 /*yield*/, (0, getUpdateOracleTx_1.getUpdateOracleTx)(constants_1.ORACLE_PACKAGE, constants_1.DEFAULT_TYPE_ARGUMENT, newOracle, managerCap, price, unix)];
|
|
71
75
|
case 4:
|
package/lib/test/testSettle.js
CHANGED
|
@@ -72,6 +72,10 @@ var constants_1 = require("../constants");
|
|
|
72
72
|
var sui_js_1 = require("@mysten/sui.js");
|
|
73
73
|
var getTypeArgumentFromToken_1 = require("../utils/getTypeArgumentFromToken");
|
|
74
74
|
var getUpdateTimeOracleTx_1 = require("../utils/getUpdateTimeOracleTx");
|
|
75
|
+
var getNewAuctionWithNextCoveredCallVaultTx_1 = require("../utils/coveredCall/getNewAuctionWithNextCoveredCallVaultTx");
|
|
76
|
+
var getNewBidTx_1 = require("../utils/coveredCall/getNewBidTx");
|
|
77
|
+
var getDeliveryTx_1 = require("../utils/coveredCall/getDeliveryTx");
|
|
78
|
+
var getUpdatePayoffConfigTx_1 = require("../utils/coveredCall/getUpdatePayoffConfigTx");
|
|
75
79
|
var provider = new sui_js_1.JsonRpcProvider(sui_js_1.Network.DEVNET); //for read only operations
|
|
76
80
|
var keypair = sui_js_1.Ed25519Keypair.deriveKeypair(constants_1.TEST_MNEMONIC);
|
|
77
81
|
var signer = new sui_js_1.RawSigner(keypair, provider);
|
|
@@ -83,7 +87,7 @@ var isRolling = true;
|
|
|
83
87
|
var expirationTsMs1 = 1000000;
|
|
84
88
|
var expirationTsMs2 = 2000000;
|
|
85
89
|
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
86
|
-
var typeArgument, _a, priceOracle, priceOracleManager, _b, timeOracle, timeOracleManager, price, ts, vaultIndex, startAuctionTsMs;
|
|
90
|
+
var typeArgument, _a, priceOracle, priceOracleManager, _b, timeOracle, timeOracleManager, price, ts, vaultIndex, startAuctionTsMs, endAuctionTsMs, decaySpeed, initialPrice, finalPrice, currentTime, size, sellSize, premiumRoi;
|
|
87
91
|
return __generator(this, function (_c) {
|
|
88
92
|
switch (_c.label) {
|
|
89
93
|
case 0: return [4 /*yield*/, (0, getTypeArgumentFromToken_1.getTypeArgumentFromToken)(token)
|
|
@@ -117,7 +121,7 @@ var expirationTsMs2 = 2000000;
|
|
|
117
121
|
// await updateTimeOracle(timeOracle, timeOracleManager, ts)
|
|
118
122
|
//create new vault
|
|
119
123
|
//DONE
|
|
120
|
-
return [4 /*yield*/, createNewVault(typeArgument, priceOracle)
|
|
124
|
+
return [4 /*yield*/, createNewVault(typeArgument, expirationTsMs1, priceOracle)
|
|
121
125
|
//deposit to new vault
|
|
122
126
|
//DONE
|
|
123
127
|
];
|
|
@@ -142,31 +146,98 @@ var expirationTsMs2 = 2000000;
|
|
|
142
146
|
_c.sent();
|
|
143
147
|
return [4 /*yield*/, updateTimeOracle(timeOracle, timeOracleManager, startAuctionTsMs)
|
|
144
148
|
//new_auction_with_next_covered_call_vault
|
|
145
|
-
//
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
+
//DONE
|
|
150
|
+
];
|
|
151
|
+
case 9:
|
|
152
|
+
_c.sent();
|
|
153
|
+
endAuctionTsMs = startAuctionTsMs + 500;
|
|
154
|
+
decaySpeed = 2;
|
|
155
|
+
initialPrice = 500000000;
|
|
156
|
+
finalPrice = 100000000;
|
|
157
|
+
return [4 /*yield*/, createNewAuctionWithNextCoveredCallVault(typeArgument, vaultIndex, startAuctionTsMs, endAuctionTsMs, decaySpeed, initialPrice, finalPrice, expirationTsMs2, strike)
|
|
149
158
|
//update time oracle
|
|
150
|
-
//
|
|
159
|
+
//DONE
|
|
160
|
+
];
|
|
161
|
+
case 10:
|
|
162
|
+
_c.sent();
|
|
163
|
+
currentTime = startAuctionTsMs + 300;
|
|
164
|
+
return [4 /*yield*/, updateTimeOracle(timeOracle, timeOracleManager, currentTime)
|
|
151
165
|
//new bid
|
|
166
|
+
//DONE
|
|
167
|
+
];
|
|
168
|
+
case 11:
|
|
169
|
+
_c.sent();
|
|
170
|
+
size = 100;
|
|
171
|
+
return [4 /*yield*/, newBid(vaultIndex, size, token, timeOracle)
|
|
172
|
+
//check some data
|
|
152
173
|
//TODO
|
|
153
174
|
//update time oracle
|
|
154
|
-
//
|
|
175
|
+
//DONE
|
|
176
|
+
];
|
|
177
|
+
case 12:
|
|
178
|
+
_c.sent();
|
|
179
|
+
//check some data
|
|
180
|
+
//TODO
|
|
181
|
+
//update time oracle
|
|
182
|
+
//DONE
|
|
183
|
+
return [4 /*yield*/, updateTimeOracle(timeOracle, timeOracleManager, endAuctionTsMs + 1)
|
|
155
184
|
//delivery
|
|
156
|
-
//
|
|
185
|
+
//DONE
|
|
186
|
+
];
|
|
187
|
+
case 13:
|
|
188
|
+
//check some data
|
|
189
|
+
//TODO
|
|
190
|
+
//update time oracle
|
|
191
|
+
//DONE
|
|
192
|
+
_c.sent();
|
|
193
|
+
sellSize = 1;
|
|
194
|
+
return [4 /*yield*/, delivery(vaultIndex, sellSize, timeOracle)
|
|
157
195
|
//================================end auction================================
|
|
158
196
|
//update price oracle and time oracle
|
|
159
|
-
//
|
|
197
|
+
//DONE
|
|
198
|
+
];
|
|
199
|
+
case 14:
|
|
200
|
+
_c.sent();
|
|
201
|
+
//================================end auction================================
|
|
202
|
+
//update price oracle and time oracle
|
|
203
|
+
//DONE
|
|
204
|
+
return [4 /*yield*/, updatePriceOracle(priceOracle, priceOracleManager, typeArgument, price, endAuctionTsMs)];
|
|
205
|
+
case 15:
|
|
206
|
+
//================================end auction================================
|
|
207
|
+
//update price oracle and time oracle
|
|
208
|
+
//DONE
|
|
209
|
+
_c.sent();
|
|
210
|
+
return [4 /*yield*/, updateTimeOracle(timeOracle, timeOracleManager, endAuctionTsMs)
|
|
160
211
|
//update payoff config
|
|
161
|
-
//
|
|
162
|
-
|
|
163
|
-
|
|
212
|
+
//DONE
|
|
213
|
+
];
|
|
214
|
+
case 16:
|
|
215
|
+
_c.sent();
|
|
216
|
+
premiumRoi = 100000;
|
|
217
|
+
return [4 /*yield*/, updatePayoffConfig(vaultIndex, price, premiumRoi)
|
|
164
218
|
//update price oracle and time oracle
|
|
165
|
-
//
|
|
219
|
+
//DONE
|
|
220
|
+
];
|
|
221
|
+
case 17:
|
|
222
|
+
_c.sent();
|
|
223
|
+
//update price oracle and time oracle
|
|
224
|
+
//DONE
|
|
225
|
+
price = 9800000000;
|
|
226
|
+
return [4 /*yield*/, updatePriceOracle(priceOracle, priceOracleManager, typeArgument, price, expirationTsMs1)];
|
|
227
|
+
case 18:
|
|
228
|
+
_c.sent();
|
|
229
|
+
return [4 /*yield*/, updateTimeOracle(timeOracle, timeOracleManager, expirationTsMs1)
|
|
166
230
|
//settle
|
|
167
231
|
//TODO
|
|
168
232
|
];
|
|
169
|
-
case
|
|
233
|
+
case 19:
|
|
234
|
+
_c.sent();
|
|
235
|
+
//settle
|
|
236
|
+
//TODO
|
|
237
|
+
return [4 /*yield*/, settle(vaultIndex, priceOracle, timeOracle)];
|
|
238
|
+
case 20:
|
|
239
|
+
//settle
|
|
240
|
+
//TODO
|
|
170
241
|
_c.sent();
|
|
171
242
|
return [2 /*return*/];
|
|
172
243
|
}
|
|
@@ -320,7 +391,7 @@ function updateTimeOracle(timeOracle, managerCap, ts) {
|
|
|
320
391
|
});
|
|
321
392
|
});
|
|
322
393
|
}
|
|
323
|
-
function createNewVault(typeArgument, priceOracle) {
|
|
394
|
+
function createNewVault(typeArgument, expirationTsMs1, priceOracle) {
|
|
324
395
|
return __awaiter(this, void 0, void 0, function () {
|
|
325
396
|
var _this = this;
|
|
326
397
|
return __generator(this, function (_a) {
|
|
@@ -435,3 +506,126 @@ function depositToVault(typeArgument, vaultIndex, depositAmount) {
|
|
|
435
506
|
});
|
|
436
507
|
});
|
|
437
508
|
}
|
|
509
|
+
function createNewAuctionWithNextCoveredCallVault(typeArgument, vaultIndex, startAuctionTsMs, endAuctionTsMs, decaySpeed, initialPrice, finalPrice, expirationTsMs2, strike) {
|
|
510
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
511
|
+
var _this = this;
|
|
512
|
+
return __generator(this, function (_a) {
|
|
513
|
+
return [2 /*return*/, new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
514
|
+
var txn, e_9;
|
|
515
|
+
return __generator(this, function (_a) {
|
|
516
|
+
switch (_a.label) {
|
|
517
|
+
case 0:
|
|
518
|
+
_a.trys.push([0, 3, , 4]);
|
|
519
|
+
return [4 /*yield*/, (0, getNewAuctionWithNextCoveredCallVaultTx_1.getNewAuctionWithNextCoveredCallVaultTx)(constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_MANAGER, constants_1.COVERED_CALL_REGISTRY, typeArgument, vaultIndex, startAuctionTsMs, endAuctionTsMs, decaySpeed, initialPrice, finalPrice, expirationTsMs2, strike)];
|
|
520
|
+
case 1:
|
|
521
|
+
txn = _a.sent();
|
|
522
|
+
return [4 /*yield*/, signer.executeMoveCall(txn)];
|
|
523
|
+
case 2:
|
|
524
|
+
_a.sent();
|
|
525
|
+
return [3 /*break*/, 4];
|
|
526
|
+
case 3:
|
|
527
|
+
e_9 = _a.sent();
|
|
528
|
+
console.error("err in createNewAuctionWithNextCoveredCallVault");
|
|
529
|
+
reject();
|
|
530
|
+
return [3 /*break*/, 4];
|
|
531
|
+
case 4: return [2 /*return*/];
|
|
532
|
+
}
|
|
533
|
+
});
|
|
534
|
+
}); })];
|
|
535
|
+
});
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
function newBid(vaultIndex, size, token, timeOracle) {
|
|
539
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
540
|
+
var _this = this;
|
|
541
|
+
return __generator(this, function (_a) {
|
|
542
|
+
return [2 /*return*/, new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
543
|
+
var newBidTx, e_10;
|
|
544
|
+
return __generator(this, function (_a) {
|
|
545
|
+
switch (_a.label) {
|
|
546
|
+
case 0:
|
|
547
|
+
_a.trys.push([0, 3, , 4]);
|
|
548
|
+
return [4 /*yield*/, (0, getNewBidTx_1.getNewBidTx)(constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_REGISTRY, constants_1.DEFAULT_TYPE_ARGUMENT, vaultIndex, size, token, timeOracle)];
|
|
549
|
+
case 1:
|
|
550
|
+
newBidTx = _a.sent();
|
|
551
|
+
return [4 /*yield*/, signer.executeMoveCall(newBidTx)];
|
|
552
|
+
case 2:
|
|
553
|
+
_a.sent();
|
|
554
|
+
return [3 /*break*/, 4];
|
|
555
|
+
case 3:
|
|
556
|
+
e_10 = _a.sent();
|
|
557
|
+
console.error("err in newBid");
|
|
558
|
+
reject();
|
|
559
|
+
return [3 /*break*/, 4];
|
|
560
|
+
case 4: return [2 /*return*/];
|
|
561
|
+
}
|
|
562
|
+
});
|
|
563
|
+
}); })];
|
|
564
|
+
});
|
|
565
|
+
});
|
|
566
|
+
}
|
|
567
|
+
function delivery(vaultIndex, sellSize, timeOracle) {
|
|
568
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
569
|
+
var _this = this;
|
|
570
|
+
return __generator(this, function (_a) {
|
|
571
|
+
return [2 /*return*/, new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
572
|
+
var deliveryTx, e_11;
|
|
573
|
+
return __generator(this, function (_a) {
|
|
574
|
+
switch (_a.label) {
|
|
575
|
+
case 0:
|
|
576
|
+
_a.trys.push([0, 3, , 4]);
|
|
577
|
+
return [4 /*yield*/, (0, getDeliveryTx_1.getDeliveryTx)(constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_MANAGER, constants_1.COVERED_CALL_REGISTRY, constants_1.DEFAULT_TYPE_ARGUMENT, vaultIndex, sellSize, timeOracle)];
|
|
578
|
+
case 1:
|
|
579
|
+
deliveryTx = _a.sent();
|
|
580
|
+
return [4 /*yield*/, signer.executeMoveCall(deliveryTx)];
|
|
581
|
+
case 2:
|
|
582
|
+
_a.sent();
|
|
583
|
+
return [3 /*break*/, 4];
|
|
584
|
+
case 3:
|
|
585
|
+
e_11 = _a.sent();
|
|
586
|
+
console.error("err in delivery");
|
|
587
|
+
reject();
|
|
588
|
+
return [3 /*break*/, 4];
|
|
589
|
+
case 4: return [2 /*return*/];
|
|
590
|
+
}
|
|
591
|
+
});
|
|
592
|
+
}); })];
|
|
593
|
+
});
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
function updatePayoffConfig(vaultIndex, price, premiumRoi) {
|
|
597
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
598
|
+
var _this = this;
|
|
599
|
+
return __generator(this, function (_a) {
|
|
600
|
+
return [2 /*return*/, new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
601
|
+
var updatePayoffConfigTx, e_12;
|
|
602
|
+
return __generator(this, function (_a) {
|
|
603
|
+
switch (_a.label) {
|
|
604
|
+
case 0:
|
|
605
|
+
_a.trys.push([0, 3, , 4]);
|
|
606
|
+
return [4 /*yield*/, (0, getUpdatePayoffConfigTx_1.getUpdatePayoffConfigTx)(constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_REGISTRY, constants_1.DEFAULT_TYPE_ARGUMENT, constants_1.COVERED_CALL_MANAGER, vaultIndex, price, premiumRoi)];
|
|
607
|
+
case 1:
|
|
608
|
+
updatePayoffConfigTx = _a.sent();
|
|
609
|
+
return [4 /*yield*/, signer.executeMoveCall(updatePayoffConfigTx)];
|
|
610
|
+
case 2:
|
|
611
|
+
_a.sent();
|
|
612
|
+
return [3 /*break*/, 4];
|
|
613
|
+
case 3:
|
|
614
|
+
e_12 = _a.sent();
|
|
615
|
+
console.error("err in updatePayoffConfig");
|
|
616
|
+
reject();
|
|
617
|
+
return [3 /*break*/, 4];
|
|
618
|
+
case 4: return [2 /*return*/];
|
|
619
|
+
}
|
|
620
|
+
});
|
|
621
|
+
}); })];
|
|
622
|
+
});
|
|
623
|
+
});
|
|
624
|
+
}
|
|
625
|
+
function settle(vaultIndex, priceOracle, timeOracle) {
|
|
626
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
627
|
+
return __generator(this, function (_a) {
|
|
628
|
+
return [2 /*return*/];
|
|
629
|
+
});
|
|
630
|
+
});
|
|
631
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function getDeliveryTx(packageId: string, managerCap: string, registry: string, typeArgument: string, index: number): Promise<any>;
|
|
1
|
+
export declare function getDeliveryTx(packageId: string, managerCap: string, registry: string, typeArgument: string, index: number, size: number, timeOracle: string): Promise<any>;
|
|
@@ -37,7 +37,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.getDeliveryTx = void 0;
|
|
40
|
-
function getDeliveryTx(packageId, managerCap, registry, typeArgument, index) {
|
|
40
|
+
function getDeliveryTx(packageId, managerCap, registry, typeArgument, index, size, timeOracle) {
|
|
41
41
|
return __awaiter(this, void 0, void 0, function () {
|
|
42
42
|
var tx;
|
|
43
43
|
return __generator(this, function (_a) {
|
|
@@ -50,6 +50,8 @@ function getDeliveryTx(packageId, managerCap, registry, typeArgument, index) {
|
|
|
50
50
|
managerCap,
|
|
51
51
|
registry,
|
|
52
52
|
index,
|
|
53
|
+
size,
|
|
54
|
+
timeOracle,
|
|
53
55
|
],
|
|
54
56
|
gasBudget: 10000,
|
|
55
57
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function getNewAuctionWithNextCoveredCallVaultTx(packageId: string, managerCap: string, registry: string, typeArgument: string, index: number, start: number, end: number, decay: number, initialPrice: number, finalPrice: number, expiration: number,
|
|
1
|
+
export declare function getNewAuctionWithNextCoveredCallVaultTx(packageId: string, managerCap: string, registry: string, typeArgument: string, index: number, start: number, end: number, decay: number, initialPrice: number, finalPrice: number, expiration: number, strikeOtmPct: number): Promise<any>;
|
|
@@ -37,7 +37,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.getNewAuctionWithNextCoveredCallVaultTx = void 0;
|
|
40
|
-
function getNewAuctionWithNextCoveredCallVaultTx(packageId, managerCap, registry, typeArgument, index, start, end, decay, initialPrice, finalPrice, expiration,
|
|
40
|
+
function getNewAuctionWithNextCoveredCallVaultTx(packageId, managerCap, registry, typeArgument, index, start, end, decay, initialPrice, finalPrice, expiration, strikeOtmPct) {
|
|
41
41
|
return __awaiter(this, void 0, void 0, function () {
|
|
42
42
|
var tx;
|
|
43
43
|
return __generator(this, function (_a) {
|
|
@@ -56,7 +56,6 @@ function getNewAuctionWithNextCoveredCallVaultTx(packageId, managerCap, registry
|
|
|
56
56
|
initialPrice,
|
|
57
57
|
finalPrice,
|
|
58
58
|
expiration,
|
|
59
|
-
assetName,
|
|
60
59
|
strikeOtmPct,
|
|
61
60
|
],
|
|
62
61
|
gasBudget: 10000,
|
|
@@ -112,7 +112,7 @@ function loadUsersDepositData(registry) {
|
|
|
112
112
|
subVault: subVaults[subVaultType],
|
|
113
113
|
subVaultType: subVaultType,
|
|
114
114
|
linkedListNode: linkedListNode.objectId,
|
|
115
|
-
balance: userData.value.fields.value
|
|
115
|
+
balance: (userData.value) ? userData.value.fields.value : 0
|
|
116
116
|
};
|
|
117
117
|
userDepositDatas = (usersDepositData.get(userData.name) == undefined) ? [] : usersDepositData.get(userData.name);
|
|
118
118
|
userDepositDatas.push(userDepositData);
|