@reflectmoney/stable.ts 2.0.7 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/classes/Stablecoin.d.ts +4 -0
- package/dist/classes/Stablecoin.js +11 -2
- package/dist/constants/lookupTables.js +1 -1
- package/dist/generated/reflect_main/accounts/DriftJlpController.js +1 -1
- package/dist/generated/reflect_main/accounts/DriftLstController.js +1 -1
- package/dist/generated/reflect_main/accounts/DriftUsdcController.js +1 -1
- package/dist/generated/reflect_main/accounts/Main.js +1 -1
- package/dist/generated/reflect_main/accounts/PerpMarket.js +1 -1
- package/dist/generated/reflect_main/accounts/PrelaunchOracle.js +1 -1
- package/dist/generated/reflect_main/accounts/PythLazerOracle.js +1 -1
- package/dist/generated/reflect_main/accounts/RebalanceLst.js +1 -1
- package/dist/generated/reflect_main/accounts/SpotMarket.js +1 -1
- package/dist/generated/reflect_main/accounts/User.js +1 -1
- package/dist/generated/reflect_main/accounts/UserPermissions.js +1 -1
- package/dist/generated/reflect_main/accounts/UserStats.js +1 -1
- package/dist/generated/reflect_main/index.d.ts +1 -1
- package/dist/generated/reflect_main/index.js +1 -1
- package/dist/generated/reflect_main/instructions/addLstDrift.js +1 -1
- package/dist/generated/reflect_main/instructions/addSubAccount.js +1 -1
- package/dist/generated/reflect_main/instructions/captureSpreadDrift.js +1 -1
- package/dist/generated/reflect_main/instructions/createAdminAccount.js +1 -1
- package/dist/generated/reflect_main/instructions/createUserStatsAccount.js +1 -1
- package/dist/generated/reflect_main/instructions/depositDrift.js +1 -1
- package/dist/generated/reflect_main/instructions/freezeProgram.js +1 -1
- package/dist/generated/reflect_main/instructions/freezeProtocolAction.js +1 -1
- package/dist/generated/reflect_main/instructions/freezeStrategyAction.js +1 -1
- package/dist/generated/reflect_main/instructions/increaseAdminSize.js +1 -1
- package/dist/generated/reflect_main/instructions/initDriftAccountsS1.js +1 -1
- package/dist/generated/reflect_main/instructions/initDriftControllerS1.js +1 -1
- package/dist/generated/reflect_main/instructions/initDriftControllerS3.js +1 -1
- package/dist/generated/reflect_main/instructions/initMain.js +1 -1
- package/dist/generated/reflect_main/instructions/mintDriftS1.js +1 -1
- package/dist/generated/reflect_main/instructions/mintDriftS3.js +1 -1
- package/dist/generated/reflect_main/instructions/processSwapDeposit.js +1 -1
- package/dist/generated/reflect_main/instructions/processSwapWithdraw.js +1 -1
- package/dist/generated/reflect_main/instructions/redeemDriftS1.js +1 -1
- package/dist/generated/reflect_main/instructions/redeemDriftS3.js +1 -1
- package/dist/generated/reflect_main/instructions/settlePnl.js +1 -1
- package/dist/generated/reflect_main/instructions/settlePnlMulti.js +1 -1
- package/dist/generated/reflect_main/instructions/suspendSplProtocol.js +1 -1
- package/dist/generated/reflect_main/instructions/suspendSplStrategy.js +1 -1
- package/dist/generated/reflect_main/instructions/swapOrca.js +1 -1
- package/dist/generated/reflect_main/instructions/swapOrcaTwoHop.js +1 -1
- package/dist/generated/reflect_main/instructions/updateActionRoleProtocol.js +1 -1
- package/dist/generated/reflect_main/instructions/updateActionRoleStrategy.js +1 -1
- package/dist/generated/reflect_main/instructions/updateAttenuation.js +1 -1
- package/dist/generated/reflect_main/instructions/updateCap.js +1 -1
- package/dist/generated/reflect_main/instructions/updateRecipients.js +1 -1
- package/dist/generated/reflect_main/instructions/updateRoleHolderProtocol.js +1 -1
- package/dist/generated/reflect_main/instructions/updateRoleHolderStrategy.js +1 -1
- package/dist/generated/reflect_main/types/AutoCompound.d.ts +0 -1
- package/dist/generated/reflect_main/types/AutoCompound.js +0 -1
- package/dist/stablecoins/UsdcPlusStablecoin.js +2 -2
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@ import { AccountMeta, Connection, Keypair, PublicKey, TransactionInstruction } f
|
|
|
2
2
|
import BN from "bn.js";
|
|
3
3
|
import { DriftClient } from "@drift-labs/sdk";
|
|
4
4
|
import { Action, Strategy } from "../generated/reflect_main";
|
|
5
|
+
import { RawMint } from "@solana/spl-token";
|
|
5
6
|
import { StablecoinMetadata, Collateral, Controller, MintContext, PythResponse } from "../types";
|
|
6
7
|
/**
|
|
7
8
|
* Abstract base class for all stablecoin implementations in the Reflect protocol.
|
|
@@ -30,6 +31,8 @@ export declare abstract class Stablecoin<T extends Controller> {
|
|
|
30
31
|
collaterals: Collateral[];
|
|
31
32
|
/** Public key of the stablecoin mint */
|
|
32
33
|
stablecoinMint: PublicKey;
|
|
34
|
+
/** Data of the stablecoin mint */
|
|
35
|
+
stablecoinMintData: RawMint;
|
|
33
36
|
/** Optional Drift client instance for DeFi operations */
|
|
34
37
|
driftClient?: DriftClient;
|
|
35
38
|
/** Lookup table with stablecoin-specific accounts. */
|
|
@@ -43,6 +46,7 @@ export declare abstract class Stablecoin<T extends Controller> {
|
|
|
43
46
|
load(schema?: {
|
|
44
47
|
fromAccountAddress: (connection: Connection, key: PublicKey) => Promise<T>;
|
|
45
48
|
}): Promise<void>;
|
|
49
|
+
loadMint(): Promise<void>;
|
|
46
50
|
buildLookupTables<T extends MintContext>(signer: PublicKey): Promise<{
|
|
47
51
|
instructions: TransactionInstruction[];
|
|
48
52
|
lookupTable: PublicKey;
|
|
@@ -50,6 +50,13 @@ class Stablecoin {
|
|
|
50
50
|
if (this.driftClient) {
|
|
51
51
|
yield this.driftClient.subscribe();
|
|
52
52
|
}
|
|
53
|
+
yield this.loadMint();
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
loadMint() {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
const { data } = yield this.connection.getAccountInfo(this.stablecoinMint);
|
|
59
|
+
this.stablecoinMintData = spl_token_1.MintLayout.decode(data);
|
|
53
60
|
});
|
|
54
61
|
}
|
|
55
62
|
buildLookupTables(signer) {
|
|
@@ -338,10 +345,10 @@ class Stablecoin {
|
|
|
338
345
|
const { decimals } = yield (0, spl_token_1.getMint)(this.connection, collateralMint);
|
|
339
346
|
const collateralAmount = new bn_js_1.default(amount)
|
|
340
347
|
.mul(new bn_js_1.default(10).pow(new bn_js_1.default(decimals)))
|
|
348
|
+
.mul(new bn_js_1.default(10000 - slippageBips))
|
|
341
349
|
.div(new bn_js_1.default(10).pow(new bn_js_1.default(6))) // stablecoin decimals
|
|
342
350
|
.div(price)
|
|
343
351
|
.div(new bn_js_1.default(10).pow(new bn_js_1.default(expo)))
|
|
344
|
-
.mul(new bn_js_1.default(10000 - slippageBips))
|
|
345
352
|
.div(new bn_js_1.default(10000));
|
|
346
353
|
return collateralAmount;
|
|
347
354
|
});
|
|
@@ -364,8 +371,10 @@ class Stablecoin {
|
|
|
364
371
|
const stablecoinAmount = new bn_js_1.default(amount)
|
|
365
372
|
.mul(price)
|
|
366
373
|
.mul(new bn_js_1.default(10).pow(new bn_js_1.default(6))) // stablecoin decimals
|
|
374
|
+
.mul(new bn_js_1.default(10000 - slippageBips))
|
|
367
375
|
.div(new bn_js_1.default(10).pow(new bn_js_1.default(expo)))
|
|
368
|
-
.div(new bn_js_1.default(10).pow(new bn_js_1.default(decimals)))
|
|
376
|
+
.div(new bn_js_1.default(10).pow(new bn_js_1.default(decimals)))
|
|
377
|
+
.div(new bn_js_1.default(10000));
|
|
369
378
|
return stablecoinAmount;
|
|
370
379
|
});
|
|
371
380
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LST_LOOKUP_TABLE = exports.JLP_LOOKUP_TABLE = exports.USDC_PLUS_LOOKUP_TABLE = void 0;
|
|
4
4
|
const web3_js_1 = require("@solana/web3.js");
|
|
5
|
-
exports.USDC_PLUS_LOOKUP_TABLE = new web3_js_1.PublicKey("
|
|
5
|
+
exports.USDC_PLUS_LOOKUP_TABLE = new web3_js_1.PublicKey("23FkJhYpNQwizoD7mFLxL9oTPqaqTitHESUPLLKC5uJc");
|
|
6
6
|
exports.JLP_LOOKUP_TABLE = new web3_js_1.PublicKey(0);
|
|
7
7
|
exports.LST_LOOKUP_TABLE = new web3_js_1.PublicKey(0);
|
|
@@ -95,7 +95,7 @@ class DriftJlpController {
|
|
|
95
95
|
*
|
|
96
96
|
* @param programId - the program that owns the accounts we are filtering
|
|
97
97
|
*/
|
|
98
|
-
static gpaBuilder(programId = new web3.PublicKey('
|
|
98
|
+
static gpaBuilder(programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
99
99
|
return beetSolana.GpaBuilder.fromStruct(programId, exports.driftJlpControllerBeet);
|
|
100
100
|
}
|
|
101
101
|
/**
|
|
@@ -95,7 +95,7 @@ class DriftLstController {
|
|
|
95
95
|
*
|
|
96
96
|
* @param programId - the program that owns the accounts we are filtering
|
|
97
97
|
*/
|
|
98
|
-
static gpaBuilder(programId = new web3.PublicKey('
|
|
98
|
+
static gpaBuilder(programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
99
99
|
return beetSolana.GpaBuilder.fromStruct(programId, exports.driftLstControllerBeet);
|
|
100
100
|
}
|
|
101
101
|
/**
|
|
@@ -93,7 +93,7 @@ class DriftUsdcController {
|
|
|
93
93
|
*
|
|
94
94
|
* @param programId - the program that owns the accounts we are filtering
|
|
95
95
|
*/
|
|
96
|
-
static gpaBuilder(programId = new web3.PublicKey('
|
|
96
|
+
static gpaBuilder(programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
97
97
|
return beetSolana.GpaBuilder.fromStruct(programId, exports.driftUsdcControllerBeet);
|
|
98
98
|
}
|
|
99
99
|
/**
|
|
@@ -95,7 +95,7 @@ class Main {
|
|
|
95
95
|
*
|
|
96
96
|
* @param programId - the program that owns the accounts we are filtering
|
|
97
97
|
*/
|
|
98
|
-
static gpaBuilder(programId = new web3.PublicKey('
|
|
98
|
+
static gpaBuilder(programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
99
99
|
return beetSolana.GpaBuilder.fromStruct(programId, exports.mainBeet);
|
|
100
100
|
}
|
|
101
101
|
/**
|
|
@@ -122,7 +122,7 @@ class PerpMarket {
|
|
|
122
122
|
*
|
|
123
123
|
* @param programId - the program that owns the accounts we are filtering
|
|
124
124
|
*/
|
|
125
|
-
static gpaBuilder(programId = new web3.PublicKey('
|
|
125
|
+
static gpaBuilder(programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
126
126
|
return beetSolana.GpaBuilder.fromStruct(programId, exports.perpMarketBeet);
|
|
127
127
|
}
|
|
128
128
|
/**
|
|
@@ -94,7 +94,7 @@ class PrelaunchOracle {
|
|
|
94
94
|
*
|
|
95
95
|
* @param programId - the program that owns the accounts we are filtering
|
|
96
96
|
*/
|
|
97
|
-
static gpaBuilder(programId = new web3.PublicKey('
|
|
97
|
+
static gpaBuilder(programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
98
98
|
return beetSolana.GpaBuilder.fromStruct(programId, exports.prelaunchOracleBeet);
|
|
99
99
|
}
|
|
100
100
|
/**
|
|
@@ -93,7 +93,7 @@ class PythLazerOracle {
|
|
|
93
93
|
*
|
|
94
94
|
* @param programId - the program that owns the accounts we are filtering
|
|
95
95
|
*/
|
|
96
|
-
static gpaBuilder(programId = new web3.PublicKey('
|
|
96
|
+
static gpaBuilder(programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
97
97
|
return beetSolana.GpaBuilder.fromStruct(programId, exports.pythLazerOracleBeet);
|
|
98
98
|
}
|
|
99
99
|
/**
|
|
@@ -94,7 +94,7 @@ class RebalanceLst {
|
|
|
94
94
|
*
|
|
95
95
|
* @param programId - the program that owns the accounts we are filtering
|
|
96
96
|
*/
|
|
97
|
-
static gpaBuilder(programId = new web3.PublicKey('
|
|
97
|
+
static gpaBuilder(programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
98
98
|
return beetSolana.GpaBuilder.fromStruct(programId, exports.rebalanceLstBeet);
|
|
99
99
|
}
|
|
100
100
|
/**
|
|
@@ -151,7 +151,7 @@ class SpotMarket {
|
|
|
151
151
|
*
|
|
152
152
|
* @param programId - the program that owns the accounts we are filtering
|
|
153
153
|
*/
|
|
154
|
-
static gpaBuilder(programId = new web3.PublicKey('
|
|
154
|
+
static gpaBuilder(programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
155
155
|
return beetSolana.GpaBuilder.fromStruct(programId, exports.spotMarketBeet);
|
|
156
156
|
}
|
|
157
157
|
/**
|
|
@@ -117,7 +117,7 @@ class User {
|
|
|
117
117
|
*
|
|
118
118
|
* @param programId - the program that owns the accounts we are filtering
|
|
119
119
|
*/
|
|
120
|
-
static gpaBuilder(programId = new web3.PublicKey('
|
|
120
|
+
static gpaBuilder(programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
121
121
|
return beetSolana.GpaBuilder.fromStruct(programId, exports.userBeet);
|
|
122
122
|
}
|
|
123
123
|
/**
|
|
@@ -93,7 +93,7 @@ class UserPermissions {
|
|
|
93
93
|
*
|
|
94
94
|
* @param programId - the program that owns the accounts we are filtering
|
|
95
95
|
*/
|
|
96
|
-
static gpaBuilder(programId = new web3.PublicKey('
|
|
96
|
+
static gpaBuilder(programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
97
97
|
return beetSolana.GpaBuilder.fromStruct(programId, exports.userPermissionsBeet);
|
|
98
98
|
}
|
|
99
99
|
/**
|
|
@@ -113,7 +113,7 @@ class UserStats {
|
|
|
113
113
|
*
|
|
114
114
|
* @param programId - the program that owns the accounts we are filtering
|
|
115
115
|
*/
|
|
116
|
-
static gpaBuilder(programId = new web3.PublicKey('
|
|
116
|
+
static gpaBuilder(programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
117
117
|
return beetSolana.GpaBuilder.fromStruct(programId, exports.userStatsBeet);
|
|
118
118
|
}
|
|
119
119
|
/**
|
|
@@ -9,7 +9,7 @@ export * from './types';
|
|
|
9
9
|
* @category constants
|
|
10
10
|
* @category generated
|
|
11
11
|
*/
|
|
12
|
-
export declare const PROGRAM_ADDRESS = "
|
|
12
|
+
export declare const PROGRAM_ADDRESS = "rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX";
|
|
13
13
|
/**
|
|
14
14
|
* Program public key
|
|
15
15
|
*
|
|
@@ -26,7 +26,7 @@ __exportStar(require("./types"), exports);
|
|
|
26
26
|
* @category constants
|
|
27
27
|
* @category generated
|
|
28
28
|
*/
|
|
29
|
-
exports.PROGRAM_ADDRESS = '
|
|
29
|
+
exports.PROGRAM_ADDRESS = 'rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX';
|
|
30
30
|
/**
|
|
31
31
|
* Program public key
|
|
32
32
|
*
|
|
@@ -50,7 +50,7 @@ exports.addLstDriftInstructionDiscriminator = [
|
|
|
50
50
|
* @category AddLstDrift
|
|
51
51
|
* @category generated
|
|
52
52
|
*/
|
|
53
|
-
function createAddLstDriftInstruction(accounts, programId = new web3.PublicKey('
|
|
53
|
+
function createAddLstDriftInstruction(accounts, programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
54
54
|
var _a;
|
|
55
55
|
const [data] = exports.addLstDriftStruct.serialize({
|
|
56
56
|
instructionDiscriminator: exports.addLstDriftInstructionDiscriminator,
|
|
@@ -50,7 +50,7 @@ exports.addSubAccountInstructionDiscriminator = [
|
|
|
50
50
|
* @category AddSubAccount
|
|
51
51
|
* @category generated
|
|
52
52
|
*/
|
|
53
|
-
function createAddSubAccountInstruction(accounts, programId = new web3.PublicKey('
|
|
53
|
+
function createAddSubAccountInstruction(accounts, programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
54
54
|
var _a, _b;
|
|
55
55
|
const [data] = exports.addSubAccountStruct.serialize({
|
|
56
56
|
instructionDiscriminator: exports.addSubAccountInstructionDiscriminator,
|
|
@@ -59,7 +59,7 @@ exports.captureSpreadDriftInstructionDiscriminator = [
|
|
|
59
59
|
* @category CaptureSpreadDrift
|
|
60
60
|
* @category generated
|
|
61
61
|
*/
|
|
62
|
-
function createCaptureSpreadDriftInstruction(accounts, args, programId = new web3.PublicKey('
|
|
62
|
+
function createCaptureSpreadDriftInstruction(accounts, args, programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
63
63
|
var _a, _b;
|
|
64
64
|
const [data] = exports.captureSpreadDriftStruct.serialize(Object.assign({ instructionDiscriminator: exports.captureSpreadDriftInstructionDiscriminator }, args));
|
|
65
65
|
const keys = [
|
|
@@ -57,7 +57,7 @@ exports.createAdminAccountInstructionDiscriminator = [
|
|
|
57
57
|
* @category CreateAdminAccount
|
|
58
58
|
* @category generated
|
|
59
59
|
*/
|
|
60
|
-
function createCreateAdminAccountInstruction(accounts, args, programId = new web3.PublicKey('
|
|
60
|
+
function createCreateAdminAccountInstruction(accounts, args, programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
61
61
|
var _a;
|
|
62
62
|
const [data] = exports.createAdminAccountStruct.serialize(Object.assign({ instructionDiscriminator: exports.createAdminAccountInstructionDiscriminator }, args));
|
|
63
63
|
const keys = [
|
|
@@ -50,7 +50,7 @@ exports.createUserStatsAccountInstructionDiscriminator = [
|
|
|
50
50
|
* @category CreateUserStatsAccount
|
|
51
51
|
* @category generated
|
|
52
52
|
*/
|
|
53
|
-
function createCreateUserStatsAccountInstruction(accounts, programId = new web3.PublicKey('
|
|
53
|
+
function createCreateUserStatsAccountInstruction(accounts, programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
54
54
|
var _a, _b;
|
|
55
55
|
const [data] = exports.createUserStatsAccountStruct.serialize({
|
|
56
56
|
instructionDiscriminator: exports.createUserStatsAccountInstructionDiscriminator,
|
|
@@ -58,7 +58,7 @@ exports.depositDriftInstructionDiscriminator = [
|
|
|
58
58
|
* @category DepositDrift
|
|
59
59
|
* @category generated
|
|
60
60
|
*/
|
|
61
|
-
function createDepositDriftInstruction(accounts, args, programId = new web3.PublicKey('
|
|
61
|
+
function createDepositDriftInstruction(accounts, args, programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
62
62
|
var _a;
|
|
63
63
|
const [data] = exports.depositDriftStruct.serialize(Object.assign({ instructionDiscriminator: exports.depositDriftInstructionDiscriminator }, args));
|
|
64
64
|
const keys = [
|
|
@@ -56,7 +56,7 @@ exports.freezeProgramInstructionDiscriminator = [
|
|
|
56
56
|
* @category FreezeProgram
|
|
57
57
|
* @category generated
|
|
58
58
|
*/
|
|
59
|
-
function createFreezeProgramInstruction(accounts, args, programId = new web3.PublicKey('
|
|
59
|
+
function createFreezeProgramInstruction(accounts, args, programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
60
60
|
var _a;
|
|
61
61
|
const [data] = exports.freezeProgramStruct.serialize(Object.assign({ instructionDiscriminator: exports.freezeProgramInstructionDiscriminator }, args));
|
|
62
62
|
const keys = [
|
|
@@ -57,7 +57,7 @@ exports.freezeProtocolActionInstructionDiscriminator = [
|
|
|
57
57
|
* @category FreezeProtocolAction
|
|
58
58
|
* @category generated
|
|
59
59
|
*/
|
|
60
|
-
function createFreezeProtocolActionInstruction(accounts, args, programId = new web3.PublicKey('
|
|
60
|
+
function createFreezeProtocolActionInstruction(accounts, args, programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
61
61
|
var _a;
|
|
62
62
|
const [data] = exports.freezeProtocolActionStruct.serialize(Object.assign({ instructionDiscriminator: exports.freezeProtocolActionInstructionDiscriminator }, args));
|
|
63
63
|
const keys = [
|
|
@@ -58,7 +58,7 @@ exports.freezeStrategyActionInstructionDiscriminator = [
|
|
|
58
58
|
* @category FreezeStrategyAction
|
|
59
59
|
* @category generated
|
|
60
60
|
*/
|
|
61
|
-
function createFreezeStrategyActionInstruction(accounts, args, programId = new web3.PublicKey('
|
|
61
|
+
function createFreezeStrategyActionInstruction(accounts, args, programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
62
62
|
var _a;
|
|
63
63
|
const [data] = exports.freezeStrategyActionStruct.serialize(Object.assign({ instructionDiscriminator: exports.freezeStrategyActionInstructionDiscriminator }, args));
|
|
64
64
|
const keys = [
|
|
@@ -55,7 +55,7 @@ exports.increaseAdminSizeInstructionDiscriminator = [
|
|
|
55
55
|
* @category IncreaseAdminSize
|
|
56
56
|
* @category generated
|
|
57
57
|
*/
|
|
58
|
-
function createIncreaseAdminSizeInstruction(accounts, args, programId = new web3.PublicKey('
|
|
58
|
+
function createIncreaseAdminSizeInstruction(accounts, args, programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
59
59
|
var _a;
|
|
60
60
|
const [data] = exports.increaseAdminSizeStruct.serialize(Object.assign({ instructionDiscriminator: exports.increaseAdminSizeInstructionDiscriminator }, args));
|
|
61
61
|
const keys = [
|
|
@@ -50,7 +50,7 @@ exports.initDriftAccountsS1InstructionDiscriminator = [
|
|
|
50
50
|
* @category InitDriftAccountsS1
|
|
51
51
|
* @category generated
|
|
52
52
|
*/
|
|
53
|
-
function createInitDriftAccountsS1Instruction(accounts, programId = new web3.PublicKey('
|
|
53
|
+
function createInitDriftAccountsS1Instruction(accounts, programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
54
54
|
var _a, _b;
|
|
55
55
|
const [data] = exports.initDriftAccountsS1Struct.serialize({
|
|
56
56
|
instructionDiscriminator: exports.initDriftAccountsS1InstructionDiscriminator,
|
|
@@ -59,7 +59,7 @@ exports.initDriftControllerS1InstructionDiscriminator = [
|
|
|
59
59
|
* @category InitDriftControllerS1
|
|
60
60
|
* @category generated
|
|
61
61
|
*/
|
|
62
|
-
function createInitDriftControllerS1Instruction(accounts, args, programId = new web3.PublicKey('
|
|
62
|
+
function createInitDriftControllerS1Instruction(accounts, args, programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
63
63
|
var _a;
|
|
64
64
|
const [data] = exports.initDriftControllerS1Struct.serialize(Object.assign({ instructionDiscriminator: exports.initDriftControllerS1InstructionDiscriminator }, args));
|
|
65
65
|
const keys = [
|
|
@@ -59,7 +59,7 @@ exports.initDriftControllerS3InstructionDiscriminator = [
|
|
|
59
59
|
* @category InitDriftControllerS3
|
|
60
60
|
* @category generated
|
|
61
61
|
*/
|
|
62
|
-
function createInitDriftControllerS3Instruction(accounts, args, programId = new web3.PublicKey('
|
|
62
|
+
function createInitDriftControllerS3Instruction(accounts, args, programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
63
63
|
var _a;
|
|
64
64
|
const [data] = exports.initDriftControllerS3Struct.serialize(Object.assign({ instructionDiscriminator: exports.initDriftControllerS3InstructionDiscriminator }, args));
|
|
65
65
|
const keys = [
|
|
@@ -50,7 +50,7 @@ exports.initMainInstructionDiscriminator = [
|
|
|
50
50
|
* @category InitMain
|
|
51
51
|
* @category generated
|
|
52
52
|
*/
|
|
53
|
-
function createInitMainInstruction(accounts, programId = new web3.PublicKey('
|
|
53
|
+
function createInitMainInstruction(accounts, programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
54
54
|
var _a;
|
|
55
55
|
const [data] = exports.initMainStruct.serialize({
|
|
56
56
|
instructionDiscriminator: exports.initMainInstructionDiscriminator,
|
|
@@ -60,7 +60,7 @@ exports.mintDriftS1InstructionDiscriminator = [
|
|
|
60
60
|
* @category MintDriftS1
|
|
61
61
|
* @category generated
|
|
62
62
|
*/
|
|
63
|
-
function createMintDriftS1Instruction(accounts, args, programId = new web3.PublicKey('
|
|
63
|
+
function createMintDriftS1Instruction(accounts, args, programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
64
64
|
var _a, _b, _c;
|
|
65
65
|
const [data] = exports.mintDriftS1Struct.serialize(Object.assign({ instructionDiscriminator: exports.mintDriftS1InstructionDiscriminator }, args));
|
|
66
66
|
const keys = [
|
|
@@ -60,7 +60,7 @@ exports.mintDriftS3InstructionDiscriminator = [
|
|
|
60
60
|
* @category MintDriftS3
|
|
61
61
|
* @category generated
|
|
62
62
|
*/
|
|
63
|
-
function createMintDriftS3Instruction(accounts, args, programId = new web3.PublicKey('
|
|
63
|
+
function createMintDriftS3Instruction(accounts, args, programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
64
64
|
var _a, _b, _c;
|
|
65
65
|
const [data] = exports.mintDriftS3Struct.serialize(Object.assign({ instructionDiscriminator: exports.mintDriftS3InstructionDiscriminator }, args));
|
|
66
66
|
const keys = [
|
|
@@ -54,7 +54,7 @@ exports.processSwapDepositInstructionDiscriminator = [
|
|
|
54
54
|
* @category ProcessSwapDeposit
|
|
55
55
|
* @category generated
|
|
56
56
|
*/
|
|
57
|
-
function createProcessSwapDepositInstruction(accounts, programId = new web3.PublicKey('
|
|
57
|
+
function createProcessSwapDepositInstruction(accounts, programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
58
58
|
var _a, _b, _c;
|
|
59
59
|
const [data] = exports.processSwapDepositStruct.serialize({
|
|
60
60
|
instructionDiscriminator: exports.processSwapDepositInstructionDiscriminator,
|
|
@@ -54,7 +54,7 @@ exports.processSwapWithdrawInstructionDiscriminator = [
|
|
|
54
54
|
* @category ProcessSwapWithdraw
|
|
55
55
|
* @category generated
|
|
56
56
|
*/
|
|
57
|
-
function createProcessSwapWithdrawInstruction(accounts, programId = new web3.PublicKey('
|
|
57
|
+
function createProcessSwapWithdrawInstruction(accounts, programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
58
58
|
var _a, _b, _c;
|
|
59
59
|
const [data] = exports.processSwapWithdrawStruct.serialize({
|
|
60
60
|
instructionDiscriminator: exports.processSwapWithdrawInstructionDiscriminator,
|
|
@@ -61,7 +61,7 @@ exports.redeemDriftS1InstructionDiscriminator = [
|
|
|
61
61
|
* @category RedeemDriftS1
|
|
62
62
|
* @category generated
|
|
63
63
|
*/
|
|
64
|
-
function createRedeemDriftS1Instruction(accounts, args, programId = new web3.PublicKey('
|
|
64
|
+
function createRedeemDriftS1Instruction(accounts, args, programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
65
65
|
var _a, _b, _c;
|
|
66
66
|
const [data] = exports.redeemDriftS1Struct.serialize(Object.assign({ instructionDiscriminator: exports.redeemDriftS1InstructionDiscriminator }, args));
|
|
67
67
|
const keys = [
|
|
@@ -61,7 +61,7 @@ exports.redeemDriftS3InstructionDiscriminator = [
|
|
|
61
61
|
* @category RedeemDriftS3
|
|
62
62
|
* @category generated
|
|
63
63
|
*/
|
|
64
|
-
function createRedeemDriftS3Instruction(accounts, args, programId = new web3.PublicKey('
|
|
64
|
+
function createRedeemDriftS3Instruction(accounts, args, programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
65
65
|
var _a, _b, _c;
|
|
66
66
|
const [data] = exports.redeemDriftS3Struct.serialize(Object.assign({ instructionDiscriminator: exports.redeemDriftS3InstructionDiscriminator }, args));
|
|
67
67
|
const keys = [
|
|
@@ -50,7 +50,7 @@ exports.settlePnlInstructionDiscriminator = [
|
|
|
50
50
|
* @category SettlePnl
|
|
51
51
|
* @category generated
|
|
52
52
|
*/
|
|
53
|
-
function createSettlePnlInstruction(accounts, programId = new web3.PublicKey('
|
|
53
|
+
function createSettlePnlInstruction(accounts, programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
54
54
|
const [data] = exports.settlePnlStruct.serialize({
|
|
55
55
|
instructionDiscriminator: exports.settlePnlInstructionDiscriminator,
|
|
56
56
|
});
|
|
@@ -55,7 +55,7 @@ exports.settlePnlMultiInstructionDiscriminator = [
|
|
|
55
55
|
* @category SettlePnlMulti
|
|
56
56
|
* @category generated
|
|
57
57
|
*/
|
|
58
|
-
function createSettlePnlMultiInstruction(accounts, args, programId = new web3.PublicKey('
|
|
58
|
+
function createSettlePnlMultiInstruction(accounts, args, programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
59
59
|
const [data] = exports.settlePnlMultiStruct.serialize(Object.assign({ instructionDiscriminator: exports.settlePnlMultiInstructionDiscriminator }, args));
|
|
60
60
|
const keys = [
|
|
61
61
|
{
|
|
@@ -57,7 +57,7 @@ exports.suspendSplProtocolInstructionDiscriminator = [
|
|
|
57
57
|
* @category SuspendSplProtocol
|
|
58
58
|
* @category generated
|
|
59
59
|
*/
|
|
60
|
-
function createSuspendSplProtocolInstruction(accounts, args, programId = new web3.PublicKey('
|
|
60
|
+
function createSuspendSplProtocolInstruction(accounts, args, programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
61
61
|
var _a;
|
|
62
62
|
const [data] = exports.suspendSplProtocolStruct.serialize(Object.assign({ instructionDiscriminator: exports.suspendSplProtocolInstructionDiscriminator }, args));
|
|
63
63
|
const keys = [
|
|
@@ -57,7 +57,7 @@ exports.suspendSplStrategyInstructionDiscriminator = [
|
|
|
57
57
|
* @category SuspendSplStrategy
|
|
58
58
|
* @category generated
|
|
59
59
|
*/
|
|
60
|
-
function createSuspendSplStrategyInstruction(accounts, args, programId = new web3.PublicKey('
|
|
60
|
+
function createSuspendSplStrategyInstruction(accounts, args, programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
61
61
|
var _a;
|
|
62
62
|
const [data] = exports.suspendSplStrategyStruct.serialize(Object.assign({ instructionDiscriminator: exports.suspendSplStrategyInstructionDiscriminator }, args));
|
|
63
63
|
const keys = [
|
|
@@ -62,7 +62,7 @@ exports.swapOrcaInstructionDiscriminator = [
|
|
|
62
62
|
* @category SwapOrca
|
|
63
63
|
* @category generated
|
|
64
64
|
*/
|
|
65
|
-
function createSwapOrcaInstruction(accounts, args, programId = new web3.PublicKey('
|
|
65
|
+
function createSwapOrcaInstruction(accounts, args, programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
66
66
|
var _a, _b;
|
|
67
67
|
const [data] = exports.swapOrcaStruct.serialize(Object.assign({ instructionDiscriminator: exports.swapOrcaInstructionDiscriminator }, args));
|
|
68
68
|
const keys = [
|
|
@@ -64,7 +64,7 @@ exports.swapOrcaTwoHopInstructionDiscriminator = [
|
|
|
64
64
|
* @category SwapOrcaTwoHop
|
|
65
65
|
* @category generated
|
|
66
66
|
*/
|
|
67
|
-
function createSwapOrcaTwoHopInstruction(accounts, args, programId = new web3.PublicKey('
|
|
67
|
+
function createSwapOrcaTwoHopInstruction(accounts, args, programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
68
68
|
var _a, _b;
|
|
69
69
|
const [data] = exports.swapOrcaTwoHopStruct.serialize(Object.assign({ instructionDiscriminator: exports.swapOrcaTwoHopInstructionDiscriminator }, args));
|
|
70
70
|
const keys = [
|
|
@@ -60,7 +60,7 @@ exports.updateActionRoleProtocolInstructionDiscriminator = [
|
|
|
60
60
|
* @category UpdateActionRoleProtocol
|
|
61
61
|
* @category generated
|
|
62
62
|
*/
|
|
63
|
-
function createUpdateActionRoleProtocolInstruction(accounts, args, programId = new web3.PublicKey('
|
|
63
|
+
function createUpdateActionRoleProtocolInstruction(accounts, args, programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
64
64
|
var _a;
|
|
65
65
|
const [data] = exports.updateActionRoleProtocolStruct.serialize(Object.assign({ instructionDiscriminator: exports.updateActionRoleProtocolInstructionDiscriminator }, args));
|
|
66
66
|
const keys = [
|
|
@@ -60,7 +60,7 @@ exports.updateActionRoleStrategyInstructionDiscriminator = [
|
|
|
60
60
|
* @category UpdateActionRoleStrategy
|
|
61
61
|
* @category generated
|
|
62
62
|
*/
|
|
63
|
-
function createUpdateActionRoleStrategyInstruction(accounts, args, programId = new web3.PublicKey('
|
|
63
|
+
function createUpdateActionRoleStrategyInstruction(accounts, args, programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
64
64
|
var _a;
|
|
65
65
|
const [data] = exports.updateActionRoleStrategyStruct.serialize(Object.assign({ instructionDiscriminator: exports.updateActionRoleStrategyInstructionDiscriminator }, args));
|
|
66
66
|
const keys = [
|
|
@@ -57,7 +57,7 @@ exports.updateAttenuationInstructionDiscriminator = [
|
|
|
57
57
|
* @category UpdateAttenuation
|
|
58
58
|
* @category generated
|
|
59
59
|
*/
|
|
60
|
-
function createUpdateAttenuationInstruction(accounts, args, programId = new web3.PublicKey('
|
|
60
|
+
function createUpdateAttenuationInstruction(accounts, args, programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
61
61
|
var _a;
|
|
62
62
|
const [data] = exports.updateAttenuationStruct.serialize(Object.assign({ instructionDiscriminator: exports.updateAttenuationInstructionDiscriminator }, args));
|
|
63
63
|
const keys = [
|
|
@@ -55,7 +55,7 @@ exports.updateCapInstructionDiscriminator = [
|
|
|
55
55
|
* @category UpdateCap
|
|
56
56
|
* @category generated
|
|
57
57
|
*/
|
|
58
|
-
function createUpdateCapInstruction(accounts, args, programId = new web3.PublicKey('
|
|
58
|
+
function createUpdateCapInstruction(accounts, args, programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
59
59
|
var _a;
|
|
60
60
|
const [data] = exports.updateCapStruct.serialize(Object.assign({ instructionDiscriminator: exports.updateCapInstructionDiscriminator }, args));
|
|
61
61
|
const keys = [
|
|
@@ -57,7 +57,7 @@ exports.updateRecipientsInstructionDiscriminator = [
|
|
|
57
57
|
* @category UpdateRecipients
|
|
58
58
|
* @category generated
|
|
59
59
|
*/
|
|
60
|
-
function createUpdateRecipientsInstruction(accounts, args, programId = new web3.PublicKey('
|
|
60
|
+
function createUpdateRecipientsInstruction(accounts, args, programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
61
61
|
var _a;
|
|
62
62
|
const [data] = exports.updateRecipientsStruct.serialize(Object.assign({ instructionDiscriminator: exports.updateRecipientsInstructionDiscriminator }, args));
|
|
63
63
|
const keys = [
|
|
@@ -58,7 +58,7 @@ exports.updateRoleHolderProtocolInstructionDiscriminator = [
|
|
|
58
58
|
* @category UpdateRoleHolderProtocol
|
|
59
59
|
* @category generated
|
|
60
60
|
*/
|
|
61
|
-
function createUpdateRoleHolderProtocolInstruction(accounts, args, programId = new web3.PublicKey('
|
|
61
|
+
function createUpdateRoleHolderProtocolInstruction(accounts, args, programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
62
62
|
var _a;
|
|
63
63
|
const [data] = exports.updateRoleHolderProtocolStruct.serialize(Object.assign({ instructionDiscriminator: exports.updateRoleHolderProtocolInstructionDiscriminator }, args));
|
|
64
64
|
const keys = [
|
|
@@ -58,7 +58,7 @@ exports.updateRoleHolderStrategyInstructionDiscriminator = [
|
|
|
58
58
|
* @category UpdateRoleHolderStrategy
|
|
59
59
|
* @category generated
|
|
60
60
|
*/
|
|
61
|
-
function createUpdateRoleHolderStrategyInstruction(accounts, args, programId = new web3.PublicKey('
|
|
61
|
+
function createUpdateRoleHolderStrategyInstruction(accounts, args, programId = new web3.PublicKey('rFLctqnUuxLmYsW5r9zNujfJx9hGpnP1csXr9PYwVgX')) {
|
|
62
62
|
var _a;
|
|
63
63
|
const [data] = exports.updateRoleHolderStrategyStruct.serialize(Object.assign({ instructionDiscriminator: exports.updateRoleHolderStrategyInstructionDiscriminator }, args));
|
|
64
64
|
const keys = [
|
|
@@ -37,7 +37,6 @@ const beet = __importStar(require("@metaplex-foundation/beet"));
|
|
|
37
37
|
*/
|
|
38
38
|
exports.autoCompoundBeet = new beet.BeetArgsStruct([
|
|
39
39
|
['depositedVaultValue', beet.u64],
|
|
40
|
-
['effectiveSupply', beet.u64],
|
|
41
40
|
['netUserFlowSinceCapture', beet.i64],
|
|
42
41
|
['lastPoolValue', beet.u64],
|
|
43
42
|
['totalCapturableYield', beet.u64],
|
|
@@ -335,7 +335,7 @@ class UsdcPlusStablecoin extends Stablecoin_1.Stablecoin {
|
|
|
335
335
|
}
|
|
336
336
|
const autocompound = this.controller.compounder;
|
|
337
337
|
// Calculate receipt tokens to issue
|
|
338
|
-
const receiptTokens = this.computeReceiptToken(usdcDeposited, new bn_js_1.default(autocompound.depositedVaultValue), new bn_js_1.default(
|
|
338
|
+
const receiptTokens = this.computeReceiptToken(usdcDeposited, new bn_js_1.default(autocompound.depositedVaultValue), new bn_js_1.default(this.stablecoinMintData.supply.toString()));
|
|
339
339
|
return receiptTokens;
|
|
340
340
|
}
|
|
341
341
|
/**
|
|
@@ -355,7 +355,7 @@ class UsdcPlusStablecoin extends Stablecoin_1.Stablecoin {
|
|
|
355
355
|
}
|
|
356
356
|
const autocompound = this.controller.compounder;
|
|
357
357
|
// Calculate USDC to return
|
|
358
|
-
const usdcAmount = this.computeBaseToken(receiptTokensBurned, new bn_js_1.default(autocompound.depositedVaultValue), new bn_js_1.default(
|
|
358
|
+
const usdcAmount = this.computeBaseToken(receiptTokensBurned, new bn_js_1.default(autocompound.depositedVaultValue), new bn_js_1.default(this.stablecoinMintData.supply.toString()));
|
|
359
359
|
return usdcAmount;
|
|
360
360
|
}
|
|
361
361
|
simulateMintMath(usdcAmount) {
|