Skip to content

Commit

Permalink
program: add vault_depositor field profit_share_fee_paid (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
crispheaney authored Aug 9, 2023
1 parent 2b70451 commit 6fb6e28
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions programs/drift_vaults/src/state/vault_depositor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ pub struct VaultDepositor {
pub cumulative_profit_share_amount: i64,
/// the exponent for vault_shares decimal places
pub vault_shares_base: u32,
pub padding: [u8; 32],
pub profit_share_fee_paid: u64,
pub padding: [u8; 24],
}

impl Size for VaultDepositor {
Expand Down Expand Up @@ -85,7 +86,8 @@ impl VaultDepositor {
total_deposits: 0,
total_withdraws: 0,
cumulative_profit_share_amount: 0,
padding: [0u8; 32],
profit_share_fee_paid: 0,
padding: [0u8; 24],
}
}

Expand Down Expand Up @@ -231,6 +233,10 @@ impl VaultDepositor {
.cumulative_profit_share_amount
.safe_add(profit_u128.cast()?)?;

self.profit_share_fee_paid = self
.profit_share_fee_paid
.safe_add(profit_share_amount.cast()?)?;

return Ok(profit_share_amount);
}

Expand Down

0 comments on commit 6fb6e28

Please sign in to comment.