@typus/typus-sdk 0.3.3 → 0.3.5
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 +6 -6
- package/lib/constants.js +6 -6
- package/lib/test/getBidData.js +4 -3
- package/lib/test/testClaim.js +1 -1
- package/lib/test/testDeposit.js +2 -2
- package/lib/test/testNewAuction.js +1 -1
- package/lib/test/testNewVault.js +13 -12
- package/lib/test/testSettle.js +7 -7
- package/lib/test/testUnsubscribe.js +5 -4
- package/lib/test/testWithdraw.js +1 -1
- package/lib/utils/auction/getBid.d.ts +2 -1
- package/lib/utils/auction/getBid.js +28 -5
- package/lib/utils/coveredCall/getDeliveryTx.d.ts +1 -1
- package/lib/utils/coveredCall/getDeliveryTx.js +1 -2
- package/lib/utils/coveredCall/getEvolutionTx.d.ts +1 -0
- package/lib/{scripts/coveredCall/getDeliveryTx.js → utils/coveredCall/getEvolutionTx.js} +25 -18
- package/lib/utils/coveredCall/getNewCoveredCallVaultTx.d.ts +1 -1
- package/lib/utils/coveredCall/getNewCoveredCallVaultTx.js +3 -2
- package/lib/utils/coveredCall/getSubscribeTx.d.ts +1 -1
- package/lib/utils/coveredCall/getSubscribeTx.js +2 -1
- package/lib/utils/coveredCall/getUnsubscribeTx.d.ts +1 -1
- package/lib/utils/coveredCall/getUnsubscribeTx.js +2 -1
- package/lib/utils/coveredCall/getUpdateNextVaultConfigTx.d.ts +1 -0
- package/lib/{scripts/getUpdateTimeOracleTx.js → utils/coveredCall/getUpdateNextVaultConfigTx.js} +26 -20
- package/lib/utils/coveredCall/getUpdatePayoffConfigTx.d.ts +1 -1
- package/lib/utils/coveredCall/getUpdatePayoffConfigTx.js +1 -2
- package/lib/utils/fetchData.d.ts +23 -0
- package/lib/utils/getVaultData.d.ts +2 -1
- package/lib/utils/getVaultData.js +203 -116
- package/package.json +1 -1
- package/lib/scripts/coveredCall/getClaimAllTx.d.ts +0 -1
- package/lib/scripts/coveredCall/getClaimAllTx.js +0 -56
- package/lib/scripts/coveredCall/getClaimTx.d.ts +0 -1
- package/lib/scripts/coveredCall/getClaimTx.js +0 -55
- package/lib/scripts/coveredCall/getDeliveryTx.d.ts +0 -1
- package/lib/scripts/coveredCall/getDepositTx.d.ts +0 -1
- package/lib/scripts/coveredCall/getDepositTx.js +0 -58
- package/lib/scripts/coveredCall/getNewAuctionTx.d.ts +0 -1
- package/lib/scripts/coveredCall/getNewAuctionTx.js +0 -58
- package/lib/scripts/coveredCall/getNewAuctionWithNextCoveredCallVaultTx.d.ts +0 -1
- package/lib/scripts/coveredCall/getNewAuctionWithNextCoveredCallVaultTx.js +0 -59
- package/lib/scripts/coveredCall/getNewBidTx.d.ts +0 -1
- package/lib/scripts/coveredCall/getNewBidTx.js +0 -59
- package/lib/scripts/coveredCall/getNewCoveredCallVaultTx.d.ts +0 -1
- package/lib/scripts/coveredCall/getNewCoveredCallVaultTx.js +0 -68
- package/lib/scripts/coveredCall/getNewManagerTx.d.ts +0 -1
- package/lib/scripts/coveredCall/getNewManagerTx.js +0 -55
- package/lib/scripts/coveredCall/getRemoveBidTx.d.ts +0 -1
- package/lib/scripts/coveredCall/getRemoveBidTx.js +0 -56
- package/lib/scripts/coveredCall/getRemoveManagerTx.d.ts +0 -1
- package/lib/scripts/coveredCall/getRemoveManagerTx.js +0 -54
- package/lib/scripts/coveredCall/getRollOverTx.d.ts +0 -1
- package/lib/scripts/coveredCall/getRollOverTx.js +0 -55
- package/lib/scripts/coveredCall/getSettleTx.d.ts +0 -1
- package/lib/scripts/coveredCall/getSettleTx.js +0 -57
- package/lib/scripts/coveredCall/getSettleWithRollOverTx.d.ts +0 -1
- package/lib/scripts/coveredCall/getSettleWithRollOverTx.js +0 -57
- package/lib/scripts/coveredCall/getSubscribeTx.d.ts +0 -1
- package/lib/scripts/coveredCall/getSubscribeTx.js +0 -55
- package/lib/scripts/coveredCall/getUnsubscribeTx.d.ts +0 -1
- package/lib/scripts/coveredCall/getUnsubscribeTx.js +0 -55
- package/lib/scripts/coveredCall/getUpdatePayoffConfigTx.d.ts +0 -1
- package/lib/scripts/coveredCall/getUpdatePayoffConfigTx.js +0 -58
- package/lib/scripts/coveredCall/getWithdrawTx.d.ts +0 -1
- package/lib/scripts/coveredCall/getWithdrawTx.js +0 -57
- package/lib/scripts/getCreateTokenRegistryTx.d.ts +0 -1
- package/lib/scripts/getCreateTokenRegistryTx.js +0 -54
- package/lib/scripts/getMintTx.d.ts +0 -1
- package/lib/scripts/getMintTx.js +0 -57
- package/lib/scripts/getNewOracleTx.d.ts +0 -1
- package/lib/scripts/getNewOracleTx.js +0 -55
- package/lib/scripts/getNewTimeOracleTx.d.ts +0 -1
- package/lib/scripts/getNewTimeOracleTx.js +0 -54
- package/lib/scripts/getUpdateOracleTx.d.ts +0 -1
- package/lib/scripts/getUpdateOracleTx.js +0 -60
- package/lib/scripts/getUpdateTimeOracleTx.d.ts +0 -1
|
@@ -35,6 +35,22 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
35
35
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
39
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
40
|
+
if (!m) return o;
|
|
41
|
+
var i = m.call(o), r, ar = [], e;
|
|
42
|
+
try {
|
|
43
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
44
|
+
}
|
|
45
|
+
catch (error) { e = { error: error }; }
|
|
46
|
+
finally {
|
|
47
|
+
try {
|
|
48
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
49
|
+
}
|
|
50
|
+
finally { if (e) throw e.error; }
|
|
51
|
+
}
|
|
52
|
+
return ar;
|
|
53
|
+
};
|
|
38
54
|
var __values = (this && this.__values) || function(o) {
|
|
39
55
|
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
40
56
|
if (m) return m.call(o);
|
|
@@ -47,141 +63,212 @@ var __values = (this && this.__values) || function(o) {
|
|
|
47
63
|
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
48
64
|
};
|
|
49
65
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
-
exports.getVaultDataFromRegistry = void 0;
|
|
66
|
+
exports.getVaultBidPrice = exports.getVaultDataFromRegistry = void 0;
|
|
51
67
|
var sui_js_1 = require("@mysten/sui.js");
|
|
52
68
|
var constants_1 = require("../constants");
|
|
69
|
+
var createTimeOracle_1 = require("../utils/coveredCall/createTimeOracle");
|
|
53
70
|
var provider = new sui_js_1.JsonRpcProvider(sui_js_1.Network.DEVNET); //for read only operations
|
|
54
71
|
function getVaultDataFromRegistry(registry) {
|
|
55
72
|
return __awaiter(this, void 0, void 0, function () {
|
|
56
|
-
var coveredCallVaults, coveredCallVaultsId, objsInfo, vaults, _loop_1, objsInfo_1, objsInfo_1_1, objInfo;
|
|
57
|
-
var e_1,
|
|
58
|
-
return __generator(this, function (
|
|
59
|
-
switch (
|
|
73
|
+
var coveredCallVaults, coveredCallVaultsId, objsInfo, vaults, _a, timeOracle, _, _loop_1, objsInfo_1, objsInfo_1_1, objInfo, e_1_1;
|
|
74
|
+
var e_1, _b;
|
|
75
|
+
return __generator(this, function (_c) {
|
|
76
|
+
switch (_c.label) {
|
|
60
77
|
case 0:
|
|
61
78
|
console.log("registry: " + registry);
|
|
62
79
|
return [4 /*yield*/, provider.getObjectsOwnedByObject(registry)];
|
|
63
80
|
case 1:
|
|
64
|
-
coveredCallVaults =
|
|
81
|
+
coveredCallVaults = _c.sent();
|
|
65
82
|
coveredCallVaultsId = coveredCallVaults.map(function (e) { return e.objectId; });
|
|
66
83
|
return [4 /*yield*/, provider.getObjectBatch(coveredCallVaultsId)];
|
|
67
84
|
case 2:
|
|
68
|
-
objsInfo =
|
|
85
|
+
objsInfo = _c.sent();
|
|
69
86
|
vaults = [];
|
|
87
|
+
return [4 /*yield*/, (0, createTimeOracle_1.createTimeOracle)()];
|
|
88
|
+
case 3:
|
|
89
|
+
_a = __read.apply(void 0, [_c.sent(), 2]), timeOracle = _a[0], _ = _a[1];
|
|
70
90
|
_loop_1 = function (objInfo) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
91
|
+
var vaultId, vaultIdx, type, asset, config, vault, prevBalance, vaultConfig, vaultConfigRes, nextVaultConfig, nextVaultConfigRes, payoffConfig, payoffConfigRes, configRes, maker, regular, rolling, vaultRes, auctionRes, vaultBidPrice, auction, priceConfig, priceConfigRes, next, deliveryPrice, deliverySize, owner, tvl, res;
|
|
92
|
+
return __generator(this, function (_d) {
|
|
93
|
+
switch (_d.label) {
|
|
94
|
+
case 0:
|
|
95
|
+
if (objInfo.status != "Exists") {
|
|
96
|
+
console.log("obj not exist");
|
|
97
|
+
return [2 /*return*/, "continue"];
|
|
98
|
+
}
|
|
99
|
+
vaultId = objInfo.details.data.fields.id.id;
|
|
100
|
+
vaultIdx = objInfo.details.data.fields.name;
|
|
101
|
+
type = objInfo.details.data.fields.value.type;
|
|
102
|
+
asset = constants_1.TOKEN_NAME.find(function (e) { return type.includes(e); });
|
|
103
|
+
if (!asset) {
|
|
104
|
+
console.log("can't find token");
|
|
105
|
+
asset = "";
|
|
106
|
+
}
|
|
107
|
+
config = objInfo.details.data.fields.value.fields.config.fields;
|
|
108
|
+
vault = objInfo.details.data.fields.value.fields.vault.fields;
|
|
109
|
+
prevBalance = objInfo.details.data.fields.value.fields.prev_balance;
|
|
110
|
+
vaultConfig = config.vault_config.fields;
|
|
111
|
+
vaultConfigRes = {
|
|
112
|
+
strikeOtmPct: vaultConfig.strike_otm_pct,
|
|
113
|
+
strikeIncrement: vaultConfig.strike_increment,
|
|
114
|
+
decaySpeed: vaultConfig.decay_speed,
|
|
115
|
+
initialPrice: vaultConfig.initial_price,
|
|
116
|
+
finalPrice: vaultConfig.final_price,
|
|
117
|
+
auctionDurationInMs: vaultConfig.auction_duration_in_ms,
|
|
118
|
+
};
|
|
119
|
+
nextVaultConfig = config.next_vault_config.fields;
|
|
120
|
+
nextVaultConfigRes = {
|
|
121
|
+
strikeOtmPct: nextVaultConfig.strike_otm_pct,
|
|
122
|
+
strikeIncrement: nextVaultConfig.strike_increment,
|
|
123
|
+
decaySpeed: nextVaultConfig.decay_speed,
|
|
124
|
+
initialPrice: nextVaultConfig.initial_price,
|
|
125
|
+
finalPrice: nextVaultConfig.final_price,
|
|
126
|
+
auctionDurationInMs: nextVaultConfig.auction_duration_in_ms,
|
|
127
|
+
};
|
|
128
|
+
payoffConfig = config.payoff_config.fields;
|
|
129
|
+
payoffConfigRes = {
|
|
130
|
+
exposureRatio: Number(payoffConfig.exposure_ratio),
|
|
131
|
+
premiumRoi: Number(payoffConfig.premium_roi),
|
|
132
|
+
strike: Number(payoffConfig.strike) / (Math.pow(10, constants_1.PRICE_DECIMAL)),
|
|
133
|
+
};
|
|
134
|
+
configRes = {
|
|
135
|
+
period: config.period,
|
|
136
|
+
activationTsMs: config.activation_ts_ms,
|
|
137
|
+
expirationTsMs: config.expiration_ts_ms,
|
|
138
|
+
tokenDecimal: config.token_decimal,
|
|
139
|
+
shareDecimal: config.share_decimal,
|
|
140
|
+
capacity: Number(config.capacity) / (Math.pow(10, constants_1.TOKEN_DECIMAL)),
|
|
141
|
+
vaultConfig: vaultConfigRes,
|
|
142
|
+
nextVaultConfig: nextVaultConfigRes,
|
|
143
|
+
payoffConfig: payoffConfigRes,
|
|
144
|
+
};
|
|
145
|
+
maker = {
|
|
146
|
+
balance: Number(vault.maker_sub_vault.fields.balance),
|
|
147
|
+
shareSupply: Number(vault.maker_sub_vault.fields.share_supply),
|
|
148
|
+
};
|
|
149
|
+
regular = {
|
|
150
|
+
balance: Number(vault.regular_sub_vault.fields.balance),
|
|
151
|
+
shareSupply: Number(vault.regular_sub_vault.fields.share_supply),
|
|
152
|
+
};
|
|
153
|
+
rolling = {
|
|
154
|
+
balance: Number(vault.rolling_sub_vault.fields.balance),
|
|
155
|
+
shareSupply: Number(vault.rolling_sub_vault.fields.share_supply),
|
|
156
|
+
};
|
|
157
|
+
vaultRes = {
|
|
158
|
+
ableToDeposit: vault.able_to_deposit,
|
|
159
|
+
ableToWithdraw: vault.able_to_withdraw,
|
|
160
|
+
makerSubVault: maker,
|
|
161
|
+
regularSubVault: regular,
|
|
162
|
+
rollingSubVault: rolling,
|
|
163
|
+
};
|
|
164
|
+
auctionRes = void 0;
|
|
165
|
+
vaultBidPrice = void 0;
|
|
166
|
+
if (!objInfo.details.data.fields.value.fields.auction) return [3 /*break*/, 2];
|
|
167
|
+
auction = objInfo.details.data.fields.value.fields.auction.fields;
|
|
168
|
+
priceConfig = auction.price_config.fields;
|
|
169
|
+
priceConfigRes = {
|
|
170
|
+
decaySpeed: Number(priceConfig.decay_speed),
|
|
171
|
+
initialPrice: Number(priceConfig.initial_price),
|
|
172
|
+
finalPrice: Number(priceConfig.final_price),
|
|
173
|
+
};
|
|
174
|
+
auctionRes = {
|
|
175
|
+
startTsMs: Number(auction.start_ts_ms),
|
|
176
|
+
endTsMs: Number(auction.end_ts_ms),
|
|
177
|
+
priceConfig: priceConfigRes,
|
|
178
|
+
index: Number(auction.index),
|
|
179
|
+
};
|
|
180
|
+
return [4 /*yield*/, getVaultBidPrice(auctionRes, timeOracle)];
|
|
181
|
+
case 1:
|
|
182
|
+
vaultBidPrice = _d.sent();
|
|
183
|
+
return [3 /*break*/, 3];
|
|
184
|
+
case 2:
|
|
185
|
+
console.log("No auction");
|
|
186
|
+
auctionRes = {};
|
|
187
|
+
vaultBidPrice = 0;
|
|
188
|
+
_d.label = 3;
|
|
189
|
+
case 3:
|
|
190
|
+
next = objInfo.details.data.fields.value.fields.next;
|
|
191
|
+
deliveryPrice = objInfo.details.data.fields.value.fields.delivery_price;
|
|
192
|
+
deliverySize = objInfo.details.data.fields.value.fields.delivery_size;
|
|
193
|
+
owner = objInfo.details.data.fields.value.fields.owner;
|
|
194
|
+
tvl = Number(vault.regular_sub_vault.fields.balance) + Number(vault.rolling_sub_vault.fields.balance);
|
|
195
|
+
res = {
|
|
196
|
+
vaultId: vaultId,
|
|
197
|
+
vaultIdx: vaultIdx,
|
|
198
|
+
asset: asset,
|
|
199
|
+
config: configRes,
|
|
200
|
+
vault: vaultRes,
|
|
201
|
+
auction: auctionRes,
|
|
202
|
+
prevBalance: prevBalance,
|
|
203
|
+
next: next,
|
|
204
|
+
deliveryPrice: deliveryPrice,
|
|
205
|
+
deliverySize: deliverySize,
|
|
206
|
+
owner: owner,
|
|
207
|
+
tvl: tvl,
|
|
208
|
+
vaultBidPrice: vaultBidPrice,
|
|
209
|
+
};
|
|
210
|
+
vaults.push(res);
|
|
211
|
+
return [2 /*return*/];
|
|
212
|
+
}
|
|
213
|
+
});
|
|
168
214
|
};
|
|
215
|
+
_c.label = 4;
|
|
216
|
+
case 4:
|
|
217
|
+
_c.trys.push([4, 9, 10, 11]);
|
|
218
|
+
objsInfo_1 = __values(objsInfo), objsInfo_1_1 = objsInfo_1.next();
|
|
219
|
+
_c.label = 5;
|
|
220
|
+
case 5:
|
|
221
|
+
if (!!objsInfo_1_1.done) return [3 /*break*/, 8];
|
|
222
|
+
objInfo = objsInfo_1_1.value;
|
|
223
|
+
return [5 /*yield**/, _loop_1(objInfo)];
|
|
224
|
+
case 6:
|
|
225
|
+
_c.sent();
|
|
226
|
+
_c.label = 7;
|
|
227
|
+
case 7:
|
|
228
|
+
objsInfo_1_1 = objsInfo_1.next();
|
|
229
|
+
return [3 /*break*/, 5];
|
|
230
|
+
case 8: return [3 /*break*/, 11];
|
|
231
|
+
case 9:
|
|
232
|
+
e_1_1 = _c.sent();
|
|
233
|
+
e_1 = { error: e_1_1 };
|
|
234
|
+
return [3 /*break*/, 11];
|
|
235
|
+
case 10:
|
|
169
236
|
try {
|
|
170
|
-
|
|
171
|
-
objInfo = objsInfo_1_1.value;
|
|
172
|
-
_loop_1(objInfo);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
176
|
-
finally {
|
|
177
|
-
try {
|
|
178
|
-
if (objsInfo_1_1 && !objsInfo_1_1.done && (_a = objsInfo_1.return)) _a.call(objsInfo_1);
|
|
179
|
-
}
|
|
180
|
-
finally { if (e_1) throw e_1.error; }
|
|
237
|
+
if (objsInfo_1_1 && !objsInfo_1_1.done && (_b = objsInfo_1.return)) _b.call(objsInfo_1);
|
|
181
238
|
}
|
|
182
|
-
|
|
239
|
+
finally { if (e_1) throw e_1.error; }
|
|
240
|
+
return [7 /*endfinally*/];
|
|
241
|
+
case 11: return [2 /*return*/, vaults];
|
|
183
242
|
}
|
|
184
243
|
});
|
|
185
244
|
});
|
|
186
245
|
}
|
|
187
246
|
exports.getVaultDataFromRegistry = getVaultDataFromRegistry;
|
|
247
|
+
function getVaultBidPrice(auction, timeOracle) {
|
|
248
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
249
|
+
var tmp, currentTsMs, initialPrice, finalPrice, decaySpeed, startTsMs, endTsMs, priceDiff, numerator, denominator;
|
|
250
|
+
return __generator(this, function (_a) {
|
|
251
|
+
switch (_a.label) {
|
|
252
|
+
case 0: return [4 /*yield*/, provider.getObject(timeOracle)];
|
|
253
|
+
case 1:
|
|
254
|
+
tmp = _a.sent();
|
|
255
|
+
currentTsMs = Number(tmp.details.data.fields.ts_ms);
|
|
256
|
+
initialPrice = Number(auction.priceConfig.initialPrice);
|
|
257
|
+
finalPrice = Number(auction.priceConfig.finalPrice);
|
|
258
|
+
decaySpeed = Number(auction.priceConfig.decaySpeed);
|
|
259
|
+
startTsMs = Number(auction.startTsMs);
|
|
260
|
+
endTsMs = Number(auction.endTsMs);
|
|
261
|
+
priceDiff = initialPrice - finalPrice;
|
|
262
|
+
numerator = currentTsMs - startTsMs;
|
|
263
|
+
denominator = endTsMs - startTsMs;
|
|
264
|
+
while (decaySpeed > 0) {
|
|
265
|
+
priceDiff = priceDiff * numerator / denominator;
|
|
266
|
+
decaySpeed = decaySpeed - 1;
|
|
267
|
+
}
|
|
268
|
+
;
|
|
269
|
+
return [2 /*return*/, initialPrice - priceDiff];
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
exports.getVaultBidPrice = getVaultBidPrice;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
var getClaimAllTx_1 = require("../../utils/coveredCall/getClaimAllTx");
|
|
40
|
-
var constants_1 = require("../../constants");
|
|
41
|
-
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
42
|
-
var index, isRolling, claimAllTx;
|
|
43
|
-
return __generator(this, function (_a) {
|
|
44
|
-
switch (_a.label) {
|
|
45
|
-
case 0:
|
|
46
|
-
console.log("test for getClaimAllTx()");
|
|
47
|
-
index = 0;
|
|
48
|
-
isRolling = true;
|
|
49
|
-
return [4 /*yield*/, (0, getClaimAllTx_1.getClaimAllTx)(constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_REGISTRY, constants_1.DEFAULT_TYPE_ARGUMENT, index)];
|
|
50
|
-
case 1:
|
|
51
|
-
claimAllTx = _a.sent();
|
|
52
|
-
console.log(claimAllTx);
|
|
53
|
-
return [2 /*return*/];
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}); })();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
var getClaimTx_1 = require("../../utils/coveredCall/getClaimTx");
|
|
40
|
-
var constants_1 = require("../../constants");
|
|
41
|
-
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
42
|
-
var index, claimTx;
|
|
43
|
-
return __generator(this, function (_a) {
|
|
44
|
-
switch (_a.label) {
|
|
45
|
-
case 0:
|
|
46
|
-
console.log("test for getClaimTx()");
|
|
47
|
-
index = 0;
|
|
48
|
-
return [4 /*yield*/, (0, getClaimTx_1.getClaimTx)(constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_REGISTRY, constants_1.DEFAULT_TYPE_ARGUMENT, index)];
|
|
49
|
-
case 1:
|
|
50
|
-
claimTx = _a.sent();
|
|
51
|
-
console.log(claimTx);
|
|
52
|
-
return [2 /*return*/];
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
}); })();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
var getDepositTx_1 = require("../../utils/coveredCall/getDepositTx");
|
|
40
|
-
var constants_1 = require("../../constants");
|
|
41
|
-
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
42
|
-
var index, rolling, coin, amount, depositTx;
|
|
43
|
-
return __generator(this, function (_a) {
|
|
44
|
-
switch (_a.label) {
|
|
45
|
-
case 0:
|
|
46
|
-
console.log("test for getDepositTx()");
|
|
47
|
-
index = 0;
|
|
48
|
-
rolling = true;
|
|
49
|
-
coin = "";
|
|
50
|
-
amount = 9999;
|
|
51
|
-
return [4 /*yield*/, (0, getDepositTx_1.getDepositTx)(constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_REGISTRY, constants_1.FAKE_TOKEN_TYPE_ARGUMENT, index, rolling, coin, amount)];
|
|
52
|
-
case 1:
|
|
53
|
-
depositTx = _a.sent();
|
|
54
|
-
console.log(depositTx);
|
|
55
|
-
return [2 /*return*/];
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
}); })();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
var getNewAuctionTx_1 = require("../../utils/coveredCall/getNewAuctionTx");
|
|
40
|
-
var constants_1 = require("../../constants");
|
|
41
|
-
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
42
|
-
var typeArgument, vaultIndex, priceOracle, timeOracle, newAuctionTx;
|
|
43
|
-
return __generator(this, function (_a) {
|
|
44
|
-
switch (_a.label) {
|
|
45
|
-
case 0:
|
|
46
|
-
console.log("test for getNewAuctionTx()");
|
|
47
|
-
typeArgument = "0x27b3674c685046f66cad1d5496d2967894fa5329::token::USDC";
|
|
48
|
-
vaultIndex = 1;
|
|
49
|
-
priceOracle = "";
|
|
50
|
-
timeOracle = "";
|
|
51
|
-
return [4 /*yield*/, (0, getNewAuctionTx_1.getNewAuctionTx)(constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_REGISTRY, typeArgument, constants_1.COVERED_CALL_MANAGER, vaultIndex, priceOracle, timeOracle)];
|
|
52
|
-
case 1:
|
|
53
|
-
newAuctionTx = _a.sent();
|
|
54
|
-
console.log(newAuctionTx);
|
|
55
|
-
return [2 /*return*/];
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
}); })();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|