Skip to content

Commit

Permalink
Merge pull request #312 from dappradar/aave-integration
Browse files Browse the repository at this point in the history
aavev3 [bsc, zksync-era]
  • Loading branch information
mantasfam authored Sep 24, 2024
2 parents b30fb45 + faecc67 commit a3fd41c
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 7 deletions.
24 changes: 24 additions & 0 deletions src/factory/providers/bsc/aavev3/index.ts
Original file line number Diff line number Diff line change
@@ -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<Partial<ITvlReturn>> {
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 };
7 changes: 0 additions & 7 deletions src/factory/providers/optimism/aavev3/data.json

This file was deleted.

24 changes: 24 additions & 0 deletions src/factory/providers/zksync-era/aavev3/index.ts
Original file line number Diff line number Diff line change
@@ -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<Partial<ITvlReturn>> {
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 };

0 comments on commit a3fd41c

Please sign in to comment.