@overcast-xyz/solana-program 0.1.1

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.
@@ -0,0 +1,578 @@
1
+ /**
2
+ * Program IDL in camelCase format in order to be used in JS/TS.
3
+ *
4
+ * Note that this is only a type helper and is not the actual IDL. The original
5
+ * IDL can be found at `target/idl/overcast_settlement_oracle_gated.json`.
6
+ */
7
+ export type OvercastSettlementOracleGated = {
8
+ address: "7gbzZmp7PyQBSHJDUM8jYrLsKTXoJDGa3GUVUQhCzNwB";
9
+ metadata: {
10
+ name: "overcastSettlementOracleGated";
11
+ version: "0.1.0";
12
+ spec: "0.1.0";
13
+ description: "Oracle-gated settlement layer for Overcast options";
14
+ };
15
+ instructions: [
16
+ {
17
+ name: "canBorrow";
18
+ discriminator: [23, 180, 16, 136, 86, 168, 84, 152];
19
+ accounts: [
20
+ {
21
+ name: "config";
22
+ }
23
+ ];
24
+ args: [
25
+ {
26
+ name: "option";
27
+ type: {
28
+ defined: {
29
+ name: "marketOption";
30
+ };
31
+ };
32
+ },
33
+ {
34
+ name: "borrower";
35
+ type: "pubkey";
36
+ },
37
+ {
38
+ name: "borrowAmount";
39
+ type: "u64";
40
+ },
41
+ {
42
+ name: "collateralReceiver";
43
+ type: "pubkey";
44
+ },
45
+ {
46
+ name: "metadata";
47
+ type: "bytes";
48
+ }
49
+ ];
50
+ },
51
+ {
52
+ name: "canExercise";
53
+ discriminator: [114, 239, 61, 62, 83, 204, 139, 83];
54
+ accounts: [
55
+ {
56
+ name: "config";
57
+ }
58
+ ];
59
+ args: [
60
+ {
61
+ name: "option";
62
+ type: {
63
+ defined: {
64
+ name: "marketOption";
65
+ };
66
+ };
67
+ },
68
+ {
69
+ name: "exerciseAmount";
70
+ type: "u64";
71
+ },
72
+ {
73
+ name: "metadata";
74
+ type: "bytes";
75
+ }
76
+ ];
77
+ returns: {
78
+ defined: {
79
+ name: "exerciseResolution";
80
+ };
81
+ };
82
+ },
83
+ {
84
+ name: "canMatch";
85
+ discriminator: [223, 238, 7, 233, 72, 137, 146, 135];
86
+ accounts: [
87
+ {
88
+ name: "config";
89
+ }
90
+ ];
91
+ args: [
92
+ {
93
+ name: "option";
94
+ type: {
95
+ defined: {
96
+ name: "marketOption";
97
+ };
98
+ };
99
+ }
100
+ ];
101
+ },
102
+ {
103
+ name: "canRedeem";
104
+ docs: [
105
+ "Oracle-gated redeem resolution — see the [`SettlementLayer`] impl in",
106
+ "`crate::layer`. Redemption is the option's unwind, not its exercise, so it",
107
+ "does not consult the oracle."
108
+ ];
109
+ discriminator: [88, 241, 152, 58, 50, 172, 234, 99];
110
+ accounts: [
111
+ {
112
+ name: "config";
113
+ }
114
+ ];
115
+ args: [
116
+ {
117
+ name: "option";
118
+ type: {
119
+ defined: {
120
+ name: "marketOption";
121
+ };
122
+ };
123
+ },
124
+ {
125
+ name: "redeemAmount";
126
+ type: "u64";
127
+ },
128
+ {
129
+ name: "claimSupply";
130
+ type: "u64";
131
+ },
132
+ {
133
+ name: "collateralBalance";
134
+ type: "u64";
135
+ },
136
+ {
137
+ name: "settlementBalance";
138
+ type: "u64";
139
+ },
140
+ {
141
+ name: "metadata";
142
+ type: "bytes";
143
+ }
144
+ ];
145
+ returns: {
146
+ defined: {
147
+ name: "redeemResolution";
148
+ };
149
+ };
150
+ },
151
+ {
152
+ name: "initializeConfig";
153
+ discriminator: [208, 127, 21, 1, 194, 190, 196, 70];
154
+ accounts: [
155
+ {
156
+ name: "authority";
157
+ writable: true;
158
+ signer: true;
159
+ },
160
+ {
161
+ name: "collMint";
162
+ docs: [
163
+ "Collateral-leg mint. Pubkey participates in PDA derivation; raw data is",
164
+ "read once to cache `decimals`."
165
+ ];
166
+ },
167
+ {
168
+ name: "settMint";
169
+ docs: ["Settlement-leg mint."];
170
+ },
171
+ {
172
+ name: "collOracleSample";
173
+ docs: [
174
+ "Sample oracle account for the collateral leg. Verifies that the",
175
+ "`(coll_oracle_kind, coll_oracle_id)` tuple resolves to a real feed.",
176
+ "Not stored."
177
+ ];
178
+ },
179
+ {
180
+ name: "settOracleSample";
181
+ docs: ["Sample oracle account for the settlement leg."];
182
+ },
183
+ {
184
+ name: "config";
185
+ writable: true;
186
+ },
187
+ {
188
+ name: "systemProgram";
189
+ address: "11111111111111111111111111111111";
190
+ }
191
+ ];
192
+ args: [
193
+ {
194
+ name: "collOracleKind";
195
+ type: {
196
+ defined: {
197
+ name: "oracleKind";
198
+ };
199
+ };
200
+ },
201
+ {
202
+ name: "collOracleId";
203
+ type: {
204
+ array: ["u8", 32];
205
+ };
206
+ },
207
+ {
208
+ name: "settOracleKind";
209
+ type: {
210
+ defined: {
211
+ name: "oracleKind";
212
+ };
213
+ };
214
+ },
215
+ {
216
+ name: "settOracleId";
217
+ type: {
218
+ array: ["u8", 32];
219
+ };
220
+ },
221
+ {
222
+ name: "maxStalenessSecs";
223
+ type: "u32";
224
+ },
225
+ {
226
+ name: "maxConfBps";
227
+ type: "u32";
228
+ },
229
+ {
230
+ name: "intrinsicResolution";
231
+ type: "bool";
232
+ }
233
+ ];
234
+ }
235
+ ];
236
+ accounts: [
237
+ {
238
+ name: "oracleSettlementConfig";
239
+ discriminator: [27, 90, 115, 138, 246, 10, 107, 57];
240
+ }
241
+ ];
242
+ errors: [
243
+ {
244
+ code: 6000;
245
+ name: "invalidCollateralAmount";
246
+ msg: "Collateral amount must be non-zero";
247
+ },
248
+ {
249
+ code: 6001;
250
+ name: "exerciseAmountTooLarge";
251
+ msg: "Exercise amount exceeds available collateral";
252
+ },
253
+ {
254
+ code: 6002;
255
+ name: "arithmeticOverflow";
256
+ msg: "Arithmetic overflow computing settlement";
257
+ },
258
+ {
259
+ code: 6003;
260
+ name: "mintBindingMismatch";
261
+ msg: "Option's collateral/settlement mints do not match the config binding";
262
+ },
263
+ {
264
+ code: 6004;
265
+ name: "feedIdMismatch";
266
+ msg: "Supplied oracle account's feed id does not match the config";
267
+ },
268
+ {
269
+ code: 6005;
270
+ name: "priceStale";
271
+ msg: "Oracle price is older than max_staleness_secs";
272
+ },
273
+ {
274
+ code: 6006;
275
+ name: "confidenceTooWide";
276
+ msg: "Oracle confidence interval is wider than max_conf_bps";
277
+ },
278
+ {
279
+ code: 6007;
280
+ name: "notInTheMoney";
281
+ msg: "Option is not in the money under the bound oracle";
282
+ },
283
+ {
284
+ code: 6008;
285
+ name: "unsupportedOracleKind";
286
+ msg: "OracleKind variant is not yet supported by this build";
287
+ },
288
+ {
289
+ code: 6009;
290
+ name: "invalidMintAccount";
291
+ msg: "Account supplied as a mint is too short to be a valid SPL Mint";
292
+ },
293
+ {
294
+ code: 6010;
295
+ name: "invalidPrice";
296
+ msg: "Oracle returned a non-positive price";
297
+ },
298
+ {
299
+ code: 6011;
300
+ name: "borrowNotSupported";
301
+ msg: "This settlement layer does not permit borrowing collateral";
302
+ }
303
+ ];
304
+ types: [
305
+ {
306
+ name: "exerciseResolution";
307
+ docs: [
308
+ "A settlement layer returns this from `can_exercise` to instruct core how to",
309
+ "move escrowed funds. Core owns custody of all option assets; layers are pure",
310
+ "decision modules."
311
+ ];
312
+ type: {
313
+ kind: "struct";
314
+ fields: [
315
+ {
316
+ name: "collateralToTaker";
317
+ docs: [
318
+ "Collateral asset moved from option escrow to maker escrow (e.g. cashless leftover)."
319
+ ];
320
+ type: "u64";
321
+ },
322
+ {
323
+ name: "settlementFromTaker";
324
+ docs: [
325
+ "Settlement asset pulled from taker to maker. Zero for cashless settlement."
326
+ ];
327
+ type: "u64";
328
+ }
329
+ ];
330
+ };
331
+ },
332
+ {
333
+ name: "marketOption";
334
+ docs: [
335
+ "A live option, as passed to a settlement layer / hook. Mirrors",
336
+ "`overcast_core::state::MarketOption` byte-for-byte."
337
+ ];
338
+ type: {
339
+ kind: "struct";
340
+ fields: [
341
+ {
342
+ name: "details";
343
+ type: {
344
+ defined: {
345
+ name: "optionDetails";
346
+ };
347
+ };
348
+ },
349
+ {
350
+ name: "taker";
351
+ type: "pubkey";
352
+ },
353
+ {
354
+ name: "maker";
355
+ type: "pubkey";
356
+ },
357
+ {
358
+ name: "settlementOffer";
359
+ type: "pubkey";
360
+ },
361
+ {
362
+ name: "collateralOffer";
363
+ type: "pubkey";
364
+ },
365
+ {
366
+ name: "borrowedCollateral";
367
+ docs: [
368
+ "Collateral currently out on loan via `borrow_collateral` and not yet",
369
+ "returned via `repay_collateral`."
370
+ ];
371
+ type: "u64";
372
+ }
373
+ ];
374
+ };
375
+ },
376
+ {
377
+ name: "optionDetails";
378
+ docs: [
379
+ "The economic terms of an option, as seen by a settlement layer / hook.",
380
+ "",
381
+ "Mirrors `overcast_core::state::OptionDetails` byte-for-byte — core owns the",
382
+ "on-chain account representation, this is the shared interface view."
383
+ ];
384
+ type: {
385
+ kind: "struct";
386
+ fields: [
387
+ {
388
+ name: "domain";
389
+ type: "u32";
390
+ },
391
+ {
392
+ name: "startTimestamp";
393
+ type: "i64";
394
+ },
395
+ {
396
+ name: "endTimestamp";
397
+ type: "i64";
398
+ },
399
+ {
400
+ name: "premiumAsset";
401
+ type: "pubkey";
402
+ },
403
+ {
404
+ name: "premiumAmount";
405
+ type: "u64";
406
+ },
407
+ {
408
+ name: "collateralAsset";
409
+ type: "pubkey";
410
+ },
411
+ {
412
+ name: "collateralAmount";
413
+ type: "u64";
414
+ },
415
+ {
416
+ name: "settlementAsset";
417
+ type: "pubkey";
418
+ },
419
+ {
420
+ name: "settlementAmount";
421
+ type: "u64";
422
+ },
423
+ {
424
+ name: "settlementLayer";
425
+ type: "pubkey";
426
+ },
427
+ {
428
+ name: "borrowAllowed";
429
+ docs: [
430
+ "Opt-in flag: if false, `borrow_collateral` is hard-rejected by core",
431
+ "regardless of what the settlement layer says. If true, the layer is",
432
+ "CPI'd and can still refuse."
433
+ ];
434
+ type: "bool";
435
+ }
436
+ ];
437
+ };
438
+ },
439
+ {
440
+ name: "oracleKind";
441
+ docs: ["Tagged oracle source. Discriminants are seed-encoded."];
442
+ repr: {
443
+ kind: "rust";
444
+ };
445
+ type: {
446
+ kind: "enum";
447
+ variants: [
448
+ {
449
+ name: "pyth";
450
+ }
451
+ ];
452
+ };
453
+ },
454
+ {
455
+ name: "oracleSettlementConfig";
456
+ docs: [
457
+ "Per-instance config for the oracle-gated settlement layer.",
458
+ "",
459
+ "The PDA seed encodes the full (assets, oracle bindings) tuple, so the",
460
+ "pubkey alone is self-describing. Operational policy (staleness, confidence)",
461
+ "is stored in data and immutable post-init."
462
+ ];
463
+ type: {
464
+ kind: "struct";
465
+ fields: [
466
+ {
467
+ name: "collMint";
468
+ type: "pubkey";
469
+ },
470
+ {
471
+ name: "settMint";
472
+ type: "pubkey";
473
+ },
474
+ {
475
+ name: "collDecimals";
476
+ docs: [
477
+ "Cached at init from the mint account; spares `can_exercise` from having",
478
+ "to take the mint accounts on every call. SPL Mint decimals are immutable",
479
+ "so the snapshot is permanently valid."
480
+ ];
481
+ type: "u8";
482
+ },
483
+ {
484
+ name: "settDecimals";
485
+ type: "u8";
486
+ },
487
+ {
488
+ name: "collOracleKind";
489
+ type: {
490
+ defined: {
491
+ name: "oracleKind";
492
+ };
493
+ };
494
+ },
495
+ {
496
+ name: "collOracleId";
497
+ type: {
498
+ array: ["u8", 32];
499
+ };
500
+ },
501
+ {
502
+ name: "settOracleKind";
503
+ type: {
504
+ defined: {
505
+ name: "oracleKind";
506
+ };
507
+ };
508
+ },
509
+ {
510
+ name: "settOracleId";
511
+ type: {
512
+ array: ["u8", 32];
513
+ };
514
+ },
515
+ {
516
+ name: "maxStalenessSecs";
517
+ type: "u32";
518
+ },
519
+ {
520
+ name: "maxConfBps";
521
+ type: "u32";
522
+ },
523
+ {
524
+ name: "intrinsicResolution";
525
+ docs: [
526
+ "Settlement style for exercise. `false` = physical: the taker pays the",
527
+ "full proportional settlement and receives the full exercised collateral.",
528
+ "`true` = intrinsic (cash-settled): the taker pays no settlement and is",
529
+ "instead paid the option's profit only, denominated in the collateral",
530
+ "asset (`(valueColl - valueSett) / priceColl`); the remaining collateral",
531
+ "stays escrowed for the maker to redeem. Immutable post-init."
532
+ ];
533
+ type: "bool";
534
+ },
535
+ {
536
+ name: "bump";
537
+ type: "u8";
538
+ }
539
+ ];
540
+ };
541
+ },
542
+ {
543
+ name: "redeemResolution";
544
+ docs: [
545
+ "A settlement layer returns this from `can_redeem` to instruct core how much",
546
+ "of each escrow to release to the maker. The redemption analogue of",
547
+ "[`ExerciseResolution`]: redemption only ever unwinds the two escrows back to",
548
+ "the maker, so the taker-facing fields are dropped."
549
+ ];
550
+ type: {
551
+ kind: "struct";
552
+ fields: [
553
+ {
554
+ name: "collateralToMaker";
555
+ docs: [
556
+ "Collateral asset released from the option escrow to the maker."
557
+ ];
558
+ type: "u64";
559
+ },
560
+ {
561
+ name: "settlementToMaker";
562
+ docs: [
563
+ "Settlement asset released from the option escrow to the maker."
564
+ ];
565
+ type: "u64";
566
+ }
567
+ ];
568
+ };
569
+ }
570
+ ];
571
+ constants: [
572
+ {
573
+ name: "settlementConfigSeed";
574
+ type: "bytes";
575
+ value: "[115, 101, 116, 116, 108, 101, 109, 101, 110, 116, 45, 99, 111, 110, 102, 105, 103]";
576
+ }
577
+ ];
578
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });