From 192cd8bdd855b6f85d2a72c9c6f172b42b6a9dc1 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 4 Jun 2024 15:54:54 +0200 Subject: [PATCH] split adapter (#10495) --- projects/dtx-dex/index.js | 4 ++++ projects/dtx/index.js | 11 +---------- projects/helper/unknownTokens.js | 11 +++++++++++ 3 files changed, 16 insertions(+), 10 deletions(-) create mode 100644 projects/dtx-dex/index.js diff --git a/projects/dtx-dex/index.js b/projects/dtx-dex/index.js new file mode 100644 index 0000000000..a9afb34a4b --- /dev/null +++ b/projects/dtx-dex/index.js @@ -0,0 +1,4 @@ +const { uniTvlExports } = require('../helper/unknownTokens') +module.exports = uniTvlExports({ + taiko: '0x2EA9051d5a48eA2350b26306f2b959D262cf67e1' +}) diff --git a/projects/dtx/index.js b/projects/dtx/index.js index e286201253..db223b152f 100644 --- a/projects/dtx/index.js +++ b/projects/dtx/index.js @@ -1,6 +1,5 @@ const { sumERC4626VaultsExport } = require("../helper/erc4626") const { sumTokensExport } = require("../helper/unwrapLPs") -const { getUniTVL } = require("../helper/unknownTokens") const sdk = require("@defillama/sdk") const ADDRESSES = require("../helper/coreAssets.json") @@ -37,7 +36,6 @@ const config = { "0xB00231B308B01Dbb90f16F966F62d86fBc78c450", ], }, - factory: "0x2EA9051d5a48eA2350b26306f2b959D262cf67e1", }, } @@ -47,14 +45,7 @@ Object.keys(config).forEach((chain) => { const otherTvl = sumTokensExport(tokenConfig) let tvlCalculators = [vaultTvl, otherTvl] - - if (factory) { - const uniTvl = getUniTVL({ - chain, - factory, - }) - tvlCalculators.push(uniTvl) - } + module.exports[chain] = { tvl: sdk.util.sumChainTvls(tvlCalculators), } diff --git a/projects/helper/unknownTokens.js b/projects/helper/unknownTokens.js index c722bc96ee..cf07b1d5f9 100644 --- a/projects/helper/unknownTokens.js +++ b/projects/helper/unknownTokens.js @@ -9,6 +9,16 @@ const { getTokenPrices, sumUnknownTokens, getLPData, } = require('./cache/sumUnk const { getUniTVL } = require('./cache/uniswap') const { getUniqueAddresses, } = require('./utils') +function uniTvlExports(config, commonOptions) { + const exportsObj = { + misrepresentedTokens: true, + } + Object.keys(config).forEach(chain => { + exportsObj[chain] = uniTvlExport(chain, config[chain],commonOptions )[chain] + }) + return exportsObj +} + function unknownTombs({ token = [], shares = [], rewardPool = [], masonry = [], lps, chain = "ethereum", coreAssets = [], useDefaultCoreAssets = false, }) { let getPrices @@ -256,4 +266,5 @@ module.exports = { sumTokensExport, yieldHelper, uniTvlExport, + uniTvlExports, }; \ No newline at end of file