@epicentral/sos-sdk 0.12.2-beta → 0.13.1-beta
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/generated/accounts/marketDataAccount.ts +13 -1
- package/generated/errors/optionProgram.ts +98 -94
- package/generated/instructions/buyFromPool.ts +43 -15
- package/generated/instructions/closeLongToPool.ts +40 -12
- package/generated/instructions/index.ts +1 -0
- package/generated/instructions/initializeMarketData.ts +13 -0
- package/generated/instructions/liquidateWriterPosition.ts +39 -11
- package/generated/instructions/migrateMarketDataVolOracle.ts +248 -0
- package/generated/instructions/optionMint.ts +50 -22
- package/generated/instructions/updateImpliedVolatility.ts +19 -2
- package/generated/programs/optionProgram.ts +16 -0
- package/index.ts +6 -0
- package/long/builders.ts +36 -10
- package/oracle/volatility-quote.ts +65 -0
- package/package.json +7 -1
- package/shared/option-program-parser.ts +6 -0
- package/short/builders.ts +93 -0
|
@@ -62,6 +62,7 @@ export type CloseLongToPoolInstruction<
|
|
|
62
62
|
TAccountEscrowLongAccount extends string | AccountMeta<string> = string,
|
|
63
63
|
TAccountPremiumVault extends string | AccountMeta<string> = string,
|
|
64
64
|
TAccountMarketData extends string | AccountMeta<string> = string,
|
|
65
|
+
TAccountVolatilityQuoteAccount extends string | AccountMeta<string> = string,
|
|
65
66
|
TAccountSwitchboardQueue extends string | AccountMeta<string> = string,
|
|
66
67
|
TAccountSlotHashesSysvar extends string | AccountMeta<string> =
|
|
67
68
|
"SysvarS1otHashes111111111111111111111111111",
|
|
@@ -110,6 +111,9 @@ export type CloseLongToPoolInstruction<
|
|
|
110
111
|
TAccountMarketData extends string
|
|
111
112
|
? ReadonlyAccount<TAccountMarketData>
|
|
112
113
|
: TAccountMarketData,
|
|
114
|
+
TAccountVolatilityQuoteAccount extends string
|
|
115
|
+
? ReadonlyAccount<TAccountVolatilityQuoteAccount>
|
|
116
|
+
: TAccountVolatilityQuoteAccount,
|
|
113
117
|
TAccountSwitchboardQueue extends string
|
|
114
118
|
? ReadonlyAccount<TAccountSwitchboardQueue>
|
|
115
119
|
: TAccountSwitchboardQueue,
|
|
@@ -198,6 +202,7 @@ export type CloseLongToPoolAsyncInput<
|
|
|
198
202
|
TAccountEscrowLongAccount extends string = string,
|
|
199
203
|
TAccountPremiumVault extends string = string,
|
|
200
204
|
TAccountMarketData extends string = string,
|
|
205
|
+
TAccountVolatilityQuoteAccount extends string = string,
|
|
201
206
|
TAccountSwitchboardQueue extends string = string,
|
|
202
207
|
TAccountSlotHashesSysvar extends string = string,
|
|
203
208
|
TAccountInstructionsSysvar extends string = string,
|
|
@@ -228,6 +233,7 @@ export type CloseLongToPoolAsyncInput<
|
|
|
228
233
|
premiumVault: Address<TAccountPremiumVault>;
|
|
229
234
|
/** Market data account (provides risk-free rate and switchboard_feed_id) */
|
|
230
235
|
marketData: Address<TAccountMarketData>;
|
|
236
|
+
volatilityQuoteAccount: Address<TAccountVolatilityQuoteAccount>;
|
|
231
237
|
switchboardQueue: Address<TAccountSwitchboardQueue>;
|
|
232
238
|
slotHashesSysvar?: Address<TAccountSlotHashesSysvar>;
|
|
233
239
|
instructionsSysvar?: Address<TAccountInstructionsSysvar>;
|
|
@@ -258,6 +264,7 @@ export async function getCloseLongToPoolInstructionAsync<
|
|
|
258
264
|
TAccountEscrowLongAccount extends string,
|
|
259
265
|
TAccountPremiumVault extends string,
|
|
260
266
|
TAccountMarketData extends string,
|
|
267
|
+
TAccountVolatilityQuoteAccount extends string,
|
|
261
268
|
TAccountSwitchboardQueue extends string,
|
|
262
269
|
TAccountSlotHashesSysvar extends string,
|
|
263
270
|
TAccountInstructionsSysvar extends string,
|
|
@@ -281,6 +288,7 @@ export async function getCloseLongToPoolInstructionAsync<
|
|
|
281
288
|
TAccountEscrowLongAccount,
|
|
282
289
|
TAccountPremiumVault,
|
|
283
290
|
TAccountMarketData,
|
|
291
|
+
TAccountVolatilityQuoteAccount,
|
|
284
292
|
TAccountSwitchboardQueue,
|
|
285
293
|
TAccountSlotHashesSysvar,
|
|
286
294
|
TAccountInstructionsSysvar,
|
|
@@ -306,6 +314,7 @@ export async function getCloseLongToPoolInstructionAsync<
|
|
|
306
314
|
TAccountEscrowLongAccount,
|
|
307
315
|
TAccountPremiumVault,
|
|
308
316
|
TAccountMarketData,
|
|
317
|
+
TAccountVolatilityQuoteAccount,
|
|
309
318
|
TAccountSwitchboardQueue,
|
|
310
319
|
TAccountSlotHashesSysvar,
|
|
311
320
|
TAccountInstructionsSysvar,
|
|
@@ -337,6 +346,10 @@ export async function getCloseLongToPoolInstructionAsync<
|
|
|
337
346
|
},
|
|
338
347
|
premiumVault: { value: input.premiumVault ?? null, isWritable: true },
|
|
339
348
|
marketData: { value: input.marketData ?? null, isWritable: false },
|
|
349
|
+
volatilityQuoteAccount: {
|
|
350
|
+
value: input.volatilityQuoteAccount ?? null,
|
|
351
|
+
isWritable: false,
|
|
352
|
+
},
|
|
340
353
|
switchboardQueue: {
|
|
341
354
|
value: input.switchboardQueue ?? null,
|
|
342
355
|
isWritable: false,
|
|
@@ -431,6 +444,7 @@ export async function getCloseLongToPoolInstructionAsync<
|
|
|
431
444
|
getAccountMeta(accounts.escrowLongAccount),
|
|
432
445
|
getAccountMeta(accounts.premiumVault),
|
|
433
446
|
getAccountMeta(accounts.marketData),
|
|
447
|
+
getAccountMeta(accounts.volatilityQuoteAccount),
|
|
434
448
|
getAccountMeta(accounts.switchboardQueue),
|
|
435
449
|
getAccountMeta(accounts.slotHashesSysvar),
|
|
436
450
|
getAccountMeta(accounts.instructionsSysvar),
|
|
@@ -458,6 +472,7 @@ export async function getCloseLongToPoolInstructionAsync<
|
|
|
458
472
|
TAccountEscrowLongAccount,
|
|
459
473
|
TAccountPremiumVault,
|
|
460
474
|
TAccountMarketData,
|
|
475
|
+
TAccountVolatilityQuoteAccount,
|
|
461
476
|
TAccountSwitchboardQueue,
|
|
462
477
|
TAccountSlotHashesSysvar,
|
|
463
478
|
TAccountInstructionsSysvar,
|
|
@@ -482,6 +497,7 @@ export type CloseLongToPoolInput<
|
|
|
482
497
|
TAccountEscrowLongAccount extends string = string,
|
|
483
498
|
TAccountPremiumVault extends string = string,
|
|
484
499
|
TAccountMarketData extends string = string,
|
|
500
|
+
TAccountVolatilityQuoteAccount extends string = string,
|
|
485
501
|
TAccountSwitchboardQueue extends string = string,
|
|
486
502
|
TAccountSlotHashesSysvar extends string = string,
|
|
487
503
|
TAccountInstructionsSysvar extends string = string,
|
|
@@ -512,6 +528,7 @@ export type CloseLongToPoolInput<
|
|
|
512
528
|
premiumVault: Address<TAccountPremiumVault>;
|
|
513
529
|
/** Market data account (provides risk-free rate and switchboard_feed_id) */
|
|
514
530
|
marketData: Address<TAccountMarketData>;
|
|
531
|
+
volatilityQuoteAccount: Address<TAccountVolatilityQuoteAccount>;
|
|
515
532
|
switchboardQueue: Address<TAccountSwitchboardQueue>;
|
|
516
533
|
slotHashesSysvar?: Address<TAccountSlotHashesSysvar>;
|
|
517
534
|
instructionsSysvar?: Address<TAccountInstructionsSysvar>;
|
|
@@ -542,6 +559,7 @@ export function getCloseLongToPoolInstruction<
|
|
|
542
559
|
TAccountEscrowLongAccount extends string,
|
|
543
560
|
TAccountPremiumVault extends string,
|
|
544
561
|
TAccountMarketData extends string,
|
|
562
|
+
TAccountVolatilityQuoteAccount extends string,
|
|
545
563
|
TAccountSwitchboardQueue extends string,
|
|
546
564
|
TAccountSlotHashesSysvar extends string,
|
|
547
565
|
TAccountInstructionsSysvar extends string,
|
|
@@ -565,6 +583,7 @@ export function getCloseLongToPoolInstruction<
|
|
|
565
583
|
TAccountEscrowLongAccount,
|
|
566
584
|
TAccountPremiumVault,
|
|
567
585
|
TAccountMarketData,
|
|
586
|
+
TAccountVolatilityQuoteAccount,
|
|
568
587
|
TAccountSwitchboardQueue,
|
|
569
588
|
TAccountSlotHashesSysvar,
|
|
570
589
|
TAccountInstructionsSysvar,
|
|
@@ -589,6 +608,7 @@ export function getCloseLongToPoolInstruction<
|
|
|
589
608
|
TAccountEscrowLongAccount,
|
|
590
609
|
TAccountPremiumVault,
|
|
591
610
|
TAccountMarketData,
|
|
611
|
+
TAccountVolatilityQuoteAccount,
|
|
592
612
|
TAccountSwitchboardQueue,
|
|
593
613
|
TAccountSlotHashesSysvar,
|
|
594
614
|
TAccountInstructionsSysvar,
|
|
@@ -619,6 +639,10 @@ export function getCloseLongToPoolInstruction<
|
|
|
619
639
|
},
|
|
620
640
|
premiumVault: { value: input.premiumVault ?? null, isWritable: true },
|
|
621
641
|
marketData: { value: input.marketData ?? null, isWritable: false },
|
|
642
|
+
volatilityQuoteAccount: {
|
|
643
|
+
value: input.volatilityQuoteAccount ?? null,
|
|
644
|
+
isWritable: false,
|
|
645
|
+
},
|
|
622
646
|
switchboardQueue: {
|
|
623
647
|
value: input.switchboardQueue ?? null,
|
|
624
648
|
isWritable: false,
|
|
@@ -687,6 +711,7 @@ export function getCloseLongToPoolInstruction<
|
|
|
687
711
|
getAccountMeta(accounts.escrowLongAccount),
|
|
688
712
|
getAccountMeta(accounts.premiumVault),
|
|
689
713
|
getAccountMeta(accounts.marketData),
|
|
714
|
+
getAccountMeta(accounts.volatilityQuoteAccount),
|
|
690
715
|
getAccountMeta(accounts.switchboardQueue),
|
|
691
716
|
getAccountMeta(accounts.slotHashesSysvar),
|
|
692
717
|
getAccountMeta(accounts.instructionsSysvar),
|
|
@@ -714,6 +739,7 @@ export function getCloseLongToPoolInstruction<
|
|
|
714
739
|
TAccountEscrowLongAccount,
|
|
715
740
|
TAccountPremiumVault,
|
|
716
741
|
TAccountMarketData,
|
|
742
|
+
TAccountVolatilityQuoteAccount,
|
|
717
743
|
TAccountSwitchboardQueue,
|
|
718
744
|
TAccountSlotHashesSysvar,
|
|
719
745
|
TAccountInstructionsSysvar,
|
|
@@ -752,22 +778,23 @@ export type ParsedCloseLongToPoolInstruction<
|
|
|
752
778
|
premiumVault: TAccountMetas[7];
|
|
753
779
|
/** Market data account (provides risk-free rate and switchboard_feed_id) */
|
|
754
780
|
marketData: TAccountMetas[8];
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
781
|
+
volatilityQuoteAccount: TAccountMetas[9];
|
|
782
|
+
switchboardQueue: TAccountMetas[10];
|
|
783
|
+
slotHashesSysvar: TAccountMetas[11];
|
|
784
|
+
instructionsSysvar: TAccountMetas[12];
|
|
758
785
|
/** Buyer's position account */
|
|
759
|
-
buyerPosition: TAccountMetas[
|
|
786
|
+
buyerPosition: TAccountMetas[13];
|
|
760
787
|
/** Buyer's LONG token account (source of tokens to return) */
|
|
761
|
-
buyerLongAccount: TAccountMetas[
|
|
788
|
+
buyerLongAccount: TAccountMetas[14];
|
|
762
789
|
/** Buyer's settlement token account (receives collateral-vault payout leg) */
|
|
763
|
-
buyerPayoutAccount: TAccountMetas[
|
|
790
|
+
buyerPayoutAccount: TAccountMetas[15];
|
|
764
791
|
/** Buyer's underlying token account (receives premium-vault payout leg; same ATA when physical) */
|
|
765
|
-
buyerUnderlyingPayoutAccount: TAccountMetas[
|
|
792
|
+
buyerUnderlyingPayoutAccount: TAccountMetas[16];
|
|
766
793
|
/** Collateral vault (source of payout) */
|
|
767
|
-
collateralVault: TAccountMetas[
|
|
768
|
-
buyer: TAccountMetas[
|
|
769
|
-
tokenProgram: TAccountMetas[
|
|
770
|
-
systemProgram: TAccountMetas[
|
|
794
|
+
collateralVault: TAccountMetas[17];
|
|
795
|
+
buyer: TAccountMetas[18];
|
|
796
|
+
tokenProgram: TAccountMetas[19];
|
|
797
|
+
systemProgram: TAccountMetas[20];
|
|
771
798
|
};
|
|
772
799
|
data: CloseLongToPoolInstructionData;
|
|
773
800
|
};
|
|
@@ -780,7 +807,7 @@ export function parseCloseLongToPoolInstruction<
|
|
|
780
807
|
InstructionWithAccounts<TAccountMetas> &
|
|
781
808
|
InstructionWithData<ReadonlyUint8Array>,
|
|
782
809
|
): ParsedCloseLongToPoolInstruction<TProgram, TAccountMetas> {
|
|
783
|
-
if (instruction.accounts.length <
|
|
810
|
+
if (instruction.accounts.length < 21) {
|
|
784
811
|
// TODO: Coded error.
|
|
785
812
|
throw new Error("Not enough accounts");
|
|
786
813
|
}
|
|
@@ -802,6 +829,7 @@ export function parseCloseLongToPoolInstruction<
|
|
|
802
829
|
escrowLongAccount: getNextAccount(),
|
|
803
830
|
premiumVault: getNextAccount(),
|
|
804
831
|
marketData: getNextAccount(),
|
|
832
|
+
volatilityQuoteAccount: getNextAccount(),
|
|
805
833
|
switchboardQueue: getNextAccount(),
|
|
806
834
|
slotHashesSysvar: getNextAccount(),
|
|
807
835
|
instructionsSysvar: getNextAccount(),
|
|
@@ -26,6 +26,7 @@ export * from "./initOptionPool";
|
|
|
26
26
|
export * from "./liquidateWriterPosition";
|
|
27
27
|
export * from "./liquidateWriterPositionRescue";
|
|
28
28
|
export * from "./migrateCollateralPoolV1ToV2";
|
|
29
|
+
export * from "./migrateMarketDataVolOracle";
|
|
29
30
|
export * from "./omlpCreateVault";
|
|
30
31
|
export * from "./omlpUpdateFeeWallet";
|
|
31
32
|
export * from "./omlpUpdateInterestModel";
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
combineCodec,
|
|
11
11
|
fixDecoderSize,
|
|
12
12
|
fixEncoderSize,
|
|
13
|
+
getAddressDecoder,
|
|
13
14
|
getAddressEncoder,
|
|
14
15
|
getBytesDecoder,
|
|
15
16
|
getBytesEncoder,
|
|
@@ -85,12 +86,16 @@ export type InitializeMarketDataInstructionData = {
|
|
|
85
86
|
riskFreeRate: number;
|
|
86
87
|
historicalVolatility: number;
|
|
87
88
|
switchboardFeedId: ReadonlyUint8Array;
|
|
89
|
+
switchboardVolatilityFeedId: ReadonlyUint8Array;
|
|
90
|
+
volatilityQuoteAuthority: Address;
|
|
88
91
|
};
|
|
89
92
|
|
|
90
93
|
export type InitializeMarketDataInstructionDataArgs = {
|
|
91
94
|
riskFreeRate: number;
|
|
92
95
|
historicalVolatility: number;
|
|
93
96
|
switchboardFeedId: ReadonlyUint8Array;
|
|
97
|
+
switchboardVolatilityFeedId: ReadonlyUint8Array;
|
|
98
|
+
volatilityQuoteAuthority: Address;
|
|
94
99
|
};
|
|
95
100
|
|
|
96
101
|
export function getInitializeMarketDataInstructionDataEncoder(): FixedSizeEncoder<InitializeMarketDataInstructionDataArgs> {
|
|
@@ -100,6 +105,8 @@ export function getInitializeMarketDataInstructionDataEncoder(): FixedSizeEncode
|
|
|
100
105
|
["riskFreeRate", getF64Encoder()],
|
|
101
106
|
["historicalVolatility", getF64Encoder()],
|
|
102
107
|
["switchboardFeedId", fixEncoderSize(getBytesEncoder(), 32)],
|
|
108
|
+
["switchboardVolatilityFeedId", fixEncoderSize(getBytesEncoder(), 32)],
|
|
109
|
+
["volatilityQuoteAuthority", getAddressEncoder()],
|
|
103
110
|
]),
|
|
104
111
|
(value) => ({
|
|
105
112
|
...value,
|
|
@@ -114,6 +121,8 @@ export function getInitializeMarketDataInstructionDataDecoder(): FixedSizeDecode
|
|
|
114
121
|
["riskFreeRate", getF64Decoder()],
|
|
115
122
|
["historicalVolatility", getF64Decoder()],
|
|
116
123
|
["switchboardFeedId", fixDecoderSize(getBytesDecoder(), 32)],
|
|
124
|
+
["switchboardVolatilityFeedId", fixDecoderSize(getBytesDecoder(), 32)],
|
|
125
|
+
["volatilityQuoteAuthority", getAddressDecoder()],
|
|
117
126
|
]);
|
|
118
127
|
}
|
|
119
128
|
|
|
@@ -140,6 +149,8 @@ export type InitializeMarketDataAsyncInput<
|
|
|
140
149
|
riskFreeRate: InitializeMarketDataInstructionDataArgs["riskFreeRate"];
|
|
141
150
|
historicalVolatility: InitializeMarketDataInstructionDataArgs["historicalVolatility"];
|
|
142
151
|
switchboardFeedId: InitializeMarketDataInstructionDataArgs["switchboardFeedId"];
|
|
152
|
+
switchboardVolatilityFeedId: InitializeMarketDataInstructionDataArgs["switchboardVolatilityFeedId"];
|
|
153
|
+
volatilityQuoteAuthority: InitializeMarketDataInstructionDataArgs["volatilityQuoteAuthority"];
|
|
143
154
|
};
|
|
144
155
|
|
|
145
156
|
export async function getInitializeMarketDataInstructionAsync<
|
|
@@ -240,6 +251,8 @@ export type InitializeMarketDataInput<
|
|
|
240
251
|
riskFreeRate: InitializeMarketDataInstructionDataArgs["riskFreeRate"];
|
|
241
252
|
historicalVolatility: InitializeMarketDataInstructionDataArgs["historicalVolatility"];
|
|
242
253
|
switchboardFeedId: InitializeMarketDataInstructionDataArgs["switchboardFeedId"];
|
|
254
|
+
switchboardVolatilityFeedId: InitializeMarketDataInstructionDataArgs["switchboardVolatilityFeedId"];
|
|
255
|
+
volatilityQuoteAuthority: InitializeMarketDataInstructionDataArgs["volatilityQuoteAuthority"];
|
|
243
256
|
};
|
|
244
257
|
|
|
245
258
|
export function getInitializeMarketDataInstruction<
|
|
@@ -60,6 +60,7 @@ export type LiquidateWriterPositionInstruction<
|
|
|
60
60
|
TAccountOmlpVault extends string | AccountMeta<string> = string,
|
|
61
61
|
TAccountUnderlyingMint extends string | AccountMeta<string> = string,
|
|
62
62
|
TAccountMarketData extends string | AccountMeta<string> = string,
|
|
63
|
+
TAccountVolatilityQuoteAccount extends string | AccountMeta<string> = string,
|
|
63
64
|
TAccountSwitchboardQueue extends string | AccountMeta<string> = string,
|
|
64
65
|
TAccountSlotHashesSysvar extends string | AccountMeta<string> =
|
|
65
66
|
"SysvarS1otHashes111111111111111111111111111",
|
|
@@ -106,6 +107,9 @@ export type LiquidateWriterPositionInstruction<
|
|
|
106
107
|
TAccountMarketData extends string
|
|
107
108
|
? ReadonlyAccount<TAccountMarketData>
|
|
108
109
|
: TAccountMarketData,
|
|
110
|
+
TAccountVolatilityQuoteAccount extends string
|
|
111
|
+
? ReadonlyAccount<TAccountVolatilityQuoteAccount>
|
|
112
|
+
: TAccountVolatilityQuoteAccount,
|
|
109
113
|
TAccountSwitchboardQueue extends string
|
|
110
114
|
? ReadonlyAccount<TAccountSwitchboardQueue>
|
|
111
115
|
: TAccountSwitchboardQueue,
|
|
@@ -183,6 +187,7 @@ export type LiquidateWriterPositionAsyncInput<
|
|
|
183
187
|
TAccountOmlpVault extends string = string,
|
|
184
188
|
TAccountUnderlyingMint extends string = string,
|
|
185
189
|
TAccountMarketData extends string = string,
|
|
190
|
+
TAccountVolatilityQuoteAccount extends string = string,
|
|
186
191
|
TAccountSwitchboardQueue extends string = string,
|
|
187
192
|
TAccountSlotHashesSysvar extends string = string,
|
|
188
193
|
TAccountInstructionsSysvar extends string = string,
|
|
@@ -212,6 +217,7 @@ export type LiquidateWriterPositionAsyncInput<
|
|
|
212
217
|
underlyingMint: Address<TAccountUnderlyingMint>;
|
|
213
218
|
/** Market data account (provides switchboard_feed_id for price check) */
|
|
214
219
|
marketData: Address<TAccountMarketData>;
|
|
220
|
+
volatilityQuoteAccount: Address<TAccountVolatilityQuoteAccount>;
|
|
215
221
|
switchboardQueue: Address<TAccountSwitchboardQueue>;
|
|
216
222
|
slotHashesSysvar?: Address<TAccountSlotHashesSysvar>;
|
|
217
223
|
instructionsSysvar?: Address<TAccountInstructionsSysvar>;
|
|
@@ -239,6 +245,7 @@ export async function getLiquidateWriterPositionInstructionAsync<
|
|
|
239
245
|
TAccountOmlpVault extends string,
|
|
240
246
|
TAccountUnderlyingMint extends string,
|
|
241
247
|
TAccountMarketData extends string,
|
|
248
|
+
TAccountVolatilityQuoteAccount extends string,
|
|
242
249
|
TAccountSwitchboardQueue extends string,
|
|
243
250
|
TAccountSlotHashesSysvar extends string,
|
|
244
251
|
TAccountInstructionsSysvar extends string,
|
|
@@ -261,6 +268,7 @@ export async function getLiquidateWriterPositionInstructionAsync<
|
|
|
261
268
|
TAccountOmlpVault,
|
|
262
269
|
TAccountUnderlyingMint,
|
|
263
270
|
TAccountMarketData,
|
|
271
|
+
TAccountVolatilityQuoteAccount,
|
|
264
272
|
TAccountSwitchboardQueue,
|
|
265
273
|
TAccountSlotHashesSysvar,
|
|
266
274
|
TAccountInstructionsSysvar,
|
|
@@ -285,6 +293,7 @@ export async function getLiquidateWriterPositionInstructionAsync<
|
|
|
285
293
|
TAccountOmlpVault,
|
|
286
294
|
TAccountUnderlyingMint,
|
|
287
295
|
TAccountMarketData,
|
|
296
|
+
TAccountVolatilityQuoteAccount,
|
|
288
297
|
TAccountSwitchboardQueue,
|
|
289
298
|
TAccountSlotHashesSysvar,
|
|
290
299
|
TAccountInstructionsSysvar,
|
|
@@ -315,6 +324,10 @@ export async function getLiquidateWriterPositionInstructionAsync<
|
|
|
315
324
|
omlpVault: { value: input.omlpVault ?? null, isWritable: true },
|
|
316
325
|
underlyingMint: { value: input.underlyingMint ?? null, isWritable: false },
|
|
317
326
|
marketData: { value: input.marketData ?? null, isWritable: false },
|
|
327
|
+
volatilityQuoteAccount: {
|
|
328
|
+
value: input.volatilityQuoteAccount ?? null,
|
|
329
|
+
isWritable: false,
|
|
330
|
+
},
|
|
318
331
|
switchboardQueue: {
|
|
319
332
|
value: input.switchboardQueue ?? null,
|
|
320
333
|
isWritable: false,
|
|
@@ -387,6 +400,7 @@ export async function getLiquidateWriterPositionInstructionAsync<
|
|
|
387
400
|
getAccountMeta(accounts.omlpVault),
|
|
388
401
|
getAccountMeta(accounts.underlyingMint),
|
|
389
402
|
getAccountMeta(accounts.marketData),
|
|
403
|
+
getAccountMeta(accounts.volatilityQuoteAccount),
|
|
390
404
|
getAccountMeta(accounts.switchboardQueue),
|
|
391
405
|
getAccountMeta(accounts.slotHashesSysvar),
|
|
392
406
|
getAccountMeta(accounts.instructionsSysvar),
|
|
@@ -411,6 +425,7 @@ export async function getLiquidateWriterPositionInstructionAsync<
|
|
|
411
425
|
TAccountOmlpVault,
|
|
412
426
|
TAccountUnderlyingMint,
|
|
413
427
|
TAccountMarketData,
|
|
428
|
+
TAccountVolatilityQuoteAccount,
|
|
414
429
|
TAccountSwitchboardQueue,
|
|
415
430
|
TAccountSlotHashesSysvar,
|
|
416
431
|
TAccountInstructionsSysvar,
|
|
@@ -434,6 +449,7 @@ export type LiquidateWriterPositionInput<
|
|
|
434
449
|
TAccountOmlpVault extends string = string,
|
|
435
450
|
TAccountUnderlyingMint extends string = string,
|
|
436
451
|
TAccountMarketData extends string = string,
|
|
452
|
+
TAccountVolatilityQuoteAccount extends string = string,
|
|
437
453
|
TAccountSwitchboardQueue extends string = string,
|
|
438
454
|
TAccountSlotHashesSysvar extends string = string,
|
|
439
455
|
TAccountInstructionsSysvar extends string = string,
|
|
@@ -463,6 +479,7 @@ export type LiquidateWriterPositionInput<
|
|
|
463
479
|
underlyingMint: Address<TAccountUnderlyingMint>;
|
|
464
480
|
/** Market data account (provides switchboard_feed_id for price check) */
|
|
465
481
|
marketData: Address<TAccountMarketData>;
|
|
482
|
+
volatilityQuoteAccount: Address<TAccountVolatilityQuoteAccount>;
|
|
466
483
|
switchboardQueue: Address<TAccountSwitchboardQueue>;
|
|
467
484
|
slotHashesSysvar?: Address<TAccountSlotHashesSysvar>;
|
|
468
485
|
instructionsSysvar?: Address<TAccountInstructionsSysvar>;
|
|
@@ -490,6 +507,7 @@ export function getLiquidateWriterPositionInstruction<
|
|
|
490
507
|
TAccountOmlpVault extends string,
|
|
491
508
|
TAccountUnderlyingMint extends string,
|
|
492
509
|
TAccountMarketData extends string,
|
|
510
|
+
TAccountVolatilityQuoteAccount extends string,
|
|
493
511
|
TAccountSwitchboardQueue extends string,
|
|
494
512
|
TAccountSlotHashesSysvar extends string,
|
|
495
513
|
TAccountInstructionsSysvar extends string,
|
|
@@ -512,6 +530,7 @@ export function getLiquidateWriterPositionInstruction<
|
|
|
512
530
|
TAccountOmlpVault,
|
|
513
531
|
TAccountUnderlyingMint,
|
|
514
532
|
TAccountMarketData,
|
|
533
|
+
TAccountVolatilityQuoteAccount,
|
|
515
534
|
TAccountSwitchboardQueue,
|
|
516
535
|
TAccountSlotHashesSysvar,
|
|
517
536
|
TAccountInstructionsSysvar,
|
|
@@ -535,6 +554,7 @@ export function getLiquidateWriterPositionInstruction<
|
|
|
535
554
|
TAccountOmlpVault,
|
|
536
555
|
TAccountUnderlyingMint,
|
|
537
556
|
TAccountMarketData,
|
|
557
|
+
TAccountVolatilityQuoteAccount,
|
|
538
558
|
TAccountSwitchboardQueue,
|
|
539
559
|
TAccountSlotHashesSysvar,
|
|
540
560
|
TAccountInstructionsSysvar,
|
|
@@ -564,6 +584,10 @@ export function getLiquidateWriterPositionInstruction<
|
|
|
564
584
|
omlpVault: { value: input.omlpVault ?? null, isWritable: true },
|
|
565
585
|
underlyingMint: { value: input.underlyingMint ?? null, isWritable: false },
|
|
566
586
|
marketData: { value: input.marketData ?? null, isWritable: false },
|
|
587
|
+
volatilityQuoteAccount: {
|
|
588
|
+
value: input.volatilityQuoteAccount ?? null,
|
|
589
|
+
isWritable: false,
|
|
590
|
+
},
|
|
567
591
|
switchboardQueue: {
|
|
568
592
|
value: input.switchboardQueue ?? null,
|
|
569
593
|
isWritable: false,
|
|
@@ -622,6 +646,7 @@ export function getLiquidateWriterPositionInstruction<
|
|
|
622
646
|
getAccountMeta(accounts.omlpVault),
|
|
623
647
|
getAccountMeta(accounts.underlyingMint),
|
|
624
648
|
getAccountMeta(accounts.marketData),
|
|
649
|
+
getAccountMeta(accounts.volatilityQuoteAccount),
|
|
625
650
|
getAccountMeta(accounts.switchboardQueue),
|
|
626
651
|
getAccountMeta(accounts.slotHashesSysvar),
|
|
627
652
|
getAccountMeta(accounts.instructionsSysvar),
|
|
@@ -646,6 +671,7 @@ export function getLiquidateWriterPositionInstruction<
|
|
|
646
671
|
TAccountOmlpVault,
|
|
647
672
|
TAccountUnderlyingMint,
|
|
648
673
|
TAccountMarketData,
|
|
674
|
+
TAccountVolatilityQuoteAccount,
|
|
649
675
|
TAccountSwitchboardQueue,
|
|
650
676
|
TAccountSlotHashesSysvar,
|
|
651
677
|
TAccountInstructionsSysvar,
|
|
@@ -683,21 +709,22 @@ export type ParsedLiquidateWriterPositionInstruction<
|
|
|
683
709
|
underlyingMint: TAccountMetas[7];
|
|
684
710
|
/** Market data account (provides switchboard_feed_id for price check) */
|
|
685
711
|
marketData: TAccountMetas[8];
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
712
|
+
volatilityQuoteAccount: TAccountMetas[9];
|
|
713
|
+
switchboardQueue: TAccountMetas[10];
|
|
714
|
+
slotHashesSysvar: TAccountMetas[11];
|
|
715
|
+
instructionsSysvar: TAccountMetas[12];
|
|
689
716
|
/** Collateral vault (source of collateral-side repayments) */
|
|
690
|
-
collateralVault: TAccountMetas[
|
|
717
|
+
collateralVault: TAccountMetas[13];
|
|
691
718
|
/** Pool premium vault (source of theta forfeiture + excess theta splits) */
|
|
692
|
-
premiumVault: TAccountMetas[
|
|
719
|
+
premiumVault: TAccountMetas[14];
|
|
693
720
|
/** OMLP vault token account (receives loan repayments + half of excess theta) */
|
|
694
|
-
omlpVaultTokenAccount: TAccountMetas[
|
|
721
|
+
omlpVaultTokenAccount: TAccountMetas[15];
|
|
695
722
|
/** Protocol fee wallet (receives protocol fees + half of excess theta) */
|
|
696
|
-
feeWallet: TAccountMetas[
|
|
723
|
+
feeWallet: TAccountMetas[16];
|
|
697
724
|
/** Liquidator/keeper (permissionless - anyone can call) */
|
|
698
|
-
liquidator: TAccountMetas[
|
|
699
|
-
tokenProgram: TAccountMetas[
|
|
700
|
-
systemProgram: TAccountMetas[
|
|
725
|
+
liquidator: TAccountMetas[17];
|
|
726
|
+
tokenProgram: TAccountMetas[18];
|
|
727
|
+
systemProgram: TAccountMetas[19];
|
|
701
728
|
};
|
|
702
729
|
data: LiquidateWriterPositionInstructionData;
|
|
703
730
|
};
|
|
@@ -710,7 +737,7 @@ export function parseLiquidateWriterPositionInstruction<
|
|
|
710
737
|
InstructionWithAccounts<TAccountMetas> &
|
|
711
738
|
InstructionWithData<ReadonlyUint8Array>,
|
|
712
739
|
): ParsedLiquidateWriterPositionInstruction<TProgram, TAccountMetas> {
|
|
713
|
-
if (instruction.accounts.length <
|
|
740
|
+
if (instruction.accounts.length < 20) {
|
|
714
741
|
// TODO: Coded error.
|
|
715
742
|
throw new Error("Not enough accounts");
|
|
716
743
|
}
|
|
@@ -732,6 +759,7 @@ export function parseLiquidateWriterPositionInstruction<
|
|
|
732
759
|
omlpVault: getNextAccount(),
|
|
733
760
|
underlyingMint: getNextAccount(),
|
|
734
761
|
marketData: getNextAccount(),
|
|
762
|
+
volatilityQuoteAccount: getNextAccount(),
|
|
735
763
|
switchboardQueue: getNextAccount(),
|
|
736
764
|
slotHashesSysvar: getNextAccount(),
|
|
737
765
|
instructionsSysvar: getNextAccount(),
|