Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/data-layer/fetchers/fetchTotalValueLocked.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const FETCH_TOTAL_VALUE_LOCKED_TASK_ID = "fetch-total-value-locked"
* Returns the latest total liquidity USD value for Ethereum.
*/
export async function fetchTotalValueLocked(): Promise<MetricReturnData> {
const url = "https://api.llama.fi/charts/Ethereum"
const url = "https://api.llama.fi/v2/historicalChainTvl/Ethereum"

console.log("Starting total value locked data fetch from DefiLlama")

Expand All @@ -26,7 +26,7 @@ export async function fetchTotalValueLocked(): Promise<MetricReturnData> {
}

// Today's value at end of array
const value = json[json.length - 1].totalLiquidityUSD
const value = json[json.length - 1].tvl
const timestamp = Date.now()

console.log("Successfully fetched total value locked data", {
Expand Down
4 changes: 2 additions & 2 deletions src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -588,8 +588,8 @@ export type EtherscanTxCountResponse = {
}

export type DefiLlamaTVLResponse = {
date: string
totalLiquidityUSD: number
date: number
tvl: number
}[]

export type MetricReturnData = ValueOrError<number>
Expand Down