@haven-fi/solauto-sdk 1.0.629 → 1.0.631
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/README.md +32 -2
- package/dist/constants/marginfiAccounts.d.ts.map +1 -1
- package/dist/constants/solautoConstants.d.ts +2 -1
- package/dist/constants/solautoConstants.d.ts.map +1 -1
- package/dist/generated/instructions/marginfiRebalance.d.ts +5 -3
- package/dist/generated/instructions/marginfiRebalance.d.ts.map +1 -1
- package/dist/generated/instructions/marginfiRebalance.js +2 -1
- package/dist/generated/instructions/marginfiRefreshData.d.ts +7 -2
- package/dist/generated/instructions/marginfiRefreshData.d.ts.map +1 -1
- package/dist/generated/instructions/marginfiRefreshData.js +8 -4
- package/dist/generated/types/index.d.ts +1 -0
- package/dist/generated/types/index.d.ts.map +1 -1
- package/dist/generated/types/index.js +1 -0
- package/dist/generated/types/priceType.d.ts +15 -0
- package/dist/generated/types/priceType.d.ts.map +1 -0
- package/dist/generated/types/priceType.js +22 -0
- package/dist/services/rebalance/rebalanceSwapManager.d.ts.map +1 -1
- package/dist/services/rebalance/rebalanceSwapManager.js +8 -8
- package/dist/services/rebalance/rebalanceTxBuilder.d.ts +2 -0
- package/dist/services/rebalance/rebalanceTxBuilder.d.ts.map +1 -1
- package/dist/services/rebalance/rebalanceTxBuilder.js +21 -10
- package/dist/services/rebalance/rebalanceValues.d.ts +2 -2
- package/dist/services/rebalance/rebalanceValues.d.ts.map +1 -1
- package/dist/services/rebalance/rebalanceValues.js +17 -17
- package/dist/services/solauto/solautoClient.d.ts +2 -2
- package/dist/services/solauto/solautoClient.d.ts.map +1 -1
- package/dist/services/solauto/solautoClient.js +27 -28
- package/dist/services/solauto/solautoMarginfiClient.d.ts +2 -2
- package/dist/services/solauto/solautoMarginfiClient.d.ts.map +1 -1
- package/dist/services/solauto/solautoMarginfiClient.js +12 -10
- package/dist/services/transactions/transactionUtils.d.ts.map +1 -1
- package/dist/services/transactions/transactionUtils.js +10 -9
- package/dist/solautoPosition/marginfiSolautoPositionEx.d.ts +3 -3
- package/dist/solautoPosition/marginfiSolautoPositionEx.d.ts.map +1 -1
- package/dist/solautoPosition/marginfiSolautoPositionEx.js +9 -9
- package/dist/solautoPosition/solautoPositionEx.d.ts +44 -33
- package/dist/solautoPosition/solautoPositionEx.d.ts.map +1 -1
- package/dist/solautoPosition/solautoPositionEx.js +112 -90
- package/dist/types/solauto.d.ts +2 -1
- package/dist/types/solauto.d.ts.map +1 -1
- package/dist/utils/instructionUtils.js +2 -2
- package/dist/utils/marginfiUtils.d.ts +2 -2
- package/dist/utils/marginfiUtils.d.ts.map +1 -1
- package/dist/utils/marginfiUtils.js +5 -5
- package/dist/utils/priceUtils.d.ts +11 -5
- package/dist/utils/priceUtils.d.ts.map +1 -1
- package/dist/utils/priceUtils.js +45 -21
- package/local/logPositions.ts +12 -12
- package/local/shared.ts +1 -1
- package/local/txSandbox.ts +29 -27
- package/local/updateMarginfiLUT.ts +13 -6
- package/package.json +1 -1
- package/src/constants/marginfiAccounts.ts +0 -1
- package/src/constants/solautoConstants.ts +1 -1
- package/src/generated/instructions/marginfiRebalance.ts +9 -3
- package/src/generated/instructions/marginfiRefreshData.ts +27 -7
- package/src/generated/types/index.ts +1 -0
- package/src/generated/types/priceType.ts +22 -0
- package/src/services/rebalance/rebalanceSwapManager.ts +8 -12
- package/src/services/rebalance/rebalanceTxBuilder.ts +41 -11
- package/src/services/rebalance/rebalanceValues.ts +22 -16
- package/src/services/solauto/solautoClient.ts +30 -30
- package/src/services/solauto/solautoMarginfiClient.ts +13 -10
- package/src/services/transactions/transactionUtils.ts +11 -9
- package/src/solautoPosition/marginfiSolautoPositionEx.ts +11 -10
- package/src/solautoPosition/solautoPositionEx.ts +145 -117
- package/src/types/solauto.ts +2 -0
- package/src/utils/instructionUtils.ts +2 -2
- package/src/utils/marginfiUtils.ts +12 -8
- package/src/utils/priceUtils.ts +66 -22
- package/tests/transactions/shared.ts +2 -5
- package/tests/unit/rebalanceCalculations.ts +9 -12
@@ -33,50 +33,50 @@ class SolautoClient extends referralStateManager_1.ReferralStateManager {
|
|
33
33
|
lendingPlatform: this.lendingPlatform,
|
34
34
|
lpEnv: this.lpEnv,
|
35
35
|
}, this.contextUpdates);
|
36
|
-
this.positionSupplyTa = (0, utils_1.getTokenAccount)(this.pos.publicKey, this.pos.supplyMint
|
37
|
-
this.signerSupplyTa = (0, utils_1.getTokenAccount)((0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), this.pos.supplyMint
|
38
|
-
this.positionDebtTa = (0, utils_1.getTokenAccount)(this.pos.publicKey, this.pos.debtMint
|
39
|
-
this.signerDebtTa = (0, utils_1.getTokenAccount)((0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), this.pos.debtMint
|
40
|
-
this.solautoFeesSupplyTa = (0, utils_1.getTokenAccount)(constants_1.SOLAUTO_FEES_WALLET, this.pos.supplyMint
|
41
|
-
this.solautoFeesDebtTa = (0, utils_1.getTokenAccount)(constants_1.SOLAUTO_FEES_WALLET, this.pos.debtMint
|
36
|
+
this.positionSupplyTa = (0, utils_1.getTokenAccount)(this.pos.publicKey, this.pos.supplyMint);
|
37
|
+
this.signerSupplyTa = (0, utils_1.getTokenAccount)((0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), this.pos.supplyMint);
|
38
|
+
this.positionDebtTa = (0, utils_1.getTokenAccount)(this.pos.publicKey, this.pos.debtMint);
|
39
|
+
this.signerDebtTa = (0, utils_1.getTokenAccount)((0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), this.pos.debtMint);
|
40
|
+
this.solautoFeesSupplyTa = (0, utils_1.getTokenAccount)(constants_1.SOLAUTO_FEES_WALLET, this.pos.supplyMint);
|
41
|
+
this.solautoFeesDebtTa = (0, utils_1.getTokenAccount)(constants_1.SOLAUTO_FEES_WALLET, this.pos.debtMint);
|
42
42
|
this.authorityLutAddress =
|
43
43
|
this.referralStateData?.lookupTable &&
|
44
44
|
!(0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.referralStateData.lookupTable).equals(web3_js_1.PublicKey.default)
|
45
45
|
? (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.referralStateData.lookupTable)
|
46
46
|
: undefined;
|
47
|
-
this.flProvider = new flashLoans_1.FlProviderAggregator(this.umi, this.signer, this.authority, this.pos.supplyMint
|
47
|
+
this.flProvider = new flashLoans_1.FlProviderAggregator(this.umi, this.signer, this.authority, this.pos.supplyMint, this.pos.debtMint, this.lpEnv);
|
48
48
|
await this.flProvider.initialize();
|
49
49
|
this.otherSigners.push(...this.flProvider.otherSigners());
|
50
|
-
this.log("Position state: ", this.pos.state
|
51
|
-
this.log("Position settings: ", this.pos.settings
|
52
|
-
this.log("Position DCA: ", this.pos.dca
|
53
|
-
this.log("Supply mint:", this.pos.supplyMint
|
54
|
-
this.log("Debt mint:", this.pos.debtMint
|
50
|
+
this.log("Position state: ", this.pos.state);
|
51
|
+
this.log("Position settings: ", this.pos.settings);
|
52
|
+
this.log("Position DCA: ", this.pos.dca);
|
53
|
+
this.log("Supply mint:", this.pos.supplyMint.toString());
|
54
|
+
this.log("Debt mint:", this.pos.debtMint.toString());
|
55
55
|
}
|
56
56
|
referredBySupplyTa() {
|
57
57
|
if (this.referredByState !== undefined) {
|
58
|
-
return (0, utils_1.getTokenAccount)(this.referredByState, this.pos.supplyMint
|
58
|
+
return (0, utils_1.getTokenAccount)(this.referredByState, this.pos.supplyMint);
|
59
59
|
}
|
60
60
|
return undefined;
|
61
61
|
}
|
62
62
|
referredByDebtTa() {
|
63
63
|
if (this.referredByState !== undefined) {
|
64
|
-
return (0, utils_1.getTokenAccount)(this.referredByState, this.pos.debtMint
|
64
|
+
return (0, utils_1.getTokenAccount)(this.referredByState, this.pos.debtMint);
|
65
65
|
}
|
66
66
|
return undefined;
|
67
67
|
}
|
68
68
|
async resetLiveTxUpdates(success) {
|
69
69
|
this.log("Resetting context updates...");
|
70
70
|
if (success) {
|
71
|
-
if (!this.pos.exists
|
71
|
+
if (!this.pos.exists) {
|
72
72
|
await this.pos.refetchPositionData();
|
73
73
|
}
|
74
74
|
else {
|
75
75
|
if (this.contextUpdates.settings) {
|
76
|
-
this.pos.
|
76
|
+
this.pos.updateSettings(this.contextUpdates.settings);
|
77
77
|
}
|
78
78
|
if (this.contextUpdates.dca) {
|
79
|
-
this.pos.
|
79
|
+
this.pos.updateDca(this.contextUpdates.dca);
|
80
80
|
}
|
81
81
|
// All other live position updates can be derived by getting a fresh position state, so we don't need to do anything else form contextUpdates
|
82
82
|
}
|
@@ -162,7 +162,7 @@ class SolautoClient extends referralStateManager_1.ReferralStateManager {
|
|
162
162
|
async signerBalances() {
|
163
163
|
if (!this.signerSupplyBalance || !this.signerDebtBalance) {
|
164
164
|
[this.signerSupplyBalance, this.signerDebtBalance] =
|
165
|
-
await (0, utils_1.getWalletSplBalances)(this.connection, (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), [this.pos.supplyMint
|
165
|
+
await (0, utils_1.getWalletSplBalances)(this.connection, (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), [this.pos.supplyMint, this.pos.debtMint]);
|
166
166
|
}
|
167
167
|
return {
|
168
168
|
supplyBalance: this.signerSupplyBalance,
|
@@ -199,12 +199,12 @@ class SolautoClient extends referralStateManager_1.ReferralStateManager {
|
|
199
199
|
let signerDcaTa = undefined;
|
200
200
|
if ((0, umi_1.isOption)(args.dca) && (0, umi_1.isSome)(args.dca)) {
|
201
201
|
if (args.dca.value.tokenType === generated_1.TokenType.Supply) {
|
202
|
-
dcaMint = (0, umi_1.publicKey)(this.pos.supplyMint
|
202
|
+
dcaMint = (0, umi_1.publicKey)(this.pos.supplyMint);
|
203
203
|
positionDcaTa = (0, umi_1.publicKey)(this.positionSupplyTa);
|
204
204
|
signerDcaTa = (0, umi_1.publicKey)(this.signerSupplyTa);
|
205
205
|
}
|
206
206
|
else {
|
207
|
-
dcaMint = (0, umi_1.publicKey)(this.pos.debtMint
|
207
|
+
dcaMint = (0, umi_1.publicKey)(this.pos.debtMint);
|
208
208
|
positionDcaTa = (0, umi_1.publicKey)(this.positionDebtTa);
|
209
209
|
signerDcaTa = (0, umi_1.publicKey)(this.signerDebtTa);
|
210
210
|
}
|
@@ -245,21 +245,21 @@ class SolautoClient extends referralStateManager_1.ReferralStateManager {
|
|
245
245
|
let dcaMint = undefined;
|
246
246
|
let positionDcaTa = undefined;
|
247
247
|
let signerDcaTa = undefined;
|
248
|
-
const currDca = this.pos.dca
|
248
|
+
const currDca = this.pos.dca;
|
249
249
|
if (currDca.dcaInBaseUnit > 0) {
|
250
250
|
if (currDca.tokenType === generated_1.TokenType.Supply) {
|
251
|
-
dcaMint = (0, umi_1.publicKey)(this.pos.supplyMint
|
251
|
+
dcaMint = (0, umi_1.publicKey)(this.pos.supplyMint);
|
252
252
|
positionDcaTa = (0, umi_1.publicKey)(this.positionSupplyTa);
|
253
253
|
signerDcaTa = (0, umi_1.publicKey)(this.signerSupplyTa);
|
254
254
|
}
|
255
255
|
else {
|
256
|
-
dcaMint = (0, umi_1.publicKey)(this.pos.debtMint
|
256
|
+
dcaMint = (0, umi_1.publicKey)(this.pos.debtMint);
|
257
257
|
positionDcaTa = (0, umi_1.publicKey)(this.positionDebtTa);
|
258
258
|
signerDcaTa = (0, umi_1.publicKey)(this.signerDebtTa);
|
259
259
|
}
|
260
260
|
this.contextUpdates.new({
|
261
261
|
type: "cancellingDca",
|
262
|
-
value: this.pos.dca
|
262
|
+
value: this.pos.dca.tokenType,
|
263
263
|
});
|
264
264
|
}
|
265
265
|
return (0, generated_1.cancelDCA)(this.umi, {
|
@@ -281,7 +281,7 @@ class SolautoClient extends referralStateManager_1.ReferralStateManager {
|
|
281
281
|
tx = tx.add((0, utils_1.splTokenTransferUmiIx)(this.signer, this.signerDebtTa, this.positionDebtTa, (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), BigInt(args.fields[0].fields[0])));
|
282
282
|
}
|
283
283
|
else {
|
284
|
-
tx = tx.add((0, utils_1.splTokenTransferUmiIx)(this.signer, this.signerDebtTa, this.positionDebtTa, (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), BigInt(Math.round(Number(this.pos.state
|
284
|
+
tx = tx.add((0, utils_1.splTokenTransferUmiIx)(this.signer, this.signerDebtTa, this.positionDebtTa, (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), BigInt(Math.round(Number(this.pos.state.debt.amountUsed.baseUnit) * 1.01))));
|
285
285
|
}
|
286
286
|
}
|
287
287
|
}
|
@@ -301,7 +301,7 @@ class SolautoClient extends referralStateManager_1.ReferralStateManager {
|
|
301
301
|
else {
|
302
302
|
this.contextUpdates.new({
|
303
303
|
type: "supply",
|
304
|
-
value: (this.pos.state
|
304
|
+
value: (this.pos.state.supply.amountUsed.baseUnit ?? BigInt(0)) *
|
305
305
|
BigInt(-1),
|
306
306
|
});
|
307
307
|
}
|
@@ -322,8 +322,7 @@ class SolautoClient extends referralStateManager_1.ReferralStateManager {
|
|
322
322
|
else {
|
323
323
|
this.contextUpdates.new({
|
324
324
|
type: "debt",
|
325
|
-
value: (this.pos.state
|
326
|
-
BigInt(-1),
|
325
|
+
value: (this.pos.state.debt.amountUsed.baseUnit ?? BigInt(0)) * BigInt(-1),
|
327
326
|
});
|
328
327
|
}
|
329
328
|
}
|
@@ -2,7 +2,7 @@ import { PublicKey } from "@solana/web3.js";
|
|
2
2
|
import { Signer, TransactionBuilder } from "@metaplex-foundation/umi";
|
3
3
|
import { MarginfiAssetAccounts, RebalanceDetails } from "../../types";
|
4
4
|
import { MarginfiProgramAccounts } from "../../constants";
|
5
|
-
import { DCASettingsInpArgs, LendingPlatform, RebalanceStep, SolautoActionArgs, SolautoSettingsParametersInpArgs } from "../../generated";
|
5
|
+
import { DCASettingsInpArgs, LendingPlatform, PriceType, RebalanceStep, SolautoActionArgs, SolautoSettingsParametersInpArgs } from "../../generated";
|
6
6
|
import { SolautoClient, SolautoClientArgs } from "./solautoClient";
|
7
7
|
export declare class SolautoMarginfiClient extends SolautoClient {
|
8
8
|
lendingPlatform: LendingPlatform;
|
@@ -21,7 +21,7 @@ export declare class SolautoMarginfiClient extends SolautoClient {
|
|
21
21
|
openPositionIx(settings?: SolautoSettingsParametersInpArgs, dca?: DCASettingsInpArgs): TransactionBuilder;
|
22
22
|
private marginfiOpenPositionIx;
|
23
23
|
closePositionIx(): TransactionBuilder;
|
24
|
-
refreshIx(): TransactionBuilder;
|
24
|
+
refreshIx(priceType: PriceType): TransactionBuilder;
|
25
25
|
protocolInteractionIx(args: SolautoActionArgs): TransactionBuilder;
|
26
26
|
private marginfiProtocolInteractionIx;
|
27
27
|
private marginfiSolautoProtocolInteractionIx;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"solautoMarginfiClient.d.ts","sourceRoot":"","sources":["../../../src/services/solauto/solautoMarginfiClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA8B,MAAM,iBAAiB,CAAC;AACxE,OAAO,EACL,MAAM,EACN,kBAAkB,EAInB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,EAAuB,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC/E,OAAO,EACL,kBAAkB,EAClB,eAAe,
|
1
|
+
{"version":3,"file":"solautoMarginfiClient.d.ts","sourceRoot":"","sources":["../../../src/services/solauto/solautoMarginfiClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA8B,MAAM,iBAAiB,CAAC;AACxE,OAAO,EACL,MAAM,EACN,kBAAkB,EAInB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,EAAuB,uBAAuB,EAAE,MAAM,iBAAiB,CA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else {
|
27
|
-
if (this.pos.exists
|
27
|
+
if (this.pos.exists) {
|
28
28
|
this.marginfiAccount = this.pos.lpUserAccount;
|
29
29
|
}
|
30
30
|
else {
|
@@ -46,9 +46,9 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
|
|
46
46
|
this.otherSigners.push(this.marginfiAccount);
|
47
47
|
}
|
48
48
|
this.marginfiSupplyAccounts =
|
49
|
-
this.mfiAccounts.bankAccounts[this.marginfiGroup.toString()][this.pos.supplyMint
|
49
|
+
this.mfiAccounts.bankAccounts[this.marginfiGroup.toString()][this.pos.supplyMint.toString()];
|
50
50
|
this.marginfiDebtAccounts =
|
51
|
-
this.mfiAccounts.bankAccounts[this.marginfiGroup.toString()][this.pos.debtMint
|
51
|
+
this.mfiAccounts.bankAccounts[this.marginfiGroup.toString()][this.pos.debtMint.toString()];
|
52
52
|
[this.supplyPriceOracle, this.debtPriceOracle] =
|
53
53
|
await this.pos.priceOracles();
|
54
54
|
this.log("Marginfi account:", this.marginfiAccountPk.toString());
|
@@ -97,10 +97,10 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
|
|
97
97
|
marginfiAccount: "publicKey" in this.marginfiAccount
|
98
98
|
? this.marginfiAccount
|
99
99
|
: (0, umi_1.publicKey)(this.marginfiAccount),
|
100
|
-
supplyMint: (0, umi_1.publicKey)(this.pos.supplyMint
|
100
|
+
supplyMint: (0, umi_1.publicKey)(this.pos.supplyMint),
|
101
101
|
supplyBank: (0, umi_1.publicKey)(this.marginfiSupplyAccounts.bank),
|
102
102
|
positionSupplyTa: (0, umi_1.publicKey)(this.positionSupplyTa),
|
103
|
-
debtMint: (0, umi_1.publicKey)(this.pos.debtMint
|
103
|
+
debtMint: (0, umi_1.publicKey)(this.pos.debtMint),
|
104
104
|
debtBank: (0, umi_1.publicKey)(this.marginfiDebtAccounts.bank),
|
105
105
|
positionDebtTa: (0, umi_1.publicKey)(this.positionDebtTa),
|
106
106
|
signerDebtTa: signerDebtTa,
|
@@ -123,7 +123,7 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
|
|
123
123
|
lpUserAccount: (0, umi_1.publicKey)(this.marginfiAccountPk),
|
124
124
|
});
|
125
125
|
}
|
126
|
-
refreshIx() {
|
126
|
+
refreshIx(priceType) {
|
127
127
|
return (0, generated_1.marginfiRefreshData)(this.umi, {
|
128
128
|
signer: this.signer,
|
129
129
|
marginfiProgram: (0, umi_1.publicKey)(this.mfiAccounts.program),
|
@@ -134,6 +134,7 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
|
|
134
134
|
debtBank: (0, umi_1.publicKey)(this.marginfiDebtAccounts.bank),
|
135
135
|
debtPriceOracle: (0, umi_1.publicKey)(this.debtPriceOracle),
|
136
136
|
solautoPosition: (0, umi_1.publicKey)(this.pos.publicKey),
|
137
|
+
priceType,
|
137
138
|
});
|
138
139
|
}
|
139
140
|
protocolInteractionIx(args) {
|
@@ -244,8 +245,8 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
|
|
244
245
|
});
|
245
246
|
}
|
246
247
|
rebalanceIx(rebalanceStep, data) {
|
247
|
-
const inputIsSupply = new web3_js_1.PublicKey(data.swapQuote.inputMint).equals(this.pos.supplyMint
|
248
|
-
const outputIsSupply = new web3_js_1.PublicKey(data.swapQuote.outputMint).equals(this.pos.supplyMint
|
248
|
+
const inputIsSupply = new web3_js_1.PublicKey(data.swapQuote.inputMint).equals(this.pos.supplyMint);
|
249
|
+
const outputIsSupply = new web3_js_1.PublicKey(data.swapQuote.outputMint).equals(this.pos.supplyMint);
|
249
250
|
const preSwapRebalance = rebalanceStep === generated_1.RebalanceStep.PreSwap;
|
250
251
|
const postSwapRebalance = rebalanceStep === generated_1.RebalanceStep.PostSwap;
|
251
252
|
const needSupplyAccounts = (inputIsSupply && preSwapRebalance) ||
|
@@ -282,7 +283,7 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
|
|
282
283
|
supplyPriceOracle: (0, umi_1.publicKey)(this.supplyPriceOracle),
|
283
284
|
positionSupplyTa: (0, umi_1.publicKey)(this.positionSupplyTa),
|
284
285
|
authoritySupplyTa: addAuthorityTas
|
285
|
-
? (0, umi_1.publicKey)((0, utils_1.getTokenAccount)(this.authority, this.pos.supplyMint
|
286
|
+
? (0, umi_1.publicKey)((0, utils_1.getTokenAccount)(this.authority, this.pos.supplyMint))
|
286
287
|
: undefined,
|
287
288
|
vaultSupplyTa: needSupplyAccounts
|
288
289
|
? (0, umi_1.publicKey)(this.marginfiSupplyAccounts.liquidityVault)
|
@@ -294,7 +295,7 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
|
|
294
295
|
debtPriceOracle: (0, umi_1.publicKey)(this.debtPriceOracle),
|
295
296
|
positionDebtTa: (0, umi_1.publicKey)(this.positionDebtTa),
|
296
297
|
authorityDebtTa: addAuthorityTas
|
297
|
-
? (0, umi_1.publicKey)((0, utils_1.getTokenAccount)(this.authority, this.pos.debtMint
|
298
|
+
? (0, umi_1.publicKey)((0, utils_1.getTokenAccount)(this.authority, this.pos.debtMint))
|
298
299
|
: undefined,
|
299
300
|
vaultDebtTa: needDebtAccounts
|
300
301
|
? (0, umi_1.publicKey)(this.marginfiDebtAccounts.liquidityVault)
|
@@ -310,6 +311,7 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
|
|
310
311
|
swapType: data.swapQuote.swapMode === "ExactOut" && isFirstRebalance
|
311
312
|
? generated_1.SwapType.ExactOut
|
312
313
|
: null,
|
314
|
+
priceType: isFirstRebalance ? data.priceType : null,
|
313
315
|
flashLoanFeeBps: data.flashLoan?.flFeeBps && isFirstRebalance
|
314
316
|
? data.flashLoan.flFeeBps
|
315
317
|
: null,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"transactionUtils.d.ts","sourceRoot":"","sources":["../../../src/services/transactions/transactionUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA8B,MAAM,iBAAiB,CAAC;AAKxE,OAAO,EAIL,kBAAkB,EAClB,GAAG,EAGJ,MAAM,0BAA0B,CAAC;
|
1
|
+
{"version":3,"file":"transactionUtils.d.ts","sourceRoot":"","sources":["../../../src/services/transactions/transactionUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA8B,MAAM,iBAAiB,CAAC;AAKxE,OAAO,EAIL,kBAAkB,EAClB,GAAG,EAGJ,MAAM,0BAA0B,CAAC;AAiBlC,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AA2BjE,OAAO,EAAE,qBAAqB,EAAyB,MAAM,aAAa,CAAC;AAwL3E,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,aAAa,EACrB,EAAE,EAAE,kBAAkB,EACtB,sBAAsB,EAAE,MAAM,EAAE,GAC/B,OAAO,CAAC,kBAAkB,CAAC,CAyF7B;AA8LD,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,aAAa,EACrB,EAAE,EAAE,kBAAkB,GACrB,OAAO,CAAC,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAC,CA0BnD;AAED,wBAAsB,gCAAgC,CACpD,eAAe,EAAE,oBAAoB,EACrC,YAAY,EAAE,SAAS,EACvB,eAAe,EAAE,SAAS,GACzB,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAuC5C;AAED,wBAAgB,YAAY,CAC1B,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,kBAAkB,EAAE,EACzB,KAAK,EAAE,KAAK,EACZ,oBAAoB,CAAC,EAAE,OAAO;;;;EA8G/B"}
|
@@ -16,8 +16,8 @@ const jupiter_sdk_1 = require("../../jupiter-sdk");
|
|
16
16
|
const types_1 = require("../../types");
|
17
17
|
const constants_1 = require("../../constants");
|
18
18
|
function getWSolUsage(client, solautoActions, initiatingDcaIn, cancellingDcaIn) {
|
19
|
-
const supplyIsWsol = client.pos.supplyMint
|
20
|
-
const debtIsWsol = client.pos.debtMint
|
19
|
+
const supplyIsWsol = client.pos.supplyMint.equals(spl_token_1.NATIVE_MINT);
|
20
|
+
const debtIsWsol = client.pos.debtMint.equals(spl_token_1.NATIVE_MINT);
|
21
21
|
if (!supplyIsWsol && !debtIsWsol) {
|
22
22
|
return undefined;
|
23
23
|
}
|
@@ -58,7 +58,7 @@ async function transactionChoresBefore(client, accountsGettingCreated, solautoAc
|
|
58
58
|
chores = chores.add(client.marginfiAccountInitialize(client.marginfiAccount));
|
59
59
|
}
|
60
60
|
// TODO: PF
|
61
|
-
if (!client.pos.exists
|
61
|
+
if (!client.pos.exists) {
|
62
62
|
chores = chores.add(client.openPositionIx());
|
63
63
|
}
|
64
64
|
}
|
@@ -104,8 +104,8 @@ async function transactionChoresBefore(client, accountsGettingCreated, solautoAc
|
|
104
104
|
}
|
105
105
|
if (!(0, utils_1.getSolanaAccountCreated)(client.umi, tokenAccount)) {
|
106
106
|
chores = chores.add((0, utils_1.createAssociatedTokenAccountUmiIx)(client.signer, (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(client.signer.publicKey), (0, generated_1.isSolautoAction)("Withdraw", solautoAction)
|
107
|
-
? client.pos.supplyMint
|
108
|
-
: client.pos.debtMint
|
107
|
+
? client.pos.supplyMint
|
108
|
+
: client.pos.debtMint));
|
109
109
|
accountsGettingCreated.push(tokenAccount.toString());
|
110
110
|
}
|
111
111
|
}
|
@@ -135,24 +135,24 @@ async function rebalanceChoresBefore(client, tx, accountsGettingCreated) {
|
|
135
135
|
let chores = (0, umi_1.transactionBuilder)();
|
136
136
|
if (checkReferralSupplyTa && !(0, utils_1.rpcAccountCreated)(referredBySupplyTa)) {
|
137
137
|
client.log("Creating referred-by supply TA");
|
138
|
-
chores = chores.add((0, utils_1.createAssociatedTokenAccountUmiIx)(client.signer, client.referredByState, client.pos.supplyMint
|
138
|
+
chores = chores.add((0, utils_1.createAssociatedTokenAccountUmiIx)(client.signer, client.referredByState, client.pos.supplyMint));
|
139
139
|
}
|
140
140
|
if (checkReferralDebtTa && !(0, utils_1.rpcAccountCreated)(referredByDebtTa)) {
|
141
141
|
client.log("Creating referred-by debt TA");
|
142
|
-
chores = chores.add((0, utils_1.createAssociatedTokenAccountUmiIx)(client.signer, client.referredByState, client.pos.debtMint
|
142
|
+
chores = chores.add((0, utils_1.createAssociatedTokenAccountUmiIx)(client.signer, client.referredByState, client.pos.debtMint));
|
143
143
|
}
|
144
144
|
if (checkSignerSupplyTa &&
|
145
145
|
!(0, utils_1.rpcAccountCreated)(signerSupplyTa) &&
|
146
146
|
!accountsGettingCreated.includes(signerSupplyTa.publicKey.toString())) {
|
147
147
|
client.log("Creating signer supply token account");
|
148
|
-
chores = chores.add((0, utils_1.createAssociatedTokenAccountUmiIx)(client.signer, (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(client.signer.publicKey), client.pos.supplyMint
|
148
|
+
chores = chores.add((0, utils_1.createAssociatedTokenAccountUmiIx)(client.signer, (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(client.signer.publicKey), client.pos.supplyMint));
|
149
149
|
accountsGettingCreated.push(signerSupplyTa.publicKey.toString());
|
150
150
|
}
|
151
151
|
if (checkSignerDebtTa &&
|
152
152
|
!(0, utils_1.rpcAccountCreated)(signerDebtTa) &&
|
153
153
|
!accountsGettingCreated.includes(signerDebtTa.publicKey.toString())) {
|
154
154
|
client.log("Creating signer debt token account");
|
155
|
-
chores = chores.add((0, utils_1.createAssociatedTokenAccountUmiIx)(client.signer, (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(client.signer.publicKey), client.pos.debtMint
|
155
|
+
chores = chores.add((0, utils_1.createAssociatedTokenAccountUmiIx)(client.signer, (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(client.signer.publicKey), client.pos.debtMint));
|
156
156
|
accountsGettingCreated.push(signerDebtTa.publicKey.toString());
|
157
157
|
}
|
158
158
|
return chores;
|
@@ -176,6 +176,7 @@ function getRebalanceInstructions(umi, tx) {
|
|
176
176
|
rebalanceType: generated_1.SolautoRebalanceType.Regular,
|
177
177
|
swapType: generated_1.SwapType.ExactIn,
|
178
178
|
targetLiqUtilizationRateBps: 0,
|
179
|
+
priceType: generated_1.PriceType.Realtime,
|
179
180
|
flashLoanFeeBps: null,
|
180
181
|
})[0];
|
181
182
|
const [data, _] = serializer.deserialize(x.data);
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { PublicKey } from "@solana/web3.js";
|
2
2
|
import { Bank } from "../marginfi-sdk";
|
3
3
|
import { SolautoPositionEx } from "./solautoPositionEx";
|
4
|
-
import { LendingPlatform } from "../generated";
|
4
|
+
import { LendingPlatform, PriceType } from "../generated";
|
5
5
|
export declare class MarginfiSolautoPositionEx extends SolautoPositionEx {
|
6
6
|
lendingPlatform: LendingPlatform;
|
7
7
|
private marginfiAccountData;
|
@@ -11,7 +11,7 @@ export declare class MarginfiSolautoPositionEx extends SolautoPositionEx {
|
|
11
11
|
getBanks(): Promise<Bank[]>;
|
12
12
|
priceOracles(): Promise<PublicKey[]>;
|
13
13
|
maxLtvAndLiqThresholdBps(): Promise<[number, number]>;
|
14
|
-
supplyLiquidityAvailable(): number;
|
15
|
-
refreshPositionState(): Promise<void>;
|
14
|
+
get supplyLiquidityAvailable(): number;
|
15
|
+
refreshPositionState(priceType?: PriceType): Promise<void>;
|
16
16
|
}
|
17
17
|
//# sourceMappingURL=marginfiSolautoPositionEx.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"marginfiSolautoPositionEx.d.ts","sourceRoot":"","sources":["../../src/solautoPosition/marginfiSolautoPositionEx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EACL,IAAI,EAIL,MAAM,iBAAiB,CAAC;AAYzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;
|
1
|
+
{"version":3,"file":"marginfiSolautoPositionEx.d.ts","sourceRoot":"","sources":["../../src/solautoPosition/marginfiSolautoPositionEx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EACL,IAAI,EAIL,MAAM,iBAAiB,CAAC;AAYzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE1D,qBAAa,yBAA0B,SAAQ,iBAAiB;IAC9D,eAAe,kBAA4B;IAE3C,OAAO,CAAC,mBAAmB,CAAgC;IAC3D,OAAO,CAAC,UAAU,CAAqB;IACvC,OAAO,CAAC,QAAQ,CAAqB;IAExB,WAAW,IAAI,OAAO,CAAC,SAAS,CAAC;IAyBxC,QAAQ,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;IAgB3B,YAAY,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;IASpC,wBAAwB,IAAI,OAAO,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAa3D,IAAI,wBAAwB,IAAI,MAAM,CAKrC;IAEK,oBAAoB,CAAC,SAAS,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;CA2BjE"}
|
@@ -36,8 +36,8 @@ class MarginfiSolautoPositionEx extends solautoPositionEx_1.SolautoPositionEx {
|
|
36
36
|
if (!this.supplyBank || !this.debtBank) {
|
37
37
|
const group = (await this.lendingPool()).toString();
|
38
38
|
const bankAccounts = (0, constants_1.getMarginfiAccounts)(this.lpEnv).bankAccounts;
|
39
|
-
const supplyBank = bankAccounts[group][this.supplyMint
|
40
|
-
const debtBank = bankAccounts[group][this.debtMint
|
39
|
+
const supplyBank = bankAccounts[group][this.supplyMint.toString()].bank;
|
40
|
+
const debtBank = bankAccounts[group][this.debtMint.toString()].bank;
|
41
41
|
[this.supplyBank, this.debtBank] = await (0, marginfi_sdk_1.safeFetchAllBank)(this.umi, [
|
42
42
|
(0, umi_1.publicKey)(supplyBank),
|
43
43
|
(0, umi_1.publicKey)(debtBank),
|
@@ -54,23 +54,23 @@ class MarginfiSolautoPositionEx extends solautoPositionEx_1.SolautoPositionEx {
|
|
54
54
|
}
|
55
55
|
async maxLtvAndLiqThresholdBps() {
|
56
56
|
const [supplyBank, debtBank] = await this.getBanks();
|
57
|
-
const [supplyPrice] = await (0, utils_1.fetchTokenPrices)([this.supplyMint
|
57
|
+
const [supplyPrice] = await (0, utils_1.fetchTokenPrices)([this.supplyMint]);
|
58
58
|
const [maxLtvBps, liqThresholdBps] = (0, utils_1.calcMarginfiMaxLtvAndLiqThresholdBps)(supplyBank, debtBank, supplyPrice);
|
59
59
|
return [maxLtvBps, liqThresholdBps];
|
60
60
|
}
|
61
|
-
supplyLiquidityAvailable() {
|
62
|
-
return (0, utils_1.fromBaseUnit)((0, utils_1.getBankLiquidityAvailableBaseUnit)(this.supplyBank, false), this.state
|
61
|
+
get supplyLiquidityAvailable() {
|
62
|
+
return (0, utils_1.fromBaseUnit)((0, utils_1.getBankLiquidityAvailableBaseUnit)(this.supplyBank, false), this.state.supply.decimals);
|
63
63
|
}
|
64
|
-
async refreshPositionState() {
|
64
|
+
async refreshPositionState(priceType) {
|
65
65
|
if (!this.canRefreshPositionState()) {
|
66
66
|
return;
|
67
67
|
}
|
68
68
|
const useDesignatedMint = !this._data.position || !this._data.selfManaged;
|
69
69
|
const resp = await (0, utils_1.getMarginfiAccountPositionState)(this.umi, { pk: this.lpUserAccount }, await this.lendingPool(), useDesignatedMint
|
70
|
-
? { mint: (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.state
|
70
|
+
? { mint: (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.state.supply.mint) }
|
71
71
|
: undefined, useDesignatedMint
|
72
|
-
? { mint: (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.state
|
73
|
-
: undefined, this.lpEnv, this.contextUpdates);
|
72
|
+
? { mint: (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.state.debt.mint) }
|
73
|
+
: undefined, this.lpEnv, this.contextUpdates, priceType);
|
74
74
|
if (resp) {
|
75
75
|
this.supplyBank = resp.supplyBank;
|
76
76
|
this.debtBank = resp.debtBank;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { PublicKey } from "@solana/web3.js";
|
2
2
|
import { Umi } from "@metaplex-foundation/umi";
|
3
|
-
import { DCASettings, LendingPlatform, PositionState, SolautoPosition, SolautoSettingsParameters } from "../generated";
|
3
|
+
import { DCASettings, LendingPlatform, PositionState, PriceType, SolautoPosition, SolautoSettingsParameters } from "../generated";
|
4
4
|
import { ContextUpdates } from "../utils";
|
5
5
|
import { ProgramEnv, RebalanceAction } from "../types";
|
6
6
|
import { TokenInfo } from "../constants";
|
@@ -34,47 +34,58 @@ export declare abstract class SolautoPositionEx {
|
|
34
34
|
private readonly firstState;
|
35
35
|
constructor(args: PositionExArgs);
|
36
36
|
abstract lendingPool(): Promise<PublicKey>;
|
37
|
-
exists(): boolean;
|
38
|
-
authority(): PublicKey
|
39
|
-
positionId(): number | undefined;
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
37
|
+
get exists(): boolean;
|
38
|
+
get authority(): PublicKey;
|
39
|
+
get positionId(): number | undefined;
|
40
|
+
get positionType(): import("../generated").PositionType | undefined;
|
41
|
+
get strategyName(): string;
|
42
|
+
liqUtilizationRateBps(priceType?: PriceType): number;
|
43
|
+
protected get data(): SolautoPositionExData;
|
44
|
+
get state(): PositionState;
|
45
|
+
get settings(): SolautoSettingsParameters | undefined;
|
46
|
+
updateSettings(settings: SolautoSettingsParameters): void;
|
47
|
+
get dca(): DCASettings | undefined;
|
48
|
+
updateDca(dca: DCASettings): void;
|
49
|
+
get supplyMint(): PublicKey;
|
50
|
+
get supplyMintInfo(): TokenInfo;
|
51
|
+
get debtMint(): PublicKey;
|
52
|
+
get debtMintInfo(): TokenInfo;
|
53
|
+
get boostToBps(): number;
|
54
|
+
get maxBoostToBps(): number;
|
55
|
+
get boostFromBps(): number;
|
56
|
+
get repayToBps(): number;
|
57
|
+
get maxRepayToBps(): number;
|
58
|
+
get repayFromBps(): number;
|
59
|
+
get maxRepayFromBps(): number;
|
60
|
+
get netWorth(): number;
|
61
|
+
get netWorthUsd(): number;
|
62
|
+
get totalSupply(): number;
|
63
|
+
supplyUsd(priceType?: PriceType): number;
|
64
|
+
get totalDebt(): number;
|
65
|
+
debtUsd(priceType?: PriceType): number;
|
66
|
+
get supplyLiquidityDepositable(): number;
|
67
|
+
get supplyLiquidityUsdDepositable(): number;
|
68
|
+
get supplyLiquidityUsdAvailable(): number;
|
69
|
+
get debtLiquidityAvailable(): number;
|
70
|
+
get debtLiquidityUsdAvailable(): number;
|
71
|
+
abstract get supplyLiquidityAvailable(): number;
|
64
72
|
abstract maxLtvAndLiqThresholdBps(): Promise<[number, number]>;
|
65
73
|
abstract priceOracles(): Promise<PublicKey[]>;
|
66
|
-
|
67
|
-
sufficientLiquidityToBoost(): boolean;
|
74
|
+
private sufficientLiquidityToBoost;
|
68
75
|
eligibleForRebalance(bpsDistanceThreshold?: number): RebalanceAction | undefined;
|
69
76
|
eligibleForRefresh(): boolean;
|
70
77
|
protected canRefreshPositionState(): boolean;
|
71
|
-
abstract refreshPositionState(): Promise<void>;
|
78
|
+
abstract refreshPositionState(priceType?: PriceType): Promise<void>;
|
72
79
|
utilizationRateBpsDrift(): Promise<number>;
|
73
80
|
updateSupply(newSupplyUsd: number, supplyPrice?: number): void;
|
74
81
|
updateDebt(newDebtUsd: number, debtPrice?: number): void;
|
75
82
|
updateNetWorth(supplyPrice?: number): void;
|
76
|
-
updateLiqUtilizationRate(): void;
|
77
|
-
updateWithLatestPrices(
|
83
|
+
updateLiqUtilizationRate(priceType?: PriceType): void;
|
84
|
+
updateWithLatestPrices(data?: {
|
85
|
+
priceType?: PriceType;
|
86
|
+
supplyPrice?: number;
|
87
|
+
debtPrice?: number;
|
88
|
+
}): Promise<void>;
|
78
89
|
simulateRebalance(unixTime: number, supplyPrice: number, debtPrice: number, targetLiqUtilizationRateBps?: number): void;
|
79
90
|
refetchPositionData(): Promise<void>;
|
80
91
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"solautoPositionEx.d.ts","sourceRoot":"","sources":["../../src/solautoPosition/solautoPositionEx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAK/C,OAAO,EACL,WAAW,EAEX,eAAe,EACf,aAAa,EACb,eAAe,EACf,yBAAyB,EAC1B,MAAM,cAAc,CAAC;AACtB,OAAO,EAQL,cAAc,
|
1
|
+
{"version":3,"file":"solautoPositionEx.d.ts","sourceRoot":"","sources":["../../src/solautoPosition/solautoPositionEx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAK/C,OAAO,EACL,WAAW,EAEX,eAAe,EACf,aAAa,EACb,SAAS,EACT,eAAe,EACf,yBAAyB,EAC1B,MAAM,cAAc,CAAC;AACtB,OAAO,EAQL,cAAc,EAiBf,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAMvD,OAAO,EAAqC,SAAS,EAAE,MAAM,cAAc,CAAC;AAE5E,MAAM,WAAW,kBAAkB;IACjC,eAAe,EAAE,eAAe,CAAC;IACjC,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,aA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