Skip to content

Commit

Permalink
split adapter (DefiLlama#10495)
Browse files Browse the repository at this point in the history
  • Loading branch information
g1nt0ki authored Jun 4, 2024
1 parent 7f801e4 commit 192cd8b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
4 changes: 4 additions & 0 deletions projects/dtx-dex/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const { uniTvlExports } = require('../helper/unknownTokens')
module.exports = uniTvlExports({
taiko: '0x2EA9051d5a48eA2350b26306f2b959D262cf67e1'
})
11 changes: 1 addition & 10 deletions projects/dtx/index.js
Original file line number Diff line number Diff line change
@@ -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")
Expand Down Expand Up @@ -37,7 +36,6 @@ const config = {
"0xB00231B308B01Dbb90f16F966F62d86fBc78c450",
],
},
factory: "0x2EA9051d5a48eA2350b26306f2b959D262cf67e1",
},
}

Expand All @@ -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),
}
Expand Down
11 changes: 11 additions & 0 deletions projects/helper/unknownTokens.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -256,4 +266,5 @@ module.exports = {
sumTokensExport,
yieldHelper,
uniTvlExport,
uniTvlExports,
};

0 comments on commit 192cd8b

Please sign in to comment.