Skip to content

Commit

Permalink
rename manager crank profit share to apply profit share
Browse files Browse the repository at this point in the history
  • Loading branch information
crispheaney committed Aug 9, 2023
1 parent 5a42612 commit 690135b
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use drift::instructions::optional_accounts::AccountMaps;
use drift::program::Drift;
use drift::state::user::User;

pub fn manager_crank_profit_share(ctx: Context<ManagerCrankProfitShare>) -> Result<()> {
pub fn apply_profit_share(ctx: Context<ApplyProfitShare>) -> Result<()> {
let clock = &Clock::get()?;

let mut vault = ctx.accounts.vault.load_mut()?;
Expand All @@ -34,7 +34,7 @@ pub fn manager_crank_profit_share(ctx: Context<ManagerCrankProfitShare>) -> Resu
}

#[derive(Accounts)]
pub struct ManagerCrankProfitShare<'info> {
pub struct ApplyProfitShare<'info> {
#[account(
mut,
constraint = is_manager_for_vault(&vault, &manager)? || is_delegate_for_vault(&vault, &manager)?
Expand Down
4 changes: 2 additions & 2 deletions programs/drift_vaults/src/instructions/mod.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
pub use apply_profit_share::*;
pub use cancel_withdraw_request::*;
pub use deposit::*;
pub use force_withdraw::*;
pub use initialize_vault::*;
pub use initialize_vault_depositor::*;
pub use liquidate::*;
pub use manager_crank_profit_share::*;
pub use manager_deposit::*;
pub use manager_withdraw::*;
pub use request_withdraw::*;
Expand All @@ -13,14 +13,14 @@ pub use update_delegate::*;
pub use update_vault::*;
pub use withdraw::*;

mod apply_profit_share;
mod cancel_withdraw_request;
pub mod constraints;
mod deposit;
mod force_withdraw;
mod initialize_vault;
mod initialize_vault_depositor;
mod liquidate;
mod manager_crank_profit_share;
mod manager_deposit;
mod manager_withdraw;
mod request_withdraw;
Expand Down
6 changes: 3 additions & 3 deletions programs/drift_vaults/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ pub mod drift_vaults {
instructions::manager_withdraw(ctx, withdraw_amount, withdraw_unit)
}

pub fn manager_crank_profit_share<'info>(
ctx: Context<'_, '_, '_, 'info, ManagerCrankProfitShare<'info>>,
pub fn apply_profit_share<'info>(
ctx: Context<'_, '_, '_, 'info, ApplyProfitShare<'info>>,
) -> Result<()> {
instructions::manager_crank_profit_share(ctx)
instructions::apply_profit_share(ctx)
}
}
102 changes: 92 additions & 10 deletions ts/sdk/src/types/drift_vaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,11 +403,6 @@ export type DriftVaults = {
isMut: true;
isSigner: false;
},
{
name: 'authority';
isMut: false;
isSigner: true;
},
{
name: 'vaultTokenAccount';
isMut: true;
Expand Down Expand Up @@ -655,6 +650,52 @@ export type DriftVaults = {
};
}
];
},
{
name: 'managerCrankProfitShare';
accounts: [
{
name: 'vault';
isMut: true;
isSigner: false;
},
{
name: 'vaultDepositor';
isMut: true;
isSigner: false;
},
{
name: 'manager';
isMut: false;
isSigner: true;
},
{
name: 'driftUserStats';
isMut: true;
isSigner: false;
},
{
name: 'driftUser';
isMut: true;
isSigner: false;
},
{
name: 'driftState';
isMut: false;
isSigner: false;
},
{
name: 'driftSigner';
isMut: false;
isSigner: false;
},
{
name: 'driftProgram';
isMut: false;
isSigner: false;
}
];
args: [];
}
];
accounts: [
Expand Down Expand Up @@ -1701,11 +1742,6 @@ export const IDL: DriftVaults = {
isMut: true,
isSigner: false,
},
{
name: 'authority',
isMut: false,
isSigner: true,
},
{
name: 'vaultTokenAccount',
isMut: true,
Expand Down Expand Up @@ -1954,6 +1990,52 @@ export const IDL: DriftVaults = {
},
],
},
{
name: 'managerCrankProfitShare',
accounts: [
{
name: 'vault',
isMut: true,
isSigner: false,
},
{
name: 'vaultDepositor',
isMut: true,
isSigner: false,
},
{
name: 'manager',
isMut: false,
isSigner: true,
},
{
name: 'driftUserStats',
isMut: true,
isSigner: false,
},
{
name: 'driftUser',
isMut: true,
isSigner: false,
},
{
name: 'driftState',
isMut: false,
isSigner: false,
},
{
name: 'driftSigner',
isMut: false,
isSigner: false,
},
{
name: 'driftProgram',
isMut: false,
isSigner: false,
},
],
args: [],
},
],
accounts: [
{
Expand Down

0 comments on commit 690135b

Please sign in to comment.