@sonarwatch/portfolio-plugins 0.11.97 → 0.11.99
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +1095 -1087
- package/README.md +3 -3
- package/package.json +3 -3
- package/src/plugins/01/depostisFetcher.js +2 -1
- package/src/plugins/01/depostisFetcher.js.map +1 -1
- package/src/plugins/aave/helpers.js +2 -1
- package/src/plugins/aave/helpers.js.map +1 -1
- package/src/plugins/aftermath/poolsJob.js +22 -20
- package/src/plugins/aftermath/poolsJob.js.map +1 -1
- package/src/plugins/aptin/depositsFetcher.js +2 -1
- package/src/plugins/aptin/depositsFetcher.js.map +1 -1
- package/src/plugins/aries/depositsFetcher.js +2 -1
- package/src/plugins/aries/depositsFetcher.js.map +1 -1
- package/src/plugins/aurory/helpers.d.ts +1 -1
- package/src/plugins/aurory/helpers.js +1 -12
- package/src/plugins/aurory/helpers.js.map +1 -1
- package/src/plugins/aurory/stakingFetcher.js +1 -1
- package/src/plugins/aurory/stakingFetcher.js.map +1 -1
- package/src/plugins/balancer/helpers/pools.js +21 -21
- package/src/plugins/bucket/collateralFetcher.js +7 -9
- package/src/plugins/bucket/collateralFetcher.js.map +1 -1
- package/src/plugins/cetus/clmmsFetcher.js +5 -5
- package/src/plugins/cetus/clmmsFetcher.js.map +1 -1
- package/src/plugins/cetus/helpers.d.ts +4 -4
- package/src/plugins/cetus/helpers.js +23 -12
- package/src/plugins/cetus/helpers.js.map +1 -1
- package/src/plugins/cetus/poolsJob.js +5 -10
- package/src/plugins/cetus/poolsJob.js.map +1 -1
- package/src/plugins/compound/getPositionsV2Fetcher.js +2 -1
- package/src/plugins/compound/getPositionsV2Fetcher.js.map +1 -1
- package/src/plugins/compound/getPositionsV3Fetcher.js +2 -1
- package/src/plugins/compound/getPositionsV3Fetcher.js.map +1 -1
- package/src/plugins/drift/deposits.js +2 -1
- package/src/plugins/drift/deposits.js.map +1 -1
- package/src/plugins/flash/perpetualFetcher.js +2 -1
- package/src/plugins/flash/perpetualFetcher.js.map +1 -1
- package/src/plugins/flowmatic/stakingFetcher.js +2 -0
- package/src/plugins/flowmatic/stakingFetcher.js.map +1 -1
- package/src/plugins/genesysgo/stakingFetcher.js +2 -0
- package/src/plugins/genesysgo/stakingFetcher.js.map +1 -1
- package/src/plugins/jupiter/perpetualFetcher.js +2 -1
- package/src/plugins/jupiter/perpetualFetcher.js.map +1 -1
- package/src/plugins/kamino/lendsFetcher.js +6 -3
- package/src/plugins/kamino/lendsFetcher.js.map +1 -1
- package/src/plugins/maker/vaultsFetcher.js +2 -1
- package/src/plugins/maker/vaultsFetcher.js.map +1 -1
- package/src/plugins/mango/boostFetcher.js +2 -1
- package/src/plugins/mango/boostFetcher.js.map +1 -1
- package/src/plugins/mango/collateralFetcher.js +2 -1
- package/src/plugins/mango/collateralFetcher.js.map +1 -1
- package/src/plugins/mango/redeemFetcher.js +2 -1
- package/src/plugins/mango/redeemFetcher.js.map +1 -1
- package/src/plugins/maple/ethereumFetcher.js +2 -1
- package/src/plugins/maple/ethereumFetcher.js.map +1 -1
- package/src/plugins/marginfi/fetcherExecutor.js +2 -1
- package/src/plugins/marginfi/fetcherExecutor.js.map +1 -1
- package/src/plugins/morpho/aaveV3CollateralFetcher.js +2 -1
- package/src/plugins/morpho/aaveV3CollateralFetcher.js.map +1 -1
- package/src/plugins/navi/collateralFetcher.js +10 -8
- package/src/plugins/navi/collateralFetcher.js.map +1 -1
- package/src/plugins/navi/reservesJob.js +5 -4
- package/src/plugins/navi/reservesJob.js.map +1 -1
- package/src/plugins/port/obligationsFetcher.js +2 -1
- package/src/plugins/port/obligationsFetcher.js.map +1 -1
- package/src/plugins/scallop/helpers.d.ts +0 -49
- package/src/plugins/scallop/helpers.js +1 -39
- package/src/plugins/scallop/helpers.js.map +1 -1
- package/src/plugins/scallop/lendingsFetcher.js +19 -15
- package/src/plugins/scallop/lendingsFetcher.js.map +1 -1
- package/src/plugins/scallop/marketJob.js +16 -16
- package/src/plugins/scallop/marketJob.js.map +1 -1
- package/src/plugins/scallop/obligationsFetcher.js +27 -22
- package/src/plugins/scallop/obligationsFetcher.js.map +1 -1
- package/src/plugins/scallop/poolsJob.js +7 -12
- package/src/plugins/scallop/poolsJob.js.map +1 -1
- package/src/plugins/scallop/spoolsMarketJob.js +8 -15
- package/src/plugins/scallop/spoolsMarketJob.js.map +1 -1
- package/src/plugins/scallop/types/coin.d.ts +1 -1
- package/src/plugins/scallop/types/market.d.ts +3 -4
- package/src/plugins/scallop/types/market.js.map +1 -1
- package/src/plugins/solend/obligationsFetcher.js +2 -1
- package/src/plugins/solend/obligationsFetcher.js.map +1 -1
- package/src/plugins/sushiswap/helpers.js +24 -24
- package/src/plugins/thala/vaultsFetcher.js +2 -1
- package/src/plugins/thala/vaultsFetcher.js.map +1 -1
- package/src/plugins/tokens/fetchers/sui-nfts.js +47 -107
- package/src/plugins/tokens/fetchers/sui-nfts.js.map +1 -1
- package/src/plugins/tokens/types.d.ts +0 -48
- package/src/plugins/turbos/clmmsPositionsFetcher.js +18 -16
- package/src/plugins/turbos/clmmsPositionsFetcher.js.map +1 -1
- package/src/plugins/turbos/helper.d.ts +3 -3
- package/src/plugins/turbos/helper.js +6 -4
- package/src/plugins/turbos/helper.js.map +1 -1
- package/src/plugins/turbos/poolsJob.js +10 -10
- package/src/plugins/turbos/poolsJob.js.map +1 -1
- package/src/plugins/uniswap-v2/helpers.js +22 -22
- package/src/utils/clients/getClientSui.d.ts +2 -2
- package/src/utils/clients/getClientSui.js +8 -3
- package/src/utils/clients/getClientSui.js.map +1 -1
- package/src/utils/clients/types.d.ts +2 -0
- package/src/utils/sei/constants.js +8 -8
- package/src/utils/sei/getQueryBalanceByOwner.js +4 -4
- package/src/utils/sui/getDynamicFieldObject.d.ts +4 -0
- package/src/utils/sui/{getMultipleObjectsSafe.js → getDynamicFieldObject.js} +9 -13
- package/src/utils/sui/getDynamicFieldObject.js.map +1 -0
- package/src/utils/sui/getDynamicFields.d.ts +3 -0
- package/src/utils/sui/getDynamicFields.js +38 -0
- package/src/utils/sui/getDynamicFields.js.map +1 -0
- package/src/utils/sui/getObject.d.ts +4 -0
- package/src/utils/sui/{getDynamicFieldsSafe.js → getObject.js} +8 -16
- package/src/utils/sui/getObject.js.map +1 -0
- package/src/utils/sui/getObjectDeletedResponse.d.ts +3 -0
- package/src/utils/sui/getObjectDeletedResponse.js +19 -0
- package/src/utils/sui/getObjectDeletedResponse.js.map +1 -0
- package/src/utils/sui/getObjectNotExistsResponse.d.ts +2 -0
- package/src/utils/sui/getObjectNotExistsResponse.js +14 -0
- package/src/utils/sui/getObjectNotExistsResponse.js.map +1 -0
- package/src/utils/sui/getOwnedObjects.d.ts +4 -0
- package/src/utils/sui/getOwnedObjects.js +36 -0
- package/src/utils/sui/getOwnedObjects.js.map +1 -0
- package/src/utils/sui/multiGetObjects.d.ts +4 -0
- package/src/utils/sui/multiGetObjects.js +32 -0
- package/src/utils/sui/multiGetObjects.js.map +1 -0
- package/src/utils/sui/queryEvents.d.ts +4 -0
- package/src/utils/sui/{queryEventSafe.js → queryEvents.js} +16 -12
- package/src/utils/sui/queryEvents.js.map +1 -0
- package/src/utils/sui/structs/kiosk.d.ts +7 -0
- package/src/utils/sui/structs/kiosk.js +3 -0
- package/src/utils/sui/structs/kiosk.js.map +1 -0
- package/src/utils/sui/structs/nft.d.ts +41 -0
- package/src/utils/sui/structs/nft.js +3 -0
- package/src/utils/sui/structs/nft.js.map +1 -0
- package/src/utils/sui/types.d.ts +23 -0
- package/src/utils/sui/types.js +3 -0
- package/src/utils/sui/types.js.map +1 -0
- package/src/utils/sui/getDynamicFieldsSafe.d.ts +0 -13
- package/src/utils/sui/getDynamicFieldsSafe.js.map +0 -1
- package/src/utils/sui/getFormattedCollectionNameAndId.d.ts +0 -4
- package/src/utils/sui/getFormattedCollectionNameAndId.js +0 -19
- package/src/utils/sui/getFormattedCollectionNameAndId.js.map +0 -1
- package/src/utils/sui/getMultipleObjectsSafe.d.ts +0 -67
- package/src/utils/sui/getMultipleObjectsSafe.js.map +0 -1
- package/src/utils/sui/queryEventSafe.d.ts +0 -14
- package/src/utils/sui/queryEventSafe.js.map +0 -1
@@ -13,13 +13,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
13
|
};
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
15
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
16
|
-
const
|
16
|
+
const utils_1 = require("@mysten/sui.js/utils");
|
17
17
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
18
18
|
const constants_1 = require("./constants");
|
19
|
-
const helpers_1 = require("./helpers");
|
20
19
|
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
20
|
+
const getOwnedObjects_1 = require("../../utils/sui/getOwnedObjects");
|
21
|
+
const clients_1 = require("../../utils/clients");
|
21
22
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
22
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
23
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
23
24
|
const elements = [];
|
24
25
|
const borrowedAssets = [];
|
25
26
|
const borrowedYields = [];
|
@@ -35,6 +36,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
35
36
|
const poolValues = Object.values(pools);
|
36
37
|
if (poolValues.length === 0)
|
37
38
|
return [];
|
39
|
+
const client = (0, clients_1.getClientSui)();
|
38
40
|
const filterOwnerObject = {
|
39
41
|
MatchAny: [
|
40
42
|
...poolValues.map((value) => ({
|
@@ -46,7 +48,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
46
48
|
],
|
47
49
|
};
|
48
50
|
const [allOwnedObjects, marketData, spoolData] = yield Promise.all([
|
49
|
-
(0,
|
51
|
+
(0, getOwnedObjects_1.getOwnedObjects)(client, owner, { filter: filterOwnerObject }),
|
50
52
|
cache.getItem(constants_1.marketKey, {
|
51
53
|
prefix: constants_1.marketPrefix,
|
52
54
|
networkId: portfolio_core_1.NetworkId.sui,
|
@@ -73,14 +75,15 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
73
75
|
const lendingAssets = {};
|
74
76
|
const stakedAccount = {};
|
75
77
|
for (const ownedMarketCoin of allOwnedObjects) {
|
76
|
-
const objType = (0
|
78
|
+
const objType = (_a = ownedMarketCoin.data) === null || _a === void 0 ? void 0 : _a.type;
|
77
79
|
if (!objType)
|
78
80
|
continue;
|
79
|
-
const parsed = (0,
|
80
|
-
const coinType = (0,
|
81
|
-
|
82
|
-
const
|
83
|
-
|
81
|
+
const parsed = (0, utils_1.parseStructTag)(objType);
|
82
|
+
const coinType = (0, utils_1.normalizeStructTag)(objType.substring(objType.indexOf('MarketCoin<') + 11, objType.indexOf('>')));
|
83
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
84
|
+
const fields = (_c = (_b = ownedMarketCoin.data) === null || _b === void 0 ? void 0 : _b.content) === null || _c === void 0 ? void 0 : _c.fields;
|
85
|
+
const coinName = (_e = (_d = poolValues
|
86
|
+
.find((value) => value.coinType === coinType)) === null || _d === void 0 ? void 0 : _d.metadata) === null || _e === void 0 ? void 0 : _e.symbol.toLowerCase();
|
84
87
|
if (!coinName || !fields)
|
85
88
|
continue;
|
86
89
|
if (!lendingAssets[coinName]) {
|
@@ -96,7 +99,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
96
99
|
stakes: fields['stakes'],
|
97
100
|
});
|
98
101
|
}
|
99
|
-
const balance = (0, bignumber_js_1.default)((
|
102
|
+
const balance = (0, bignumber_js_1.default)((_f = (parsed.name === 'Coin' ? fields['balance'] : fields['stakes'])) !== null && _f !== void 0 ? _f : 0);
|
100
103
|
lendingAssets[coinName] = Object.assign(Object.assign({}, lendingAssets[coinName]), { amount: lendingAssets[coinName].amount.plus(balance) });
|
101
104
|
}
|
102
105
|
let pendingReward = (0, bignumber_js_1.default)(0);
|
@@ -124,7 +127,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
124
127
|
});
|
125
128
|
if (pendingReward.isGreaterThan(0)) {
|
126
129
|
const pendingRewardAmount = pendingReward
|
127
|
-
.shiftedBy(-1 * ((
|
130
|
+
.shiftedBy(-1 * ((_j = (_h = (_g = pools['sui']) === null || _g === void 0 ? void 0 : _g.metadata) === null || _h === void 0 ? void 0 : _h.decimals) !== null && _j !== void 0 ? _j : 0))
|
128
131
|
.toNumber();
|
129
132
|
const rewardTokenAddress = (0, portfolio_core_1.formatMoveTokenAddress)(pools['sui'].coinType);
|
130
133
|
const rewardTokenPrice = tokenPrices.get(rewardTokenAddress);
|
@@ -140,8 +143,8 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
140
143
|
const addressMove = (0, portfolio_core_1.formatMoveTokenAddress)(assetValue.coinType);
|
141
144
|
const tokenPrice = tokenPrices.get(addressMove);
|
142
145
|
const lendingAmount = assetValue.amount
|
143
|
-
.multipliedBy((
|
144
|
-
.shiftedBy(-1 * ((
|
146
|
+
.multipliedBy((_k = lendingRate.get(assetName)) !== null && _k !== void 0 ? _k : 0)
|
147
|
+
.shiftedBy(-1 * ((_o = (_m = (_l = pools[assetName]) === null || _l === void 0 ? void 0 : _l.metadata) === null || _m === void 0 ? void 0 : _m.decimals) !== null && _o !== void 0 ? _o : 0))
|
145
148
|
.toNumber();
|
146
149
|
const assetToken = (0, tokenPriceToAssetToken_1.default)(addressMove, lendingAmount, portfolio_core_1.NetworkId.sui, tokenPrice);
|
147
150
|
suppliedYields.push([
|
@@ -156,7 +159,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
156
159
|
borrowedAssets.length === 0 &&
|
157
160
|
rewardAssets.length === 0)
|
158
161
|
return [];
|
159
|
-
const { borrowedValue, healthRatio, suppliedValue, value } = (0, portfolio_core_1.getElementLendingValues)(suppliedAssets, borrowedAssets, rewardAssets);
|
162
|
+
const { borrowedValue, healthRatio, suppliedValue, value, rewardValue } = (0, portfolio_core_1.getElementLendingValues)(suppliedAssets, borrowedAssets, rewardAssets);
|
160
163
|
elements.push({
|
161
164
|
type: portfolio_core_1.PortfolioElementType.borrowlend,
|
162
165
|
networkId: portfolio_core_1.NetworkId.sui,
|
@@ -173,6 +176,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
173
176
|
collateralRatio: null,
|
174
177
|
healthRatio,
|
175
178
|
rewardAssets,
|
179
|
+
rewardValue,
|
176
180
|
value,
|
177
181
|
},
|
178
182
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"lendingsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/scallop/lendingsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAUoC;AACpC,
|
1
|
+
{"version":3,"file":"lendingsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/scallop/lendingsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAUoC;AACpC,gDAA0E;AAC1E,gEAAqC;AAIrC,2CAWqB;AACrB,qGAA6E;AAQ7E,qEAAkE;AAClE,iDAAmD;AAEnD,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;;IACtE,MAAM,QAAQ,GAAuB,EAAE,CAAC;IACxC,MAAM,cAAc,GAAqB,EAAE,CAAC;IAC5C,MAAM,cAAc,GAAc,EAAE,CAAC;IACrC,MAAM,cAAc,GAAqB,EAAE,CAAC;IAC5C,MAAM,cAAc,GAAc,EAAE,CAAC;IACrC,MAAM,YAAY,GAAqB,EAAE,CAAC;IAE1C,MAAM,KAAK,GAAG,MAAM,KAAK,CAAC,OAAO,CAAQ,oBAAQ,EAAE;QACjD,MAAM,EAAE,uBAAW;QACnB,SAAS,EAAE,0BAAS,CAAC,GAAG;KACzB,CAAC,CAAC;IAEH,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE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QAEF,cAAc,CAAC,IAAI,CAAC;YAClB;gBACE,GAAG,EAAE,IAAA,yBAAQ,EAAC,MAAM,CAAC,kBAAkB,CAAC;gBACxC,GAAG,EAAE,MAAM,CAAC,kBAAkB;aAC/B;SACF,CAAC,CAAC;QACH,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAClC,CAAC;IACD,IACE,cAAc,CAAC,MAAM,KAAK,CAAC;QAC3B,cAAc,CAAC,MAAM,KAAK,CAAC;QAC3B,YAAY,CAAC,MAAM,KAAK,CAAC;QAEzB,OAAO,EAAE,CAAC;IACZ,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,KAAK,EAAE,WAAW,EAAE,GACrE,IAAA,wCAAuB,EAAC,cAAc,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC;IACxE,QAAQ,CAAC,IAAI,CAAC;QACZ,IAAI,EAAE,qCAAoB,CAAC,UAAU;QACrC,SAAS,EAAE,0BAAS,CAAC,GAAG;QACxB,UAAU,EAAV,sBAAU;QACV,KAAK,EAAE,SAAS;QAChB,KAAK;QACL,IAAI,EAAE;YACJ,cAAc;YACd,aAAa;YACb,cAAc;YACd,cAAc;YACd,aAAa;YACb,cAAc;YACd,eAAe,EAAE,IAAI;YACrB,WAAW;YACX,YAAY;YACZ,WAAW;YACX,KAAK;SACN;KACF,CAAC,CAAC;IACH,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,WAAW;IAC5B,SAAS,EAAE,0BAAS,CAAC,GAAG;IACxB,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -13,13 +13,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
13
|
};
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
15
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
16
|
-
const sui_js_1 = require("@mysten/sui.js");
|
17
16
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
18
17
|
const clients_1 = require("../../utils/clients");
|
19
18
|
const constants_1 = require("./constants");
|
20
19
|
const runInBatch_1 = __importDefault(require("../../utils/misc/runInBatch"));
|
20
|
+
const getObject_1 = require("../../utils/sui/getObject");
|
21
|
+
const getDynamicFieldObject_1 = require("../../utils/sui/getDynamicFieldObject");
|
21
22
|
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
22
|
-
var _a, _b;
|
23
|
+
var _a, _b, _c, _d, _e, _f;
|
23
24
|
const client = (0, clients_1.getClientSui)();
|
24
25
|
const addressData = yield cache.getItem(constants_1.addressKey, {
|
25
26
|
prefix: constants_1.addressPrefix,
|
@@ -36,18 +37,16 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
36
37
|
return;
|
37
38
|
const marketId = addressData.mainnet.core.market;
|
38
39
|
// get market data
|
39
|
-
const marketObject = yield
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
},
|
44
|
-
});
|
45
|
-
const marketData = (0, sui_js_1.getObjectFields)(marketObject);
|
40
|
+
const marketObject = yield (0, getObject_1.getObject)(client, marketId);
|
41
|
+
const marketData = (_b = (_a = marketObject.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.fields;
|
42
|
+
if (!marketData)
|
43
|
+
return;
|
46
44
|
// get balance sheet
|
47
45
|
const balanceSheets = {};
|
48
46
|
const balanceSheetParentId = marketData.vault.fields.balance_sheets.fields.table.fields.id.id;
|
49
47
|
const balanceSheetPromises = Object.keys(pools).map((coinName) => () => __awaiter(void 0, void 0, void 0, function* () {
|
50
|
-
|
48
|
+
var _g, _h;
|
49
|
+
balanceSheets[coinName] = (_h = (_g = (yield (0, getDynamicFieldObject_1.getDynamicFieldObject)(client, {
|
51
50
|
parentId: balanceSheetParentId,
|
52
51
|
name: {
|
53
52
|
type: '0x1::type_name::TypeName',
|
@@ -55,14 +54,15 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
55
54
|
name: pools[coinName].coinType.substring(2),
|
56
55
|
},
|
57
56
|
},
|
58
|
-
}));
|
57
|
+
})).data) === null || _g === void 0 ? void 0 : _g.content) === null || _h === void 0 ? void 0 : _h.fields;
|
59
58
|
}));
|
60
59
|
yield (0, runInBatch_1.default)(balanceSheetPromises, 5);
|
61
60
|
// get borrow indexes
|
62
61
|
const borrowIndexes = {};
|
63
62
|
const borrowIndexesParentId = marketData.borrow_dynamics.fields.table.fields.id.id;
|
64
63
|
const borrowIndexesPromises = Object.keys(pools).map((coinName) => () => __awaiter(void 0, void 0, void 0, function* () {
|
65
|
-
|
64
|
+
var _j, _k;
|
65
|
+
borrowIndexes[coinName] = (_k = (_j = (yield (0, getDynamicFieldObject_1.getDynamicFieldObject)(client, {
|
66
66
|
parentId: borrowIndexesParentId,
|
67
67
|
name: {
|
68
68
|
type: '0x1::type_name::TypeName',
|
@@ -70,14 +70,14 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
70
70
|
name: pools[coinName].coinType.substring(2),
|
71
71
|
},
|
72
72
|
},
|
73
|
-
}));
|
73
|
+
})).data) === null || _j === void 0 ? void 0 : _j.content) === null || _k === void 0 ? void 0 : _k.fields;
|
74
74
|
}));
|
75
75
|
yield (0, runInBatch_1.default)(borrowIndexesPromises, 5);
|
76
76
|
// get interest models
|
77
77
|
const interestModels = {};
|
78
78
|
const interestModelsParentId = marketData.interest_models.fields.table.fields.id.id;
|
79
79
|
for (const coinName of Object.keys(pools)) {
|
80
|
-
interestModels[coinName] = (0,
|
80
|
+
interestModels[coinName] = (_d = (_c = (yield (0, getDynamicFieldObject_1.getDynamicFieldObject)(client, {
|
81
81
|
parentId: interestModelsParentId,
|
82
82
|
name: {
|
83
83
|
type: '0x1::type_name::TypeName',
|
@@ -85,7 +85,7 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
85
85
|
name: pools[coinName].coinType.substring(2),
|
86
86
|
},
|
87
87
|
},
|
88
|
-
}));
|
88
|
+
})).data) === null || _c === void 0 ? void 0 : _c.content) === null || _d === void 0 ? void 0 : _d.fields;
|
89
89
|
}
|
90
90
|
const market = {};
|
91
91
|
const borrowYearFactor = 24 * 365 * 3600;
|
@@ -135,7 +135,7 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
135
135
|
supplyRate = supplyRate.isFinite() ? supplyRate : (0, bignumber_js_1.default)(0);
|
136
136
|
market[asset] = {
|
137
137
|
coin: asset,
|
138
|
-
decimal: (
|
138
|
+
decimal: (_f = (_e = pools[asset].metadata) === null || _e === void 0 ? void 0 : _e.decimals) !== null && _f !== void 0 ? _f : 0,
|
139
139
|
coinType: pools[asset].coinType,
|
140
140
|
growthInterest: growthInterest.toNumber(),
|
141
141
|
borrowInterestRate: Math.min(calculatedBorrowRate, calculatedMaxBorrowRate),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"marketJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/scallop/marketJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,
|
1
|
+
{"version":3,"file":"marketJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/scallop/marketJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,gEAAqC;AAGrC,iDAAmD;AACnD,2CAOqB;AAarB,6EAAqD;AACrD,yDAAsD;AACtD,iFAA8E;AAE9E,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;;IACnD,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAE9B,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC,OAAO,CAAc,sBAAU,EAAE;QAC/D,MAAM,EAAE,yBAAa;QACrB,SAAS,EAAE,0BAAS,CAAC,GAAG;KACzB,CAAC,CAAC;IACH,IAAI,CAAC,WAAW;QAAE,OAAO;IAEzB,wB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AAM,KAAK,CAAC,OAAO,CAAC,qBAAS,EAAE,MAAM,EAAE;QACrC,MAAM,EAAN,wBAAM;QACN,SAAS,EAAE,0BAAS,CAAC,GAAG;KACzB,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,wBAAM;IACV,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AAEF,kBAAe,GAAG,CAAC"}
|
@@ -13,13 +13,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
13
|
};
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
15
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
16
|
-
const
|
16
|
+
const utils_1 = require("@mysten/sui.js/utils");
|
17
17
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
18
18
|
const constants_1 = require("./constants");
|
19
19
|
const helpers_1 = require("./helpers");
|
20
20
|
const clients_1 = require("../../utils/clients");
|
21
21
|
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
22
22
|
const runInBatch_1 = __importDefault(require("../../utils/misc/runInBatch"));
|
23
|
+
const getOwnedObjects_1 = require("../../utils/sui/getOwnedObjects");
|
24
|
+
const getObject_1 = require("../../utils/sui/getObject");
|
25
|
+
const getDynamicFieldObject_1 = require("../../utils/sui/getDynamicFieldObject");
|
23
26
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
24
27
|
var _a, _b, _c, _d, _e, _f;
|
25
28
|
const client = (0, clients_1.getClientSui)();
|
@@ -42,7 +45,9 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
42
45
|
],
|
43
46
|
};
|
44
47
|
const [ownedObligationKeys, marketData] = yield Promise.all([
|
45
|
-
(0,
|
48
|
+
(0, getOwnedObjects_1.getOwnedObjects)(client, owner, {
|
49
|
+
filter: filterOwnerObject,
|
50
|
+
}),
|
46
51
|
cache.getItem(constants_1.marketKey, {
|
47
52
|
prefix: constants_1.marketPrefix,
|
48
53
|
networkId: portfolio_core_1.NetworkId.sui,
|
@@ -52,7 +57,8 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
52
57
|
return [];
|
53
58
|
const userObligations = {};
|
54
59
|
const debtsAndCollateralCalculationPromises = ownedObligationKeys.map((obligationKey) => () => __awaiter(void 0, void 0, void 0, function* () {
|
55
|
-
|
60
|
+
var _g, _h, _j, _k;
|
61
|
+
const obligationKeyFields = (_h = (_g = obligationKey.data) === null || _g === void 0 ? void 0 : _g.content) === null || _h === void 0 ? void 0 : _h.fields;
|
56
62
|
if (!obligationKeyFields)
|
57
63
|
return;
|
58
64
|
const obligationId = obligationKeyFields.ownership.fields.of;
|
@@ -62,12 +68,8 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
62
68
|
debts: {},
|
63
69
|
};
|
64
70
|
}
|
65
|
-
const
|
66
|
-
|
67
|
-
options: {
|
68
|
-
showContent: true,
|
69
|
-
},
|
70
|
-
}));
|
71
|
+
const getObjectRes = yield (0, getObject_1.getObject)(client, obligationId);
|
72
|
+
const account = (_k = (_j = getObjectRes.data) === null || _j === void 0 ? void 0 : _j.content) === null || _k === void 0 ? void 0 : _k.fields;
|
71
73
|
if (!account)
|
72
74
|
return;
|
73
75
|
const accountCollateralsId = account.collaterals.fields.table.fields.id.id;
|
@@ -76,12 +78,12 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
76
78
|
const accountDebtsAssets = account.debts.fields.keys.fields.contents;
|
77
79
|
// get user collateral
|
78
80
|
const accountCollateralsAssetsPromises = accountCollateralsAssets.map(({ fields }) => () => __awaiter(void 0, void 0, void 0, function* () {
|
79
|
-
var
|
81
|
+
var _l, _m, _o;
|
80
82
|
if (!userObligations[obligationId].collaterals[fields.name]) {
|
81
83
|
userObligations[obligationId].collaterals[fields.name] =
|
82
84
|
(0, bignumber_js_1.default)(0);
|
83
85
|
}
|
84
|
-
const
|
86
|
+
const rAsset = yield (0, getDynamicFieldObject_1.getDynamicFieldObject)(client, {
|
85
87
|
parentId: accountCollateralsId,
|
86
88
|
name: {
|
87
89
|
type: '0x1::type_name::TypeName',
|
@@ -89,17 +91,18 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
89
91
|
name: fields.name,
|
90
92
|
},
|
91
93
|
},
|
92
|
-
})
|
94
|
+
});
|
95
|
+
const asset = (_m = (_l = rAsset.data) === null || _l === void 0 ? void 0 : _l.content) === null || _m === void 0 ? void 0 : _m.fields;
|
93
96
|
if (!asset)
|
94
97
|
return;
|
95
98
|
userObligations[obligationId].collaterals[fields.name] =
|
96
|
-
userObligations[obligationId].collaterals[fields.name].plus((0, bignumber_js_1.default)((
|
99
|
+
userObligations[obligationId].collaterals[fields.name].plus((0, bignumber_js_1.default)((_o = asset.value.fields.amount) !== null && _o !== void 0 ? _o : 0));
|
97
100
|
}));
|
98
101
|
// get user debt
|
99
102
|
const accountDebtsAssetsPromises = accountDebtsAssets.map(({ fields }) => () => __awaiter(void 0, void 0, void 0, function* () {
|
100
|
-
var
|
101
|
-
const coinName = (
|
102
|
-
.find((value) => value.coinType === (0,
|
103
|
+
var _p, _q, _r, _s, _t;
|
104
|
+
const coinName = (_q = (_p = ctmValues
|
105
|
+
.find((value) => value.coinType === (0, utils_1.normalizeStructTag)(fields.name))) === null || _p === void 0 ? void 0 : _p.metadata) === null || _q === void 0 ? void 0 : _q.symbol.toLowerCase();
|
103
106
|
if (!coinName)
|
104
107
|
return;
|
105
108
|
const market = marketData[coinName];
|
@@ -108,7 +111,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
108
111
|
if (!userObligations[obligationId].debts[fields.name]) {
|
109
112
|
userObligations[obligationId].debts[fields.name] = (0, bignumber_js_1.default)(0);
|
110
113
|
}
|
111
|
-
const
|
114
|
+
const rAsset = yield (0, getDynamicFieldObject_1.getDynamicFieldObject)(client, {
|
112
115
|
parentId: accountDebtsId,
|
113
116
|
name: {
|
114
117
|
type: '0x1::type_name::TypeName',
|
@@ -116,10 +119,11 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
116
119
|
name: fields.name,
|
117
120
|
},
|
118
121
|
},
|
119
|
-
})
|
122
|
+
});
|
123
|
+
const asset = (_s = (_r = rAsset.data) === null || _r === void 0 ? void 0 : _r.content) === null || _s === void 0 ? void 0 : _s.fields;
|
120
124
|
if (!asset)
|
121
125
|
return;
|
122
|
-
userObligations[obligationId].debts[fields.name] = userObligations[obligationId].debts[fields.name].plus((0, bignumber_js_1.default)((
|
126
|
+
userObligations[obligationId].debts[fields.name] = userObligations[obligationId].debts[fields.name].plus((0, bignumber_js_1.default)((_t = asset.value.fields.amount) !== null && _t !== void 0 ? _t : 0).multipliedBy(market.growthInterest + 1));
|
123
127
|
}));
|
124
128
|
yield Promise.all([
|
125
129
|
(0, runInBatch_1.default)(accountCollateralsAssetsPromises, 5),
|
@@ -142,14 +146,14 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
142
146
|
const suppliedYields = [];
|
143
147
|
const { collaterals, debts } = userObligations[account];
|
144
148
|
for (const coinType of Object.keys(collaterals)) {
|
145
|
-
const metadata = ctmValues.find((value) => value.coinType === (0,
|
149
|
+
const metadata = ctmValues.find((value) => value.coinType === (0, utils_1.normalizeStructTag)(coinType));
|
146
150
|
const address = (0, portfolio_core_1.formatMoveTokenAddress)(`0x${coinType}`);
|
147
151
|
suppliedAssets.push((0, tokenPriceToAssetToken_1.default)(address, collaterals[coinType]
|
148
152
|
.shiftedBy(-1 * ((_b = (_a = metadata === null || metadata === void 0 ? void 0 : metadata.metadata) === null || _a === void 0 ? void 0 : _a.decimals) !== null && _b !== void 0 ? _b : 0))
|
149
153
|
.toNumber(), portfolio_core_1.NetworkId.sui, tokenPrices.get(address)));
|
150
154
|
}
|
151
155
|
for (const coinType of Object.keys(debts)) {
|
152
|
-
const metadata = ctmValues.find((value) => value.coinType === (0,
|
156
|
+
const metadata = ctmValues.find((value) => value.coinType === (0, utils_1.normalizeStructTag)(coinType));
|
153
157
|
const coinName = (_d = (_c = metadata === null || metadata === void 0 ? void 0 : metadata.metadata) === null || _c === void 0 ? void 0 : _c.symbol.toLowerCase()) !== null && _d !== void 0 ? _d : '';
|
154
158
|
const market = marketData[coinName];
|
155
159
|
if (!market)
|
@@ -169,7 +173,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
169
173
|
borrowedAssets.length === 0 &&
|
170
174
|
rewardAssets.length === 0)
|
171
175
|
continue;
|
172
|
-
const { borrowedValue, healthRatio, suppliedValue, value } = (0, portfolio_core_1.getElementLendingValues)(suppliedAssets, borrowedAssets, rewardAssets);
|
176
|
+
const { borrowedValue, healthRatio, suppliedValue, value, rewardValue } = (0, portfolio_core_1.getElementLendingValues)(suppliedAssets, borrowedAssets, rewardAssets);
|
173
177
|
elements.push({
|
174
178
|
type: portfolio_core_1.PortfolioElementType.borrowlend,
|
175
179
|
networkId: portfolio_core_1.NetworkId.sui,
|
@@ -187,6 +191,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
187
191
|
collateralRatio: null,
|
188
192
|
healthRatio,
|
189
193
|
rewardAssets,
|
194
|
+
rewardValue,
|
190
195
|
value,
|
191
196
|
},
|
192
197
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"obligationsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/scallop/obligationsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAUoC;AACpC,
|
1
|
+
{"version":3,"file":"obligationsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/scallop/obligationsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAUoC;AACpC,gDAA0D;AAC1D,gEAAqC;AAIrC,2CAOqB;AAQrB,uCAA2C;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C,MAAM,KAAK,CAAC;YAC3B,YAAY,CAAC,MAAM,KAAK,CAAC;YAEzB,SAAS;QACX,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,KAAK,EAAE,WAAW,EAAE,GACrE,IAAA,wCAAuB,EAAC,cAAc,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC;QACxE,QAAQ,CAAC,IAAI,CAAC;YACZ,IAAI,EAAE,qCAAoB,CAAC,UAAU;YACrC,SAAS,EAAE,0BAAS,CAAC,GAAG;YACxB,UAAU,EAAV,sBAAU;YACV,KAAK,EAAE,SAAS;YAChB,IAAI,EAAE,GAAG,IAAA,wBAAc,EAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,cAAc;YACpD,KAAK;YACL,IAAI,EAAE;gBACJ,cAAc;gBACd,aAAa;gBACb,cAAc;gBACd,cAAc;gBACd,aAAa;gBACb,cAAc;gBACd,eAAe,EAAE,IAAI;gBACrB,WAAW;gBACX,YAAY;gBACZ,WAAW;gBACX,KAAK;aACN;SACF,CAAC,CAAC;IACL,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,cAAc;IAC/B,SAAS,EAAE,0BAAS,CAAC,GAAG;IACxB,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -9,14 +9,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
9
9
|
});
|
10
10
|
};
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
-
const sui_js_1 = require("@mysten/sui.js");
|
13
12
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
13
|
+
const utils_1 = require("@mysten/sui.js/utils");
|
14
14
|
const constants_1 = require("./constants");
|
15
15
|
const clients_1 = require("../../utils/clients");
|
16
|
-
const
|
16
|
+
const getObject_1 = require("../../utils/sui/getObject");
|
17
|
+
const SUI_TYPE = (0, utils_1.normalizeStructTag)(utils_1.SUI_TYPE_ARG);
|
17
18
|
const client = (0, clients_1.getClientSui)();
|
18
19
|
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
19
|
-
var _a;
|
20
|
+
var _a, _b, _c;
|
20
21
|
const address = yield cache.getItem(constants_1.addressKey, {
|
21
22
|
prefix: constants_1.addressPrefix,
|
22
23
|
networkId: portfolio_core_1.NetworkId.sui,
|
@@ -37,15 +38,9 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
37
38
|
};
|
38
39
|
}
|
39
40
|
else {
|
40
|
-
const object = yield
|
41
|
-
|
42
|
-
|
43
|
-
showType: true,
|
44
|
-
showContent: true,
|
45
|
-
},
|
46
|
-
});
|
47
|
-
const objType = (0, sui_js_1.normalizeStructTag)((_a = (0, sui_js_1.getObjectType)(object)) !== null && _a !== void 0 ? _a : '');
|
48
|
-
const objFields = (0, sui_js_1.getObjectFields)(object);
|
41
|
+
const object = yield (0, getObject_1.getObject)(client, detail.metaData);
|
42
|
+
const objType = (0, utils_1.normalizeStructTag)(((_a = object.data) === null || _a === void 0 ? void 0 : _a.type) || '');
|
43
|
+
const objFields = (_c = (_b = object.data) === null || _b === void 0 ? void 0 : _b.content) === null || _c === void 0 ? void 0 : _c.fields;
|
49
44
|
if (!objType || !objFields)
|
50
45
|
return;
|
51
46
|
coinTypes[coinName] = {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"poolsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/scallop/poolsJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA
|
1
|
+
{"version":3,"file":"poolsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/scallop/poolsJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAuD;AACvD,gDAAwE;AAIxE,2CAKqB;AAErB,iDAAmD;AACnD,yDAAsD;AAEtD,MAAM,QAAQ,GAAG,IAAA,0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,CAAC,IAAI,0CAAE,OAAO,0CAAE,MAAM,CAAC;YAC/C,IAAI,CAAC,OAAO,IAAI,CAAC,SAAS;gBAAE,OAAO;YACnC,SAAS,CAAC,QAAQ,CAAC,GAAG;gBACpB,QAAQ,EAAE,OAAO,CAAC,SAAS,CACzB,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EACxB,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CACrB;gBACD,QAAQ,EAAE,SAAS;aACpB,CAAC;QACJ,CAAC;IACH,CAAC;IAED,MAAM,KAAK,CAAC,OAAO,CAAC,oBAAQ,EAAE,SAAS,EAAE;QACvC,MAAM,EAAN,uBAAM;QACN,SAAS,EAAE,0BAAS,CAAC,GAAG;KACzB,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,uBAAM;IACV,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -13,12 +13,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
13
|
};
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
15
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
16
|
-
const sui_js_1 = require("@mysten/sui.js");
|
17
16
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
18
17
|
const constants_1 = require("./constants");
|
19
18
|
const clients_1 = require("../../utils/clients");
|
19
|
+
const getObject_1 = require("../../utils/sui/getObject");
|
20
20
|
const client = (0, clients_1.getClientSui)();
|
21
21
|
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
22
|
+
var _a, _b;
|
22
23
|
const address = yield cache.getItem(constants_1.addressKey, {
|
23
24
|
prefix: constants_1.addressPrefix,
|
24
25
|
networkId: portfolio_core_1.NetworkId.sui,
|
@@ -34,22 +35,14 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
34
35
|
continue;
|
35
36
|
const { id: poolId, rewardPoolId } = detail;
|
36
37
|
const [stakeObjectResponse, rewardObjectResponse] = yield Promise.all([
|
37
|
-
|
38
|
-
|
39
|
-
options: {
|
40
|
-
showContent: true,
|
41
|
-
},
|
42
|
-
}),
|
43
|
-
client.getObject({
|
44
|
-
id: rewardPoolId,
|
45
|
-
options: {
|
46
|
-
showContent: true,
|
47
|
-
},
|
48
|
-
}),
|
38
|
+
(0, getObject_1.getObject)(client, poolId),
|
39
|
+
(0, getObject_1.getObject)(client, rewardPoolId),
|
49
40
|
]);
|
50
41
|
if (stakeObjectResponse.data && rewardObjectResponse.data) {
|
51
|
-
|
52
|
-
const
|
42
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
43
|
+
const stakeFields = (_a = stakeObjectResponse.data.content) === null || _a === void 0 ? void 0 : _a.fields;
|
44
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
45
|
+
const rewardFields = (_b = rewardObjectResponse.data.content) === null || _b === void 0 ? void 0 : _b.fields;
|
53
46
|
if (!stakeFields || !rewardFields)
|
54
47
|
continue;
|
55
48
|
const staked = stakeFields['stakes'];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"spoolsMarketJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/scallop/spoolsMarketJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,
|
1
|
+
{"version":3,"file":"spoolsMarketJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/scallop/spoolsMarketJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,gEAAqC;AAGrC,2CAMqB;AAErB,iDAAmD;AACnD,yDAAsD;AAEtD,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;AAE9B,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;;IACnD,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,OAAO,CAA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AAC,MAAM,CAAC;oBACtB,CAAC,CAAC,IAAA,sBAAS,EAAC,CAAC,CAAC,CACjB;gBACD,uBAAuB,EAAE,MAAM,CAC7B,YAAY,CAAC,yBAAyB,CAAC,CACxC;gBACD,qBAAqB,EAAE,MAAM,CAC3B,YAAY,CAAC,2BAA2B,CAAC,CAC1C;aACF,CAAC;QACJ,CAAC;IACH,CAAC;IAED,MAAM,KAAK,CAAC,OAAO,CAAC,qBAAS,EAAE,eAAe,EAAE;QAC9C,MAAM,EAAN,wBAAM;QACN,SAAS,EAAE,0BAAS,CAAC,GAAG;KACzB,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,wBAAM;IACV,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { CoinMetadata } from '@mysten/sui.js';
|
1
|
+
import { CoinMetadata } from '@mysten/sui.js/client';
|
2
2
|
export declare const COIN_NAMES: readonly ["eth", "btc", "usdc", "usdt", "sui", "apt", "sol", "cetus"];
|
3
3
|
export declare const MARKET_COIN_NAMES: readonly ["seth", "sbtc", "susdc", "susdt", "ssui", "sapt", "ssol", "scetus"];
|
4
4
|
export declare const SUPPORTED_SPOOL_COIN_NAMES: readonly ["ssui", "susdc"];
|
@@ -1,14 +1,13 @@
|
|
1
|
-
import { ObjectContentFields } from '@mysten/sui.js';
|
2
1
|
import BigNumber from 'bignumber.js';
|
3
2
|
import { BasicField, IdField, WitTable } from './basic';
|
4
3
|
export type BalanceSheet = {
|
5
|
-
[k in string]?:
|
4
|
+
[k in string]?: any;
|
6
5
|
};
|
7
6
|
export type BorrowIndexes = {
|
8
|
-
[k in string]?:
|
7
|
+
[k in string]?: any;
|
9
8
|
};
|
10
9
|
export type InterestModel = {
|
11
|
-
[k in string]?:
|
10
|
+
[k in string]?: any;
|
12
11
|
};
|
13
12
|
export type InterestModelData = {
|
14
13
|
base_borrow_rate_per_sec: {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"market.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/scallop/types/market.ts"],"names":[],"mappings":";;
|
1
|
+
{"version":3,"file":"market.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/scallop/types/market.ts"],"names":[],"mappings":";;AAsFA,MAAM,kBAAkB,GAAG;IACzB,qBAAqB;IACrB,iBAAiB;IACjB,kBAAkB;IAClB,IAAI;IACJ,iBAAiB;IACjB,UAAU;IACV,gBAAgB;IAChB,aAAa;IACb,OAAO;CACC,CAAC;AAEX,MAAM,YAAY,GAAG;IACnB,gBAAgB;IAChB,iBAAiB;IACjB,IAAI;IACJ,sBAAsB;IACtB,qBAAqB;CACb,CAAC"}
|
@@ -189,7 +189,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
189
189
|
}
|
190
190
|
if (suppliedAssets.length === 0 && borrowedAssets.length === 0)
|
191
191
|
continue;
|
192
|
-
const { borrowedValue, suppliedValue, value, healthRatio } = (0, portfolio_core_1.getElementLendingValues)(suppliedAssets, borrowedAssets, rewardAssets, suppliedLtvs, borrowedWeights);
|
192
|
+
const { borrowedValue, suppliedValue, value, healthRatio, rewardValue } = (0, portfolio_core_1.getElementLendingValues)(suppliedAssets, borrowedAssets, rewardAssets, suppliedLtvs, borrowedWeights);
|
193
193
|
elements.push({
|
194
194
|
type: portfolio_core_1.PortfolioElementType.borrowlend,
|
195
195
|
networkId: portfolio_core_1.NetworkId.solana,
|
@@ -207,6 +207,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
207
207
|
collateralRatio: null,
|
208
208
|
healthRatio,
|
209
209
|
rewardAssets,
|
210
|
+
rewardValue,
|
210
211
|
value,
|
211
212
|
},
|
212
213
|
});
|