@@ -10,11 +10,9 @@ use crate::{
10
10
native_treasury:: get_native_treasury_address,
11
11
program_metadata:: get_program_metadata_address,
12
12
proposal:: { get_proposal_address, VoteType } ,
13
- proposal_instruction:: { get_proposal_instruction_address, InstructionData } ,
14
- realm:: {
15
- get_governing_token_holding_address, get_realm_address, RealmConfigArgs ,
16
- SetRealmAuthorityAction ,
17
- } ,
13
+ proposal_transaction:: { get_proposal_transaction_address, InstructionData } ,
14
+ realm:: SetRealmAuthorityAction ,
15
+ realm:: { get_governing_token_holding_address, get_realm_address, RealmConfigArgs } ,
18
16
realm_config:: get_realm_config_address,
19
17
signatory_record:: get_signatory_record_address,
20
18
token_owner_record:: get_token_owner_record_address,
@@ -154,7 +152,7 @@ pub enum GovernanceInstruction {
154
152
transfer_upgrade_authority : bool ,
155
153
} ,
156
154
157
- /// Creates Proposal account for Instructions that will be executed at some point in the future
155
+ /// Creates Proposal account for Transactions which will be executed at some point in the future
158
156
///
159
157
/// 0. `[]` Realm account the created Proposal belongs to
160
158
/// 1. `[writable]` Proposal account. PDA seeds ['governance',governance, governing_token_mint, proposal_index]
@@ -188,7 +186,7 @@ pub enum GovernanceInstruction {
188
186
#[ allow( dead_code) ]
189
187
/// Indicates whether the proposal has the deny option
190
188
/// A proposal without the rejecting option is a non binding survey
191
- /// Only proposals with the rejecting option can have executable instructions
189
+ /// Only proposals with the rejecting option can have executable transactions
192
190
use_deny_option : bool ,
193
191
} ,
194
192
@@ -220,42 +218,42 @@ pub enum GovernanceInstruction {
220
218
signatory : Pubkey ,
221
219
} ,
222
220
223
- /// Inserts an instruction for the Proposal at the given index position
224
- /// New Instructions must be inserted at the end of the range indicated by Proposal instructions_next_index
225
- /// If an Instruction replaces an existing Instruction at a given index then the old one must be removed using RemoveInstruction first
221
+ /// Inserts Transaction with a set of instructions for the Proposal at the given index position
222
+ /// New Transaction must be inserted at the end of the range indicated by Proposal transactions_next_index
223
+ /// If a Transaction replaces an existing Transaction at a given index then the old one must be removed using RemoveTransaction first
226
224
227
225
/// 0. `[]` Governance account
228
226
/// 1. `[writable]` Proposal account
229
227
/// 2. `[]` TokenOwnerRecord account of the Proposal owner
230
228
/// 3. `[signer]` Governance Authority (Token Owner or Governance Delegate)
231
- /// 4. `[writable]` ProposalInstruction account. PDA seeds: ['governance',proposal,index]
229
+ /// 4. `[writable]` ProposalTransaction, account. PDA seeds: ['governance',proposal,index]
232
230
/// 5. `[signer]` Payer
233
231
/// 6. `[]` System program
234
232
/// 7. `[]` Rent sysvar
235
- InsertInstruction {
233
+ InsertTransaction {
236
234
#[ allow( dead_code) ]
237
- /// The index of the option the instruction is for
235
+ /// The index of the option the transaction is for
238
236
option_index : u16 ,
239
237
#[ allow( dead_code) ]
240
- /// Instruction index to be inserted at.
238
+ /// Transaction index to be inserted at.
241
239
index : u16 ,
242
240
#[ allow( dead_code) ]
243
241
/// Waiting time (in seconds) between vote period ending and this being eligible for execution
244
242
hold_up_time : u32 ,
245
243
246
244
#[ allow( dead_code) ]
247
- /// Instruction Data
248
- instruction : InstructionData ,
245
+ /// Instructions Data
246
+ instructions : Vec < InstructionData > ,
249
247
} ,
250
248
251
- /// Removes instruction from the Proposal
249
+ /// Removes Transaction from the Proposal
252
250
///
253
251
/// 0. `[writable]` Proposal account
254
252
/// 1. `[]` TokenOwnerRecord account of the Proposal owner
255
253
/// 2. `[signer]` Governance Authority (Token Owner or Governance Delegate)
256
- /// 3. `[writable]` ProposalInstruction account
257
- /// 4. `[writable]` Beneficiary Account which would receive lamports from the disposed ProposalInstruction account
258
- RemoveInstruction ,
254
+ /// 3. `[writable]` ProposalTransaction, account
255
+ /// 4. `[writable]` Beneficiary Account which would receive lamports from the disposed ProposalTransaction account
256
+ RemoveTransaction ,
259
257
260
258
/// Cancels Proposal by changing its state to Canceled
261
259
///
@@ -276,8 +274,8 @@ pub enum GovernanceInstruction {
276
274
SignOffProposal ,
277
275
278
276
/// Uses your voter weight (deposited Community or Council tokens) to cast a vote on a Proposal
279
- /// By doing so you indicate you approve or disapprove of running the Proposal set of instructions
280
- /// If you tip the consensus then the instructions can begin to be run after their hold up time
277
+ /// By doing so you indicate you approve or disapprove of running the Proposal set of transactions
278
+ /// If you tip the consensus then the transactions can begin to be run after their hold up time
281
279
///
282
280
/// 0. `[]` Realm account
283
281
/// 1. `[]` Governance account
@@ -328,16 +326,16 @@ pub enum GovernanceInstruction {
328
326
/// It's required only when Proposal is still being voted on
329
327
RelinquishVote ,
330
328
331
- /// Executes an instruction in the Proposal
329
+ /// Executes a Transaction in the Proposal
332
330
/// Anybody can execute transaction once Proposal has been voted Yes and transaction_hold_up time has passed
333
- /// The actual instruction being executed will be signed by Governance PDA the Proposal belongs to
331
+ /// The actual transaction being executed will be signed by Governance PDA the Proposal belongs to
334
332
/// For example to execute Program upgrade the ProgramGovernance PDA would be used as the singer
335
333
///
336
334
/// 0. `[writable]` Proposal account
337
- /// 1. `[writable]` ProposalInstruction account you wish to execute
335
+ /// 1. `[writable]` ProposalTransaction account you wish to execute
338
336
/// 2. `[]` Clock sysvar
339
- /// 3+ Any extra accounts that are part of the instruction , in order
340
- ExecuteInstruction ,
337
+ /// 3+ Any extra accounts that are part of the transaction , in order
338
+ ExecuteTransaction ,
341
339
342
340
/// Creates Mint Governance account which governs a mint
343
341
///
@@ -401,17 +399,17 @@ pub enum GovernanceInstruction {
401
399
config : GovernanceConfig ,
402
400
} ,
403
401
404
- /// Flags an instruction and its parent Proposal with error status
405
- /// It can be used by Proposal owner in case the instruction is permanently broken and can't be executed
402
+ /// Flags a transaction and its parent Proposal with error status
403
+ /// It can be used by Proposal owner in case the transaction is permanently broken and can't be executed
406
404
/// Note: This instruction is a workaround because currently it's not possible to catch errors from CPI calls
407
405
/// and the Governance program has no way to know when instruction failed and flag it automatically
408
406
///
409
407
/// 0. `[writable]` Proposal account
410
408
/// 1. `[]` TokenOwnerRecord account of the Proposal owner
411
409
/// 2. `[signer]` Governance Authority (Token Owner or Governance Delegate)
412
- /// 3. `[writable]` ProposalInstruction account to flag
410
+ /// 3. `[writable]` ProposalTransaction account to flag
413
411
/// 4. `[]` Clock sysvar
414
- FlagInstructionError ,
412
+ FlagTransactionError ,
415
413
416
414
/// Sets new Realm authority
417
415
///
@@ -1154,9 +1152,9 @@ pub fn cancel_proposal(
1154
1152
}
1155
1153
}
1156
1154
1157
- /// Creates InsertInstruction instruction
1155
+ /// Creates InsertTransaction instruction
1158
1156
#[ allow( clippy:: too_many_arguments) ]
1159
- pub fn insert_instruction (
1157
+ pub fn insert_transaction (
1160
1158
program_id : & Pubkey ,
1161
1159
// Accounts
1162
1160
governance : & Pubkey ,
@@ -1168,9 +1166,9 @@ pub fn insert_instruction(
1168
1166
option_index : u16 ,
1169
1167
index : u16 ,
1170
1168
hold_up_time : u32 ,
1171
- instruction : InstructionData ,
1169
+ instructions : Vec < InstructionData > ,
1172
1170
) -> Instruction {
1173
- let proposal_instruction_address = get_proposal_instruction_address (
1171
+ let proposal_transaction_address = get_proposal_transaction_address (
1174
1172
program_id,
1175
1173
proposal,
1176
1174
& option_index. to_le_bytes ( ) ,
@@ -1182,17 +1180,17 @@ pub fn insert_instruction(
1182
1180
AccountMeta :: new( * proposal, false ) ,
1183
1181
AccountMeta :: new_readonly( * token_owner_record, false ) ,
1184
1182
AccountMeta :: new_readonly( * governance_authority, true ) ,
1185
- AccountMeta :: new( proposal_instruction_address , false ) ,
1183
+ AccountMeta :: new( proposal_transaction_address , false ) ,
1186
1184
AccountMeta :: new( * payer, true ) ,
1187
1185
AccountMeta :: new_readonly( system_program:: id( ) , false ) ,
1188
1186
AccountMeta :: new_readonly( sysvar:: rent:: id( ) , false ) ,
1189
1187
] ;
1190
1188
1191
- let instruction = GovernanceInstruction :: InsertInstruction {
1189
+ let instruction = GovernanceInstruction :: InsertTransaction {
1192
1190
option_index,
1193
1191
index,
1194
1192
hold_up_time,
1195
- instruction ,
1193
+ instructions ,
1196
1194
} ;
1197
1195
1198
1196
Instruction {
@@ -1202,25 +1200,25 @@ pub fn insert_instruction(
1202
1200
}
1203
1201
}
1204
1202
1205
- /// Creates RemoveInstruction instruction
1206
- pub fn remove_instruction (
1203
+ /// Creates RemoveTransaction instruction
1204
+ pub fn remove_transaction (
1207
1205
program_id : & Pubkey ,
1208
1206
// Accounts
1209
1207
proposal : & Pubkey ,
1210
1208
token_owner_record : & Pubkey ,
1211
1209
governance_authority : & Pubkey ,
1212
- proposal_instruction : & Pubkey ,
1210
+ proposal_transaction : & Pubkey ,
1213
1211
beneficiary : & Pubkey ,
1214
1212
) -> Instruction {
1215
1213
let accounts = vec ! [
1216
1214
AccountMeta :: new( * proposal, false ) ,
1217
1215
AccountMeta :: new_readonly( * token_owner_record, false ) ,
1218
1216
AccountMeta :: new_readonly( * governance_authority, true ) ,
1219
- AccountMeta :: new( * proposal_instruction , false ) ,
1217
+ AccountMeta :: new( * proposal_transaction , false ) ,
1220
1218
AccountMeta :: new( * beneficiary, false ) ,
1221
1219
] ;
1222
1220
1223
- let instruction = GovernanceInstruction :: RemoveInstruction { } ;
1221
+ let instruction = GovernanceInstruction :: RemoveTransaction { } ;
1224
1222
1225
1223
Instruction {
1226
1224
program_id : * program_id,
@@ -1229,27 +1227,27 @@ pub fn remove_instruction(
1229
1227
}
1230
1228
}
1231
1229
1232
- /// Creates ExecuteInstruction instruction
1233
- pub fn execute_instruction (
1230
+ /// Creates ExecuteTransaction instruction
1231
+ pub fn execute_transaction (
1234
1232
program_id : & Pubkey ,
1235
1233
// Accounts
1236
1234
governance : & Pubkey ,
1237
1235
proposal : & Pubkey ,
1238
- proposal_instruction : & Pubkey ,
1236
+ proposal_transaction : & Pubkey ,
1239
1237
instruction_program_id : & Pubkey ,
1240
1238
instruction_accounts : & [ AccountMeta ] ,
1241
1239
) -> Instruction {
1242
1240
let mut accounts = vec ! [
1243
1241
AccountMeta :: new_readonly( * governance, false ) ,
1244
1242
AccountMeta :: new( * proposal, false ) ,
1245
- AccountMeta :: new( * proposal_instruction , false ) ,
1243
+ AccountMeta :: new( * proposal_transaction , false ) ,
1246
1244
AccountMeta :: new_readonly( sysvar:: clock:: id( ) , false ) ,
1247
1245
AccountMeta :: new_readonly( * instruction_program_id, false ) ,
1248
1246
] ;
1249
1247
1250
1248
accounts. extend_from_slice ( instruction_accounts) ;
1251
1249
1252
- let instruction = GovernanceInstruction :: ExecuteInstruction { } ;
1250
+ let instruction = GovernanceInstruction :: ExecuteTransaction { } ;
1253
1251
1254
1252
Instruction {
1255
1253
program_id : * program_id,
@@ -1277,24 +1275,24 @@ pub fn set_governance_config(
1277
1275
}
1278
1276
}
1279
1277
1280
- /// Creates FlagInstructionError instruction
1281
- pub fn flag_instruction_error (
1278
+ /// Creates FlagTransactionError instruction
1279
+ pub fn flag_transaction_error (
1282
1280
program_id : & Pubkey ,
1283
1281
// Accounts
1284
1282
proposal : & Pubkey ,
1285
1283
token_owner_record : & Pubkey ,
1286
1284
governance_authority : & Pubkey ,
1287
- proposal_instruction : & Pubkey ,
1285
+ proposal_transaction : & Pubkey ,
1288
1286
) -> Instruction {
1289
1287
let accounts = vec ! [
1290
1288
AccountMeta :: new( * proposal, false ) ,
1291
1289
AccountMeta :: new_readonly( * token_owner_record, false ) ,
1292
1290
AccountMeta :: new_readonly( * governance_authority, true ) ,
1293
- AccountMeta :: new( * proposal_instruction , false ) ,
1291
+ AccountMeta :: new( * proposal_transaction , false ) ,
1294
1292
AccountMeta :: new_readonly( sysvar:: clock:: id( ) , false ) ,
1295
1293
] ;
1296
1294
1297
- let instruction = GovernanceInstruction :: FlagInstructionError { } ;
1295
+ let instruction = GovernanceInstruction :: FlagTransactionError { } ;
1298
1296
1299
1297
Instruction {
1300
1298
program_id : * program_id,
0 commit comments