Skip to content

Commit

Permalink
drift-market-maker fees already paid
Browse files Browse the repository at this point in the history
  • Loading branch information
opptylabs committed Feb 12, 2025
1 parent 5fcd4f1 commit 99b85c6
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ const executor: FetcherExecutor = async (owner: string, cache: Cache) => {
label: 'Deposit',
platformId,
name,
// link: `https://app.drift.trade/vaults/${vaultInfo.pubkey.toString()}`,
sourceRefs: [
{
name: 'Vault',
address: vaultInfo.pubkey.toString(),
},
],
ref: depositAccount.pubkey,
});

const pricePerShare = new BigNumber(vaultInfo.totalTokens).dividedBy(
Expand All @@ -79,7 +87,6 @@ const executor: FetcherExecutor = async (owner: string, cache: Cache) => {
depositAccount.vaultShares.multipliedBy(pricePerShare);
const netDeposits = new BigNumber(depositAccount.netDeposits);
const userPnL = userSharesValue.minus(netDeposits);
const profitShare = new BigNumber(vaultInfo.profitShare).dividedBy(10 ** 6);

if (!depositAccount.lastWithdrawRequest?.value.isZero()) {
const withdrawCooldown = [
Expand Down Expand Up @@ -115,12 +122,12 @@ const executor: FetcherExecutor = async (owner: string, cache: Cache) => {
},
});

if (userPnL.isPositive())
if (depositAccount.profitShareFeePaid.isPositive())
element.addAsset({
address: mint,
amount: userPnL.multipliedBy(profitShare).negated(),
amount: depositAccount.profitShareFeePaid.negated(),
attributes: {
tags: ['Performance Fee'],
tags: ['Fees Paid'],
},
});
}
Expand Down

0 comments on commit 99b85c6

Please sign in to comment.