@metadaoproject/futarchy 0.3.0-alpha.11 → 0.3.0-alpha.13

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.
@@ -1,7 +1,222 @@
1
1
  export type ConditionalVault = {
2
- version: "0.3.0";
2
+ version: "0.4.0";
3
3
  name: "conditional_vault";
4
4
  instructions: [
5
+ {
6
+ name: "initializeQuestion";
7
+ accounts: [
8
+ {
9
+ name: "question";
10
+ isMut: true;
11
+ isSigner: false;
12
+ },
13
+ {
14
+ name: "payer";
15
+ isMut: true;
16
+ isSigner: true;
17
+ },
18
+ {
19
+ name: "systemProgram";
20
+ isMut: false;
21
+ isSigner: false;
22
+ }
23
+ ];
24
+ args: [
25
+ {
26
+ name: "args";
27
+ type: {
28
+ defined: "InitializeQuestionArgs";
29
+ };
30
+ }
31
+ ];
32
+ },
33
+ {
34
+ name: "resolveQuestion";
35
+ accounts: [
36
+ {
37
+ name: "question";
38
+ isMut: true;
39
+ isSigner: false;
40
+ },
41
+ {
42
+ name: "oracle";
43
+ isMut: false;
44
+ isSigner: true;
45
+ }
46
+ ];
47
+ args: [
48
+ {
49
+ name: "args";
50
+ type: {
51
+ defined: "ResolveQuestionArgs";
52
+ };
53
+ }
54
+ ];
55
+ },
56
+ {
57
+ name: "initializeNewConditionalVault";
58
+ accounts: [
59
+ {
60
+ name: "vault";
61
+ isMut: true;
62
+ isSigner: false;
63
+ },
64
+ {
65
+ name: "question";
66
+ isMut: false;
67
+ isSigner: false;
68
+ },
69
+ {
70
+ name: "underlyingTokenMint";
71
+ isMut: false;
72
+ isSigner: false;
73
+ },
74
+ {
75
+ name: "vaultUnderlyingTokenAccount";
76
+ isMut: false;
77
+ isSigner: false;
78
+ },
79
+ {
80
+ name: "payer";
81
+ isMut: true;
82
+ isSigner: true;
83
+ },
84
+ {
85
+ name: "tokenProgram";
86
+ isMut: false;
87
+ isSigner: false;
88
+ },
89
+ {
90
+ name: "associatedTokenProgram";
91
+ isMut: false;
92
+ isSigner: false;
93
+ },
94
+ {
95
+ name: "systemProgram";
96
+ isMut: false;
97
+ isSigner: false;
98
+ }
99
+ ];
100
+ args: [];
101
+ },
102
+ {
103
+ name: "splitTokens";
104
+ accounts: [
105
+ {
106
+ name: "question";
107
+ isMut: false;
108
+ isSigner: false;
109
+ },
110
+ {
111
+ name: "vault";
112
+ isMut: false;
113
+ isSigner: false;
114
+ },
115
+ {
116
+ name: "vaultUnderlyingTokenAccount";
117
+ isMut: true;
118
+ isSigner: false;
119
+ },
120
+ {
121
+ name: "authority";
122
+ isMut: false;
123
+ isSigner: true;
124
+ },
125
+ {
126
+ name: "userUnderlyingTokenAccount";
127
+ isMut: true;
128
+ isSigner: false;
129
+ },
130
+ {
131
+ name: "tokenProgram";
132
+ isMut: false;
133
+ isSigner: false;
134
+ }
135
+ ];
136
+ args: [
137
+ {
138
+ name: "amount";
139
+ type: "u64";
140
+ }
141
+ ];
142
+ },
143
+ {
144
+ name: "mergeTokens";
145
+ accounts: [
146
+ {
147
+ name: "question";
148
+ isMut: false;
149
+ isSigner: false;
150
+ },
151
+ {
152
+ name: "vault";
153
+ isMut: false;
154
+ isSigner: false;
155
+ },
156
+ {
157
+ name: "vaultUnderlyingTokenAccount";
158
+ isMut: true;
159
+ isSigner: false;
160
+ },
161
+ {
162
+ name: "authority";
163
+ isMut: false;
164
+ isSigner: true;
165
+ },
166
+ {
167
+ name: "userUnderlyingTokenAccount";
168
+ isMut: true;
169
+ isSigner: false;
170
+ },
171
+ {
172
+ name: "tokenProgram";
173
+ isMut: false;
174
+ isSigner: false;
175
+ }
176
+ ];
177
+ args: [
178
+ {
179
+ name: "amount";
180
+ type: "u64";
181
+ }
182
+ ];
183
+ },
184
+ {
185
+ name: "redeemTokens";
186
+ accounts: [
187
+ {
188
+ name: "question";
189
+ isMut: false;
190
+ isSigner: false;
191
+ },
192
+ {
193
+ name: "vault";
194
+ isMut: false;
195
+ isSigner: false;
196
+ },
197
+ {
198
+ name: "vaultUnderlyingTokenAccount";
199
+ isMut: true;
200
+ isSigner: false;
201
+ },
202
+ {
203
+ name: "authority";
204
+ isMut: false;
205
+ isSigner: true;
206
+ },
207
+ {
208
+ name: "userUnderlyingTokenAccount";
209
+ isMut: true;
210
+ isSigner: false;
211
+ },
212
+ {
213
+ name: "tokenProgram";
214
+ isMut: false;
215
+ isSigner: false;
216
+ }
217
+ ];
218
+ args: [];
219
+ },
5
220
  {
6
221
  name: "initializeConditionalVault";
7
222
  accounts: [
@@ -316,6 +531,40 @@ export type ConditionalVault = {
316
531
  }
317
532
  ];
318
533
  accounts: [
534
+ {
535
+ name: "newConditionalVault";
536
+ type: {
537
+ kind: "struct";
538
+ fields: [
539
+ {
540
+ name: "question";
541
+ type: "publicKey";
542
+ },
543
+ {
544
+ name: "underlyingTokenMint";
545
+ type: "publicKey";
546
+ },
547
+ {
548
+ name: "underlyingTokenAccount";
549
+ type: "publicKey";
550
+ },
551
+ {
552
+ name: "conditionalTokenMints";
553
+ type: {
554
+ vec: "publicKey";
555
+ };
556
+ },
557
+ {
558
+ name: "pdaBump";
559
+ type: "u8";
560
+ },
561
+ {
562
+ name: "decimals";
563
+ type: "u8";
564
+ }
565
+ ];
566
+ };
567
+ },
319
568
  {
320
569
  name: "conditionalVault";
321
570
  type: {
@@ -364,6 +613,56 @@ export type ConditionalVault = {
364
613
  }
365
614
  ];
366
615
  };
616
+ },
617
+ {
618
+ name: "question";
619
+ docs: [
620
+ "Questions represent statements about future events.",
621
+ "",
622
+ "These statements include:",
623
+ '- "Will this proposal pass?"',
624
+ '- "Who, if anyone, will be hired?"',
625
+ '- "How effective will the grant committee deem this grant?"',
626
+ "",
627
+ 'Questions have 2 or more possible outcomes. For a question like "will this',
628
+ 'proposal pass," the outcomes are "yes" and "no." For a question like "who',
629
+ 'will be hired," the outcomes could be "Alice," "Bob," and "neither."',
630
+ "",
631
+ 'Outcomes resolve to a number between 0 and 1. Binary questions like "will',
632
+ 'this proposal pass" have outcomes that resolve to exactly 0 or 1. You can',
633
+ 'also have questions with scalar outcomes. For example, the question "how',
634
+ 'effective will the grant committee deem this grant" could have two outcomes:',
635
+ '"ineffective" and "effective." If the grant committee deems the grant 70%',
636
+ 'effective, the "effective" outcome would resolve to 0.7 and the "ineffective"',
637
+ "outcome would resolve to 0.3.",
638
+ "",
639
+ "Once resolved, the sum of all outcome resolutions is exactly 1."
640
+ ];
641
+ type: {
642
+ kind: "struct";
643
+ fields: [
644
+ {
645
+ name: "questionId";
646
+ type: {
647
+ array: ["u8", 32];
648
+ };
649
+ },
650
+ {
651
+ name: "oracle";
652
+ type: "publicKey";
653
+ },
654
+ {
655
+ name: "payoutNumerators";
656
+ type: {
657
+ vec: "u32";
658
+ };
659
+ },
660
+ {
661
+ name: "payoutDenominator";
662
+ type: "u32";
663
+ }
664
+ ];
665
+ };
367
666
  }
368
667
  ];
369
668
  types: [
@@ -399,6 +698,42 @@ export type ConditionalVault = {
399
698
  ];
400
699
  };
401
700
  },
701
+ {
702
+ name: "InitializeQuestionArgs";
703
+ type: {
704
+ kind: "struct";
705
+ fields: [
706
+ {
707
+ name: "questionId";
708
+ type: {
709
+ array: ["u8", 32];
710
+ };
711
+ },
712
+ {
713
+ name: "oracle";
714
+ type: "publicKey";
715
+ },
716
+ {
717
+ name: "numConditions";
718
+ type: "u8";
719
+ }
720
+ ];
721
+ };
722
+ },
723
+ {
724
+ name: "ResolveQuestionArgs";
725
+ type: {
726
+ kind: "struct";
727
+ fields: [
728
+ {
729
+ name: "payoutNumerators";
730
+ type: {
731
+ vec: "u32";
732
+ };
733
+ }
734
+ ];
735
+ };
736
+ },
402
737
  {
403
738
  name: "VaultStatus";
404
739
  type: {
@@ -425,23 +760,68 @@ export type ConditionalVault = {
425
760
  },
426
761
  {
427
762
  code: 6001;
763
+ name: "InsufficientConditionalTokens";
764
+ msg: "Insufficient conditional token balance to merge this `amount`";
765
+ },
766
+ {
767
+ code: 6002;
428
768
  name: "InvalidVaultUnderlyingTokenAccount";
429
769
  msg: "This `vault_underlying_token_account` is not this vault's `underlying_token_account`";
430
770
  },
431
771
  {
432
- code: 6002;
772
+ code: 6003;
433
773
  name: "InvalidConditionalTokenMint";
434
774
  msg: "This conditional token mint is not this vault's conditional token mint";
435
775
  },
436
776
  {
437
- code: 6003;
777
+ code: 6004;
438
778
  name: "CantRedeemConditionalTokens";
439
- msg: "Vault needs to be settled as finalized before users can redeem conditional tokens for underlying tokens";
779
+ msg: "Question needs to be resolved before users can redeem conditional tokens for underlying tokens";
440
780
  },
441
781
  {
442
- code: 6004;
782
+ code: 6005;
443
783
  name: "VaultAlreadySettled";
444
784
  msg: "Once a vault has been settled, its status as either finalized or reverted cannot be changed";
785
+ },
786
+ {
787
+ code: 6006;
788
+ name: "InsufficientNumConditions";
789
+ msg: "Questions need 2 or more conditions";
790
+ },
791
+ {
792
+ code: 6007;
793
+ name: "InvalidNumPayoutNumerators";
794
+ msg: "Invalid number of payout numerators";
795
+ },
796
+ {
797
+ code: 6008;
798
+ name: "InvalidConditionals";
799
+ msg: "Client needs to pass in the list of conditional mints for a vault followed by the user's token accounts for those tokens";
800
+ },
801
+ {
802
+ code: 6009;
803
+ name: "ConditionalMintMismatch";
804
+ msg: "Conditional mint not in vault";
805
+ },
806
+ {
807
+ code: 6010;
808
+ name: "BadConditionalMint";
809
+ msg: "Unable to deserialize a conditional token mint";
810
+ },
811
+ {
812
+ code: 6011;
813
+ name: "BadConditionalTokenAccount";
814
+ msg: "Unable to deserialize a conditional token account";
815
+ },
816
+ {
817
+ code: 6012;
818
+ name: "ConditionalTokenMintMismatch";
819
+ msg: "User conditional token account mint does not match conditional mint";
820
+ },
821
+ {
822
+ code: 6013;
823
+ name: "PayoutZero";
824
+ msg: "Payouts must sum to 1 or more";
445
825
  }
446
826
  ];
447
827
  };