From a75e5b878074ba1507e1cc550d96e3b6793fe99a Mon Sep 17 00:00:00 2001 From: osman sonmezturk Date: Thu, 23 Nov 2023 17:01:53 +0300 Subject: [PATCH] holdstation integration --- .../providers/zksync-era/holdstation/index.ts | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/factory/providers/zksync-era/holdstation/index.ts diff --git a/src/factory/providers/zksync-era/holdstation/index.ts b/src/factory/providers/zksync-era/holdstation/index.ts new file mode 100644 index 00000000..4bf91cb1 --- /dev/null +++ b/src/factory/providers/zksync-era/holdstation/index.ts @@ -0,0 +1,30 @@ +import util from '../../../../util/blockchainUtil'; +import formatter from '../../../../util/formatter'; +import { ITvlParams, ITvlReturn } from '../../../../interfaces/ITvl'; +import ERC20_ABI from '../../../../constants/abi/erc20.json'; + +const START_BLOCK = 3242317; +const VAULT_ADDRESS = '0xaf08a9d918f16332F22cf8Dc9ABE9D9E14DdcbC2'; +const USDC = '0x3355df6d4c9c3035724fd0e3914de96a5a83aaf4'; +async function tvl(params: ITvlParams): Promise> { + const { block, chain, provider, web3 } = params; + const balances = {}; + if (block < START_BLOCK) { + return { balances }; + } + + const usdcBalance = await util.executeMultiCallsOfTarget( + USDC, + ERC20_ABI, + 'balanceOf', + [VAULT_ADDRESS], + block, + chain, + web3, + ); + formatter.convertBalancesToFixed(balances); + + return { balances: { [USDC]: usdcBalance.toString() } }; +} + +export { tvl };