@reflectmoney/stable.ts 2.0.4 → 2.0.5
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.
|
@@ -123,4 +123,5 @@ export declare class UsdcPlusStablecoin extends Stablecoin<DriftUsdcController>
|
|
|
123
123
|
private processRedemption;
|
|
124
124
|
simulateMintMath(usdcAmount: BN): Promise<BN>;
|
|
125
125
|
simulateRedeemMath(receiptTokens: BN): Promise<BN>;
|
|
126
|
+
depositDrift(signer: PublicKey, amount: BN): Promise<TransactionInstruction>;
|
|
126
127
|
}
|
|
@@ -374,5 +374,35 @@ class UsdcPlusStablecoin extends Stablecoin_1.Stablecoin {
|
|
|
374
374
|
return this.processRedemption(receiptTokens);
|
|
375
375
|
});
|
|
376
376
|
}
|
|
377
|
+
depositDrift(signer, amount) {
|
|
378
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
379
|
+
const { oracle, marketIndex } = sdk_1.SpotMarkets["mainnet-beta"][0];
|
|
380
|
+
const spotMarket = (0, sdk_1.getSpotMarketPublicKeySync)(constants_1.DRIFT_PROGRAM_ID, marketIndex);
|
|
381
|
+
const [{ mint }] = this.collaterals;
|
|
382
|
+
const controllerTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(mint, this.controllerKey, true);
|
|
383
|
+
const depositorTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(mint, signer, true);
|
|
384
|
+
const bump = this.controller.baseStrategy.bump;
|
|
385
|
+
const ix = (0, reflect_main_1.createDepositDriftInstruction)({
|
|
386
|
+
controller: this.controllerKey,
|
|
387
|
+
depositor: signer,
|
|
388
|
+
spotMarket,
|
|
389
|
+
controllerTokenAccount,
|
|
390
|
+
main: classes_1.PdaClient.deriveMain(),
|
|
391
|
+
userAccount: (0, sdk_1.getUserAccountPublicKeySync)(constants_1.DRIFT_PROGRAM_ID, this.controllerKey),
|
|
392
|
+
userStats: (0, sdk_1.getUserStatsAccountPublicKey)(constants_1.DRIFT_PROGRAM_ID, this.controllerKey),
|
|
393
|
+
spotMarketVault: yield (0, sdk_1.getSpotMarketVaultPublicKey)(constants_1.DRIFT_PROGRAM_ID, 0),
|
|
394
|
+
oracle,
|
|
395
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
396
|
+
state: yield (0, sdk_1.getDriftStateAccountPublicKey)(constants_1.DRIFT_PROGRAM_ID),
|
|
397
|
+
depositorTokenAccount,
|
|
398
|
+
drift: constants_1.DRIFT_PROGRAM_ID
|
|
399
|
+
}, {
|
|
400
|
+
amount,
|
|
401
|
+
controllerBump: bump,
|
|
402
|
+
controllerIndex: this.index,
|
|
403
|
+
}, reflect_main_1.PROGRAM_ID);
|
|
404
|
+
return ix;
|
|
405
|
+
});
|
|
406
|
+
}
|
|
377
407
|
}
|
|
378
408
|
exports.UsdcPlusStablecoin = UsdcPlusStablecoin;
|