From 7ab9ef6722b2074e76f3173e22b1ff43e6f855c3 Mon Sep 17 00:00:00 2001 From: Eyyub Ensar MERMER <98224771+eyyubmermer@users.noreply.github.com> Date: Tue, 5 Mar 2024 12:18:17 +0300 Subject: [PATCH] Add SquadSwap provider for BSC --- src/factory/providers/bsc/squadswap/index.ts | 25 ++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/factory/providers/bsc/squadswap/index.ts diff --git a/src/factory/providers/bsc/squadswap/index.ts b/src/factory/providers/bsc/squadswap/index.ts new file mode 100644 index 00000000..d240df3b --- /dev/null +++ b/src/factory/providers/bsc/squadswap/index.ts @@ -0,0 +1,25 @@ +import { ITvlParams, ITvlReturn } from '../../../../interfaces/ITvl'; +import uniswapV2 from '../../../../util/calculators/uniswapV2'; +import formatter from '../../../../util/formatter'; + +const START_BLOCK = 34130751; +const FACTORY_ADDRESS = '0x1D9F43a6195054313ac1aE423B1f810f593b6ac1'; + +async function tvl(params: ITvlParams): Promise> { + const { block, chain, provider, web3 } = params; + if (block < START_BLOCK) { + return {}; + } + + const { balances, poolBalances } = await uniswapV2.getTvl( + FACTORY_ADDRESS, + block, + chain, + provider, + web3, + ); + formatter.convertBalancesToFixed(balances); + return { balances, poolBalances }; +} + +export { tvl }; \ No newline at end of file