-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Closed
feat: adjust pumpbtc adapter #11482
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
c812cf2
adjust pumpbtc adapter
xianshui 3e6b698
adjust methodology
xianshui 29b718e
adjust methodology with btc addresses
xianshui 7d662a4
update
xianshui 712d098
update
xianshui 7b0c33f
update
xianshui 0ffe50d
Merge branch 'main' of https://github.com/DefiLlama/DefiLlama-Adapter…
xianshui d2ef270
update
xianshui 01baec3
update
xianshui dba5e4f
code refactor
g1nt0ki d31db7f
code refactor
g1nt0ki 9bfd413
update
xianshui 3f15b02
update btc staking address
xianshui File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: { | ||
'X-Dune-API-Key': 'ajYucyUuEIM3VCMRjUN2wyBAIXdYOUhK' | ||
}}) | ||
|
||
stakedAmount = res.data.result.rows[0].total || 0 | ||
} catch (e) { | ||
console.log('error:', e) | ||
} | ||
|
||
api.add(token, stakedAmount * 1e8) | ||
} | ||
} | ||
}) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?