Skip to content

Commit

Permalink
another invariant
Browse files Browse the repository at this point in the history
  • Loading branch information
crispheaney committed Oct 29, 2024
1 parent 8b1abfc commit 08bc6ec
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions programs/drift_vaults/src/state/vault.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,12 @@ impl Vault {
}

// this will underflow if there is an issue with protocol fee calc
validate!(
self.total_shares >= self.user_shares,
ErrorCode::InvalidVaultSharesDetected,
"total_shares must be >= user_shares"
)?;

self.get_manager_shares(vault_protocol)?;

Ok(VaultFee {
Expand Down

0 comments on commit 08bc6ec

Please sign in to comment.