Skip to content

Commit a241e66

Browse files
committed
stop referencing sdk/build
1 parent 94071e0 commit a241e66

File tree

9 files changed

+12
-22
lines changed

9 files changed

+12
-22
lines changed

projects/corepound/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
const { abi } = require("@defillama/sdk/build/api");
21
const { sumTokens2 } = require("../helper/unwrapLPs")
32

43
const aggregator = "0xF822226491a93046DA650ecb4049E43386497C7D";

projects/dhedge.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
/* *** Common config *** */
2-
3-
const { sliceIntoChunks } = require("@defillama/sdk/build/util");
1+
const sdk = require("@defillama/sdk");
42

53
const DHEDGE_FACTORY_PROXIES = {
64
ethereum: "0x96d33bcf84dde326014248e2896f79bbb9c13d6d",
@@ -76,7 +74,7 @@ const tvl = async (api) => {
7674
const dhedgeVaults = allVaults.filter(v => !torosVaults.includes(v) && !mstableVaults.includes(v));
7775

7876
let chunkSize = chain === 'optimism' ? 42 : 51 // Optimism has a lower gas limit
79-
const vaultChunks = sliceIntoChunks(dhedgeVaults, chunkSize);
77+
const vaultChunks = sdk.util.sliceIntoChunks(dhedgeVaults, chunkSize);
8078
const summaries = [];
8179
for (const chunk of vaultChunks) {
8280
summaries.push(...await api.multiCall({ abi: DHEDGE_V2_VAULT_SUMMARY_ABI, calls: chunk, permitFailure: true, }))

projects/exactly/index.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,3 @@ const abis = {
9090
totalFloatingBorrowAssets: "function totalFloatingBorrowAssets() view returns (uint256)",
9191
};
9292

93-
/** @typedef {import("@defillama/sdk").ChainApi} ChainApi */
94-
/** @typedef {import("@defillama/sdk/build/types").Balances} Balances */
95-
/** @typedef {{ borrowed: string, supplied: string }} FixedPool */

projects/helper/karpatkey.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const { sumSingleBalance } = require("@defillama/sdk/build/generalUtil")
21
const { fetchURL } = require("./utils")
2+
const sdk = require('@defillama/sdk')
33

44
const MONTH = 30 * 24 * 3600e3
55

@@ -25,7 +25,7 @@ async function karpatKeyTvl(api, daoName, tokenToExclude) {
2525
if (tokenToExclude !== bal.token_symbol && bal.value) {
2626
const chain = chainMapping[bal.blockchain] ?? bal.blockchain.toLowerCase()
2727
// api.log(`Adding ${bal.token_symbol} on ${chain} with address ${bal.token_address} and value ${bal.value}`)
28-
sumSingleBalance(balances, chain + ':' + bal.token_address, bal.value)
28+
sdk.util.sumSingleBalance(balances, chain + ':' + bal.token_address, bal.value)
2929
} else {
3030
api.log(`Skipping ${bal.token_symbol}`)
3131
}

projects/helper/unwrapLPs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,7 @@ group by
10141014
Object.entries(balances).forEach(([token, value]) => {
10151015
if (token.includes(nullAddress)) return;
10161016
if (!token.startsWith('tron:0x')) return;
1017-
api.removeTokenBalance(token)
1017+
delete balances[token]
10181018
const tronToken = sdk.util.evmToTronAddress(token.split(':')[1])
10191019
sdk.util.sumSingleBalance(balances, tronToken, value, chain)
10201020
})

projects/justlend.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
const { unhexifyTarget, } = require('@defillama/sdk/build/abi/tron');
21
const ADDRESSES = require('./helper/coreAssets.json')
32
const { sumTokens } = require('./helper/sumTokens')
3+
const sdk = require('@defillama/sdk')
44

55
const comptroller = 'TGjYzgCyPobsNS9n6WcbdLVR9dH7mWqFx7'
66

@@ -14,7 +14,7 @@ module.exports = {
1414
};
1515

1616
async function tvl(api) {
17-
const markets = (await api.call({ abi: 'address[]:getAllMarkets', target: comptroller })).map(unhexifyTarget)
17+
const markets = (await api.call({ abi: 'address[]:getAllMarkets', target: comptroller })).map(sdk.tron.unhexifyTarget)
1818
const cMarkets = ['TE2RzoSV3wFK99w6J9UnnZ4vLfXYoxvRwP']
1919
const tokensAndOwners = []
2020
const otherMarkets = []
@@ -31,7 +31,7 @@ async function tvl(api) {
3131
}
3232

3333
async function borrowed(api) {
34-
const markets = (await api.call({ abi: 'address[]:getAllMarkets', target: comptroller })).map(unhexifyTarget)
34+
const markets = (await api.call({ abi: 'address[]:getAllMarkets', target: comptroller })).map(sdk.tron.unhexifyTarget)
3535
const cMarkets = ['TE2RzoSV3wFK99w6J9UnnZ4vLfXYoxvRwP']
3636
const otherMarkets = []
3737
for (let i = 0; i < markets.length; i++) {

projects/rings/index.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
const ADDRESSES = require('../helper/coreAssets.json')
22
const { sumTokensExport } = require("../helper/unwrapLPs");
3-
const { stakings } = require("../helper/staking");
4-
const { balanceOf } = require('@defillama/sdk/build/erc20');
5-
const { ethereum } = require('../helper/whitelistedNfts');
63

74
module.exports = {
85
methodology: 'TVL counts the tokens deposited in the boring vaults.',

projects/summer-fi/automation-v1.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
const { sliceIntoChunks } = require("@defillama/sdk/build/util/index.js");
2-
1+
const sdk = require('@defillama/sdk')
32
const { abi, contracts, logsTopic, creationBlocks } = require("./constants");
43
const { cachedCalls } = require("./cache");
54

@@ -8,7 +7,7 @@ const { getDecimalsData } = require("./helpers");
87

98
const getCdpData = async (cdpIds, api) => {
109
const res = [];
11-
const chunks = sliceIntoChunks(cdpIds, 100);
10+
const chunks = sdk.util.sliceIntoChunks(cdpIds, 100);
1211
for (const chunk of chunks)
1312
res.push(
1413
...(await api.multiCall({

projects/thales/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const { staking } = require('../helper/staking')
2-
const { sumChainTvls } = require('@defillama/sdk/build/generalUtil')
32
const CHAIN_CONFIG = require('./chainConfig')
43
const helpers = require('./utils')
4+
const sdk = require('@defillama/sdk')
55

66
// Create module for each chain
77
const createChainModule = (chain) => {
@@ -14,7 +14,7 @@ const createChainModule = (chain) => {
1414
module.pool2 = (api) => helpers.calculatePool2TVL(api, chain)
1515
}
1616

17-
module.staking = (api) => sumChainTvls([
17+
module.staking = (api) => sdk.util.sumChainTvls([
1818
config.stakingPools ? helpers.calculateStakingTVL(api, chain) : {},
1919
config.staking ? staking(config.staking.contract, config.staking.token) : {}
2020
])

0 commit comments

Comments
 (0)