@drift-labs/vaults-sdk 0.1.423 → 0.1.424

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,7 @@ import {
5
5
  unstakeSharesToAmount as depositSharesToVaultAmount,
6
6
  stakeAmountToShares as vaultAmountToDepositorShares,
7
7
  } from '@drift-labs/sdk';
8
- import { Vault, VaultDepositor, VaultProtocol } from '../types/types';
8
+ import { Vault, VaultDepositor } from '../types/types';
9
9
 
10
10
  /**
11
11
  * Calculates the unrealized profitShare for a vaultDepositor
@@ -42,49 +42,17 @@ export function calculateApplyProfitShare(
42
42
  export function calculateProfitShare(
43
43
  vaultDepositor: VaultDepositor,
44
44
  totalAmount: BN,
45
- vault: Vault,
46
- vaultProtocol?: VaultProtocol
45
+ vault: Vault
47
46
  ) {
48
47
  const profit = totalAmount.sub(
49
48
  vaultDepositor.netDeposits.add(vaultDepositor.cumulativeProfitShareAmount)
50
49
  );
51
- let profitShare = vault.profitShare;
52
- if (vaultProtocol) {
53
- profitShare += vaultProtocol.protocolProfitShare;
54
- }
55
50
  if (profit.gt(ZERO)) {
56
51
  const profitShareAmount = profit
57
- .mul(new BN(profitShare))
52
+ .mul(new BN(vault.profitShare))
58
53
  .div(PERCENTAGE_PRECISION);
59
54
  return profitShareAmount;
60
55
  }
61
- return ZERO;
62
- }
63
56
 
64
- /**
65
- * Calculates the equity across deposits and realized profit for a vaultDepositor
66
- * @param vaultDepositor vault depositor account
67
- * @param vaultEquity total vault equity
68
- * @param vault vault account
69
- * @param vaultProtocol if vault account has "vaultProtocol" then this is needed
70
- * @returns
71
- */
72
- export function calculateRealizedVaultDepositorEquity(
73
- vaultDepositor: VaultDepositor,
74
- vaultEquity: BN,
75
- vault: Vault,
76
- vaultProtocol?: VaultProtocol
77
- ): BN {
78
- const vdAmount = depositSharesToVaultAmount(
79
- vaultDepositor.vaultShares,
80
- vault.totalShares,
81
- vaultEquity
82
- );
83
- const profitShareAmount = calculateProfitShare(
84
- vaultDepositor,
85
- vdAmount,
86
- vault,
87
- vaultProtocol
88
- );
89
- return vdAmount.sub(profitShareAmount);
57
+ return ZERO;
90
58
  }