From cde242b4c657e824e7fcecd821cc9088dab4f459 Mon Sep 17 00:00:00 2001 From: bifkn <25141495+DJHellscream@users.noreply.github.com> Date: Sun, 24 Nov 2024 15:43:37 -0500 Subject: [PATCH] Update to include dailyRevenue (#2124) --- fees/apexdefi/burst.ts | 11 ++++++++--- fees/apexdefi/dex.ts | 4 ++++ fees/apexdefi/index.ts | 5 +++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/fees/apexdefi/burst.ts b/fees/apexdefi/burst.ts index 4e72f44e47..fb9b67a2aa 100644 --- a/fees/apexdefi/burst.ts +++ b/fees/apexdefi/burst.ts @@ -34,12 +34,14 @@ const burstFactoryFee = BigInt(75); // 0.75% export async function burstMetrics(options: FetchOptions): Promise<{ dailyFees: Balances; + dailyRevenue: Balances; dailyProtocolRevenue: Balances; dailyVolume: Balances; }> { const { createBalances } = options; let dailyFees = createBalances(); + let dailyRevenue = createBalances(); let dailyProtocolRevenue = createBalances(); let dailyVolume = createBalances(); @@ -60,6 +62,7 @@ export async function burstMetrics(options: FetchOptions): Promise<{ const creatorRewardsAmount = BigInt(log.creatorRewards); const totalFee = launchFeeAmount + creatorRewardsAmount; dailyFees.addGasToken(totalFee); + dailyRevenue.addGasToken(launchFeeAmount); dailyProtocolRevenue.addGasToken(launchFeeAmount); }); @@ -68,13 +71,15 @@ export async function burstMetrics(options: FetchOptions): Promise<{ const fee = (nativeAmount * burstSwapFee) / scaleFactor; const protocolRevenue = (nativeAmount * burstFactoryFee) / scaleFactor; dailyFees.addGasToken(fee + protocolRevenue); + dailyRevenue.addGasToken(protocolRevenue); dailyProtocolRevenue.addGasToken(protocolRevenue); dailyVolume.addGasToken(nativeAmount); }); return { - dailyFees: dailyFees, - dailyProtocolRevenue: dailyProtocolRevenue, - dailyVolume: dailyVolume, + dailyFees, + dailyRevenue, + dailyProtocolRevenue, + dailyVolume, }; } diff --git a/fees/apexdefi/dex.ts b/fees/apexdefi/dex.ts index 1367ecdf93..d82bd0fd99 100644 --- a/fees/apexdefi/dex.ts +++ b/fees/apexdefi/dex.ts @@ -32,6 +32,7 @@ const lpFee = BigInt(20); // 0.2% export async function swapMetrics(options: FetchOptions): Promise<{ dailyFees: Balances; + dailyRevenue: Balances; dailySupplySideRevenue: Balances; dailyProtocolRevenue: Balances; dailyVolume: Balances; @@ -41,6 +42,7 @@ export async function swapMetrics(options: FetchOptions): Promise<{ const dailySupplySideRevenue = createBalances(); const dailyProtocolRevenue = createBalances(); const dailyVolume = createBalances(); + const dailyRevenue = createBalances(); const allTokens = await options.api.call({ target: FACTORIES[options.chain], @@ -58,6 +60,7 @@ export async function swapMetrics(options: FetchOptions): Promise<{ const fee = (nativeAmount * lpFee) / scaleFactor; const protocolRevenue = (nativeAmount * factoryFee) / scaleFactor; dailyFees.addGasToken(fee + protocolRevenue); + dailyRevenue.addGasToken(protocolRevenue); dailyProtocolRevenue.addGasToken(protocolRevenue); dailySupplySideRevenue.addGasToken(fee); dailyVolume.addGasToken(nativeAmount); @@ -65,6 +68,7 @@ export async function swapMetrics(options: FetchOptions): Promise<{ return { dailyFees, + dailyRevenue, dailyVolume, dailyProtocolRevenue, dailySupplySideRevenue, diff --git a/fees/apexdefi/index.ts b/fees/apexdefi/index.ts index bd78b00310..d977c55186 100644 --- a/fees/apexdefi/index.ts +++ b/fees/apexdefi/index.ts @@ -18,11 +18,14 @@ const fetch = async (options: FetchOptions) => { const dailySupplySideRevenue = createBalances(); const dailyProtocolRevenue = createBalances(); const dailyVolume = createBalances(); + const dailyRevenue = createBalances(); const swapMetricsResult = await swapMetrics(options); dailyFees.addBalances(swapMetricsResult.dailyFees); + dailyRevenue.addBalances(swapMetricsResult.dailyRevenue); + dailySupplySideRevenue.addBalances(swapMetricsResult.dailySupplySideRevenue); dailyProtocolRevenue.addBalances(swapMetricsResult.dailyProtocolRevenue); @@ -34,12 +37,14 @@ const fetch = async (options: FetchOptions) => { const burstMetricsResult = await burstMetrics(options); dailyFees.addBalances(burstMetricsResult.dailyFees); + dailyRevenue.addBalances(burstMetricsResult.dailyRevenue); dailyProtocolRevenue.addBalances(burstMetricsResult.dailyProtocolRevenue); dailyVolume.addBalances(burstMetricsResult.dailyVolume); } return { dailyFees, + dailyRevenue, dailySupplySideRevenue, dailyProtocolRevenue, dailyVolume,