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

add new btc address #11270

Closed
wants to merge 1 commit into from
Closed
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
39 changes: 25 additions & 14 deletions projects/fbtc/index.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,38 @@
const { sumTokens } = require('../helper/chain/bitcoin')
const sdk = require('@defillama/sdk')
const sdk = require('@defillama/sdk');
const { sumTokens } = require('../helper/chain/bitcoin');

const staticAddresses = [
// https://docs.fbtc.com/security/bitcoin-reserve-address
'bc1qr5nz7n8ulcdz0w3s6fska80fawxhvqlh273qypm3rkjequ9wpmhs65ppw7',
'bc1q7jgulg69frc8zuzy0ng8d5208kae7t0twyfjwm',
'bc1q6c3c0t3zvnphce37ufr4yz9veaqvew2wg0shwr',
'3HjNJWcn2ayFLikzmKRaFtcbLufYChQo3T',
'374vhN24WryvNWUUZR2uDAnL4oNP5EW4qR',
]
];

const abi = {
getQualifiedUserInfo: "function getQualifiedUserInfo(address _user) view returns ((bool locked, string depositAddress, string withdrawalAddress) info)",
}
getQualifiedUserInfo:
'function getQualifiedUserInfo(address _user) view returns ((bool locked, string depositAddress, string withdrawalAddress) info)',
};

async function tvl() {
const api = new sdk.ChainApi({ chain: 'ethereum' })
const users = await api.call({ abi: 'address[]:getQualifiedUsers', target: '0xbee335BB44e75C4794a0b9B54E8027b111395943' })
const userInfos = await api.multiCall({ abi: abi.getQualifiedUserInfo, target: '0xbee335BB44e75C4794a0b9B54E8027b111395943', calls: users })
userInfos.forEach(i => staticAddresses.push(i.depositAddress))
return sumTokens({ owners: staticAddresses })
const api = new sdk.ChainApi({ chain: 'ethereum' });
const users = await api.call({
abi: 'address[]:getQualifiedUsers',
target: '0xbee335BB44e75C4794a0b9B54E8027b111395943',
});
const userInfos = await api.multiCall({
abi: abi.getQualifiedUserInfo,
target: '0xbee335BB44e75C4794a0b9B54E8027b111395943',
calls: users,
});
userInfos.forEach((info) => {
staticAddresses.push(info.depositAddress);
});
return sumTokens({ owners: staticAddresses });
}

module.exports = {
timetravel: false,
bitcoin: {
tvl,
}
}
bitcoin: { tvl },
};
Loading