diff --git a/src/factory/providers/bsc/aavev3/index.ts b/src/factory/providers/bsc/aavev3/index.ts new file mode 100644 index 00000000..a8a2efed --- /dev/null +++ b/src/factory/providers/bsc/aavev3/index.ts @@ -0,0 +1,24 @@ +import formatter from '../../../../util/formatter'; +import { ITvlParams, ITvlReturn } from '../../../../interfaces/ITvl'; +import aaveV3 from '../../../../util/calculators/aaveV3'; + +const START_BLOCK = 33571625; +const POOL_DATA_PROVIDER_V3 = '0x41585C50524fb8c3899B43D7D797d9486AAc94DB'; + +async function tvl(params: ITvlParams): Promise> { + const { block, chain, provider, web3 } = params; + if (block < START_BLOCK) { + return {}; + } + + const balances = await aaveV3.getTvl( + POOL_DATA_PROVIDER_V3, + block, + chain, + web3, + ); + + formatter.convertBalancesToFixed(balances); + return { balances }; +} +export { tvl }; diff --git a/src/factory/providers/optimism/aavev3/data.json b/src/factory/providers/optimism/aavev3/data.json deleted file mode 100644 index 1b8f1a8a..00000000 --- a/src/factory/providers/optimism/aavev3/data.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "address": "0x76fb31fb4af56892a25e32cfc43de717950c9278", - "name": "Aave", - "symbol": "AAVE", - "decimals": 18, - "logo": "https://assets.coingecko.com/coins/images/12645/small/AAVE.png" -} \ No newline at end of file diff --git a/src/factory/providers/zksync-era/aavev3/index.ts b/src/factory/providers/zksync-era/aavev3/index.ts new file mode 100644 index 00000000..4babd13d --- /dev/null +++ b/src/factory/providers/zksync-era/aavev3/index.ts @@ -0,0 +1,24 @@ +import formatter from '../../../../util/formatter'; +import { ITvlParams, ITvlReturn } from '../../../../interfaces/ITvl'; +import aaveV3 from '../../../../util/calculators/aaveV3'; + +const START_BLOCK = 43708965; +const POOL_DATA_PROVIDER_V3 = '0x48B96565291d1B23a014bb9f68E07F4B2bb3Cd6D'; + +async function tvl(params: ITvlParams): Promise> { + const { block, chain, provider, web3 } = params; + if (block < START_BLOCK) { + return {}; + } + + const balances = await aaveV3.getTvl( + POOL_DATA_PROVIDER_V3, + block, + chain, + web3, + ); + + formatter.convertBalancesToFixed(balances); + return { balances }; +} +export { tvl };