Skip to content

Commit

Permalink
fix param
Browse files Browse the repository at this point in the history
  • Loading branch information
dtmkeng committed Mar 3, 2025
1 parent 8dfe896 commit 97a8d7a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions fees/fluid/fees.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ export const getVaultsT1Resolver = async (api: ChainApi) => {
}
}

export const getFluidDexesDailyBorrowFees = async ({ fromApi, toApi, createBalances }: FetchOptions, liquidityOperateLogs: any[]) => {
export const getFluidDexesDailyBorrowFees = async ({ fromApi, toApi, createBalances, api }: FetchOptions, liquidityOperateLogs: any[]) => {
// borrow fees for all dexes that have smart debt pool enabled (covers smart debt vaults).
const dailyFees = createBalances();
const dexes: string[] = await (await getDexResolver(fromApi)).getAllDexAddresses();
const dexes: string[] = await (await getDexResolver(api)).getAllDexAddresses();

if(!dexes.length){
return dailyFees;
Expand All @@ -142,7 +142,7 @@ export const getFluidDexesDailyBorrowFees = async ({ fromApi, toApi, createBalan
const [dexStatesFrom, dexStatesTo, dexTokens] = await Promise.all([
(await getDexResolver(fromApi)).getDexStates(dexes),
(await getDexResolver(toApi)).getDexStates(dexes),
(await getDexResolver(fromApi)).getDexTokens(dexes),
(await getDexResolver(api)).getDexTokens(dexes),
]);

for (const [i, dex] of dexes.entries()) {
Expand Down Expand Up @@ -201,10 +201,10 @@ export const getFluidDexesDailyBorrowFees = async ({ fromApi, toApi, createBalan
return dailyFees;
}

export const getFluidVaultsDailyBorrowFees = async ({ fromApi, toApi, createBalances }: FetchOptions, liquidityOperateLogs: any[]) => {
export const getFluidVaultsDailyBorrowFees = async ({ fromApi, toApi, createBalances, api}: FetchOptions, liquidityOperateLogs: any[]) => {
// borrow fees for all normal debt vaults.
const dailyFees = createBalances();
const vaults: string[] = await (await getVaultsResolver(fromApi)).getAllVaultsAddresses();
const vaults: string[] = await (await getVaultsResolver(api)).getAllVaultsAddresses();

const [vaultDatasFrom, vaultDatasTo] = await Promise.all([
(await getVaultsResolver(fromApi)).getVaultEntireData(vaults),
Expand Down Expand Up @@ -254,8 +254,8 @@ export const getFluidDailyFees = async (options: FetchOptions) => {
const liquidityOperateLogs = await options.getLogs({
target: LIQUIDITY,
onlyArgs: true,
topics: [TOPIC0.logOperate],
eventAbi: EVENT_ABI.logOperate});
eventAbi: EVENT_ABI.logOperate}
);

const [vaultFees, dexFees] = await Promise.all([
await getFluidVaultsDailyBorrowFees(options, liquidityOperateLogs),
Expand Down
6 changes: 3 additions & 3 deletions fees/fluid/revenue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ const getUncollectedLiquidities = async (api: ChainApi, tokens: string []) => {
});
}

const getLiquidityRevenues = async ({ fromApi, toApi, getLogs, createBalances }: FetchOptions) => {
const getLiquidityRevenues = async ({ fromApi, toApi, getLogs, createBalances, api }: FetchOptions) => {
const dailyValues = createBalances();
const tokens: string[] = (await (await liquidityResolver(fromApi)).listedTokens()).map((t: string) => t.toLowerCase());
const tokens: string[] = (await (await liquidityResolver(api)).listedTokens()).map((t: string) => t.toLowerCase());

// Fetch uncollected revenues for the "from" and "to" timestamps
const [revenuesFrom, revenuesTo] = await Promise.all([
Expand Down Expand Up @@ -144,7 +144,7 @@ const getVaultT1CollectedRevenues = async (api: ChainApi, createBalances: Create
const getVaultsT1Revenues = async ({ api, fromApi, toApi, createBalances, getLogs, fromTimestamp, toTimestamp }: FetchOptions) => {
if (toTimestamp < CONFIG_FLUID[api.chain].vaultResolverExistAfterTimestamp) return 0

const vaults: string[] = await (await getVaultsT1Resolver(fromApi)).getAllVaultsAddresses();
const vaults: string[] = await (await getVaultsT1Resolver(api)).getAllVaultsAddresses();

const [vaultUncollectedBalancesFrom, vaultUncollectedBalancesTo, vaultCollected] = await Promise.all([
getVaultT1UncollectedRevenues(fromApi, createBalances, vaults, fromTimestamp),
Expand Down

0 comments on commit 97a8d7a

Please sign in to comment.