Skip to content

Commit

Permalink
add flag to module: isHeavyProtocol
Browse files Browse the repository at this point in the history
  • Loading branch information
g1nt0ki authored and tlatkdgus1 committed Nov 25, 2024
1 parent 8b889eb commit e381598
Show file tree
Hide file tree
Showing 19 changed files with 10 additions and 284 deletions.
1 change: 0 additions & 1 deletion projects/GajFinance/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ async function stakingAvax(timestamp, ethBlock, chainBlocks) {
}

module.exports = {
broken: 'Api is no longer reachable',
methodology: "TVL comes from NFT Farming, Jungle Pools, MasterChef and Vaults",
avax:{
staking: stakingAvax,
Expand Down
12 changes: 0 additions & 12 deletions projects/babyswap/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,10 @@ const { staking } = require("../helper/staking");
const MasterChefContract = "0xdfAa0e08e357dB0153927C7EaBB492d1F60aC730";
const BABY = "0x53E562b9B7E5E94b81f10e96Ee70Ad06df3D2657";

// node test.js projects/babyswap/index.js

/*
module.exports = {
bsc: {
staking: staking(MasterChefContract, BABY),
tvl: bscTvl,
},
methodology:
"We count liquidity on the Farms (LP tokens) and Pools (single tokens) seccions threw MasterChef Contract",
};*/
const { getUniTVL } = require('../helper/unknownTokens')
module.exports = {
methodology: `Uses factory(0x86407bEa2078ea5f5EB5A52B2caA963bC1F889Da) address and whitelisted tokens address to find and price Liquidity Pool pairs`,
misrepresentedTokens: true,
incentivized: true,
bsc: {
tvl: getUniTVL({ factory: '0x86407bEa2078ea5f5EB5A52B2caA963bC1F889Da', useDefaultCoreAssets: true }),
staking: staking(MasterChefContract, BABY),
Expand Down
1 change: 0 additions & 1 deletion projects/bfly.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ module.exports={
methodology: "Data is retrieved from the api at https://fai.bfly.finance",
misrepresentedTokens: true,
timetravel: false,
incentivized: true,
starcoin: {
tvl,
}
Expand Down
2 changes: 1 addition & 1 deletion projects/coconuts-finance/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ module.exports = {
avax: {
tvl: () => ({})
},
broken: 'Api is down'
deadFrom: '2022-04-27',
};
2 changes: 0 additions & 2 deletions projects/coincollect/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const { staking } = require("../helper/staking");
const { getUniTVL, sumTokensExport } = require('../helper/unknownTokens')

const MasterChefContract = "0x46A928F2386b8c38cdde028a32c5b7aa19F40445";
Expand All @@ -7,7 +6,6 @@ const COLLECT = "0x56633733fc8BAf9f730AD2b6b9956Ae22c6d4148";
module.exports = {
methodology: `Uses factory(0x2bc17223A99B6e2857796a5F64A1ED91067b5657) address to count liquidity in pools as TVL.`,
misrepresentedTokens: true,
incentivized: true,
polygon: {
tvl: getUniTVL({ factory: '0x2bc17223A99B6e2857796a5F64A1ED91067b5657', useDefaultCoreAssets: true, fetchBalances: true }),
staking: sumTokensExport({owner: MasterChefContract, tokens: [COLLECT], lps: ['0x0cCc84b6506003487AEC687085e82C2f912E607B'], useDefaultCoreAssets: true, }),
Expand Down
2 changes: 0 additions & 2 deletions projects/dddx.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const { stakings } = require("./helper/staking");

module.exports = {
misrepresentedTokens: true,
incentivized: true,
bsc: {
tvl: getUniTVL({ factory: '0xb5737A06c330c22056C77a4205D16fFD1436c81b', useDefaultCoreAssets: true }),
staking: stakings(
Expand All @@ -14,7 +13,6 @@ module.exports = {

],
'0x4B6ee8188d6Df169E1071a7c96929640D61f144f',
'bsc'
)
}
};
1 change: 1 addition & 0 deletions projects/fluxbeam-xyz/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ async function tvl(api) {
module.exports = {
timetravel: false,
solana: { tvl, },
isHeavyProtocol: true,
}
5 changes: 3 additions & 2 deletions projects/helper/solana.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,15 @@ async function getTokenSupply(token) {
}

async function getTokenAccountBalances(tokenAccounts, { individual = false, allowError = false, chain = 'solana' } = {}) {
log('total token accounts: ', tokenAccounts.length)
const sleepTime = tokenAccounts.length > 2000 ? 2000 : 200
log('total token accounts: ', tokenAccounts.length, 'sleepTime: ', sleepTime)
tokenAccounts.forEach((val, i) => {
if (typeof val === 'string') tokenAccounts[i] = new PublicKey(val)
})
const connection = getConnection(chain)
const balancesIndividual = []
const balances = {}
const res = await runInChunks(tokenAccounts, chunk => connection.getMultipleAccountsInfo(chunk))
const res = await runInChunks(tokenAccounts, chunk => connection.getMultipleAccountsInfo(chunk), { sleepTime })
res.forEach((data, idx) => {

if (!data) {
Expand Down
5 changes: 1 addition & 4 deletions projects/helper/whitelistedExportKeys.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,9 @@
"borrowed",
"start",
"doublecounted",
"treasury",
"hallmarks",
"incentivized",
"offers",
"isHeavyProtocol",
"deadFrom",
"broken",
"ownTokens",
"vesting"
]
1 change: 0 additions & 1 deletion projects/kyotoswap/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const KSWAP = "0x29ABc4D03D133D8Fd1F1C54318428353CE08727E";
module.exports = {
methodology: `Uses factory(${FACTORY}) address and whitelisted tokens address to find and price Liquidity Pool pairs`,
misrepresentedTokens: true,
incentivized: true,
bsc: {
tvl: getUniTVL({
factory: FACTORY,
Expand Down
1 change: 0 additions & 1 deletion projects/orbitalswap/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const { getUniTVL } = require('../helper/unknownTokens')
module.exports = {
methodology: `Uses factory(0x1A04Afe9778f95829017741bF46C9524B91433fB) address and whitelisted tokens address to find and price Liquidity Pool pairs`,
misrepresentedTokens: true,
incentivized: true,
bsc: {
tvl: getUniTVL({ factory: '0x1A04Afe9778f95829017741bF46C9524B91433fB', useDefaultCoreAssets: true }),
staking: staking(MasterChefContract, ORB),
Expand Down
105 changes: 0 additions & 105 deletions projects/safedollar/farm-utils.js

This file was deleted.

76 changes: 0 additions & 76 deletions projects/safedollar/farms-polygon.json

This file was deleted.

61 changes: 2 additions & 59 deletions projects/safedollar/index.js
Original file line number Diff line number Diff line change
@@ -1,63 +1,6 @@
const ADDRESSES = require('../helper/coreAssets.json')
const sdk = require('@defillama/sdk');
const farmUtils = require('./farm-utils');
/**
* calculate collateral locked in safedollar
*/
const Contracts = {
SafeAssets: [{
collateralAddress: "0x736Fb0CbB5F55941ecF6A811be4926c2cFa4dD4b",
address: ADDRESSES.polygon.USDC
},{
collateralAddress: "0xbd75b2a992ea83abed729e60022c9fe8fe539e54",
address: ADDRESSES.polygon.WMATIC_2
}],

boardRoom: "0x46C6a9b8E3243FB0dfB069119D5Fc6a75EEc8604",
sds: "0xAB72EE159Ff70b64beEcBbB0FbBE58b372391C54"
}
const polygonTvl = async (timestamp, ethBlock, chainBlocks) => {
// --- Sections of boardroom ---
const stakeboardroom$ = sdk
.api.abi.call({
target: Contracts.sds,
abi: 'erc20:balanceOf',
chain: 'polygon',
block: chainBlocks['polygon'],
params: [Contracts.boardRoom],
}).then(x => x.output)

const [farmTvl, sdsStaked] = await Promise.all([

farmUtils.polygonFarmLocked(chainBlocks['polygon']),
stakeboardroom$
])
const balances = {
[`polygon:${Contracts.sds}`]: sdsStaked,
};
// --- Sections of Safe Assets ---
const promises$ = Contracts.SafeAssets.map((item) => {
return sdk
.api.abi.call({
target: item.address,
abi: 'erc20:balanceOf',
chain: 'polygon',
block: chainBlocks['polygon'],
params: [item.collateralAddress],
}).then(x => {
sdk.util.sumSingleBalance(balances, `polygon:${item.address}`, x.output)
})
});
const collateralBalance = await Promise.all(promises$)
for (const [token, balance] of Object.entries(farmTvl)) {
sdk.util.sumSingleBalance(balances, token, balance)
}
return balances
};

module.exports = {
polygon: {
tvl: polygonTvl,
tvl: () => ({}),
},
// broken: 'Api is down, discord seems deserted.',
deadFrom: '2022-04-27',
};
1 change: 1 addition & 0 deletions projects/serum.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ async function tvl(api) {

module.exports = {
timetravel: false,
isHeavyProtocol: true,
hallmarks: [
[1667826000, "FTX/Alameda collapse"],
[1680310800, "Move to onchain data"],
Expand Down
1 change: 0 additions & 1 deletion projects/starswap-starcoin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ module.exports = {
methodology: `Starswap's TVL is achieved by making a call to it's API: https://swap-api.starcoin.org/main/v1/farmingTvlInUsd (Farming) and https://swap-api.starcoin.org/main/v1/syrupPoolTvlInUsd (Stake).`,
misrepresentedTokens: true,
timetravel: false,
incentivized: true,
starcoin: {
tvl,
staking,
Expand Down
Loading

0 comments on commit e381598

Please sign in to comment.