-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[HAL-03] HOLDER GROUPS CANNOT BE REVOKED IF THEIR HODLER ARE ALREADY …
…REVOKED (#37) * [HAL-03] HOLDER GROUPS CANNOT BE REVOKED IF THEIR HODLER ARE ALREADY REVOKED * add new errors definition * fix after merge
- Loading branch information
1 parent
0de55fd
commit d693552
Showing
15 changed files
with
220 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 36 additions & 35 deletions
71
programs/transfer-restrictions/src/contexts/initialize_transfer_restriction_holder.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,49 @@ | ||
use anchor_lang::prelude::*; | ||
use crate::{ | ||
contexts::common::DISCRIMINATOR_LEN, TransferRestrictionData, TRANSFER_RESTRICTION_DATA_PREFIX, | ||
}; | ||
use access_control::{self, AccessControl, WalletRole}; | ||
use crate::{contexts::common::DISCRIMINATOR_LEN, TransferRestrictionData, TRANSFER_RESTRICTION_DATA_PREFIX}; | ||
use anchor_lang::prelude::*; | ||
|
||
pub const TRANSFER_RESTRICTION_HOLDER_PREFIX: &str = "trh"; // transfer_restriction_holder | ||
|
||
|
||
#[account] | ||
#[derive(Default)] | ||
#[derive(InitSpace)] | ||
#[derive(Default, InitSpace)] | ||
pub struct TransferRestrictionHolder { | ||
pub transfer_restriction_data: Pubkey, | ||
pub current_wallets_count: u64, | ||
pub id: u64, | ||
pub active: bool, | ||
pub transfer_restriction_data: Pubkey, | ||
pub current_wallets_count: u64, | ||
pub current_holder_group_count: u64, | ||
pub id: u64, | ||
pub active: bool, | ||
} | ||
|
||
#[derive(Accounts)] | ||
#[instruction(id: u64)] | ||
pub struct InitializeTransferRestrictionHolder<'info> { | ||
#[account(init, payer = payer, space = DISCRIMINATOR_LEN + TransferRestrictionHolder::INIT_SPACE, | ||
seeds = [ | ||
TRANSFER_RESTRICTION_HOLDER_PREFIX.as_bytes(), | ||
&transfer_restriction_data.key().to_bytes(), | ||
&id.to_le_bytes(), | ||
], | ||
bump, | ||
)] | ||
pub transfer_restriction_holder: Account<'info, TransferRestrictionHolder>, | ||
#[account(init, payer = payer, space = DISCRIMINATOR_LEN + TransferRestrictionHolder::INIT_SPACE, | ||
seeds = [ | ||
TRANSFER_RESTRICTION_HOLDER_PREFIX.as_bytes(), | ||
&transfer_restriction_data.key().to_bytes(), | ||
&id.to_le_bytes(), | ||
], | ||
bump, | ||
)] | ||
pub transfer_restriction_holder: Account<'info, TransferRestrictionHolder>, | ||
|
||
#[account(mut, | ||
seeds = [ | ||
TRANSFER_RESTRICTION_DATA_PREFIX.as_bytes(), | ||
&access_control_account.mint.key().to_bytes(), | ||
], | ||
bump, | ||
)] | ||
pub transfer_restriction_data: Account<'info, TransferRestrictionData>, | ||
pub access_control_account: Account<'info, AccessControl>, | ||
#[account( | ||
constraint = authority_wallet_role.owner == payer.key(), | ||
constraint = authority_wallet_role.access_control == transfer_restriction_data.access_control_account.key(), | ||
)] | ||
pub authority_wallet_role: Account<'info, WalletRole>, | ||
#[account(mut)] | ||
pub payer: Signer<'info>, | ||
pub system_program: Program<'info, System>, | ||
#[account(mut, | ||
seeds = [ | ||
TRANSFER_RESTRICTION_DATA_PREFIX.as_bytes(), | ||
&access_control_account.mint.key().to_bytes(), | ||
], | ||
bump, | ||
)] | ||
pub transfer_restriction_data: Account<'info, TransferRestrictionData>, | ||
pub access_control_account: Account<'info, AccessControl>, | ||
#[account( | ||
constraint = authority_wallet_role.owner == payer.key(), | ||
constraint = authority_wallet_role.access_control == transfer_restriction_data.access_control_account.key(), | ||
)] | ||
pub authority_wallet_role: Account<'info, WalletRole>, | ||
#[account(mut)] | ||
pub payer: Signer<'info>, | ||
pub system_program: Program<'info, System>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.