-
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.
Merge branch 'dev' into token-2022-support
# Conflicts: # programs/tokenized_vault/src/utils/strategy.rs # tests/integration/vault.ts
- Loading branch information
Showing
27 changed files
with
408 additions
and
240 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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/accountant/src/instructions/init_token_account.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 anchor_lang::prelude::*; | ||
use anchor_spl::{ | ||
associated_token::AssociatedToken, | ||
token::Token, | ||
token_interface::{Mint, TokenAccount}, | ||
}; | ||
use access_control::{ | ||
constants::USER_ROLE_SEED, | ||
program::AccessControl, | ||
state::{Role, UserRole} | ||
}; | ||
|
||
use crate::state::*; | ||
use crate::constants::CONFIG_SEED; | ||
|
||
#[derive(Accounts)] | ||
pub struct InitTokenAccount<'info> { | ||
#[account( | ||
init_if_needed, | ||
payer = signer, | ||
associated_token::mint = underlying_mint, | ||
associated_token::authority = accountant, | ||
)] | ||
pub token_account: Box<InterfaceAccount<'info, TokenAccount>>, | ||
|
||
#[account(mut)] | ||
pub underlying_mint: Box<InterfaceAccount<'info, Mint>>, | ||
|
||
/// CHECK: We want to hadle all accountant types here | ||
#[account(mut)] | ||
pub accountant: UncheckedAccount<'info>, | ||
|
||
#[account(mut, seeds = [CONFIG_SEED.as_bytes()], bump)] | ||
pub config: Account<'info, Config>, | ||
|
||
#[account( | ||
seeds = [ | ||
USER_ROLE_SEED.as_bytes(), | ||
signer.key().as_ref(), | ||
Role::AccountantAdmin.to_seed().as_ref() | ||
], | ||
bump, | ||
seeds::program = access_control.key() | ||
)] | ||
pub roles: Account<'info, UserRole>, | ||
|
||
#[account(mut, constraint = roles.check_role()?)] | ||
pub signer: Signer<'info>, | ||
|
||
pub access_control: Program<'info, AccessControl>, | ||
pub token_program: Program<'info, Token>, | ||
pub associated_token_program: Program<'info, AssociatedToken>, | ||
pub system_program: Program<'info, System>, | ||
pub rent: Sysvar<'info, Rent>, | ||
} | ||
|
||
pub fn handle_init_token_account(_ctx: Context<InitTokenAccount>) -> Result<()> { | ||
Ok(()) | ||
} |
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,11 +1,11 @@ | ||
pub mod distribute; | ||
pub mod init_accountant; | ||
pub mod init_token_account; | ||
pub mod initialize; | ||
pub mod set_fee; | ||
pub mod set_fee_recipient; | ||
|
||
pub use distribute::*; | ||
pub use init_accountant::*; | ||
pub use init_token_account::*; | ||
pub use initialize::*; | ||
pub use set_fee::*; | ||
pub use set_fee_recipient::*; | ||
pub use set_fee::*; |
This file was deleted.
Oops, something went wrong.
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.