diff --git a/projects/etherfi-lrt/test.js b/projects/etherfi-lrt/test.js new file mode 100644 index 0000000000..9fb4d95d1c --- /dev/null +++ b/projects/etherfi-lrt/test.js @@ -0,0 +1,15 @@ +const { ethereum } = require('./index.js'); + +async function testTVL() { + try { + const timestamp = Math.floor(Date.now() / 1000); + const block = 'latest'; + + const result = await ethereum.tvl(timestamp, block); + console.log('TVL Result:', result); + } catch (error) { + console.error('Error:', error); + } +} + +testTVL(); \ No newline at end of file diff --git a/projects/lombard-liquid/index.js b/projects/lombard-liquid/index.js new file mode 100644 index 0000000000..06cfc850bd --- /dev/null +++ b/projects/lombard-liquid/index.js @@ -0,0 +1,22 @@ +const sdk = require("@defillama/sdk"); + +async function tvl(timestamp, block) { + const lbtcAddress = "0x8236a87084f8B84306f72007F36F2618A5634494"; + + const totalSupply = await sdk.api.erc20.totalSupply({ + target: lbtcAddress, + block + }); + + return { + bitcoin: totalSupply.output / 1e8 + }; +} + +module.exports = { + doublecounted: true, + ethereum: { + tvl, + }, + methodology: `TVL for LBTC consists of the total supply of the LBTC ERC-20 token on Ethereum, backed by locked Bitcoin`, +}; \ No newline at end of file diff --git a/projects/lombard-vault/index.js b/projects/lombard-vault/index.js new file mode 100644 index 0000000000..bf2dccc6c7 --- /dev/null +++ b/projects/lombard-vault/index.js @@ -0,0 +1,21 @@ +const axios = require('axios'); + +const vaultAddress = '0x5401b8620E5FB570064CA9114fd1e135fd77D57c'; + +async function fetchTVL() { + const response = await axios.get(`https://api.sevenseas.capital/hourlyData/ethereum/${vaultAddress}/1725321600/latest`); + const latestData = response.data.Response[0]; + return parseFloat(latestData.tvl); +} + +module.exports = { + doublecounted: true, + ethereum: { + tvl: async () => { + const tvl = await fetchTVL(); + return { + 'usd': tvl + }; + }, + }, +} \ No newline at end of file diff --git a/projects/lombard/index.js b/projects/lombard/index.js new file mode 100644 index 0000000000..4ca0729ebd --- /dev/null +++ b/projects/lombard/index.js @@ -0,0 +1,43 @@ +const { getConfig } = require('../helper/cache') +const { sumTokens } = require('../helper/chain/bitcoin') +const { get } = require('../helper/http') +const sdk = require('@defillama/sdk') + +const API_URL = 'https://mainnet.prod.lombard.finance/api/v1/addresses' +const BATCH_SIZE = 1000 + +async function getAllAddresses() { + let allAddresses = [] + let offset = 0 + let hasMore = true + let batchNumber = 1 + + while (hasMore) { + const response = await get(`${API_URL}?limit=${BATCH_SIZE}&offset=${offset}`) + const data = response.addresses + + const newAddresses = data.map(a => a.btc_address) + allAddresses = allAddresses.concat(newAddresses) + + sdk.log(`Batch ${batchNumber} completed: ${newAddresses.length} addresses`) + + hasMore = response.has_more + offset += BATCH_SIZE + batchNumber++ + } + + return allAddresses +} + +async function tvl() { + const addresses = await getConfig('lombard', undefined, { fetcher: getAllAddresses}) + return sumTokens({ owners: addresses }) +} + +module.exports = { + timetravel: false, + isHeavyProtocol: true, + bitcoin: { + tvl + } +} \ No newline at end of file