@sonarwatch/portfolio-plugins 0.14.135 → 0.14.136
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/CHANGELOG.md +4 -0
- package/package.json +1 -1
- package/src/plugins/jupiter/exchange/valueAverageFetcher.js +4 -1
- package/src/plugins/jupiter/exchange/valueAverageFetcher.js.map +1 -1
- package/src/plugins/rain/defiPoolsFetcher.js +63 -0
- package/src/plugins/rain/defiPoolsFetcher.js.map +1 -0
- package/src/plugins/rain/index.js +4 -2
- package/src/plugins/rain/index.js.map +1 -1
- package/src/plugins/rain/nftPoolsFetcher.d.ts +3 -0
- package/src/plugins/rain/{poolsFetcher.js → nftPoolsFetcher.js} +4 -27
- package/src/plugins/rain/nftPoolsFetcher.js.map +1 -0
- package/src/plugins/rain/poolsFetcher.js.map +0 -1
- /package/src/plugins/rain/{poolsFetcher.d.ts → defiPoolsFetcher.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
4
4
|
|
5
|
+
## [0.14.136](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.135...plugins-0.14.136) (2025-02-28)
|
6
|
+
|
7
|
+
|
8
|
+
|
5
9
|
## [0.14.135](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.134...plugins-0.14.135) (2025-02-28)
|
6
10
|
|
7
11
|
|
package/package.json
CHANGED
@@ -57,7 +57,10 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
57
57
|
input: inputAsset,
|
58
58
|
output: outputAsset,
|
59
59
|
},
|
60
|
-
filledPercentage: account.inUsed
|
60
|
+
filledPercentage: account.inUsed
|
61
|
+
.div(Math.pow(10, inputTokenPrice.decimals))
|
62
|
+
.div(initialInputAmount)
|
63
|
+
.toNumber(),
|
61
64
|
initialInputAmount,
|
62
65
|
inputAddress,
|
63
66
|
outputAddress,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"valueAverageFetcher.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/jupiter/exchange/valueAverageFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAKoC;AAGpC,2CAAgE;AAChE,oDAAyD;AACzD,kDAAiE;AACjE,wGAAgF;AAChF,uCAA+C;AAC/C,uCAAgD;AAEhD,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IAEjC,MAAM,QAAQ,GAAG,MAAM,IAAA,iCAAwB,EAC7C,MAAM,EACN,4BAAkB,EAClB,iCAAqB,EACrB,IAAA,6BAAmB,EAAC,KAAK,CAAC,CAC3B,CAAC;IACF,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAErC,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC,mBAAmB,CACjD,QAAQ;SACL,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC;SAC7D,IAAI,EAAE,EACT,0BAAS,CAAC,MAAM,CACjB,CAAC;IAEF,MAAM,QAAQ,GAA4B,EAAE,CAAC;IAC7C,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,MAAM,YAAY,GAAG,OAAO,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;QAClD,MAAM,aAAa,GAAG,OAAO,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;QACpD,MAAM,eAAe,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QACtD,MAAM,gBAAgB,GAAG,WAAW,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QACxD,IAAI,CAAC,eAAe,IAAI,CAAC,gBAAgB;YAAE,SAAS;QAEpD,MAAM,YAAY,GAAG,OAAO,CAAC,WAAW;aACrC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC;aAC3B,GAAG,CAAC,SAAA,EAAE,EAAI,gBAAgB,CAAC,QAAQ,CAAA,CAAC;aACpC,QAAQ,EAAE,CAAC;QAEd,MAAM,WAAW,GACf,YAAY,KAAK,CAAC;YAChB,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,IAAA,gCAAsB,EACpB,aAAa,EACb,YAAY,EACZ,0BAAS,CAAC,MAAM,EAChB,gBAAgB,CACjB,CAAC;QAER,MAAM,UAAU,GAAG,IAAA,gCAAsB,EACvC,YAAY,EACZ,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,SAAA,EAAE,EAAI,eAAe,CAAC,QAAQ,CAAA,CAAC,CAAC,QAAQ,EAAE,EAC7D,0BAAS,CAAC,MAAM,EAChB,eAAe,CAChB,CAAC;QAEF,MAAM,kBAAkB,GAAG,OAAO,CAAC,WAAW;aAC3C,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC;aAC1B,GAAG,CAAC,SAAA,EAAE,EAAI,eAAe,CAAC,QAAQ,CAAA,CAAC;aACnC,QAAQ,EAAE,CAAC;QAEd,MAAM,OAAO,GAA0B;YACrC,IAAI,EAAE,qCAAoB,CAAC,KAAK;YAChC,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,UAAU,EAAV,sBAAU;YACV,KAAK,EAAE,UAAU;YACjB,IAAI,EAAE;gBACJ,MAAM,EAAE;oBACN,KAAK,EAAE,UAAU;oBACjB,MAAM,EAAE,WAAW;iBACpB;gBACD,gBAAgB,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC,
|
1
|
+
{"version":3,"file":"valueAverageFetcher.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/jupiter/exchange/valueAverageFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAK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AAE,OAAO,CAAC,YAAY;qBACxC,GAAG,CAAC,SAAA,EAAE,EAAI,gBAAgB,CAAC,QAAQ,CAAA,CAAC;qBACpC,QAAQ,EAAE;gBACb,GAAG,EAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE;gBAC9B,QAAQ,EAAE,iCAAqB,CAAC,QAAQ,EAAE;gBAC1C,IAAI,EAAE,2BAA2B;aAClC;YACD,KAAK,EAAE,IAAA,+BAAc,EAAC,CAAC,UAAU,CAAC,KAAK,EAAE,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,KAAK,KAAI,CAAC,CAAC,CAAC;SACnE,CAAC;QACF,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,gBAAgB;IACjC,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -0,0 +1,63 @@
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
13
|
+
const web3_js_1 = require("@solana/web3.js");
|
14
|
+
const constants_1 = require("./constants");
|
15
|
+
const clients_1 = require("../../utils/clients");
|
16
|
+
const ParsedGpa_1 = require("../../utils/solana/beets/ParsedGpa");
|
17
|
+
const ElementRegistry_1 = require("../../utils/elementbuilder/ElementRegistry");
|
18
|
+
const structs_1 = require("./structs");
|
19
|
+
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
20
|
+
const client = (0, clients_1.getClientSolana)();
|
21
|
+
const pools = yield ParsedGpa_1.ParsedGpa.build(client, structs_1.poolStruct, constants_1.defiLendingProgramId)
|
22
|
+
.addFilter('accountDiscriminator', [241, 154, 109, 4, 17, 177, 109, 188])
|
23
|
+
.addFilter('owner', new web3_js_1.PublicKey(owner))
|
24
|
+
.run();
|
25
|
+
if (!pools.length)
|
26
|
+
return [];
|
27
|
+
const allDefiLoans = yield Promise.all(pools.map((pool) => ParsedGpa_1.ParsedGpa.build(client, structs_1.defiLoanStruct, constants_1.defiLendingProgramId)
|
28
|
+
.addFilter('accountDiscriminator', [20, 195, 70, 117, 165, 227, 182, 1])
|
29
|
+
.addFilter('pool', pool.pubkey)
|
30
|
+
.run()));
|
31
|
+
if (allDefiLoans.flat().length === 0)
|
32
|
+
return [];
|
33
|
+
const elementRegistry = new ElementRegistry_1.ElementRegistry(portfolio_core_1.NetworkId.solana, constants_1.platformId);
|
34
|
+
pools.forEach((pool, i) => {
|
35
|
+
const defiLoans = allDefiLoans[i];
|
36
|
+
defiLoans.forEach((loan) => {
|
37
|
+
if (loan.status !== structs_1.LoanStatus.Ongoing)
|
38
|
+
return;
|
39
|
+
const element = elementRegistry.addElementBorrowlend({
|
40
|
+
label: 'Lending',
|
41
|
+
ref: loan.pubkey,
|
42
|
+
link: `https://app.rain.fi/dashboard/loans?address=${loan.pubkey}`,
|
43
|
+
});
|
44
|
+
element.setFixedTerms(true, loan.expiredAt.multipliedBy(1000));
|
45
|
+
element.addSuppliedAsset({
|
46
|
+
address: loan.principal,
|
47
|
+
amount: loan.borrowedAmount,
|
48
|
+
});
|
49
|
+
element.addBorrowedAsset({
|
50
|
+
address: loan.collateral,
|
51
|
+
amount: loan.collateralAmount,
|
52
|
+
});
|
53
|
+
});
|
54
|
+
});
|
55
|
+
return elementRegistry.getElements(cache);
|
56
|
+
});
|
57
|
+
const fetcher = {
|
58
|
+
id: `${constants_1.platformId}-defi-pools`,
|
59
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
60
|
+
executor,
|
61
|
+
};
|
62
|
+
exports.default = fetcher;
|
63
|
+
//# sourceMappingURL=defiPoolsFetcher.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"defiPoolsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/rain/defiPoolsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAuD;AACvD,6CAA4C;AAG5C,2CAA+D;AAC/D,iDAAsD;AACtD,kEAA+D;AAC/D,gFAA6E;AAC7E,uCAAmE;AAEnE,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IAEjC,MAAM,KAAK,GAAG,MAAM,qBAAS,CAAC,KAAK,CAAC,MAAM,EAAE,oBAAU,EAAE,gCAAoB,CAAC;SAC1E,SAAS,CAAC,sBAAsB,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;SACxE,SAAS,CAAC,OAAO,EAAE,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC;SACxC,GAAG,EAAE,CAAC;IAET,IAAI,CAAC,KAAK,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IAE7B,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,GAAG,CACpC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACjB,qBAAS,CAAC,KAAK,CAAC,MAAM,EAAE,wBAA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AAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,eAAe,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC5C,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,aAAa;IAC9B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -6,16 +6,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.fetchers = exports.jobs = exports.platforms = void 0;
|
7
7
|
const constants_1 = require("./constants");
|
8
8
|
const collectionsJob_1 = __importDefault(require("./collectionsJob"));
|
9
|
-
const poolsFetcher_1 = __importDefault(require("./poolsFetcher"));
|
10
9
|
const banksFetcher_1 = __importDefault(require("./banksFetcher"));
|
11
10
|
const defiBorrowsFetcher_1 = __importDefault(require("./defiBorrowsFetcher"));
|
12
11
|
const nftBorrowsFetcher_1 = __importDefault(require("./nftBorrowsFetcher"));
|
12
|
+
const defiPoolsFetcher_1 = __importDefault(require("./defiPoolsFetcher"));
|
13
|
+
const nftPoolsFetcher_1 = __importDefault(require("./nftPoolsFetcher"));
|
13
14
|
exports.platforms = [constants_1.platform];
|
14
15
|
exports.jobs = [collectionsJob_1.default];
|
15
16
|
exports.fetchers = [
|
16
17
|
defiBorrowsFetcher_1.default,
|
17
18
|
nftBorrowsFetcher_1.default,
|
18
|
-
|
19
|
+
defiPoolsFetcher_1.default,
|
20
|
+
nftPoolsFetcher_1.default,
|
19
21
|
banksFetcher_1.default,
|
20
22
|
];
|
21
23
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/rain/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,sEAA8C;AAC9C,kEAA0C;AAC1C,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/rain/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,sEAA8C;AAC9C,kEAA0C;AAC1C,8EAAsD;AACtD,4EAAoD;AACpD,0EAAkD;AAClD,wEAAgD;AAEnC,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,CAAC,wBAAc,CAAC,CAAC;AAC/B,QAAA,QAAQ,GAAc;IACjC,4BAAkB;IAClB,2BAAiB;IACjB,0BAAgB;IAChB,yBAAe;IACf,sBAAY;CACb,CAAC"}
|
@@ -22,21 +22,17 @@ const ElementRegistry_1 = require("../../utils/elementbuilder/ElementRegistry");
|
|
22
22
|
const structs_1 = require("./structs");
|
23
23
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
24
24
|
const client = (0, clients_1.getClientSolana)();
|
25
|
-
const pools = yield ParsedGpa_1.ParsedGpa.build(client, structs_1.poolStruct, constants_1.
|
25
|
+
const pools = yield ParsedGpa_1.ParsedGpa.build(client, structs_1.poolStruct, constants_1.nftLendingProgramId)
|
26
26
|
.addFilter('accountDiscriminator', [241, 154, 109, 4, 17, 177, 109, 188])
|
27
27
|
.addFilter('owner', new web3_js_1.PublicKey(owner))
|
28
28
|
.run();
|
29
29
|
if (!pools.length)
|
30
30
|
return [];
|
31
|
-
const allDefiLoans = yield Promise.all(pools.map((pool) => ParsedGpa_1.ParsedGpa.build(client, structs_1.defiLoanStruct, constants_1.defiLendingProgramId)
|
32
|
-
.addFilter('accountDiscriminator', [20, 195, 70, 117, 165, 227, 182, 1])
|
33
|
-
.addFilter('pool', pool.pubkey)
|
34
|
-
.run()));
|
35
31
|
const allNftsLoans = yield Promise.all(pools.map((pool) => ParsedGpa_1.ParsedGpa.build(client, structs_1.nftLoanStruct, constants_1.nftLendingProgramId)
|
36
32
|
.addFilter('accountDiscriminator', [20, 195, 70, 117, 165, 227, 182, 1])
|
37
33
|
.addFilter('pool', pool.pubkey)
|
38
34
|
.run()));
|
39
|
-
if (
|
35
|
+
if (allNftsLoans.flat().length === 0)
|
40
36
|
return [];
|
41
37
|
const [collections, solTokenPrice] = yield Promise.all([
|
42
38
|
constants_1.collectionsMemo.getItem(cache),
|
@@ -48,26 +44,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
48
44
|
throw new Error('Sol price not cached');
|
49
45
|
const elementRegistry = new ElementRegistry_1.ElementRegistry(portfolio_core_1.NetworkId.solana, constants_1.platformId);
|
50
46
|
pools.forEach((pool, i) => {
|
51
|
-
const defiLoans = allDefiLoans[i];
|
52
47
|
const nftLoans = allNftsLoans[i];
|
53
|
-
defiLoans.forEach((loan) => {
|
54
|
-
if (loan.status !== structs_1.LoanStatus.Ongoing)
|
55
|
-
return;
|
56
|
-
const element = elementRegistry.addElementBorrowlend({
|
57
|
-
label: 'Lending',
|
58
|
-
ref: loan.pubkey,
|
59
|
-
link: `https://app.rain.fi/dashboard/loans?address=${loan.pubkey}`,
|
60
|
-
});
|
61
|
-
element.setFixedTerms(true, loan.expiredAt.multipliedBy(1000));
|
62
|
-
element.addSuppliedAsset({
|
63
|
-
address: loan.principal,
|
64
|
-
amount: loan.borrowedAmount,
|
65
|
-
});
|
66
|
-
element.addBorrowedAsset({
|
67
|
-
address: loan.collateral,
|
68
|
-
amount: loan.collateralAmount,
|
69
|
-
});
|
70
|
-
});
|
71
48
|
nftLoans.forEach((loan) => {
|
72
49
|
if (loan.status !== structs_1.LoanStatus.Ongoing)
|
73
50
|
return;
|
@@ -100,9 +77,9 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
100
77
|
return elementRegistry.getElements(cache);
|
101
78
|
});
|
102
79
|
const fetcher = {
|
103
|
-
id: `${constants_1.platformId}-pools`,
|
80
|
+
id: `${constants_1.platformId}-nft-pools`,
|
104
81
|
networkId: portfolio_core_1.NetworkId.solana,
|
105
82
|
executor,
|
106
83
|
};
|
107
84
|
exports.default = fetcher;
|
108
|
-
//# sourceMappingURL=
|
85
|
+
//# sourceMappingURL=nftPoolsFetcher.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"nftPoolsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/rain/nftPoolsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAIoC;AACpC,6CAA4C;AAC5C,gEAAqC;AAGrC,2CAA+E;AAC/E,iDAAsD;AACtD,kEAA+D;AAC/D,gFAA6E;AAC7E,uCAAkE;AAElE,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IAEjC,MAAM,KAAK,GAAG,MAAM,qBAAS,CAAC,KAAK,CAAC,MAAM,EAAE,oBAAU,EAAE,+BAAmB,CAAC;SACzE,SAAS,CAAC,sBAAsB,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;SACxE,SAAS,CAAC,OAAO,EAAE,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC;SACxC,GAAG,EAAE,CAAC;IAET,IAAI,CAAC,KAAK,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IAE7B,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,GAAG,CACpC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACjB,qBAAS,CAAC,KAAK,CAAC,MAAM,EAAE,uBAAa,EAAE,+BAAmB,CAAC;SACxD,SAAS,CAAC,sBAAsB,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;SACvE,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;SAC9B,GAAG,EAAE,CACT,CACF,CAAC;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