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
37 changes: 31 additions & 6 deletions projects/pumpbtc/index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,42 @@
const { lock } = require('ethers')
const ADDRESSES = require('../helper/coreAssets.json')
const { default: axios } = require('axios')

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.',
methodology: 'TVL for pumpBTC is calculated based on the total value of WBTC, FBTC staked in the contract that were utilized in the minting process of pumpBTC.',
}
const config = {
ethereum: { owners: ['0x1fCca65fb6Ae3b2758b9b2B394CB227eAE404e1E', '0x3d9bCcA8Bc7D438a4c5171435f41a0AF5d5E6083'], tokens: ['0xC96dE26018A54D51c097160568752c4E3BD6C364', ADDRESSES.ethereum.WBTC], },
bsc: { owners: ['0x2Ee808F769AB697C477E0aF8357315069b66bCBb'], tokens: [ADDRESSES.bsc.BTCB], },
mantle: { owners: ['0xd6Ab15B2458B6EC3E94cE210174d860FdBdd6b96'], tokens: ['0xC96dE26018A54D51c097160568752c4E3BD6C364'], },
ethereum: { token: '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599' },
bsc: { token: '0xC96dE26018A54D51c097160568752c4E3BD6C364', },
mantle: { token: '0xC96dE26018A54D51c097160568752c4E3BD6C364', },
}

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

if (chain === 'ethereum') {
queryId = '3912607'
} else if (chain === 'bsc') {
queryId = '3911272'
} else {
queryId = '3947155'
}

try {
const res = await axios.get(`https://api.dune.com/api/v1/query/${queryId}/results?limit=1000`, {headers: {
Copy link
Member

Choose a reason for hiding this comment

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

hi @xianshui
total minted - burned will be supply right? We might as we read token supply.I guess the issue here, is no easy way to get babylon staking balance?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hi @g1nt0ki , thanks for this reply. Yes, (total minted - burned) counts as the total supply in our system. It is definitely no easy way to get babylon staking balance when querying. In this PR, it gets the total staked WBTC/FBTC amount which equal to the total supply of PumpBTC. We still want to know that can we calculating the total supply to represent the TVL?

'X-Dune-API-Key': 'ajYucyUuEIM3VCMRjUN2wyBAIXdYOUhK'
}})

stakedAmount = res.data.result.rows[0].total || 0
} catch (e) {
console.log('error:', e)
}

api.add(token, stakedAmount * 1e8)
}
}
})
Loading