-
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.
[PRD-3898] Transfer restrictions integration specs (#22)
* add max holders group validation * initialize active holder by default * refactor test environment to setup each envs separately * add initialize data specs * add initialize holder specs * add initialize holdergroup specs * add initialize group specs * add transfer restrictions specs to CI * add initialize associated account specs * add initialize transfer rule specs * fix ts lint * add transfer group not allowed when locked until is zero * refactor test to commitment name * update transfer restrictions idl * add set allow transfer rule specs * add set holder group max specs * add set holder max specs * update filename * add set lockup escrow account specs * add validation of tokenlock discriminator * add tokenlock discriminator error * remove solana-program dependency from tokenlock * add holder to the group on security associated account initialization * update idl * add update wallet group specs * update idl * fix ts lint * add extra account data validation on transfer hook * fix specs * add pause specs * add holders count validation for init sec assoc token specs * add revoke holder group specs * add revoke holder group specs * revoke holder without holder group and group * add wallet presence in group and holder before revokes * add revoke holder specs * add revoke security token account specs * add explicit error that wallet new group must be differ from existing * add explicit error that wallet new group must be differ from existing * does not increment holderIds for already initialized one * update idl * fix specs * add enforce transfer restrictions specs * remove obsolete commented code * fix spec
- Loading branch information
1 parent
acd8dd4
commit c97853b
Showing
67 changed files
with
5,410 additions
and
219 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
3 changes: 1 addition & 2 deletions
3
programs/tokenlock/src/instructions/create_release_schedule.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
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
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
59 changes: 59 additions & 0 deletions
59
programs/transfer-restrictions/src/contexts/revoke_holder_group.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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
use crate::{ | ||
HolderGroup, TransferRestrictionData, TransferRestrictionGroup, TransferRestrictionHolder, TRANSFER_RESTRICTION_DATA_PREFIX, TRANSFER_RESTRICTION_GROUP_PREFIX, TRANSFER_RESTRICTION_HOLDER_GROUP_PREFIX, TRANSFER_RESTRICTION_HOLDER_PREFIX | ||
}; | ||
use access_control::{self, WalletRole}; | ||
use anchor_lang::prelude::*; | ||
|
||
#[derive(Accounts)] | ||
pub struct RevokeHolderGroup<'info> { | ||
#[account( | ||
seeds = [ | ||
TRANSFER_RESTRICTION_HOLDER_PREFIX.as_bytes(), | ||
&transfer_restriction_data.key().to_bytes(), | ||
&holder.id.to_le_bytes(), | ||
], | ||
bump, | ||
constraint = holder.transfer_restriction_data == transfer_restriction_data.key(), | ||
)] | ||
pub holder: Account<'info, TransferRestrictionHolder>, | ||
|
||
#[account(mut, | ||
close = payer, | ||
seeds = [ | ||
TRANSFER_RESTRICTION_HOLDER_GROUP_PREFIX.as_bytes(), | ||
&holder.key().to_bytes(), | ||
&group.id.to_le_bytes(), | ||
], | ||
bump, | ||
constraint = holder_group.holder == holder.key(), | ||
constraint = holder_group.group == group.id, | ||
)] | ||
pub holder_group: Account<'info, HolderGroup>, | ||
|
||
#[account(mut, | ||
seeds = [TRANSFER_RESTRICTION_DATA_PREFIX.as_bytes(), &transfer_restriction_data.security_token_mint.key().to_bytes()], | ||
bump, | ||
)] | ||
pub transfer_restriction_data: Account<'info, TransferRestrictionData>, | ||
|
||
#[account( | ||
seeds = [ | ||
TRANSFER_RESTRICTION_GROUP_PREFIX.as_bytes(), | ||
&transfer_restriction_data.key().to_bytes(), | ||
&group.id.to_le_bytes() | ||
], | ||
bump, | ||
constraint = group.transfer_restriction_data == transfer_restriction_data.key(), | ||
)] | ||
pub group: Account<'info, TransferRestrictionGroup>, | ||
|
||
#[account(mut, | ||
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>, | ||
} |
Oops, something went wrong.