Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
waynebruce0x committed Mar 14, 2024
2 parents 156c1f9 + 04dc8cb commit 7ba11bc
Show file tree
Hide file tree
Showing 214 changed files with 2,864 additions and 1,394 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Also, don't hesitate to send a message on [our discord](https://discord.defillam
1. PLEASE PLEASE **enable "Allow edits by maintainers" while putting up the PR.**
2. Once your adapter has been merged, it takes time to show on the UI. No need to notify us on Discord.
3. Sorry, We no longer accept fetch adapter for new projects (reason: https://github.com/DefiLlama/DefiLlama-Adapters/discussions/432), we prefer the tvl to computed from blockchain data, if you have trouble with creating a the adapter, please hop onto our discord, we are happy to assist you.
3. Sorry, We no longer accept fetch adapter for new projects (reason: https://github.com/DefiLlama/DefiLlama-Adapters/discussions/432), we prefer the tvl to be computed from blockchain data, if you have trouble with creating a the adapter, please hop onto our discord, we are happy to assist you.
4. **For updating listing info** It is a different repo, you can find your listing in this file: https://github.com/DefiLlama/defillama-server/blob/master/defi/src/protocols/data2.ts, you can edit it there and put up a PR
5. Do not edit/push `package-lock.json` file as part of your changes, we use lockfileVersion 2, and most use v1 and using that messes up our CI
6. No need to go to our discord and announce that you've created a PR, we monitor all PRs and will review it asap
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 13 additions & 4 deletions projects/0xLend/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
const { usdCompoundExports } = require("../helper/compound");
module.exports = {
kcc: usdCompoundExports("0x337d8719f70D514367aBe780F7c1eAd1c0113Bc7", "kcc", "0x309f1639018e8B272126C4B99af442AA25Dcd1F2")
}
const { compoundExports2 } = require('../helper/compound')

const config = {
kcc: { comptroller: '0x337d8719f70D514367aBe780F7c1eAd1c0113Bc7', cether: '0x309f1639018e8b272126c4b99af442aa25dcd1f2' },
era: { comptroller: '0x599bb9202EE2D2F95EDe9f88F622854f7ef2c371', cether: '0x9dae6c8c431ffc6d21b836e0d8d113e8365defb9' },
blast: { comptroller: '0x1DD821C9E27fB2399DAb75AedB113c80C755DCa6', cether: '0xd9fcbd7b60966d013a28ff87925f75bb49e9b5ee' },
}

Object.keys(config).forEach(chain => {
module.exports[chain] = compoundExports2(config[chain])
})

module.exports.kcc.borrowed = () => ({})
21 changes: 17 additions & 4 deletions projects/BlastNYAN/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,29 @@ const BLNYAN_WETH_SLP = '0x0E9309f32881899F6D4aC2711c6E21367A84CA26'

const stakingBLNYANContract = '0xA76D6dc805d0EbEcb3787c781ce3A18feEF020cb'
const feeDistro = '0xBC8a7a845cC7A8246EB34856Afe6f1a3d62BD9C6'
const stakeLpEarnWeth = '0x0a3A757BE3049C2d9444d025E98D37b2a81a0a32'
const stakeLpEarnWeth = '0xF63Ef9F4320f9d16731a40ff1f58a966ee086806'
const button = '0x00066Ed6c2F7d6CC6e66c678BaEE2C8683B632e6'
const lockPoints = '0x46B3a66ef4fAC801B455884035eF2862F01e6158'
const opts = { useDefaultCoreAssets: true, lps: [BLNYAN_WETH_SLP] }

module.exports = {
misrepresentedTokens: true,
blast: {
tvl: sumTokensExport({ owners: [stakeLpEarnWeth, feeDistro, button], tokens: [WETH], ...opts, }),
pool2: sumTokensExport({ ...opts, owners: [stakeLpEarnWeth], tokens: [BLNYAN_WETH_SLP], }),
staking: sumTokensExport({ owners: [stakingBLNYANContract], tokens: [BLNYAN], ...opts, }),
tvl: sumTokensExport({
owners: [lockPoints, feeDistro, button],
tokens: [WETH],
...opts,
}),
pool2: sumTokensExport({
...opts,
owners: [stakeLpEarnWeth],
tokens: [BLNYAN_WETH_SLP],
}),
staking: sumTokensExport({
owners: [stakingBLNYANContract, lockPoints],
tokens: [BLNYAN],
...opts,
}),
},
methodology:
'Counts as TVL the ETH only. blNYAN and LP assets deposited are counted as Pool2 and staking Respectively',
Expand Down
6 changes: 6 additions & 0 deletions projects/Blaster/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const { uniV3Export } = require("../helper/uniswapV3");
const { mergeExports } = require('../helper/utils')

module.exports = mergeExports([
uniV3Export({ blast: { factory: "0x9792FaeA53Af241bCE57C7C8D6622d5DaAD0D4Fc", fromBlock: 693561, }, }),
])
1 change: 1 addition & 0 deletions projects/MantisSwap/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const { sumTokens2 } = require("../helper/unwrapLPs");
const config = {
polygon: { vaults: ['0x62Ba5e1AB1fa304687f132f67E35bFC5247166aD'] },
polygon_zkevm: { vaults: ['0x12d41b6DF938C739F00c392575e3FD9292d98215'] },
mode: { vaults: ['0x4af97f73343b226C5a5872dCd2d1c4944BDb3E77'] },
}

const MAX_LP_TOKENS = 3
Expand Down
8 changes: 8 additions & 0 deletions projects/Produs/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const { getUniTVL, } = require('../helper/unknownTokens')

module.exports = {
misrepresentedTokens: true,
bsc: {
tvl: getUniTVL({ factory: '0x8ae5527706446943cBA8589313EC217a4a7288a4', useDefaultCoreAssets: true, fetchBalances: true, }),
},
};
12 changes: 12 additions & 0 deletions projects/XDX/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const { getUniTVL } = require('../helper/unknownTokens')

module.exports = {
misrepresentedTokens: true,
blast: {
tvl: getUniTVL({
fetchBalances: true,
useDefaultCoreAssets: true,
factory: '0xF55dE36072beCebF162d2d54C49964f3b0683711',
})
}
}
34 changes: 22 additions & 12 deletions projects/aada/index.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
const { sumTokensExport, } = require("../helper/chain/cardano");
const { sumTokensExport } = require("../helper/chain/cardano");

const scriptAdresses = [
'addr1zy9940grv28qxz9k82l9gmqd80vfd8a2734e35yzsz9cqktfjcnq9fczt4qkxgec2hz6x7f38vnj8xuxywk4x4qgzh9smq5w00', //request.hs -- Request created. Lender to fund
'addr1zykhtew0z93z6hmgu2ew7kl9puqz0wmafp0f3jypuejkwmrfjcnq9fczt4qkxgec2hz6x7f38vnj8xuxywk4x4qgzh9skq4p22', //collateral.hs -- Loan funded. Borrower to repay
'addr1zxfgvtfgp9476dhmq8fkm3x8wg20v33s6c9unyxmnpm0y5rfjcnq9fczt4qkxgec2hz6x7f38vnj8xuxywk4x4qgzh9st8q78h', //interest.hs -- Borrower repaid -- Lender to claim
'addr1zxcjtxuc7mj8w6v9l3dfxvm30kxf78nzw387mqjqvszxr4mfjcnq9fczt4qkxgec2hz6x7f38vnj8xuxywk4x4qgzh9sp92046', //liquidation.hs -- Funds were liquidated. Borrower to claim
'addr1zytwe3qhc0kf5k8yaur60cnhcxjg9zvfdnftp0rfu2czprtfjcnq9fczt4qkxgec2hz6x7f38vnj8xuxywk4x4qgzh9sgzwepc', //debt_request.hs -- Funds locked as liquidity deposits 'addr1z8tjrqy2dj5uk6her4ksltyxy2flzykktxkahzlahm9nwctfjcnq9fczt4qkxgec2hz6x7f38vnj8xuxywk4x4qgzh9st86ewu', //request.hs v2 -- Funds locked as liquidity deposits
'addr1zyc7w5n699ews00yujnhw59g4nuzykuzgl5x6nzqp49zv5tfjcnq9fczt4qkxgec2hz6x7f38vnj8xuxywk4x4qgzh9sdyxnxc', //collateral.hs v2-- Funds locked as liquidity deposits
'addr1zy6v8c7xdhftln7zk5uvt9h6jaknaxlx6hz5nkw63mpgwamfjcnq9fczt4qkxgec2hz6x7f38vnj8xuxywk4x4qgzh9sw9snf6', //debt_request.hs v2-- Funds locked as liquidity deposits
"addr1zy9940grv28qxz9k82l9gmqd80vfd8a2734e35yzsz9cqktfjcnq9fczt4qkxgec2hz6x7f38vnj8xuxywk4x4qgzh9smq5w00", //request.hs -- Request created. Lender to fund
"addr1zykhtew0z93z6hmgu2ew7kl9puqz0wmafp0f3jypuejkwmrfjcnq9fczt4qkxgec2hz6x7f38vnj8xuxywk4x4qgzh9skq4p22", //collateral.hs -- Loan funded. Borrower to repay
"addr1zxfgvtfgp9476dhmq8fkm3x8wg20v33s6c9unyxmnpm0y5rfjcnq9fczt4qkxgec2hz6x7f38vnj8xuxywk4x4qgzh9st8q78h", //interest.hs -- Borrower repaid -- Lender to claim
"addr1zxcjtxuc7mj8w6v9l3dfxvm30kxf78nzw387mqjqvszxr4mfjcnq9fczt4qkxgec2hz6x7f38vnj8xuxywk4x4qgzh9sp92046", //liquidation.hs -- Funds were liquidated. Borrower to claim
"addr1zytwe3qhc0kf5k8yaur60cnhcxjg9zvfdnftp0rfu2czprtfjcnq9fczt4qkxgec2hz6x7f38vnj8xuxywk4x4qgzh9sgzwepc", //debt_request.hs -- Funds locked as liquidity deposits 'addr1z8tjrqy2dj5uk6her4ksltyxy2flzykktxkahzlahm9nwctfjcnq9fczt4qkxgec2hz6x7f38vnj8xuxywk4x4qgzh9st86ewu', //request.hs v2 -- Funds locked as liquidity deposits
"addr1zyc7w5n699ews00yujnhw59g4nuzykuzgl5x6nzqp49zv5tfjcnq9fczt4qkxgec2hz6x7f38vnj8xuxywk4x4qgzh9sdyxnxc", //collateral.hs v2-- Funds locked as liquidity deposits
"addr1zy6v8c7xdhftln7zk5uvt9h6jaknaxlx6hz5nkw63mpgwamfjcnq9fczt4qkxgec2hz6x7f38vnj8xuxywk4x4qgzh9sw9snf6", //debt_request.hs v2-- Funds locked as liquidity deposits
"script1xt5vpt33fm6tu3fvz65enpnlvmg6z7gle9evktmuwn3c6gjfc7p", // Pool contract
"script1nwvlaa0wnf43wzjp3xv738k6myam74dlrlh027mq20trg3ng772", // Collateral contract
"script1sqscxzh7mkzlmgf98k3tuadkds8xt3yzzj8t3jnfpypukld9xck", // Leftovers contract
];

module.exports = {
methodology: 'Counts amount of AADA staked; by a price of ADA sitting in the orderbook.',
methodology:
"Calculates the total of idle tokens held in pool contracts or collateral tokens secured in the collateral contract.",
timetravel: false,
cardano: {
staking: sumTokensExport({ owner: 'addr1wyvej5rmcrhfpcwrwmnqsjtwvf8gv3dn64vwy3xzekp95wqqhdkwa' , tokens: ['8fef2d34078659493ce161a6c7fba4b56afefa8535296a5743f6958741414441']}),
tvl: sumTokensExport({ scripts: scriptAdresses, })
}
staking: sumTokensExport({
owner: "addr1wyvej5rmcrhfpcwrwmnqsjtwvf8gv3dn64vwy3xzekp95wqqhdkwa",
tokens: [
"8fef2d34078659493ce161a6c7fba4b56afefa8535296a5743f6958741414441",
],
}),
tvl: sumTokensExport({ scripts: scriptAdresses }),
},
hallmarks: [[1708560053, "V2 Launch"]],
};
3 changes: 2 additions & 1 deletion projects/aave/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const { getV2Reserves, getTvl, getBorrowed, aaveChainTvl } = require('../helper/
const { staking } = require('../helper/staking');
const { ammMarket } = require('./amm');
const { unwrapBalancerToken } = require('../helper/unwrapLPs');
const methodologies = require('../helper/methodologies');


const addressesProviderRegistryETH = "0x52D306e36E3B6B02c153d0266ff0f85d18BCD413";
Expand Down Expand Up @@ -49,7 +50,7 @@ function v2(chain, v2Registry){

module.exports = {
timetravel: true,
methodology: `Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending`,
methodology: methodologies.lendingMarket,
ethereum: {
staking: staking(aaveStakingContract, aaveTokenAddress),
pool2: stakingBalancerTvl,
Expand Down
3 changes: 2 additions & 1 deletion projects/aave/v3.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const { aaveChainTvl } = require('../helper/aave');
const methodologies = require('../helper/methodologies');

const v3params = ["0x770ef9f4fe897e59daCc474EF11238303F9552b6", undefined, ["0x69FA688f1Dc47d4B5d8029D5a35FB7a548310654"]]

Expand All @@ -24,7 +25,7 @@ function v3(chain) {
}

module.exports = {
methodology: `Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending`,
methodology: methodologies.lendingMarket,
avax: v3("avax"),
...["optimism", "fantom", "harmony", "arbitrum", "polygon", "ethereum", "metis", "base", "xdai", "scroll", "bsc"].reduce((t, c) => ({ ...t, [c]: v3(c) }), {}),
hallmarks: [
Expand Down
5 changes: 3 additions & 2 deletions projects/agave.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const { staking } = require("./helper/staking.js");
const { aaveChainTvl } = require('./helper/aave.js');
const sdk = require('@defillama/sdk')
const sdk = require('@defillama/sdk');
const methodologies = require("./helper/methodologies.js");

// Staking TVLs
const agaveTokenAddress = '0x3a97704a1b25F08aa230ae53B352e2e72ef52843'
Expand All @@ -22,7 +23,7 @@ module.exports = {
hallmarks: [
[1647302400, "Reentrancy attack"]
],
methodology: `Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending`,
methodology: methodologies.lendingMarket,
xdai: {
tvl: sdk.util.sumChainTvls([
aaveChainTvl("xdai", addressesProviderRegistryXDAI, addr => `xdai:${addr}`, [protocolDataHelper], false),
Expand Down
24 changes: 6 additions & 18 deletions projects/agora/index.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,20 @@
const ADDRESSES = require('../helper/coreAssets.json')
const sdk = require("@defillama/sdk");
const { compoundExports } = require("../helper/compound");
const { compoundExports, methodology, } = require("../helper/compound");
const { getUniTVL } = require('../helper/unknownTokens')

const factory = '0x3c4063B964B1b3bF229315fCc4df61a694B0aE84'
const metis = ADDRESSES.metis.Metis
const agora = '0x0Ed0Ca6872073E02cd3aE005BaF04bA43BE947fA'

const whitelist = [
agora, // AGORA
ADDRESSES.metis.m_USDC, // USDC
ADDRESSES.metis.m_USDT, // USDT
ADDRESSES.metis.WETH, // WETH
'0x94e56c0c59433599ba857a9a7243b2826745cf91', //kWBTC
'0x6d11f074131e3fc61c983cce538f5d0ca3553c0f', //kUSDC
'0xcfd482dce13ca1d27834d381af1b570e9e6c6810', //kmetis
'0x2e9347dda00b3ec1b188963b590ca1ecbd73145a', //kweth
]

const { tvl: agoraTvl, borrowed: agoraBorrowed } = compoundExports(
const { tvl: agoraTvl, } = compoundExports(
"0x3fe29D7412aCDade27e21f55a65a7ddcCE23d9B3",
"metis",
"0xcFd482DcE13cA1d27834D381AF1b570E9E6C6810",
metis,
);

const { tvl: agoraPlusTvl, borrowed: agoraPlusBorrowed } = compoundExports(
const { tvl: agoraPlusTvl, } = compoundExports(
"0x92DcecEaF4c0fDA373899FEea00032E8E8Da58Da",
"metis",
"0xE85A1ae1A2A21135c49ADEd398D3FD5Ed032B28e",
Expand All @@ -34,15 +23,15 @@ const { tvl: agoraPlusTvl, borrowed: agoraPlusBorrowed } = compoundExports(
symbol => symbol.indexOf('appuffNetswap') > -1
);

const { tvl: agoraStakeTvl, borrowed: agoraStakeBorrowed } = compoundExports(
const { tvl: agoraStakeTvl, } = compoundExports(
"0xb36DF0773AbD23081516F54f9dbB9a99Ec27dbB0",
"metis",
"0xc3034143816398d37Ec9447c9CA17c407e96Dc12",
metis,
undefined,
);

const { tvl: agoraFarmTvl, borrowed: agoraFarmBorrowed } = compoundExports(
const { tvl: agoraFarmTvl, } = compoundExports(
"0xEC1A06f320E6e295Ab6892BB4e0f9e29c712F11F",
"metis",
"0x13Cb104a1D94A89a260b27DfAAB07C862da622E5",
Expand All @@ -56,9 +45,8 @@ module.exports = {
hallmarks: [
[1649376000, "STARS collateral Exploit"]
],
incentivized: true,
methodology,
misrepresentedTokens: true,
methodology: `As in Compound Finance, TVL counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are counted as "Borrowed" TVL and can be toggled towards the regular TVL.`,
metis: {
tvl: sdk.util.sumChainTvls([chainTvl, agoraTvl, agoraPlusTvl, agoraFarmTvl, agoraStakeTvl]),
borrowed: ()=>({}),
Expand Down
11 changes: 11 additions & 0 deletions projects/alien-finance/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const { sumTokensExport } = require("../helper/unwrapLPs")
const ADDRESSES = require('../helper/coreAssets.json')

const owner = "0x50454acC07bf8fC78100619a1b68e9E8d28cE022"

module.exports = {
blast: {
tvl: sumTokensExport({ owner, tokens: [ADDRESSES.blast.USDB, ADDRESSES.blast.WETH]}),
},
start: 1709630412,
};
20 changes: 11 additions & 9 deletions projects/alongside/index.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
const sdk = require("@defillama/sdk");
const { sumTokensExport } = require("../helper/unwrapLPs");
const { sumTokens2 } = require("../helper/unwrapLPs")
const ADDRESSES = require('../helper/coreAssets.json')

const INDEX = "0xF17A3fE536F8F7847F1385ec1bC967b2Ca9caE8D";
async function tvl(_, block, _cb, { api }) {
const aSTETH = "0x27C2B9fd547EAd2c05C305BeE2399A55811257c2"
const vault = "0xf3bCeDaB2998933c6AAD1cB31430D8bAb329dD8C"
const astBal = await api.call({ abi: 'erc20:balanceOf', target: aSTETH, params: vault })
const stethBal = await api.call({ abi: 'erc20:balanceOf', target: ADDRESSES.ethereum.STETH, params: aSTETH })
const astethSupply = await api.call({ abi: 'erc20:totalSupply', target: aSTETH })
api.add(ADDRESSES.ethereum.STETH, stethBal * astBal / astethSupply)

async function tvl(_, block, _cb) {
const balances = {}
const supply = await sdk.api2.abi.call({ abi: 'uint256:totalSupply', target: INDEX, block })
sdk.util.sumSingleBalance(balances, INDEX, supply, 'ethereum')
return balances
return sumTokens2({ api, owner: vault, fetchCoValentTokens: true, blacklistedTokens: [aSTETH] })
}

module.exports = {
methodology:
"Data is retrieved from calculation of market price and total supply",
ethereum: {
tvl: sumTokensExport({ owner: '0xf3bCeDaB2998933c6AAD1cB31430D8bAb329dD8C', fetchCoValentTokens: true }),
tvl,
},
};
25 changes: 25 additions & 0 deletions projects/alta-finance/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module.exports = {
methodology: "Sums the amount of funded real-world assets on ALTA Finance as borrowed. Tokens left in the countract are counted towards tvl",
}

const config = {
polygon: { investments: ['0xcf152E9f60E197A44FAdce961c6B822Dcb6c9dcc'], debts: ['0xE92F580C930dd24aACB38Ab0EA18F6c1dEf31369','0x64D6583b81716a4d141f07E264805CaCd3f484bB'], token: '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174' },
}

Object.keys(config).forEach(chain => {
const { investments, debts, token } = config[chain]
module.exports[chain] = {
tvl: async (_, _b, _cb, { api, }) => {
return api.sumTokens({ owners: investments.concat(debts), tokens: [token] })
},
borrowed: async (_, _b, _cb, { api, }) => {
const nftCount = (await api.multiCall({ abi: 'uint256:_tokenIdCounter', calls: investments, permitFailure: true })).map(i => i ?? 0)
const amount = (await api.multiCall({ abi: 'uint256:amountPerNft', calls: investments, permitFailure: true })).map(i => i ?? 0)
api.add(token, nftCount.map((v, i) => v * amount[i]))

const bals = (await api.multiCall({ abi: 'uint256:amount', calls: debts, permitFailure: true })).map(i => i ?? 0)
api.add(token, bals)
return api.getBalances()
},
}
})
2 changes: 1 addition & 1 deletion projects/ambient-finance/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const vault = {
const subgraphs = {
scroll: 'https://ambindexer.net/scroll-gcgo/pool_list?chainId=0x82750',
blast: 'https://ambindexer.net/blast-gcgo/pool_list?chainId=0x13e31',
canto: "https://canto-subgraph.plexnode.wtf/subgraphs/name/ambient-graph",
canto: "https://ambient-graphcache.fly.dev/gcgo/pool_list?chainId=0x1e14",
ethereum: `https://api.thegraph.com/subgraphs/name/crocswap/croc-mainnet`
}

Expand Down
24 changes: 9 additions & 15 deletions projects/anyhedge/index.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
const axios = require("axios");


const dayHistory = {};

async function GetDailyHistory() {
async function GetDailyHistory(day) {
// Data & calculation method is fully reproducible, see:
// https://gitlab.com/0353F40E/anyhedge-stats/-/blob/master/readme.md

let { data } = await axios.get('https://gitlab.com/0353F40E/anyhedge-stats/-/raw/master/stats_daily.csv');
data = parseCSV(data);

data.forEach((row) => {
if (!row.tvl) return;
dayHistory[row.day] = row.tvl;
});
try {
let { data } = await axios.get(`https://gitlab.com/0353F40E/anyhedge-stats/-/raw/master/stats_daily/${day}.csv`);
data = parseCSV(data);
return data[0].tvl;
} catch {
return null;
}
}

async function getTVLAnyHedge(timestamp) {
const day = new Date(timestamp * 1000).toISOString().slice(0,10)
return dayHistory[day]
return await GetDailyHistory(day);
}

async function tvl(timestamp) {
Expand All @@ -32,8 +28,6 @@ async function tvl(timestamp) {
if (timestamp > lastTimestamp)
throw "Data for the date is incomplete, awaiting contract reveals."

await GetDailyHistory();

tvlAnyHedge = await getTVLAnyHedge(timestamp)
testDataSource = await getTVLAnyHedge(timestamp + 31*86400)

Expand Down
Loading

0 comments on commit 7ba11bc

Please sign in to comment.