mirror of
https://github.com/alexgo-io/DefiLlama-Adapters.git
synced 2026-01-12 16:53:02 +08:00
fix centrifuge historical
This commit is contained in:
@@ -15,42 +15,39 @@ query GET_TOTAL_TOKEN_TVL($block: Int) {
|
||||
}
|
||||
`;
|
||||
const dai = "0x6b175474e89094c44da98b954eedeac495271d0f"
|
||||
let data
|
||||
|
||||
async function getData(ethBlock) {
|
||||
if (!data)
|
||||
data = request(
|
||||
subgraphUrl,
|
||||
graphTotalTokenTVLQuery,
|
||||
{
|
||||
block: ethBlock
|
||||
}
|
||||
return request(
|
||||
subgraphUrl,
|
||||
graphTotalTokenTVLQuery,
|
||||
{
|
||||
block: ethBlock
|
||||
}
|
||||
)
|
||||
return data
|
||||
}
|
||||
|
||||
async function borrowed(timestamp, ethBlock) {
|
||||
let total = BigNumber(0)
|
||||
const { pools } = await getData(ethBlock);
|
||||
pools.forEach(pool=>{
|
||||
total = total.plus(pool.assetValue)
|
||||
})
|
||||
let total = BigNumber(0)
|
||||
const { pools } = await getData(ethBlock);
|
||||
pools.forEach(pool => {
|
||||
total = total.plus(pool.assetValue)
|
||||
})
|
||||
|
||||
return {
|
||||
[dai]: total.toFixed(0)
|
||||
}
|
||||
return {
|
||||
[dai]: total.toFixed(0)
|
||||
}
|
||||
}
|
||||
|
||||
async function tvl(timestamp, ethBlock) {
|
||||
let total = BigNumber(0)
|
||||
const { pools } = await getData(ethBlock);
|
||||
pools.forEach(pool=>{
|
||||
total = total.plus(pool.reserve)
|
||||
})
|
||||
let total = BigNumber(0)
|
||||
const { pools } = await getData(ethBlock);
|
||||
pools.forEach(pool => {
|
||||
total = total.plus(pool.reserve)
|
||||
})
|
||||
|
||||
return {
|
||||
[dai]: total.toFixed(0)
|
||||
}
|
||||
return {
|
||||
[dai]: total.toFixed(0)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -58,8 +55,8 @@ async function tvl(timestamp, ethBlock) {
|
||||
module.exports = {
|
||||
doublecounted: false,
|
||||
methodology: 'TVL consist of the sum of every pool. The pool value is made up of the NAV (the value of the assets in the pool) and the Pool Reserve (undeployed capital in the pool). The Tinlake subgraph is used to pull the assetValue and reserve values of each pool.',
|
||||
ethereum:{
|
||||
tvl,
|
||||
ethereum: {
|
||||
tvl,
|
||||
borrowed,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user