Skip to content

Commit 49f7268

Browse files
chore: minor cleanup:
1 parent 8d17f16 commit 49f7268

File tree

6 files changed

+20
-14
lines changed

6 files changed

+20
-14
lines changed

programs/squads_smart_account_program/src/instructions/settings_transaction_sync.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
use account_events::{AddSpendingLimitEvent, RemoveSpendingLimitEvent};
21
use anchor_lang::prelude::*;
32

4-
use crate::{ consensus::ConsensusAccount, consensus_trait::{Consensus, ConsensusAccountType}, errors::*, events::*, program::SquadsSmartAccountProgram, state::*, utils::*};
3+
use crate::{consensus::ConsensusAccount, consensus_trait::{Consensus, ConsensusAccountType}, errors::*, events::*, program::SquadsSmartAccountProgram, state::*, utils::*};
54

65
#[derive(AnchorSerialize, AnchorDeserialize)]
76
pub struct SyncSettingsTransactionArgs {

programs/squads_smart_account_program/src/instructions/transaction_close.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@ use crate::consensus_trait::ConsensusAccountType;
1818
use crate::errors::*;
1919
use crate::program::SquadsSmartAccountProgram;
2020
use crate::state::*;
21-
use crate::utils;
2221
use crate::LogAuthorityInfo;
2322
use crate::SmartAccountEvent;
24-
use crate::TransactionContent;
2523
use crate::TransactionEvent;
2624
use crate::TransactionEventType;
2725

@@ -534,7 +532,7 @@ pub struct CloseEmptyPolicyTransaction<'info> {
534532
pub empty_policy: AccountInfo<'info>,
535533

536534
/// CHECK: `seeds` and `bump` verify that the account is the canonical Proposal,
537-
/// the logic within `transaction_close` does the rest of the checks.
535+
/// the logic within `close_empty_policy_transaction` does the rest of the checks.
538536
#[account(
539537
mut,
540538
seeds = [
@@ -579,7 +577,7 @@ impl CloseEmptyPolicyTransaction<'_> {
579577
/// empty/deleted policies.
580578
///
581579
/// Since a policy can never exist at the same address again after being
582-
/// closed, any transaction & proposal associated with it can be closed.
580+
/// closed, any transaction & proposal associated with it can be closed safely.
583581
pub fn close_empty_policy_transaction(ctx: Context<Self>) -> Result<()> {
584582
let proposal = &mut ctx.accounts.proposal;
585583
let proposal_rent_collector = &ctx.accounts.proposal_rent_collector;

programs/squads_smart_account_program/src/instructions/transaction_execute.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,16 @@ pub struct ExecuteTransaction<'info> {
4545

4646
pub signer: Signer<'info>,
4747
pub program: Program<'info, SquadsSmartAccountProgram>,
48-
// `remaining_accounts` must include the following accounts in the exact order:
48+
// `remaining_accounts` must include the following accounts in the exact
49+
// order:
50+
// For transaction execution:
4951
// 1. AddressLookupTable accounts in the order they appear in `message.address_table_lookups`.
5052
// 2. Accounts in the order they appear in `message.account_keys`.
5153
// 3. Accounts in the order they appear in `message.address_table_lookups`.
54+
//
55+
// For policy execution:
56+
// 1. Settings account if the policy has a settings state expiration
57+
// 2. Any remaining accounts associated with the policy
5258
}
5359

5460
impl<'info> ExecuteTransaction<'info> {

programs/squads_smart_account_program/src/instructions/transaction_execute_sync.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@ pub struct SyncTransaction<'info> {
5151
pub program: Program<'info, SquadsSmartAccountProgram>,
5252
// `remaining_accounts` must include the following accounts in the exact order:
5353
// 1. The exact amount of signers required to reach the threshold
54-
// 2. Any remaining accounts associated with the instructions
54+
// 2. For transaction execution:
55+
// 2.1. Any remaining accounts associated with the instructions
56+
// 3. For policy execution:
57+
// 3.1 Settings account if the policy has a settings state expiration
58+
// 3.2 Any remaining accounts associated with the policy
5559
}
5660

5761
impl<'info> SyncTransaction<'info> {
@@ -189,7 +193,7 @@ impl<'info> SyncTransaction<'info> {
189193
// Potentially remove the settings account for expiration from
190194
// the remaining accounts
191195
let remaining_accounts = &remaining_accounts[account_offset..];
192-
196+
193197
// Execute the policy
194198
policy.execute(None, None, payload, &remaining_accounts)?;
195199

programs/squads_smart_account_program/src/interface/consensus_trait.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use anchor_lang::prelude::*;
22
use borsh::{BorshDeserialize, BorshSerialize};
33

4-
use crate::{errors::SmartAccountError, Permission, SmartAccountSigner};
4+
use crate::{Permission, SmartAccountSigner};
55

66
#[derive(BorshSerialize, BorshDeserialize, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Debug)]
77
pub enum ConsensusAccountType {

programs/squads_smart_account_program/src/state/policies/policy_core/policy.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
use anchor_lang::prelude::*;
22

3+
use super::{payloads::PolicyPayload, traits::PolicyTrait, PolicyExecutionContext};
4+
use crate::state::policies::implementations::InternalFundTransferPolicy;
35
use crate::{
46
errors::*,
57
interface::consensus_trait::{Consensus, ConsensusAccountType},
6-
InternalFundTransferExecutionArgs, Permission, ProgramInteractionExecutionArgs,
8+
InternalFundTransferExecutionArgs, ProgramInteractionExecutionArgs,
79
ProgramInteractionPolicy, Proposal, Settings, SettingsChangeExecutionArgs,
810
SettingsChangePolicy, SmartAccountSigner, SpendingLimitExecutionArgs, SpendingLimitPolicy,
911
Transaction, SEED_POLICY, SEED_PREFIX,
@@ -25,9 +27,6 @@ pub enum PolicyExpirationArgs {
2527
SettingsState,
2628
}
2729

28-
use super::{payloads::PolicyPayload, traits::PolicyTrait, PolicyExecutionContext};
29-
use crate::state::policies::implementations::InternalFundTransferPolicy;
30-
3130
#[account]
3231
pub struct Policy {
3332
/// The smart account this policy belongs to.

0 commit comments

Comments
 (0)