Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified clients/rust/tests/fixtures/token_acl.so
Binary file not shown.
24 changes: 15 additions & 9 deletions program/src/instructions/freeze_permissionless.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,15 @@ impl FreezePermissionless<'_> {
&bump_seed,
];

let ix = solana_system_interface::instruction::create_account(
self.authority.key,
self.flag_account.key,
0,
1 as u64,
&crate::ID,
);
// allocate, assign and initialize flag account
let ix = solana_system_interface::instruction::allocate(self.flag_account.key, 1 as u64);
invoke_signed(
&ix,
&[self.authority.clone(), self.flag_account.clone()],
&[&seeds],
)?;

let ix = solana_system_interface::instruction::assign(self.flag_account.key, &crate::ID);
invoke_signed(
&ix,
&[self.authority.clone(), self.flag_account.clone()],
Expand All @@ -89,8 +90,6 @@ impl FreezePermissionless<'_> {
self.remaining_accounts,
)?;

self.flag_account.data.borrow_mut()[0] = 0;

let bump_seed = [config.bump];
let seeds = [MintConfig::SEED_PREFIX, self.mint.key.as_ref(), &bump_seed];

Expand All @@ -111,6 +110,13 @@ impl FreezePermissionless<'_> {
&[&seeds],
)?;

// clean up flag account
self.flag_account.data.borrow_mut()[0] = 0;
self.flag_account.realloc(0, false)?;
self.flag_account.assign(&Pubkey::default());
**self.authority.try_borrow_mut_lamports()? += self.flag_account.lamports();
**self.flag_account.try_borrow_mut_lamports()? = 0;

Ok(())
}
}
Expand Down
24 changes: 15 additions & 9 deletions program/src/instructions/thaw_permissionless.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,15 @@ impl ThawPermissionless<'_> {
&bump_seed,
];

let ix = solana_system_interface::instruction::create_account(
self.authority.key,
self.flag_account.key,
0,
1 as u64,
&crate::ID,
);
// allocate, assign and initialize flag account
let ix = solana_system_interface::instruction::allocate(self.flag_account.key, 1 as u64);
invoke_signed(
&ix,
&[self.authority.clone(), self.flag_account.clone()],
&[&seeds],
)?;

let ix = solana_system_interface::instruction::assign(self.flag_account.key, &crate::ID);
invoke_signed(
&ix,
&[self.authority.clone(), self.flag_account.clone()],
Expand All @@ -89,8 +90,6 @@ impl ThawPermissionless<'_> {
self.remaining_accounts,
)?;

self.flag_account.data.borrow_mut()[0] = 0;

let bump_seed = [config.bump];
let seeds = [MintConfig::SEED_PREFIX, self.mint.key.as_ref(), &bump_seed];

Expand All @@ -111,6 +110,13 @@ impl ThawPermissionless<'_> {
&[&seeds],
)?;

// clean up flag account
self.flag_account.data.borrow_mut()[0] = 0;
self.flag_account.realloc(0, false)?;
self.flag_account.assign(&Pubkey::default());
**self.authority.try_borrow_mut_lamports()? += self.flag_account.lamports();
**self.flag_account.try_borrow_mut_lamports()? = 0;

Ok(())
}
}
Expand Down