@typus/typus-sdk 1.5.8 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/dice/user-entry.js +20 -46
- package/dist/src/typus-dov-single-v2/user-entry.js +8 -36
- package/dist/src/typus-safu/user-entry.js +7 -27
- package/dist/src/utils/api/sentio/vault-history.d.ts +2 -1
- package/dist/src/utils/api/sentio/vault-history.js +50 -3
- package/dist/src/utils/pyth/constant.d.ts +2 -0
- package/dist/src/utils/pyth/constant.js +2 -0
- package/package.json +1 -1
|
@@ -57,6 +57,7 @@ exports.playGuessTx = playGuessTx;
|
|
|
57
57
|
exports.newGamePlayGuessTx = newGamePlayGuessTx;
|
|
58
58
|
exports.getConsumeExpCoinStakedTx = getConsumeExpCoinStakedTx;
|
|
59
59
|
exports.getConsumeExpCoinUnstakedTx = getConsumeExpCoinUnstakedTx;
|
|
60
|
+
var utils_1 = require("../../src/utils");
|
|
60
61
|
/**
|
|
61
62
|
public(friend) entry fun new_game<TOKEN>(
|
|
62
63
|
registry: &mut Registry,
|
|
@@ -68,7 +69,7 @@ exports.getConsumeExpCoinUnstakedTx = getConsumeExpCoinUnstakedTx;
|
|
|
68
69
|
*/
|
|
69
70
|
function newGameTx(config, tx, input) {
|
|
70
71
|
return __awaiter(this, void 0, void 0, function () {
|
|
71
|
-
var registry;
|
|
72
|
+
var registry, coin;
|
|
72
73
|
return __generator(this, function (_a) {
|
|
73
74
|
registry = "";
|
|
74
75
|
switch (input.module) {
|
|
@@ -81,15 +82,11 @@ function newGameTx(config, tx, input) {
|
|
|
81
82
|
default:
|
|
82
83
|
break;
|
|
83
84
|
}
|
|
85
|
+
coin = (0, utils_1.splitCoins)(tx, input.typeArguments[0], input.coins, input.amount);
|
|
84
86
|
tx.moveCall({
|
|
85
87
|
target: "".concat(config.package.dice, "::").concat(input.module, "::new_game"),
|
|
86
88
|
typeArguments: input.typeArguments,
|
|
87
|
-
arguments: [
|
|
88
|
-
tx.object(registry),
|
|
89
|
-
tx.pure.u64(input.index),
|
|
90
|
-
tx.makeMoveVec({ elements: input.coins.map(function (id) { return tx.object(id); }) }),
|
|
91
|
-
tx.pure.u64(input.amount),
|
|
92
|
-
],
|
|
89
|
+
arguments: [tx.object(registry), tx.pure.u64(input.index), tx.makeMoveVec({ elements: [coin] }), tx.pure.u64(input.amount)],
|
|
93
90
|
});
|
|
94
91
|
return [2 /*return*/, tx];
|
|
95
92
|
});
|
|
@@ -140,8 +137,8 @@ function playGuessTx(config, tx, input) {
|
|
|
140
137
|
}
|
|
141
138
|
function newGamePlayGuessTx(config, tx, input) {
|
|
142
139
|
return __awaiter(this, void 0, void 0, function () {
|
|
143
|
-
var registry,
|
|
144
|
-
return __generator(this, function (
|
|
140
|
+
var registry, coin;
|
|
141
|
+
return __generator(this, function (_a) {
|
|
145
142
|
registry = "";
|
|
146
143
|
switch (input.module) {
|
|
147
144
|
case "tails_exp":
|
|
@@ -153,43 +150,20 @@ function newGamePlayGuessTx(config, tx, input) {
|
|
|
153
150
|
default:
|
|
154
151
|
break;
|
|
155
152
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
: [tx.object(registry), tx.pure.u64(input.index), tx.makeMoveVec({ elements: [coin] }), tx.pure.u64(input.amount)],
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
else {
|
|
174
|
-
tx.moveCall({
|
|
175
|
-
target: "".concat(config.package.dice, "::").concat(input.module, "::new_game"),
|
|
176
|
-
typeArguments: input.typeArguments,
|
|
177
|
-
arguments: input.module == "combo_dice"
|
|
178
|
-
? [
|
|
179
|
-
tx.object(config.registry.dice.comboDice),
|
|
180
|
-
tx.object(config.registry.dice.tailsExp),
|
|
181
|
-
tx.pure.u64(input.index),
|
|
182
|
-
tx.makeMoveVec({ elements: input.coins.map(function (id) { return tx.object(id); }) }),
|
|
183
|
-
tx.pure.u64(input.amount),
|
|
184
|
-
]
|
|
185
|
-
: [
|
|
186
|
-
tx.object(registry),
|
|
187
|
-
tx.pure.u64(input.index),
|
|
188
|
-
tx.makeMoveVec({ elements: input.coins.map(function (id) { return tx.object(id); }) }),
|
|
189
|
-
tx.pure.u64(input.amount),
|
|
190
|
-
],
|
|
191
|
-
});
|
|
192
|
-
}
|
|
153
|
+
coin = (0, utils_1.splitCoins)(tx, input.typeArguments[0], input.coins, input.amount);
|
|
154
|
+
tx.moveCall({
|
|
155
|
+
target: "".concat(config.package.dice, "::").concat(input.module, "::new_game"),
|
|
156
|
+
typeArguments: input.typeArguments,
|
|
157
|
+
arguments: input.module == "combo_dice"
|
|
158
|
+
? [
|
|
159
|
+
tx.object(config.registry.dice.comboDice),
|
|
160
|
+
tx.object(config.registry.dice.tailsExp),
|
|
161
|
+
tx.pure.u64(input.index),
|
|
162
|
+
tx.makeMoveVec({ elements: [coin] }),
|
|
163
|
+
tx.pure.u64(input.amount),
|
|
164
|
+
]
|
|
165
|
+
: [tx.object(registry), tx.pure.u64(input.index), tx.makeMoveVec({ elements: [coin] }), tx.pure.u64(input.amount)],
|
|
166
|
+
});
|
|
193
167
|
// tx.moveCall({
|
|
194
168
|
// target: `${config.package.dice}::${input.module}::play_guess`,
|
|
195
169
|
// typeArguments: [],
|
|
@@ -29,6 +29,7 @@ exports.getCompoundWithRedeemTx = getCompoundWithRedeemTx;
|
|
|
29
29
|
var bcs_1 = require("@mysten/sui/bcs");
|
|
30
30
|
var transactions_1 = require("@mysten/sui/transactions");
|
|
31
31
|
var constants_1 = require("../../src/constants");
|
|
32
|
+
var utils_1 = require("../../src/utils");
|
|
32
33
|
/**
|
|
33
34
|
public fun public_raise_fund<D_TOKEN, B_TOKEN>(
|
|
34
35
|
typus_ecosystem_version: &TypusEcosystemVersion,
|
|
@@ -45,32 +46,12 @@ var constants_1 = require("../../src/constants");
|
|
|
45
46
|
): (TypusDepositReceipt, vector<u64>) {
|
|
46
47
|
*/
|
|
47
48
|
function getRaiseFundTx(config, tx, input) {
|
|
48
|
-
var
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
tx.pure.address(input.user),
|
|
55
|
-
tx.makeMoveVec({
|
|
56
|
-
type: "0x2::coin::Coin<".concat(input.typeArguments[0], ">"),
|
|
57
|
-
elements: [tx.splitCoins(tx.gas, [tx.pure.u64(input.raiseAmount)])],
|
|
58
|
-
}),
|
|
59
|
-
tx.pure.u64(input.raiseAmount),
|
|
60
|
-
],
|
|
61
|
-
})
|
|
62
|
-
: tx.moveCall({
|
|
63
|
-
target: "".concat(config.package.framework, "::utils::delegate_extract_balance"),
|
|
64
|
-
typeArguments: [input.typeArguments[0]],
|
|
65
|
-
arguments: [
|
|
66
|
-
tx.pure.address(input.user),
|
|
67
|
-
tx.makeMoveVec({
|
|
68
|
-
type: "0x2::coin::Coin<".concat(input.typeArguments[0], ">"),
|
|
69
|
-
elements: input.raiseCoins.map(function (coin) { return tx.object(coin); }),
|
|
70
|
-
}),
|
|
71
|
-
tx.pure.u64(input.raiseAmount),
|
|
72
|
-
],
|
|
73
|
-
});
|
|
49
|
+
var coin = (0, utils_1.splitCoins)(tx, input.typeArguments[0], input.raiseCoins, input.raiseAmount);
|
|
50
|
+
var raiseBalance = tx.moveCall({
|
|
51
|
+
target: "0x2::coin::into_balance",
|
|
52
|
+
typeArguments: [input.typeArguments[0]],
|
|
53
|
+
arguments: [tx.object(coin)],
|
|
54
|
+
});
|
|
74
55
|
var result = tx.moveCall({
|
|
75
56
|
target: "".concat(config.package.dovSingle, "::tds_user_entry::public_raise_fund"),
|
|
76
57
|
typeArguments: input.typeArguments,
|
|
@@ -223,16 +204,7 @@ function getNewBidTx(config, tx, input) {
|
|
|
223
204
|
});
|
|
224
205
|
}
|
|
225
206
|
else {
|
|
226
|
-
var
|
|
227
|
-
target: "".concat(config.package.framework, "::utils::extract_balance"),
|
|
228
|
-
typeArguments: [input.typeArguments[1]],
|
|
229
|
-
arguments: [tx.makeMoveVec({ elements: input.coins.map(function (coin) { return tx.object(coin); }) }), tx.pure.u64(input.premium_required)],
|
|
230
|
-
});
|
|
231
|
-
var coin = tx.moveCall({
|
|
232
|
-
target: "0x2::coin::from_balance",
|
|
233
|
-
typeArguments: [input.typeArguments[1]],
|
|
234
|
-
arguments: [tx.object(balance)],
|
|
235
|
-
});
|
|
207
|
+
var coin = (0, utils_1.splitCoins)(tx, input.typeArguments[1], input.coins, input.premium_required);
|
|
236
208
|
var result = tx.moveCall({
|
|
237
209
|
target: "".concat(config.package.dovSingle, "::tds_user_entry::public_bid"),
|
|
238
210
|
typeArguments: input.typeArguments,
|
|
@@ -23,33 +23,13 @@ var utils_1 = require("../../src/utils");
|
|
|
23
23
|
) {
|
|
24
24
|
*/
|
|
25
25
|
function getRaiseFundTx(config, tx, input) {
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
tx.makeMoveVec({
|
|
34
|
-
type: "0x2::coin::Coin<".concat(input.typeArguments[0], ">"),
|
|
35
|
-
elements: [tx.splitCoins(tx.gas, [tx.pure.u64(input.raiseAmount)])],
|
|
36
|
-
}),
|
|
37
|
-
tx.pure.u64(input.raiseAmount),
|
|
38
|
-
],
|
|
39
|
-
})
|
|
40
|
-
: tx.moveCall({
|
|
41
|
-
target: "".concat(config.package.framework, "::utils::delegate_extract_balance"),
|
|
42
|
-
typeArguments: [input.typeArguments[0]],
|
|
43
|
-
arguments: [
|
|
44
|
-
tx.pure.address(input.user),
|
|
45
|
-
tx.makeMoveVec({
|
|
46
|
-
type: "0x2::coin::Coin<".concat(input.typeArguments[0], ">"),
|
|
47
|
-
elements: input.raiseCoins.map(function (coin) { return tx.object(coin); }),
|
|
48
|
-
}),
|
|
49
|
-
tx.pure.u64(input.raiseAmount),
|
|
50
|
-
],
|
|
51
|
-
});
|
|
52
|
-
var result = tx.moveCall({
|
|
26
|
+
var coin = (0, utils_1.splitCoins)(tx, input.typeArguments[0], input.raiseCoins, input.raiseAmount);
|
|
27
|
+
var raiseBalance = tx.moveCall({
|
|
28
|
+
target: "0x2::coin::into_balance",
|
|
29
|
+
typeArguments: [input.typeArguments[0]],
|
|
30
|
+
arguments: [tx.object(coin)],
|
|
31
|
+
});
|
|
32
|
+
tx.moveCall({
|
|
53
33
|
target: "".concat(config.package.safu, "::safu::raise_fund"),
|
|
54
34
|
typeArguments: input.typeArguments,
|
|
55
35
|
arguments: [
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export declare function getVaultHistorySummary(): Promise<VaultHistorySummary[]>;
|
|
1
|
+
export declare function getVaultHistorySummary(startTimestamp?: number): Promise<VaultHistorySummary[]>;
|
|
2
|
+
export declare function getFilledSummary(startTimestamp?: number): Promise<VaultHistorySummary[]>;
|
|
2
3
|
interface VaultHistorySummary {
|
|
3
4
|
AverageDrawdown: number;
|
|
4
5
|
AverageFilled: number;
|
|
@@ -37,21 +37,65 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.getVaultHistorySummary = getVaultHistorySummary;
|
|
40
|
+
exports.getFilledSummary = getFilledSummary;
|
|
40
41
|
exports.getVaultHistory = getVaultHistory;
|
|
41
42
|
var headers = {
|
|
42
43
|
"api-key": "tz3JJ6stG7Fux6ueRSRA5mdpC9U0lozI3",
|
|
43
44
|
"Content-Type": "application/json",
|
|
44
45
|
};
|
|
45
|
-
function getVaultHistorySummary() {
|
|
46
|
+
function getVaultHistorySummary(startTimestamp) {
|
|
46
47
|
return __awaiter(this, void 0, void 0, function () {
|
|
47
|
-
var apiUrl, requestData, jsonData, response, data, result;
|
|
48
|
+
var apiUrl, timeFilter, requestData, jsonData, response, data, result;
|
|
49
|
+
return __generator(this, function (_a) {
|
|
50
|
+
switch (_a.label) {
|
|
51
|
+
case 0:
|
|
52
|
+
apiUrl = "https://app.sentio.xyz/api/v1/analytics/typus/typus_v2/sql/execute";
|
|
53
|
+
if (startTimestamp) {
|
|
54
|
+
timeFilter = "WHERE timestamp >= ".concat(startTimestamp);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
timeFilter = "";
|
|
58
|
+
}
|
|
59
|
+
requestData = {
|
|
60
|
+
sqlQuery: {
|
|
61
|
+
sql: "\n WITH hourly_price_table AS (\n SELECT\n symbol,\n toStartOfHour(time) AS hour,\n argMax(price, time) AS hourly_price\n FROM\n token.prices\n GROUP BY\n symbol, hour\n ),\n\n vault_history AS (\n SELECT\n Settle.timestamp as timestamp,\n Settle.index as Index,\n Settle.round as Round,\n NewAuction.start_ts_ms as ActivationDate,\n COALESCE(NULLIF(UpdateStrike.strikes, ''), NewAuction.strikes) AS Strikes, -- \u5982\u679C UpdateStrike.strikes \u662F\u7A7A\u5B57\u7B26\u4E32\uFF0C\u5C31\u4F7F\u7528 NewAuction.strikes\n Settle.oracle_price as SettlePrice,\n -- Settle.share_price as share_price,\n -- Settle.settle_balance as SettleBalance,\n CAST(Activate.deposit_balance as Float64) as DepositAmount,\n DepositAmount * Settle.price_d_token as DepositAmountUSD,\n Delivery.max_size as MaxSize,\n (SafuOtc.delivery_size + Delivery.delivery_size) as TotalSell,\n CASE WHEN MaxSize != 0 THEN TotalSell / MaxSize ELSE 0 END AS Filled,\n Delivery.delivery_size as DeliverySize,\n Delivery.delivery_price as DeliveryPrice,\n SafuOtc.delivery_size as OtcSize,\n SafuOtc.delivery_price as OtcPrice,\n Delivery.bidder_bid_value as BidderPremium,\n BidderPremium * Delivery.price_b_token as BidderPremiumUSD,\n Delivery.incentive_bid_value as IncentivePremium,\n SafuOtc.bidder_bid_value as OtcPremium,\n (Delivery.bidder_bid_value + Delivery.incentive_bid_value + SafuOtc.bidder_bid_value) AS Premium, -- Total Premium b_token\n Premium * Delivery.price_b_token AS PremiumUSD,\n Delivery.depositor_incentive_value as BpIncentive, -- SUI or SCA based on o_token\n BpIncentive * Delivery.price_o_token as BpIncentiveUSD,\n Delivery.fixed_incentive_amount as FixedIncentive, -- SUI\n FixedIncentive * hourly_price_table.hourly_price as FixedIncentiveUSD,\n (1 - Settle.share_price) as LossPecentage,\n CAST((Settle.settle_balance - Settle.settled_balance) AS Float64) as OptionProfit, -- d_token\n OptionProfit * Settle.price_d_token as OptionProfitUSD,\n PremiumUSD + BpIncentiveUSD + FixedIncentiveUSD - OptionProfitUSD as DepositorPNL,\n -- CASE WHEN DepositAmountUSD != 0 THEN DepositorPNL / DepositAmountUSD ELSE 0 END AS DepositorROI,\n OptionProfitUSD - BidderPremiumUSD as BidderPNL,\n CASE WHEN BidderPremiumUSD != 0 THEN BidderPNL / BidderPremiumUSD ELSE 0 END AS BidderROI,\n Settle.d_token as d_token,\n Delivery.b_token as b_token,\n Delivery.o_token as o_token\n FROM Settle\n JOIN Activate ON Settle.index = Activate.index AND Settle.round = Activate.round\n JOIN NewAuction ON Settle.index = NewAuction.index AND Settle.round = NewAuction.round\n LEFT JOIN UpdateStrike ON Settle.index = UpdateStrike.index AND Settle.round = UpdateStrike.round\n JOIN Delivery ON Settle.index = Delivery.index AND Settle.round = Delivery.round\n LEFT JOIN SafuOtc ON Settle.index = SafuOtc.index AND Settle.round = SafuOtc.round\n LEFT JOIN hourly_price_table ON 'sui' = hourly_price_table.symbol AND toStartOfHour(Settle.timestamp) = hourly_price_table.hour\n ".concat(timeFilter, "\n ORDER BY ActivationDate DESC\n )\n\n SELECT\n vault_history.Index AS Index,\n SUM(vault_history.TotalSell) AS TotalSell, -- Total Sell Size\n AVG(vault_history.Filled) AS AverageFilled, -- Average Filled Rate\n AVG(vault_history.OptionProfit) AS AverageLoss, -- Average Option Profit\n SUM(vault_history.OptionProfit) AS TotalOptionProfit, -- Total Option Profit\n AVG(CASE -- Calculating Average Drawdown, ignoring DepositAmount == 0\n WHEN vault_history.DepositAmount > 0 THEN vault_history.OptionProfit / vault_history.DepositAmount ELSE NULL\n END) AS AverageDrawdown, -- Average Drawdown (based on Option Profit and TVL)\n SUM(CASE WHEN vault_history.BidderPNL > 0 THEN 1 ELSE 0 END) / COUNT(*) AS BidderWinRate, -- Calculating Bidder Win Rate (probability BidderPNL > 0)\n SUM(CASE WHEN vault_history.DepositorPNL > 0 THEN 1 ELSE 0 END) / COUNT(*) AS DepositorWinRate -- Calculating Depositor Win Rate (probability DepositorPNL > 0)\n FROM vault_history\n GROUP BY vault_history.Index\n ORDER BY Index ASC\n "),
|
|
62
|
+
size: 1000,
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
jsonData = JSON.stringify(requestData);
|
|
66
|
+
return [4 /*yield*/, fetch(apiUrl, {
|
|
67
|
+
method: "POST",
|
|
68
|
+
headers: headers,
|
|
69
|
+
body: jsonData,
|
|
70
|
+
})];
|
|
71
|
+
case 1:
|
|
72
|
+
response = _a.sent();
|
|
73
|
+
return [4 /*yield*/, response.json()];
|
|
74
|
+
case 2:
|
|
75
|
+
data = _a.sent();
|
|
76
|
+
result = data.result.rows;
|
|
77
|
+
// console.log(result);
|
|
78
|
+
return [2 /*return*/, result];
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
function getFilledSummary(startTimestamp) {
|
|
84
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
85
|
+
var apiUrl, timeFilter, requestData, jsonData, response, data, result;
|
|
48
86
|
return __generator(this, function (_a) {
|
|
49
87
|
switch (_a.label) {
|
|
50
88
|
case 0:
|
|
51
89
|
apiUrl = "https://app.sentio.xyz/api/v1/analytics/typus/typus_v2/sql/execute";
|
|
90
|
+
if (startTimestamp) {
|
|
91
|
+
timeFilter = "WHERE timestamp >= ".concat(startTimestamp);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
timeFilter = "";
|
|
95
|
+
}
|
|
52
96
|
requestData = {
|
|
53
97
|
sqlQuery: {
|
|
54
|
-
sql: "\n WITH hourly_price_table AS (\n SELECT\n symbol,\n toStartOfHour(time) AS hour,\n argMax(price, time) AS hourly_price\n FROM\n
|
|
98
|
+
sql: "\n WITH hourly_price_table AS (\n SELECT\n symbol,\n toStartOfHour(time) AS hour,\n argMax(price, time) AS hourly_price -- Get the most recent price before or at the hour\n FROM\n sui.coin_prices\n GROUP BY\n symbol, hour\n ),\n\n vault_history AS (\n SELECT\n Delivery.timestamp as timestamp,\n Delivery.index as Index,\n Delivery.round as Round,\n NewAuction.start_ts_ms as ActivationDate,\n COALESCE(NULLIF(UpdateStrike.strikes, ''), NewAuction.strikes) AS Strikes, -- \u5982\u679C UpdateStrike.strikes \u662F\u7A7A\u5B57\u7B26\u4E32\uFF0C\u5C31\u4F7F\u7528 NewAuction.strikes\n Activate.deposit_balance as DepositAmount,\n Delivery.max_size as MaxSize,\n (SafuOtc.delivery_size + Delivery.delivery_size) as TotalSell,\n CASE WHEN MaxSize != 0 THEN TotalSell / MaxSize ELSE 0 END AS Filled,\n Delivery.delivery_size as DeliverySize,\n Delivery.delivery_price as DeliveryPrice,\n SafuOtc.delivery_size as OtcSize,\n SafuOtc.delivery_price as OtcPrice,\n Delivery.bidder_bid_value as BidderPremium,\n BidderPremium * Delivery.price_b_token as BidderPremiumUSD,\n Delivery.incentive_bid_value as IncentivePremium,\n SafuOtc.bidder_bid_value as OtcPremium,\n (Delivery.bidder_bid_value + Delivery.incentive_bid_value + SafuOtc.bidder_bid_value) AS Premium, -- Total Premium b_token\n Premium * Delivery.price_b_token AS PremiumUSD,\n Delivery.depositor_incentive_value as BpIncentive, -- SUI or SCA based on o_token\n BpIncentive * Delivery.price_o_token as BpIncentiveUSD,\n Delivery.fixed_incentive_amount as FixedIncentive, -- SUI\n FixedIncentive * hourly_price_table.hourly_price as FixedIncentiveUSD,\n VaultInfo.d_token as d_token,\n Delivery.b_token as b_token,\n Delivery.o_token as o_token\n FROM Delivery\n JOIN Activate ON Delivery.index = Activate.index AND Delivery.round = Activate.round\n JOIN NewAuction ON Delivery.index = NewAuction.index AND Delivery.round = NewAuction.round\n JOIN VaultInfo ON Delivery.index = CAST(VaultInfo.id AS Decimal(76, 12))\n LEFT JOIN UpdateStrike ON Delivery.index = UpdateStrike.index AND Delivery.round = UpdateStrike.round\n LEFT JOIN SafuOtc ON Delivery.index = SafuOtc.index AND Delivery.round = SafuOtc.round\n LEFT JOIN hourly_price_table ON 'sui' = hourly_price_table.symbol AND toStartOfHour(Delivery.timestamp) = hourly_price_table.hour\n ".concat(timeFilter, "\n ORDER BY ActivationDate DESC\n )\n\n SELECT\n vault_history.Index AS Index,\n SUM(vault_history.BidderPremiumUSD) * 0.2 AS FeeUSD,\n SUM(vault_history.TotalSell) AS TotalSell, -- Total Sell Size\n AVG(vault_history.Filled) AS AverageFilled -- Average Filled Rate\n FROM vault_history\n GROUP BY vault_history.Index\n ORDER BY FeeUSD DESC\n "),
|
|
55
99
|
size: 1000,
|
|
56
100
|
},
|
|
57
101
|
};
|
|
@@ -105,5 +149,8 @@ function getVaultHistory(index_1) {
|
|
|
105
149
|
});
|
|
106
150
|
});
|
|
107
151
|
}
|
|
152
|
+
// let quarterly_timestamp = Math.round(new Date().setMonth(new Date().getMonth() - 3) / 1000);
|
|
153
|
+
// console.log(quarterly_timestamp);
|
|
108
154
|
// getVaultHistorySummary();
|
|
155
|
+
// getFilledSummary(quarterly_timestamp);
|
|
109
156
|
// getVaultHistory("78", 3);
|
|
@@ -9,6 +9,7 @@ export declare const priceIDs: {
|
|
|
9
9
|
CETUS: string;
|
|
10
10
|
NAVX: string;
|
|
11
11
|
SCA: string;
|
|
12
|
+
TURBOS: string;
|
|
12
13
|
};
|
|
13
14
|
TESTNET: {
|
|
14
15
|
SUI: string;
|
|
@@ -21,6 +22,7 @@ export declare const priceIDs: {
|
|
|
21
22
|
CETUS: string;
|
|
22
23
|
NAVX: string;
|
|
23
24
|
SCA: string;
|
|
25
|
+
TURBOS: string;
|
|
24
26
|
};
|
|
25
27
|
};
|
|
26
28
|
export declare const priceInfoObjectIds: {
|
|
@@ -14,6 +14,7 @@ exports.priceIDs = {
|
|
|
14
14
|
CETUS: "0xe5b274b2611143df055d6e7cd8d93fe1961716bcd4dca1cad87a83bc1e78c1ef", // CETUS/USD price ID
|
|
15
15
|
NAVX: "0x88250f854c019ef4f88a5c073d52a18bb1c6ac437033f5932cd017d24917ab46", // NAVX/USD price ID
|
|
16
16
|
SCA: "0x7e17f0ac105abe9214deb9944c30264f5986bf292869c6bd8e8da3ccd92d79bc", // SCA/USD price ID
|
|
17
|
+
TURBOS: "0xf9c2e890443dd995d0baafc08eea3358be1ffb874f93f99c30b3816c460bbac3", // TURBOS/USD price ID
|
|
17
18
|
},
|
|
18
19
|
TESTNET: {
|
|
19
20
|
// Pyth EVM Beta
|
|
@@ -27,6 +28,7 @@ exports.priceIDs = {
|
|
|
27
28
|
CETUS: "0xcb324dafd531712dd31c39969ae0246ee4c6ae167257bcf8ac27e28ca35e6a0c", // CETUS/USD price ID
|
|
28
29
|
NAVX: "0x946292ad3f481f36f5e558726cf4974e2a7a34598bf15d2abe3619e7b6a8db91", // NAVX/USD price ID
|
|
29
30
|
SCA: "0xeacabc6304d11fc10a757f63286ef44415d8e91b7a1a525ae94a7ec9398b73f3", // SCA/USD price ID
|
|
31
|
+
TURBOS: "0x3f545e3f4ec9fd8eb3b9d9d6071a1da361f6729fa1b93d1d1baca3379551d99e", // TURBOS/USD price ID
|
|
30
32
|
},
|
|
31
33
|
};
|
|
32
34
|
exports.priceInfoObjectIds = {
|