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 wstBfc #12610

Merged
merged 5 commits into from
Dec 12, 2024
Merged
Changes from 1 commit
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
28 changes: 26 additions & 2 deletions projects/bifi/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,41 @@ const chainPools = {
},
}

async function wstBfc(api) {
const wstBfc = await api.call({
target: '0x386f2F5d9A97659C86f3cA9B8B11fc3F76eFDdaE',
abi: "erc20:balanceOf",
params: ['0xf9B2f6D2a61923E61aD9F6DAA78f52b7e1722b12'],
});

const bfcAmount = await api.call({
target: '0x386f2F5d9A97659C86f3cA9B8B11fc3F76eFDdaE',
abi: "function getStBFCByWstBFC(uint256 _wstBFCAmount) external view returns (uint256)",
params: [wstBfc],
});

return bfcAmount
}


module.exports = {
bitcoin: {
tvl: bitcoin
},
}
};

Object.keys(chainPools).forEach(chain => {
const pools = chainPools[chain]
module.exports[chain] = {
tvl: async (api) => {
return sumTokens2({ api, tokensAndOwners: Object.values(pools).map(({ pool, token }) => ([token, pool,])) })
const tvl = await sumTokens2({ api, tokensAndOwners: Object.values(pools).map(({ pool, token }) => ([token, pool,])) });

if(chain === 'bfc') {
const wstBfcTvl = await wstBfc(api);
tvl[`bfc:${ADDRESSES.null}`] = String(Number(tvl[`bfc:${ADDRESSES.null}`]) + Number(wstBfcTvl));
}

return tvl
}
}
})
Expand Down
Loading