separate aave versions

This commit is contained in:
0xngmi
2022-06-18 21:44:14 +01:00
parent c7bdc15b46
commit 75b56de868
3 changed files with 28 additions and 17 deletions

View File

@@ -0,0 +1,6 @@
const { aaveExports } = require('../helper/aave');
// start block: 13431423
module.exports = {
ethereum: aaveExports("ethereum", "0x6FdfafB66d39cD72CFE7984D3Bbcc76632faAb00", id=>id, ["0x71B53fC437cCD988b1b89B1D4605c3c3d0C810ea"]),
};

22
projects/aave-v1/index.js Normal file
View File

@@ -0,0 +1,22 @@
const { singleAssetV1Market,uniswapV1Market } = require('../aave/v1');
// v1
const aaveLendingPoolCore = "0x3dfd23A6c5E8BbcFc9581d2E864a68feb6a076d3";
const uniswapLendingPoolCore = "0x1012cfF81A1582ddD0616517eFB97D02c5c17E25";
function ethereum(borrowed) {
return async (timestamp, block)=> {
const balances = {}
await singleAssetV1Market(balances, aaveLendingPoolCore, block, borrowed)
await uniswapV1Market(balances, uniswapLendingPoolCore, block, borrowed)
return balances
}
}
module.exports = {
ethereum: {
tvl: ethereum(false),
borrowed: ethereum(true),
},
};

View File

@@ -1,23 +1,15 @@
const sdk = require('@defillama/sdk');
const { getV2Reserves, getTvl, getBorrowed, aaveChainTvl } = require('../helper/aave');
const { staking } = require('../helper/staking');
const { singleAssetV1Market,uniswapV1Market } = require('./v1');
const { ammMarket } = require('./amm');
const addressesProviderRegistryETH = "0x52D306e36E3B6B02c153d0266ff0f85d18BCD413";
// v1
const aaveLendingPoolCore = "0x3dfd23A6c5E8BbcFc9581d2E864a68feb6a076d3";
const uniswapLendingPoolCore = "0x1012cfF81A1582ddD0616517eFB97D02c5c17E25";
function ethereum(borrowed) {
return async (timestamp, block)=> {
const balances = {}
await singleAssetV1Market(balances, aaveLendingPoolCore, block, borrowed)
await uniswapV1Market(balances, uniswapLendingPoolCore, block, borrowed)
// V2 TVLs
if (block >= 11360925) {
const [v2Atokens, v2ReserveTokens, dataHelper] = await getV2Reserves(block, addressesProviderRegistryETH, 'ethereum')
@@ -30,15 +22,6 @@ function ethereum(borrowed) {
if (block >= 11998773) {
await ammMarket(balances, block, borrowed)
}
// Permissioned TVLs
if (block >= 13431423) {
const [v2Atokens, v2ReserveTokens, dataHelper] = await getV2Reserves(block, "0x6FdfafB66d39cD72CFE7984D3Bbcc76632faAb00", 'ethereum', ["0x71B53fC437cCD988b1b89B1D4605c3c3d0C810ea"])
if(borrowed){
await getBorrowed(balances, block, "ethereum", v2ReserveTokens, dataHelper, id=>id);
} else {
await getTvl(balances, block, 'ethereum', v2Atokens, v2ReserveTokens, id => id);
}
}
return balances;
}