Skip to content

Commit

Permalink
fix adapter;
Browse files Browse the repository at this point in the history
  • Loading branch information
dtmkeng committed Mar 1, 2025
1 parent 09fdadc commit 98c14ce
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
8 changes: 7 additions & 1 deletion fees/fluid/fees.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,13 @@ export const getFluidVaultsDailyBorrowFees = async ({ fromApi, toApi, createBala

export const getFluidDailyFees = async (options: FetchOptions) => {
// fetch all operate logs at liquidity layer at once
const liquidityOperateLogs = await options.getLogs({ target: LIQUIDITY, onlyArgs: true, topics: [TOPIC0.logOperate], eventAbi: EVENT_ABI.logOperate, flatten: true, skipCacheRead: true });
const liquidityOperateLogs = await options.getLogs({
target: LIQUIDITY,
onlyArgs: true,
topics: [TOPIC0.logOperate],
eventAbi: EVENT_ABI.logOperate,
flatten: true
});

const [vaultFees, dexFees] = await Promise.all([
await getFluidVaultsDailyBorrowFees(options, liquidityOperateLogs),
Expand Down
8 changes: 4 additions & 4 deletions fees/fluid/index.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { Adapter, FetchOptions, FetchV2 } from "../../adapters/types";
import { Adapter, FetchOptions, Fetch } from "../../adapters/types";
import { CONFIG_FLUID, METHODOLOGY_FLUID } from "./config";
import { getFluidDailyFees } from "./fees";
import { getFluidDailyRevenue } from "./revenue";

const fetch: FetchV2 = async (options: FetchOptions) => {
const fetch: Fetch = async (_t: any, _a: any, options: FetchOptions) => {
const [dailyFees, dailyRevenue] = await Promise.all([
getFluidDailyFees(options),
getFluidDailyRevenue(options)
])
return { dailyFees, dailyRevenue };
return { dailyFees, dailyRevenue, timestamp: options.startOfDay };
}

const adapter: Adapter = {
version: 2,
version: 1,
adapter: Object.entries(CONFIG_FLUID).reduce((acc, [chain, config]) => {
acc[chain] = {
meta: { methodology: METHODOLOGY_FLUID },
Expand Down
5 changes: 2 additions & 3 deletions fees/fluid/revenue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ const revenueResolver = async (api: ChainApi) => {
const block = await api.getBlock();
let address: string
let abi: any = ABI.revenueResolver;

switch (api.chain) {
case CHAIN.ETHEREUM:
// fluid revenueResolver exist after block 19784319
Expand All @@ -50,7 +49,7 @@ const revenueResolver = async (api: ChainApi) => {

case CHAIN.ARBITRUM:
address = "0xFe4affaD55c7AeC012346195654634F7C786fA2c";
break
break;
case CHAIN.BASE:
address = "0xFe4affaD55c7AeC012346195654634F7C786fA2c";
break;
Expand All @@ -63,7 +62,7 @@ const revenueResolver = async (api: ChainApi) => {
}

const getUncollectedLiquidities = async (api: ChainApi, tokens: string []) => {
const revenueResolverInfo = (await revenueResolver(api)).targetInfo();
const revenueResolverInfo = (await revenueResolver(api)).targetInfo();
return await api.multiCall({
calls: tokens.map((token) => ({ target: revenueResolverInfo.address, params: [token] })),
abi: revenueResolverInfo.abi.getRevenue,
Expand Down

0 comments on commit 98c14ce

Please sign in to comment.