@typus/typus-sdk 1.6.0 → 1.6.2
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.d.ts +36 -0
- package/dist/src/dice/user-entry.js +72 -0
- package/dist/src/utils/api/sentio/reward-generated.js +9 -3
- package/dist/src/utils/api/sentio/vault-history.js +3 -3
- package/dist/src/utils/pyth/constant.d.ts +1 -0
- package/dist/src/utils/pyth/constant.js +1 -0
- package/package.json +1 -1
|
@@ -47,6 +47,42 @@ export declare function newGamePlayGuessTx(config: TypusConfig, tx: Transaction,
|
|
|
47
47
|
guess_2: string;
|
|
48
48
|
larger_than_2: boolean;
|
|
49
49
|
}): Promise<Transaction>;
|
|
50
|
+
/**
|
|
51
|
+
entry fun play<TOKEN>( // combo_dice
|
|
52
|
+
registry: &mut Registry,
|
|
53
|
+
exp_registry: &mut ExpRegistry,
|
|
54
|
+
index: u64,
|
|
55
|
+
coin: Coin<TOKEN>,
|
|
56
|
+
guess_1: u64,
|
|
57
|
+
larger_than_1: bool,
|
|
58
|
+
guess_2: u64,
|
|
59
|
+
larger_than_2: bool,
|
|
60
|
+
random: &Random,
|
|
61
|
+
ctx: &mut TxContext
|
|
62
|
+
) {
|
|
63
|
+
entry fun play<TOKEN>( // tails_exp
|
|
64
|
+
registry: &mut Registry,
|
|
65
|
+
index: u64,
|
|
66
|
+
coin: Coin<TOKEN>,
|
|
67
|
+
guess_1: u64,
|
|
68
|
+
larger_than_1: bool,
|
|
69
|
+
guess_2: u64,
|
|
70
|
+
larger_than_2: bool,
|
|
71
|
+
random: &Random,
|
|
72
|
+
ctx: &mut TxContext
|
|
73
|
+
) {
|
|
74
|
+
*/
|
|
75
|
+
export declare function playTx(config: TypusConfig, tx: Transaction, input: {
|
|
76
|
+
module: "tails_exp" | "combo_dice";
|
|
77
|
+
typeArguments: string[];
|
|
78
|
+
index: string;
|
|
79
|
+
coins: string[];
|
|
80
|
+
amount: string;
|
|
81
|
+
guess_1: string;
|
|
82
|
+
larger_than_1: boolean;
|
|
83
|
+
guess_2: string;
|
|
84
|
+
larger_than_2: boolean;
|
|
85
|
+
}): Promise<Transaction>;
|
|
50
86
|
/**
|
|
51
87
|
public fun consume_exp_coin_staked(
|
|
52
88
|
registry: &mut Registry,
|
|
@@ -55,6 +55,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
55
55
|
exports.newGameTx = newGameTx;
|
|
56
56
|
exports.playGuessTx = playGuessTx;
|
|
57
57
|
exports.newGamePlayGuessTx = newGamePlayGuessTx;
|
|
58
|
+
exports.playTx = playTx;
|
|
58
59
|
exports.getConsumeExpCoinStakedTx = getConsumeExpCoinStakedTx;
|
|
59
60
|
exports.getConsumeExpCoinUnstakedTx = getConsumeExpCoinUnstakedTx;
|
|
60
61
|
var utils_1 = require("../../src/utils");
|
|
@@ -193,6 +194,77 @@ function newGamePlayGuessTx(config, tx, input) {
|
|
|
193
194
|
});
|
|
194
195
|
});
|
|
195
196
|
}
|
|
197
|
+
/**
|
|
198
|
+
entry fun play<TOKEN>( // combo_dice
|
|
199
|
+
registry: &mut Registry,
|
|
200
|
+
exp_registry: &mut ExpRegistry,
|
|
201
|
+
index: u64,
|
|
202
|
+
coin: Coin<TOKEN>,
|
|
203
|
+
guess_1: u64,
|
|
204
|
+
larger_than_1: bool,
|
|
205
|
+
guess_2: u64,
|
|
206
|
+
larger_than_2: bool,
|
|
207
|
+
random: &Random,
|
|
208
|
+
ctx: &mut TxContext
|
|
209
|
+
) {
|
|
210
|
+
entry fun play<TOKEN>( // tails_exp
|
|
211
|
+
registry: &mut Registry,
|
|
212
|
+
index: u64,
|
|
213
|
+
coin: Coin<TOKEN>,
|
|
214
|
+
guess_1: u64,
|
|
215
|
+
larger_than_1: bool,
|
|
216
|
+
guess_2: u64,
|
|
217
|
+
larger_than_2: bool,
|
|
218
|
+
random: &Random,
|
|
219
|
+
ctx: &mut TxContext
|
|
220
|
+
) {
|
|
221
|
+
*/
|
|
222
|
+
function playTx(config, tx, input) {
|
|
223
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
224
|
+
var registry, coin;
|
|
225
|
+
return __generator(this, function (_a) {
|
|
226
|
+
registry = "";
|
|
227
|
+
switch (input.module) {
|
|
228
|
+
case "tails_exp":
|
|
229
|
+
registry = config.registry.dice.tailsExp;
|
|
230
|
+
break;
|
|
231
|
+
case "combo_dice":
|
|
232
|
+
registry = config.registry.dice.comboDice;
|
|
233
|
+
break;
|
|
234
|
+
default:
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
237
|
+
coin = (0, utils_1.splitCoins)(tx, input.typeArguments[0], input.coins, input.amount);
|
|
238
|
+
tx.moveCall({
|
|
239
|
+
target: "".concat(config.package.dice, "::").concat(input.module, "::play"),
|
|
240
|
+
typeArguments: input.typeArguments,
|
|
241
|
+
arguments: input.module == "combo_dice"
|
|
242
|
+
? [
|
|
243
|
+
tx.object(config.registry.dice.comboDice),
|
|
244
|
+
tx.object(config.registry.dice.tailsExp),
|
|
245
|
+
tx.pure.u64(input.index),
|
|
246
|
+
tx.object(coin),
|
|
247
|
+
tx.pure.u64(input.guess_1),
|
|
248
|
+
tx.pure.bool(input.larger_than_1),
|
|
249
|
+
tx.pure.u64(input.guess_2),
|
|
250
|
+
tx.pure.bool(input.larger_than_2),
|
|
251
|
+
tx.object("0x8"),
|
|
252
|
+
]
|
|
253
|
+
: [
|
|
254
|
+
tx.object(config.registry.dice.tailsExp),
|
|
255
|
+
tx.pure.u64(input.index),
|
|
256
|
+
tx.object(coin),
|
|
257
|
+
tx.pure.u64(input.guess_1),
|
|
258
|
+
tx.pure.bool(input.larger_than_1),
|
|
259
|
+
tx.pure.u64(input.guess_2),
|
|
260
|
+
tx.pure.bool(input.larger_than_2),
|
|
261
|
+
tx.object("0x8"),
|
|
262
|
+
],
|
|
263
|
+
});
|
|
264
|
+
return [2 /*return*/, tx];
|
|
265
|
+
});
|
|
266
|
+
});
|
|
267
|
+
}
|
|
196
268
|
/**
|
|
197
269
|
public fun consume_exp_coin_staked(
|
|
198
270
|
registry: &mut Registry,
|
|
@@ -345,7 +345,9 @@ function getAccumulatedUser() {
|
|
|
345
345
|
}
|
|
346
346
|
finally { if (e_1) throw e_1.error; }
|
|
347
347
|
return [7 /*endfinally*/];
|
|
348
|
-
case 9:
|
|
348
|
+
case 9:
|
|
349
|
+
// console.log(result);
|
|
350
|
+
return [2 /*return*/, result];
|
|
349
351
|
}
|
|
350
352
|
});
|
|
351
353
|
});
|
|
@@ -410,7 +412,7 @@ function getAccumulatedNotionalVolumeUSD() {
|
|
|
410
412
|
return [4 /*yield*/, response.json()];
|
|
411
413
|
case 4:
|
|
412
414
|
data = _b.sent();
|
|
413
|
-
console.log(data.results[0]);
|
|
415
|
+
// console.log(data.results[0]);
|
|
414
416
|
result.push(data.results[0].matrix.samples[0].values[0].value);
|
|
415
417
|
_b.label = 5;
|
|
416
418
|
case 5:
|
|
@@ -427,7 +429,9 @@ function getAccumulatedNotionalVolumeUSD() {
|
|
|
427
429
|
}
|
|
428
430
|
finally { if (e_2) throw e_2.error; }
|
|
429
431
|
return [7 /*endfinally*/];
|
|
430
|
-
case 9:
|
|
432
|
+
case 9:
|
|
433
|
+
// console.log(result);
|
|
434
|
+
return [2 /*return*/, result];
|
|
431
435
|
}
|
|
432
436
|
});
|
|
433
437
|
});
|
|
@@ -485,3 +489,5 @@ function getSafuAccumulatedRewardGeneratedUSD() {
|
|
|
485
489
|
});
|
|
486
490
|
});
|
|
487
491
|
}
|
|
492
|
+
// getAccumulatedNotionalVolumeUSD();
|
|
493
|
+
// getAccumulatedUser();
|
|
@@ -58,7 +58,7 @@ function getVaultHistorySummary(startTimestamp) {
|
|
|
58
58
|
}
|
|
59
59
|
requestData = {
|
|
60
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 (
|
|
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 safu_otc_aggregated AS (\n SELECT\n index,\n round,\n AVG(delivery_price) AS delivery_price,\n SUM(delivery_size) AS delivery_size,\n SUM(bidder_bid_value) AS bidder_bid_value\n FROM SafuOtc\n GROUP BY index, round\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 (safu_otc_aggregated.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 safu_otc_aggregated.delivery_size as OtcSize,\n safu_otc_aggregated.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 safu_otc_aggregated.bidder_bid_value as OtcPremium,\n (Delivery.bidder_bid_value + Delivery.incentive_bid_value + safu_otc_aggregated.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 safu_otc_aggregated ON Settle.index = safu_otc_aggregated.index AND Settle.round = safu_otc_aggregated.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
62
|
size: 1000,
|
|
63
63
|
},
|
|
64
64
|
};
|
|
@@ -95,7 +95,7 @@ function getFilledSummary(startTimestamp) {
|
|
|
95
95
|
}
|
|
96
96
|
requestData = {
|
|
97
97
|
sqlQuery: {
|
|
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 (
|
|
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 safu_otc_aggregated AS (\n SELECT\n index,\n round,\n AVG(delivery_price) AS delivery_price,\n SUM(delivery_size) AS delivery_size,\n SUM(bidder_bid_value) AS bidder_bid_value\n FROM SafuOtc\n GROUP BY index, round\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 (safu_otc_aggregated.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 safu_otc_aggregated.delivery_size as OtcSize,\n safu_otc_aggregated.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 safu_otc_aggregated.bidder_bid_value as OtcPremium,\n (Delivery.bidder_bid_value + Delivery.incentive_bid_value + safu_otc_aggregated.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 safu_otc_aggregated ON Delivery.index = safu_otc_aggregated.index AND Delivery.round = safu_otc_aggregated.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 "),
|
|
99
99
|
size: 1000,
|
|
100
100
|
},
|
|
101
101
|
};
|
|
@@ -127,7 +127,7 @@ function getVaultHistory(index_1) {
|
|
|
127
127
|
apiUrl = "https://app.sentio.xyz/api/v1/analytics/typus/typus_v2/sql/execute";
|
|
128
128
|
requestData = {
|
|
129
129
|
sqlQuery: {
|
|
130
|
-
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 token.prices\n GROUP BY\n symbol, hour\n )\n\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 Activate.deposit_balance as DepositAmount,\n DepositAmount * Settle.price_d_token as DepositAmountUSD,\n Delivery.max_size as MaxSize,\n (
|
|
130
|
+
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 token.prices\n GROUP BY\n symbol, hour\n ),\n safu_otc_aggregated AS (\n SELECT\n index,\n round,\n AVG(delivery_price) AS delivery_price,\n SUM(delivery_size) AS delivery_size,\n SUM(bidder_bid_value) AS bidder_bid_value\n FROM SafuOtc\n GROUP BY index, round\n )\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 Activate.deposit_balance as DepositAmount,\n DepositAmount * Settle.price_d_token as DepositAmountUSD,\n Delivery.max_size as MaxSize,\n (safu_otc_aggregated.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 safu_otc_aggregated.delivery_size as OtcSize,\n safu_otc_aggregated.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 safu_otc_aggregated.bidder_bid_value as OtcPremium,\n (Delivery.bidder_bid_value + Delivery.incentive_bid_value + safu_otc_aggregated.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 (Settle.settle_balance - Settle.settled_balance) 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 safu_otc_aggregated ON Settle.index = safu_otc_aggregated.index AND Settle.round = safu_otc_aggregated.round\n -- LEFT JOIN hourly_price_table ON LOWER(Settle.d_token) = hourly_price_table.symbol AND toStartOfHour(Settle.timestamp) = hourly_price_table.hour\n LEFT JOIN hourly_price_table ON 'sui' = hourly_price_table.symbol AND toStartOfHour(Settle.timestamp) = hourly_price_table.hour\n WHERE Settle.index = ".concat(index, "\n ORDER BY ActivationDate DESC;\n "),
|
|
131
131
|
size: limit,
|
|
132
132
|
},
|
|
133
133
|
};
|
|
@@ -55,6 +55,7 @@ exports.priceInfoObjectIds = {
|
|
|
55
55
|
CETUS: "0xb0ba78106259b7ceefd288edc5f65b65f8b7bca0816e61dae5136616aac7d3da",
|
|
56
56
|
NAVX: "0x94905bdcaa656b0908aa8a3a42cf72b0e8e2e849f7d0a7e0e39bb9e1dc3c9cf6",
|
|
57
57
|
SCA: "0xf96e3c4b7d74efbde9df5b669188421196e6164adf6fbaaa92903c42569807c8",
|
|
58
|
+
TURBOS: "0xfe38289883c3afed692e5856f4896b3e094d4793e2ccf0a2715b890a718fa5c0",
|
|
58
59
|
},
|
|
59
60
|
};
|
|
60
61
|
// Get the state IDs of the Pyth and Wormhole contracts from
|