Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating the Lombard Info #11526

Closed
wants to merge 6 commits into from
Closed
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
15 changes: 15 additions & 0 deletions projects/etherfi-lrt/test.js
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can test tvl of an adapter by running npm test projects/<adapterName>

I am tempted to reject this PR as it bring nothing new

Original file line number Diff line number Diff line change
@@ -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();
22 changes: 22 additions & 0 deletions projects/lombard-liquid/index.js
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added this to existing ether-fi vault listing

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*this was meant for lombard-vault listing

For this file, the backing of these tokens are already counted in lomard/inde.js on bitcoin side right?

Original file line number Diff line number Diff line change
@@ -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`,
};
21 changes: 21 additions & 0 deletions projects/lombard-vault/index.js
Original file line number Diff line number Diff line change
@@ -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
};
},
},
}
43 changes: 43 additions & 0 deletions projects/lombard/index.js
Original file line number Diff line number Diff line change
@@ -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
}
}
Loading