Skip to content

Commit

Permalink
fluid lending fix 2
Browse files Browse the repository at this point in the history
  • Loading branch information
slasher125 committed Jan 8, 2025
1 parent 6bb3041 commit ea8112c
Showing 1 changed file with 26 additions and 20 deletions.
46 changes: 26 additions & 20 deletions src/adaptors/fluid-lending/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,26 +199,32 @@ const calculateVaultPoolData = (
10 ** tokenData.borrowTokenDecimals[index]
);

return filteredVaults.map((vault, index) => ({
project: 'fluid-lending',
pool: `${chain}_${vaultDetails.pools[index]}`,
tvlUsd: totalSupplyUsd[index],
totalSupplyUsd: totalSupplyUsd[index],
totalBorrowUsd: totalBorrowUsd[index],
symbol: tokenData.symbol[index].replace('.base', ''),
underlyingTokens: vaultDetails.underlyingTokens[index],
rewardTokens: vaultDetails.underlyingTokens[index],
chain,
apyBase: Number((vaultDetails.supplyRates[index] / 1e2).toFixed(2)),
apyBaseBorrow: Number(
(vaultDetails.supplyRatesBorrow[index] / 1e2).toFixed(2)
),
apyReward: Number((vaultDetails.rewardsRates[index] / 1e12).toFixed(2)),
apyRewardBorrow: Number(
(vaultDetails.rewardsRatesBorrow[index] / 1e12).toFixed(2)
),
ltv: vaultDetails.ltv[index] / 1e4,
}));
return filteredVaults.map((vault, index) => {
const s = tokenData.symbol[index].replace('.base', '').split('/');
const supplySymbol = s[0];
const borrowSymbol = s[1];
return {
project: 'fluid-lending',
pool: `${chain}_${vaultDetails.pools[index]}`,
tvlUsd: totalSupplyUsd[index],
totalSupplyUsd: totalSupplyUsd[index],
totalBorrowUsd: totalBorrowUsd[index],
symbol: supplySymbol,
underlyingTokens: vaultDetails.underlyingTokens[index],
rewardTokens: vaultDetails.underlyingTokens[index],
chain,
apyBase: Number((vaultDetails.supplyRates[index] / 1e2).toFixed(2)),
apyBaseBorrow: Number(
(vaultDetails.supplyRatesBorrow[index] / 1e2).toFixed(2)
),
apyReward: Number((vaultDetails.rewardsRates[index] / 1e12).toFixed(2)),
apyRewardBorrow: Number(
(vaultDetails.rewardsRatesBorrow[index] / 1e12).toFixed(2)
),
ltv: vaultDetails.ltv[index] / 1e4,
mintedCoin: borrowSymbol,
};
});
};

// Main Function
Expand Down

0 comments on commit ea8112c

Please sign in to comment.