@@ -163,10 +163,8 @@ pub enum GovernanceInstruction {
163
163
/// 5. `[signer]` Governance Authority (Token Owner or Governance Delegate)
164
164
/// 6. `[signer]` Payer
165
165
/// 7. `[]` System program
166
- /// 8. `[]` Rent sysvar
167
- /// 9. `[]` Clock sysvar
168
- /// 10. `[]` Realm Config
169
- /// 11. `[]` Optional Voter Weight Record
166
+ /// 8. `[]` Realm Config
167
+ /// 9. `[]` Optional Voter Weight Record
170
168
CreateProposal {
171
169
#[ allow( dead_code) ]
172
170
/// UTF-8 encoded name of the proposal
@@ -258,11 +256,11 @@ pub enum GovernanceInstruction {
258
256
259
257
/// Cancels Proposal by changing its state to Canceled
260
258
///
261
- /// 0. `[writable]` Proposal account
262
- /// 1. `[writable]` TokenOwnerRecord account of the Proposal owner
263
- /// 2. `[signer ]` Governance Authority (Token Owner or Governance Delegate)
264
- /// 3. `[]` Clock sysvar
265
- /// 4. `[]` Governance account
259
+ /// 0. `[writable]` Realm account
260
+ /// 1. `[writable]` Governance account
261
+ /// 2. `[writable ]` Proposal account
262
+ /// 3. `[writable ]` TokenOwnerRecord account of the Proposal owner
263
+ /// 4. `[signer ]` Governance Authority (Token Owner or Governance Delegate)
266
264
CancelProposal ,
267
265
268
266
/// Signs off Proposal indicating the Signatory approves the Proposal
@@ -271,20 +269,21 @@ pub enum GovernanceInstruction {
271
269
/// it's entirely at the discretion of the Proposal owner
272
270
/// If Proposal owner doesn't designate any signatories then can sign off the Proposal themself
273
271
///
274
- /// 0. `[writable]` Proposal account
275
- /// 1. `[writable]` Signatory Record account
276
- /// 2. `[signer]` Signatory account signing off the Proposal
272
+ /// 0. `[writable]` Realm account
273
+ /// 1. `[writable]` Governance account
274
+ /// 2. `[writable]` Proposal account
275
+ /// 4. `[signer]` Signatory account signing off the Proposal
277
276
/// Or Proposal owner if the owner hasn't appointed any signatories
278
- /// 3 . `[]` Clock sysvar
279
- /// 4 . `[]` Optional TokenOwnerRecord of the Proposal owner when self signing off the Proposal
277
+ /// 5 . `[]` Optional TokenOwnerRecord for the Proposal owner. Required when the owner signs off the Proposal
278
+ /// 3 . `[writable ]` Optional Signatory Record account. Required when non owner sings off the Proposal
280
279
SignOffProposal ,
281
280
282
281
/// Uses your voter weight (deposited Community or Council tokens) to cast a vote on a Proposal
283
282
/// By doing so you indicate you approve or disapprove of running the Proposal set of transactions
284
283
/// If you tip the consensus then the transactions can begin to be run after their hold up time
285
284
///
286
- /// 0. `[]` Realm account
287
- /// 1. `[]` Governance account
285
+ /// 0. `[writable ]` Realm account
286
+ /// 1. `[writable ]` Governance account
288
287
/// 2. `[writable]` Proposal account
289
288
/// 4. `[writable]` TokenOwnerRecord of the Proposal owner
290
289
/// 3. `[writable]` TokenOwnerRecord of the voter. PDA seeds: ['governance',realm, governing_token_mint, governing_token_owner]
@@ -293,11 +292,9 @@ pub enum GovernanceInstruction {
293
292
/// 6. `[]` Governing Token Mint
294
293
/// 7. `[signer]` Payer
295
294
/// 8. `[]` System program
296
- /// 9. `[]` Rent sysvar
297
- /// 10. `[]` Clock sysvar
298
- /// 11. `[]` Realm Config
299
- /// 12. `[]` Optional Voter Weight Record
300
- /// 13. `[]` Optional Max Voter Weight Record
295
+ /// 9. `[]` Realm Config
296
+ /// 10. `[]` Optional Voter Weight Record
297
+ /// 11. `[]` Optional Max Voter Weight Record
301
298
CastVote {
302
299
#[ allow( dead_code) ]
303
300
/// User's vote
@@ -306,14 +303,13 @@ pub enum GovernanceInstruction {
306
303
307
304
/// Finalizes vote in case the Vote was not automatically tipped within max_voting_time period
308
305
///
309
- /// 0. `[]` Realm account
310
- /// 1. `[]` Governance account
306
+ /// 0. `[writable ]` Realm account
307
+ /// 1. `[writable ]` Governance account
311
308
/// 2. `[writable]` Proposal account
312
309
/// 3. `[writable]` TokenOwnerRecord of the Proposal owner
313
310
/// 4. `[]` Governing Token Mint
314
- /// 5. `[]` Clock sysvar
315
- /// 6. `[]` Realm Config
316
- /// 7. `[]` Optional Max Voter Weight Record
311
+ /// 5. `[]` Realm Config
312
+ /// 6. `[]` Optional Max Voter Weight Record
317
313
FinalizeVote { } ,
318
314
319
315
/// Relinquish Vote removes voter weight from a Proposal and removes it from voter's active votes
@@ -339,8 +335,7 @@ pub enum GovernanceInstruction {
339
335
///
340
336
/// 0. `[writable]` Proposal account
341
337
/// 1. `[writable]` ProposalTransaction account you wish to execute
342
- /// 2. `[]` Clock sysvar
343
- /// 3+ Any extra accounts that are part of the transaction, in order
338
+ /// 2+ Any extra accounts that are part of the transaction, in order
344
339
ExecuteTransaction ,
345
340
346
341
/// Creates Mint Governance account which governs a mint
@@ -414,7 +409,6 @@ pub enum GovernanceInstruction {
414
409
/// 1. `[]` TokenOwnerRecord account of the Proposal owner
415
410
/// 2. `[signer]` Governance Authority (Token Owner or Governance Delegate)
416
411
/// 3. `[writable]` ProposalTransaction account to flag
417
- /// 4. `[]` Clock sysvar
418
412
FlagTransactionError ,
419
413
420
414
/// Sets new Realm authority
@@ -599,7 +593,6 @@ pub fn deposit_governing_tokens(
599
593
AccountMeta :: new( * payer, true ) ,
600
594
AccountMeta :: new_readonly( system_program:: id( ) , false ) ,
601
595
AccountMeta :: new_readonly( spl_token:: id( ) , false ) ,
602
- AccountMeta :: new_readonly( sysvar:: rent:: id( ) , false ) ,
603
596
] ;
604
597
605
598
let instruction = GovernanceInstruction :: DepositGoverningTokens { amount } ;
@@ -713,7 +706,6 @@ pub fn create_governance(
713
706
AccountMeta :: new_readonly( * token_owner_record, false ) ,
714
707
AccountMeta :: new( * payer, true ) ,
715
708
AccountMeta :: new_readonly( system_program:: id( ) , false ) ,
716
- AccountMeta :: new_readonly( sysvar:: rent:: id( ) , false ) ,
717
709
AccountMeta :: new_readonly( * create_authority, true ) ,
718
710
] ;
719
711
@@ -758,7 +750,6 @@ pub fn create_program_governance(
758
750
AccountMeta :: new( * payer, true ) ,
759
751
AccountMeta :: new_readonly( bpf_loader_upgradeable:: id( ) , false ) ,
760
752
AccountMeta :: new_readonly( system_program:: id( ) , false ) ,
761
- AccountMeta :: new_readonly( sysvar:: rent:: id( ) , false ) ,
762
753
AccountMeta :: new_readonly( * create_authority, true ) ,
763
754
] ;
764
755
@@ -803,7 +794,6 @@ pub fn create_mint_governance(
803
794
AccountMeta :: new( * payer, true ) ,
804
795
AccountMeta :: new_readonly( spl_token:: id( ) , false ) ,
805
796
AccountMeta :: new_readonly( system_program:: id( ) , false ) ,
806
- AccountMeta :: new_readonly( sysvar:: rent:: id( ) , false ) ,
807
797
AccountMeta :: new_readonly( * create_authority, true ) ,
808
798
] ;
809
799
@@ -848,7 +838,6 @@ pub fn create_token_governance(
848
838
AccountMeta :: new( * payer, true ) ,
849
839
AccountMeta :: new_readonly( spl_token:: id( ) , false ) ,
850
840
AccountMeta :: new_readonly( system_program:: id( ) , false ) ,
851
- AccountMeta :: new_readonly( sysvar:: rent:: id( ) , false ) ,
852
841
AccountMeta :: new_readonly( * create_authority, true ) ,
853
842
] ;
854
843
@@ -902,8 +891,6 @@ pub fn create_proposal(
902
891
AccountMeta :: new_readonly( * governance_authority, true ) ,
903
892
AccountMeta :: new( * payer, true ) ,
904
893
AccountMeta :: new_readonly( system_program:: id( ) , false ) ,
905
- AccountMeta :: new_readonly( sysvar:: rent:: id( ) , false ) ,
906
- AccountMeta :: new_readonly( sysvar:: clock:: id( ) , false ) ,
907
894
] ;
908
895
909
896
with_realm_config_accounts ( program_id, & mut accounts, realm, voter_weight_record, None ) ;
@@ -943,7 +930,6 @@ pub fn add_signatory(
943
930
AccountMeta :: new( signatory_record_address, false ) ,
944
931
AccountMeta :: new( * payer, true ) ,
945
932
AccountMeta :: new_readonly( system_program:: id( ) , false ) ,
946
- AccountMeta :: new_readonly( sysvar:: rent:: id( ) , false ) ,
947
933
] ;
948
934
949
935
let instruction = GovernanceInstruction :: AddSignatory {
@@ -992,21 +978,25 @@ pub fn remove_signatory(
992
978
pub fn sign_off_proposal (
993
979
program_id : & Pubkey ,
994
980
// Accounts
981
+ realm : & Pubkey ,
982
+ governance : & Pubkey ,
995
983
proposal : & Pubkey ,
996
984
signatory : & Pubkey ,
997
985
proposal_owner_record : Option < & Pubkey > ,
998
986
) -> Instruction {
999
- let signatory_record_address = get_signatory_record_address ( program_id, proposal, signatory) ;
1000
-
1001
987
let mut accounts = vec ! [
988
+ AccountMeta :: new( * realm, false ) ,
989
+ AccountMeta :: new( * governance, false ) ,
1002
990
AccountMeta :: new( * proposal, false ) ,
1003
- AccountMeta :: new( signatory_record_address, false ) ,
1004
991
AccountMeta :: new_readonly( * signatory, true ) ,
1005
- AccountMeta :: new_readonly( sysvar:: clock:: id( ) , false ) ,
1006
992
] ;
1007
993
1008
994
if let Some ( proposal_owner_record) = proposal_owner_record {
1009
995
accounts. push ( AccountMeta :: new_readonly ( * proposal_owner_record, false ) )
996
+ } else {
997
+ let signatory_record_address =
998
+ get_signatory_record_address ( program_id, proposal, signatory) ;
999
+ accounts. push ( AccountMeta :: new ( signatory_record_address, false ) ) ;
1010
1000
}
1011
1001
1012
1002
let instruction = GovernanceInstruction :: SignOffProposal ;
@@ -1040,8 +1030,8 @@ pub fn cast_vote(
1040
1030
get_vote_record_address ( program_id, proposal, voter_token_owner_record) ;
1041
1031
1042
1032
let mut accounts = vec ! [
1043
- AccountMeta :: new_readonly ( * realm, false ) ,
1044
- AccountMeta :: new_readonly ( * governance, false ) ,
1033
+ AccountMeta :: new ( * realm, false ) ,
1034
+ AccountMeta :: new ( * governance, false ) ,
1045
1035
AccountMeta :: new( * proposal, false ) ,
1046
1036
AccountMeta :: new( * proposal_owner_record, false ) ,
1047
1037
AccountMeta :: new( * voter_token_owner_record, false ) ,
@@ -1050,8 +1040,6 @@ pub fn cast_vote(
1050
1040
AccountMeta :: new_readonly( * governing_token_mint, false ) ,
1051
1041
AccountMeta :: new( * payer, true ) ,
1052
1042
AccountMeta :: new_readonly( system_program:: id( ) , false ) ,
1053
- AccountMeta :: new_readonly( sysvar:: rent:: id( ) , false ) ,
1054
- AccountMeta :: new_readonly( sysvar:: clock:: id( ) , false ) ,
1055
1043
] ;
1056
1044
1057
1045
with_realm_config_accounts (
@@ -1083,12 +1071,11 @@ pub fn finalize_vote(
1083
1071
max_voter_weight_record : Option < Pubkey > ,
1084
1072
) -> Instruction {
1085
1073
let mut accounts = vec ! [
1086
- AccountMeta :: new_readonly ( * realm, false ) ,
1087
- AccountMeta :: new_readonly ( * governance, false ) ,
1074
+ AccountMeta :: new ( * realm, false ) ,
1075
+ AccountMeta :: new ( * governance, false ) ,
1088
1076
AccountMeta :: new( * proposal, false ) ,
1089
1077
AccountMeta :: new( * proposal_owner_record, false ) ,
1090
1078
AccountMeta :: new_readonly( * governing_token_mint, false ) ,
1091
- AccountMeta :: new_readonly( sysvar:: clock:: id( ) , false ) ,
1092
1079
] ;
1093
1080
1094
1081
with_realm_config_accounts (
@@ -1147,17 +1134,18 @@ pub fn relinquish_vote(
1147
1134
pub fn cancel_proposal (
1148
1135
program_id : & Pubkey ,
1149
1136
// Accounts
1137
+ realm : & Pubkey ,
1138
+ governance : & Pubkey ,
1150
1139
proposal : & Pubkey ,
1151
1140
proposal_owner_record : & Pubkey ,
1152
1141
governance_authority : & Pubkey ,
1153
- governance : & Pubkey ,
1154
1142
) -> Instruction {
1155
1143
let accounts = vec ! [
1144
+ AccountMeta :: new( * realm, false ) ,
1145
+ AccountMeta :: new( * governance, false ) ,
1156
1146
AccountMeta :: new( * proposal, false ) ,
1157
1147
AccountMeta :: new( * proposal_owner_record, false ) ,
1158
1148
AccountMeta :: new_readonly( * governance_authority, true ) ,
1159
- AccountMeta :: new_readonly( sysvar:: clock:: id( ) , false ) ,
1160
- AccountMeta :: new_readonly( * governance, false ) ,
1161
1149
] ;
1162
1150
1163
1151
let instruction = GovernanceInstruction :: CancelProposal { } ;
@@ -1258,7 +1246,6 @@ pub fn execute_transaction(
1258
1246
AccountMeta :: new_readonly( * governance, false ) ,
1259
1247
AccountMeta :: new( * proposal, false ) ,
1260
1248
AccountMeta :: new( * proposal_transaction, false ) ,
1261
- AccountMeta :: new_readonly( sysvar:: clock:: id( ) , false ) ,
1262
1249
AccountMeta :: new_readonly( * instruction_program_id, false ) ,
1263
1250
] ;
1264
1251
@@ -1306,7 +1293,6 @@ pub fn flag_transaction_error(
1306
1293
AccountMeta :: new_readonly( * token_owner_record, false ) ,
1307
1294
AccountMeta :: new_readonly( * governance_authority, true ) ,
1308
1295
AccountMeta :: new( * proposal_transaction, false ) ,
1309
- AccountMeta :: new_readonly( sysvar:: clock:: id( ) , false ) ,
1310
1296
] ;
1311
1297
1312
1298
let instruction = GovernanceInstruction :: FlagTransactionError { } ;
0 commit comments