From dba66454c143b3ef695d01d773f34c0daeed7a09 Mon Sep 17 00:00:00 2001 From: 0xprinc <0xprinc@gmail.com> Date: Mon, 13 Jan 2025 17:20:37 +0530 Subject: [PATCH] added url for lending and vault protocol (#1686) Co-authored-by: 0xprinc --- src/adaptors/fluid-lending/index.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/adaptors/fluid-lending/index.js b/src/adaptors/fluid-lending/index.js index a37861088d..763e01e67c 100644 --- a/src/adaptors/fluid-lending/index.js +++ b/src/adaptors/fluid-lending/index.js @@ -9,7 +9,6 @@ const CONSTANTS = { arbitrum: 42161, base: 8453, }, - // SUPPORTED_CHAINS: ['ethereum'], SUPPORTED_CHAINS: ['ethereum', 'arbitrum', 'base'], RESOLVERS: { LENDING: { @@ -73,6 +72,7 @@ const getLendingApy = async (chain) => { chain, apyBase: Number((token.supplyRate / 1e2).toFixed(2)), apyReward: Number((token.rewardsRate / 1e12).toFixed(2)), + url: `https://fluid.instadapp.io/lending/${CONSTANTS.CHAIN_ID_MAPPING[chain]}/${symbol.output[i].output}`, })) .filter((i) => utils.keepFinite(i)); } catch (error) { @@ -84,7 +84,7 @@ const getLendingApy = async (chain) => { // Vault Functions const getVaultApy = async (chain) => { try { - const vaultsEntireData = ( + let vaultsEntireData = ( await sdk.api.abi.call({ target: CONSTANTS.RESOLVERS.VAULT[chain], abi: abiVaultResolver.find((m) => m.name === 'getVaultsEntireData'), @@ -92,6 +92,11 @@ const getVaultApy = async (chain) => { }) ).output; + vaultsEntireData = vaultsEntireData.map((vault, index) => ({ + ...vault, + VaultId: index + 1, + })); + const filteredVaults = vaultsEntireData.filter( (vault) => vault[1] === false && vault[2] === false ); @@ -223,6 +228,7 @@ const calculateVaultPoolData = ( ), ltv: vaultDetails.ltv[index] / 1e4, mintedCoin: borrowSymbol, + url: `https://fluid.instadapp.io/vaults/${CONSTANTS.CHAIN_ID_MAPPING[chain]}/${vault.VaultId}`, }; }); }; @@ -239,5 +245,4 @@ const apy = async () => { module.exports = { apy, - url: 'https://fluid.instadapp.io', };