@@ -50,7 +50,7 @@ pub enum GovernanceInstruction {
50
50
/// 5. `[]` System
51
51
/// 6. `[]` SPL Token
52
52
/// 7. `[]` Sysvar Rent
53
- /// 8. `[]` Realm custodian - optional
53
+
54
54
/// 9. `[]` Council Token Mint - optional
55
55
/// 10. `[writable]` Council Token Holding account - optional unless council is used. PDA seeds: ['governance',realm,council_mint]
56
56
/// The account will be created with the Realm PDA as its owner
@@ -109,10 +109,11 @@ pub enum GovernanceInstruction {
109
109
///
110
110
/// 0. `[]` Realm account the created Governance belongs to
111
111
/// 1. `[writable]` Account Governance account. PDA seeds: ['account-governance', realm, governed_account]
112
- /// 2. `[]` Account governed by this Governance account
113
- /// 3. `[signer]` Payer
114
- /// 4. `[]` System program
115
- /// 5. `[]` Sysvar Rent
112
+ /// 2. `[]` Account governed by this Governance
113
+ /// 3. `[]` Governing TokenOwnerRecord account
114
+ /// 4. `[signer]` Payer
115
+ /// 5. `[]` System program
116
+ /// 6. `[]` Sysvar Rent
116
117
CreateAccountGovernance {
117
118
/// Governance config
118
119
#[ allow( dead_code) ]
@@ -126,10 +127,11 @@ pub enum GovernanceInstruction {
126
127
/// 2. `[]` Program governed by this Governance account
127
128
/// 3. `[writable]` Program Data account of the Program governed by this Governance account
128
129
/// 4. `[signer]` Current Upgrade Authority account of the Program governed by this Governance account
129
- /// 5. `[signer]` Payer
130
- /// 6. `[]` bpf_upgradeable_loader program
131
- /// 7. `[]` System program
132
- /// 8. `[]` Sysvar Rent
130
+ /// 5. `[]` Governing TokenOwnerRecord account
131
+ /// 6. `[signer]` Payer
132
+ /// 7. `[]` bpf_upgradeable_loader program
133
+ /// 8. `[]` System program
134
+ /// 9. `[]` Sysvar Rent
133
135
CreateProgramGovernance {
134
136
/// Governance config
135
137
#[ allow( dead_code) ]
@@ -310,10 +312,11 @@ pub enum GovernanceInstruction {
310
312
/// 1. `[writable]` Mint Governance account. PDA seeds: ['mint-governance', realm, governed_mint]
311
313
/// 2. `[writable]` Mint governed by this Governance account
312
314
/// 3. `[signer]` Current Mint Authority
313
- /// 4. `[signer]` Payer
314
- /// 5. `[]` SPL Token program
315
- /// 6. `[]` System program
316
- /// 7. `[]` Sysvar Rent
315
+ /// 4. `[]` Governing TokenOwnerRecord account
316
+ /// 5. `[signer]` Payer
317
+ /// 6. `[]` SPL Token program
318
+ /// 7. `[]` System program
319
+ /// 8. `[]` Sysvar Rent
317
320
CreateMintGovernance {
318
321
#[ allow( dead_code) ]
319
322
/// Governance config
@@ -331,11 +334,12 @@ pub enum GovernanceInstruction {
331
334
/// 0. `[]` Realm account the created Governance belongs to
332
335
/// 1. `[writable]` Token Governance account. PDA seeds: ['token-governance', realm, governed_token]
333
336
/// 2. `[writable]` Token account governed by this Governance account
334
- /// 3. `[signer]` Current Token account owner
335
- /// 4. `[signer]` Payer
336
- /// 5. `[]` SPL Token program
337
- /// 6. `[]` System program
338
- /// 7. `[]` Sysvar Rent
337
+ /// 3. `[signer]` Current Token account
338
+ /// 4. `[]` Governing TokenOwnerRecord account
339
+ /// 5. `[signer]` Payer
340
+ /// 6. `[]` SPL Token program
341
+ /// 7. `[]` System program
342
+ /// 8. `[]` Sysvar Rent
339
343
CreateTokenGovernance {
340
344
#[ allow( dead_code) ]
341
345
/// Governance config
@@ -383,7 +387,7 @@ pub enum GovernanceInstruction {
383
387
/// Sets realm config
384
388
/// 0. `[writable]` Realm account
385
389
/// 1. `[signer]` Realm authority
386
- /// 2. `[]` Realm custodian - optional
390
+
387
391
/// 3. `[]` Council Token Mint - optional
388
392
/// Note: In the current version it's only possible to remove council mint (set it to None)
389
393
/// After setting council to None it won't be possible to withdraw the tokens from the Realm any longer
@@ -405,10 +409,10 @@ pub fn create_realm(
405
409
realm_authority : & Pubkey ,
406
410
community_token_mint : & Pubkey ,
407
411
payer : & Pubkey ,
408
- realm_custodian : Option < Pubkey > ,
409
412
council_token_mint : Option < Pubkey > ,
410
413
// Args
411
414
name : String ,
415
+ min_community_tokens_to_create_governance : u64 ,
412
416
community_mint_max_vote_weight_source : MintMaxVoteWeightSource ,
413
417
) -> Instruction {
414
418
let realm_address = get_realm_address ( program_id, & name) ;
@@ -426,13 +430,6 @@ pub fn create_realm(
426
430
AccountMeta :: new_readonly( sysvar:: rent:: id( ) , false ) ,
427
431
] ;
428
432
429
- let use_custodian = if let Some ( realm_custodian) = realm_custodian {
430
- accounts. push ( AccountMeta :: new_readonly ( realm_custodian, false ) ) ;
431
- true
432
- } else {
433
- false
434
- } ;
435
-
436
433
let use_council_mint = if let Some ( council_token_mint) = council_token_mint {
437
434
let council_token_holding_address =
438
435
get_governing_token_holding_address ( program_id, & realm_address, & council_token_mint) ;
@@ -447,7 +444,7 @@ pub fn create_realm(
447
444
let instruction = GovernanceInstruction :: CreateRealm {
448
445
config_args : RealmConfigArgs {
449
446
use_council_mint,
450
- use_custodian ,
447
+ min_community_tokens_to_create_governance ,
451
448
community_mint_max_vote_weight_source,
452
449
} ,
453
450
name,
@@ -582,6 +579,7 @@ pub fn create_account_governance(
582
579
// Accounts
583
580
realm : & Pubkey ,
584
581
governed_account : & Pubkey ,
582
+ token_owner_record : & Pubkey ,
585
583
payer : & Pubkey ,
586
584
// Args
587
585
config : GovernanceConfig ,
@@ -593,6 +591,7 @@ pub fn create_account_governance(
593
591
AccountMeta :: new_readonly( * realm, false ) ,
594
592
AccountMeta :: new( account_governance_address, false ) ,
595
593
AccountMeta :: new_readonly( * governed_account, false ) ,
594
+ AccountMeta :: new_readonly( * token_owner_record, false ) ,
596
595
AccountMeta :: new_readonly( * payer, true ) ,
597
596
AccountMeta :: new_readonly( system_program:: id( ) , false ) ,
598
597
AccountMeta :: new_readonly( sysvar:: rent:: id( ) , false ) ,
@@ -608,12 +607,14 @@ pub fn create_account_governance(
608
607
}
609
608
610
609
/// Creates CreateProgramGovernance instruction
610
+ #[ allow( clippy:: too_many_arguments) ]
611
611
pub fn create_program_governance (
612
612
program_id : & Pubkey ,
613
613
// Accounts
614
614
realm : & Pubkey ,
615
615
governed_program : & Pubkey ,
616
616
governed_program_upgrade_authority : & Pubkey ,
617
+ token_owner_record : & Pubkey ,
617
618
payer : & Pubkey ,
618
619
// Args
619
620
config : GovernanceConfig ,
@@ -629,6 +630,7 @@ pub fn create_program_governance(
629
630
AccountMeta :: new_readonly( * governed_program, false ) ,
630
631
AccountMeta :: new( governed_program_data_address, false ) ,
631
632
AccountMeta :: new_readonly( * governed_program_upgrade_authority, true ) ,
633
+ AccountMeta :: new_readonly( * token_owner_record, false ) ,
632
634
AccountMeta :: new_readonly( * payer, true ) ,
633
635
AccountMeta :: new_readonly( bpf_loader_upgradeable:: id( ) , false ) ,
634
636
AccountMeta :: new_readonly( system_program:: id( ) , false ) ,
@@ -647,13 +649,15 @@ pub fn create_program_governance(
647
649
}
648
650
}
649
651
650
- /// Creates CreateMintGovernance instruction
652
+ /// Creates CreateMintGovernance
653
+ #[ allow( clippy:: too_many_arguments) ]
651
654
pub fn create_mint_governance (
652
655
program_id : & Pubkey ,
653
656
// Accounts
654
657
realm : & Pubkey ,
655
658
governed_mint : & Pubkey ,
656
659
governed_mint_authority : & Pubkey ,
660
+ token_owner_record : & Pubkey ,
657
661
payer : & Pubkey ,
658
662
// Args
659
663
config : GovernanceConfig ,
@@ -666,6 +670,7 @@ pub fn create_mint_governance(
666
670
AccountMeta :: new( mint_governance_address, false ) ,
667
671
AccountMeta :: new( * governed_mint, false ) ,
668
672
AccountMeta :: new_readonly( * governed_mint_authority, true ) ,
673
+ AccountMeta :: new_readonly( * token_owner_record, false ) ,
669
674
AccountMeta :: new_readonly( * payer, true ) ,
670
675
AccountMeta :: new_readonly( spl_token:: id( ) , false ) ,
671
676
AccountMeta :: new_readonly( system_program:: id( ) , false ) ,
@@ -685,12 +690,14 @@ pub fn create_mint_governance(
685
690
}
686
691
687
692
/// Creates CreateTokenGovernance instruction
693
+ #[ allow( clippy:: too_many_arguments) ]
688
694
pub fn create_token_governance (
689
695
program_id : & Pubkey ,
690
696
// Accounts
691
697
realm : & Pubkey ,
692
698
governed_token : & Pubkey ,
693
699
governed_token_owner : & Pubkey ,
700
+ token_owner_record : & Pubkey ,
694
701
payer : & Pubkey ,
695
702
// Args
696
703
config : GovernanceConfig ,
@@ -703,6 +710,7 @@ pub fn create_token_governance(
703
710
AccountMeta :: new( token_governance_address, false ) ,
704
711
AccountMeta :: new( * governed_token, false ) ,
705
712
AccountMeta :: new_readonly( * governed_token_owner, true ) ,
713
+ AccountMeta :: new_readonly( * token_owner_record, false ) ,
706
714
AccountMeta :: new_readonly( * payer, true ) ,
707
715
AccountMeta :: new_readonly( spl_token:: id( ) , false ) ,
708
716
AccountMeta :: new_readonly( system_program:: id( ) , false ) ,
@@ -1159,22 +1167,16 @@ pub fn set_realm_config(
1159
1167
realm : & Pubkey ,
1160
1168
realm_authority : & Pubkey ,
1161
1169
council_token_mint : Option < Pubkey > ,
1162
- realm_custodian : Option < Pubkey > ,
1170
+
1163
1171
// Args
1172
+ min_community_tokens_to_create_governance : u64 ,
1164
1173
community_mint_max_vote_weight_source : MintMaxVoteWeightSource ,
1165
1174
) -> Instruction {
1166
1175
let mut accounts = vec ! [
1167
1176
AccountMeta :: new( * realm, false ) ,
1168
1177
AccountMeta :: new_readonly( * realm_authority, true ) ,
1169
1178
] ;
1170
1179
1171
- let use_custodian = if let Some ( realm_custodian) = realm_custodian {
1172
- accounts. push ( AccountMeta :: new_readonly ( realm_custodian, false ) ) ;
1173
- true
1174
- } else {
1175
- false
1176
- } ;
1177
-
1178
1180
let use_council_mint = if let Some ( council_token_mint) = council_token_mint {
1179
1181
let council_token_holding_address =
1180
1182
get_governing_token_holding_address ( program_id, realm, & council_token_mint) ;
@@ -1189,7 +1191,7 @@ pub fn set_realm_config(
1189
1191
let instruction = GovernanceInstruction :: SetRealmConfig {
1190
1192
config_args : RealmConfigArgs {
1191
1193
use_council_mint,
1192
- use_custodian ,
1194
+ min_community_tokens_to_create_governance ,
1193
1195
community_mint_max_vote_weight_source,
1194
1196
} ,
1195
1197
} ;
0 commit comments