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

feat: adjust pumpbtc adapter #11482

Closed
wants to merge 13 commits into from
29 changes: 27 additions & 2 deletions projects/pumpbtc/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
const ADDRESSES = require('../helper/coreAssets.json')
const { sumTokens } = require('../helper/sumTokens');
const utils = require('../helper/utils');
const { getConfig } = require('../helper/cache')

module.exports = {
methodology: 'TVL for pumpBTC is calculated based on the total value of WBTC, FBTC, BTCB held in the contract that were utilized in the minting process of pumpBTC.',
Expand All @@ -7,11 +10,33 @@ const config = {
ethereum: { owners: ['0x1fCca65fb6Ae3b2758b9b2B394CB227eAE404e1E', '0x3d9bCcA8Bc7D438a4c5171435f41a0AF5d5E6083'], tokens: ['0xC96dE26018A54D51c097160568752c4E3BD6C364', ADDRESSES.ethereum.WBTC], },
bsc: { owners: ['0x2Ee808F769AB697C477E0aF8357315069b66bCBb'], tokens: [ADDRESSES.bsc.BTCB], },
mantle: { owners: ['0xd6Ab15B2458B6EC3E94cE210174d860FdBdd6b96'], tokens: ['0xC96dE26018A54D51c097160568752c4E3BD6C364'], },
bitcoin: {},
}

Object.keys(config).forEach(chain => {
const { owners, tokens, } = config[chain]
module.exports[chain] = {
tvl: async (api) => api.sumTokens({ owners, tokens })

if (chain === 'bitcoin') {
module.exports[chain] = {
tvl:
async (api) => {
const addresses = await getConfig('pumpbtc', undefined, { fetcher: getStakingAddresses })
return sumTokens({ api, owners: addresses })
}
}
} else {
module.exports[chain] = {
tvl: async (api) => api.sumTokens({ owners, tokens })
}
}
})

async function getStakingAddresses() {
let res = await utils.fetchURL('https://dashboard.pumpbtc.xyz/api/dashboard/btc/addresses')

const btcAddresses = res.data.data || []
//console.log('>>', btcAddresses.length)
return btcAddresses
}

module.exports.isHeavyProtocol = true
Loading