diff --git a/src/adaptors/amphor/index.js b/src/adaptors/amphor/index.js index 3d70ab0476..bc07768b9f 100644 --- a/src/adaptors/amphor/index.js +++ b/src/adaptors/amphor/index.js @@ -3,12 +3,13 @@ const sdk = require('@defillama/sdk'); const poolsFunction = async () => { - // const wbtc = "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599"; + const wbtc = "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599"; const wsteth = "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0"; - const prices = (await utils.getPrices([wsteth/*, wbtc*/], 'ethereum')) + const prices = (await utils.getPrices([wsteth, wbtc], 'ethereum')) .pricesByAddress; const usdcVaultAddress = '0x3b022EdECD65b63288704a6fa33A8B9185b5096b'; const wstethVaultAddress = '0x2791EB5807D69Fe10C02eED6B4DC12baC0701744'; + const wbtcVaultAddress = '0xC4A324fDF8a2495776B4d6cA46599B5a52f96489'; const ERC4626TotalAssets = { @@ -24,16 +25,20 @@ const poolsFunction = async () => { "stateMutability": "view", "type": "function" }; - const wstethAprData = await utils.getData( - 'https://app.amphor.io/api/apr?vaultSelected=ETH&networkId=1' + 'https://app.amphor.io/api/apr?vault=wstethVault' ); - const wstethApy = ((1 + Number(wstethAprData.apr)/2600) ** (26) - 1) * 100; + const wstethApy = ((1 + Number(JSON.stringify(wstethAprData.wstethVault.strategyNetAPR))/2600) ** (26) - 1) * 100; const usdcAprData = await utils.getData( - 'https://app.amphor.io/api/apr?vaultSelected=USDC&networkId=1' + 'https://app.amphor.io/api/apr?vault=usdcVault' + ); + const usdcApy = ((1 + Number(JSON.stringify(usdcAprData.usdcVault.strategyNetAPR))/2600) ** (26) - 1) * 100; + + const wbtcAprData = await utils.getData( + 'https://app.amphor.io/api/apr?vault=wbtcVault' ); - const usdcApy = ((1 + Number(usdcAprData.apr)/2600) ** (26) - 1) * 100; + const wbtcApy = ((1 + Number(JSON.stringify(wbtcAprData.wbtcVault.strategyNetAPR))/2600) ** (26) - 1) * 100; const usdcTotalAsset = await sdk.api.abi.call({ abi: ERC4626TotalAssets, @@ -45,6 +50,11 @@ const poolsFunction = async () => { chain: 'ethereum', target: wstethVaultAddress, }); + const wbtcTotalAsset = await sdk.api.abi.call({ + abi: ERC4626TotalAssets, + chain: 'ethereum', + target: wbtcVaultAddress, + }); const usdcPool = { pool: usdcVaultAddress, @@ -64,7 +74,16 @@ const poolsFunction = async () => { apy: wstethApy, }; - return [usdcPool, wstethPool]; + const wbtcPool = { + pool: wbtcVaultAddress, + chain: 'ethereum', + project: 'amphor', + symbol: utils.formatSymbol('WBTC'), + tvlUsd: (Number(wbtcTotalAsset.output)/1e18) * prices[wbtc.toLowerCase()], + apy: wbtcApy, + }; + + return [usdcPool, wstethPool, wbtcPool]; }; module.exports = {