Skip to content

Commit

Permalink
reorg filters
Browse files Browse the repository at this point in the history
  • Loading branch information
MirthFutures committed Dec 30, 2024
1 parent e147423 commit 1809eb2
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/utils/getBalancerTradingFeeAndLstApr.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const getChainName = chain => {
export const getBalTradingAndLstApr = async (chain, poolAddresses) => {
let tradingAprMap = {};
let lstAprs = [];
let lstMap = {};
const api = 'https://api-v3.balancer.fi/graphql';

const queryString = `query apr {
Expand Down Expand Up @@ -59,22 +60,20 @@ export const getBalTradingAndLstApr = async (chain, poolAddresses) => {

const responseData = await data.json();

responseData.data.poolGetPools.forEach(pool => {
const poolAddressesLowerCase = poolAddresses.map(address => address.toLowerCase());

poolAddressesLowerCase.forEach(address => {
const poolAddressesLowerCase = poolAddresses.map(address => address.toLowerCase());
poolAddressesLowerCase.forEach(address => {
responseData.data.poolGetPools.forEach(pool => {
if (pool.address.toLowerCase() === address) {
let tradingApr = 0;
let lstApr = 0;
let lstApr = new BigNumber(0);
pool.dynamicData.aprItems.forEach(aprItem => {
if (aprItem.type === 'SWAP_FEE_24H') {
tradingApr = aprItem.apr;
} else if (aprItem.type === 'IB_YIELD') {
lstApr += aprItem.apr;
lstApr = lstApr.plus(new BigNumber(aprItem.apr));
}
});

tradingAprMap[pool.address] = new BigNumber(tradingApr);
tradingAprMap[address.address] = tradingApr;
lstAprs.push(lstApr);
}
});
Expand Down

0 comments on commit 1809eb2

Please sign in to comment.