Skip to content

Commit

Permalink
feat(dexes): add fluid dex for arbitrum (#2254)
Browse files Browse the repository at this point in the history
  • Loading branch information
bergben authored Dec 24, 2024
1 parent 77b26a4 commit 2677144
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions dexs/fluid-dex/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,17 @@ interface SwapEventArgs {
fee: bigint;
}

const dexReservesResolver = "0xE8a07a32489BD9d5a00f01A55749Cf5cB854Fd13";
const dexReservesResolver = (chain: string) => {
switch (chain) {
case CHAIN.ETHEREUM:
return "0xE8a07a32489BD9d5a00f01A55749Cf5cB854Fd13";
case CHAIN.ARBITRUM:
return "0xb8f526718FF58758E256D9aD86bC194a9ff5986D";
default:
throw new Error("DexReservesResolver not defined");
}
}


const abi = {
getAllPools: "function getAllPools() view returns (tuple(address pool, address token0, address token1, uint256 fee)[])",
Expand All @@ -29,7 +39,7 @@ const abi = {
const fetch = async ({ api, createBalances, getLogs }: FetchOptions): Promise<FetchResultV2> => {
const dailyVolume = createBalances();
const dailyFees = createBalances()
const rawPools: PoolInfo[] = await api.call({ target: dexReservesResolver, abi: abi.getAllPools });
const rawPools: PoolInfo[] = await api.call({ target: dexReservesResolver(api.chain), abi: abi.getAllPools });
const pools = rawPools.map(({ pool, token0, token1, fee }) => ({ pool, token0, token1, fee: BigInt(fee) }));

const logsByPool: SwapEventArgs[][]= await Promise.all(
Expand Down Expand Up @@ -77,6 +87,7 @@ const adapter: Adapter = {
version: 2,
adapter: {
[CHAIN.ETHEREUM]: { fetch, start: '2024-10-26' },
[CHAIN.ARBITRUM]: { fetch, start: '2024-12-23' },
},
};

Expand Down

0 comments on commit 2677144

Please sign in to comment.