diff --git a/adapters/beefy/hourly_blocks.csv b/adapters/beefy/hourly_blocks.csv index 2a3841cc..67294af4 100644 --- a/adapters/beefy/hourly_blocks.csv +++ b/adapters/beefy/hourly_blocks.csv @@ -13,4 +13,5 @@ number,timestamp 5784890,1718972096 6301186,1720005441 7643069,1722689579 -7848072,1723099948 \ No newline at end of file +7848072,1723099948 +8029967,1723464243 \ No newline at end of file diff --git a/adapters/beefy/src/sdk/breakdown/protocol_type/beefy_clm.ts b/adapters/beefy/src/sdk/breakdown/protocol_type/beefy_clm.ts index f465d675..a0a7f6eb 100644 --- a/adapters/beefy/src/sdk/breakdown/protocol_type/beefy_clm.ts +++ b/adapters/beefy/src/sdk/breakdown/protocol_type/beefy_clm.ts @@ -73,19 +73,28 @@ export const getBeefyClmVaultBreakdown = async ( abi: BeefyVaultV7Abi, }); - const [balance, totalSupply] = await Promise.all([ - vaultContract.read.balance({ blockNumber }), - vaultContract.read.totalSupply({ blockNumber }), - ]); + const underlyingContract = getContract({ + client, + address: vault.undelying_lp_address, + abi: BeefyVaultConcLiqAbi, + }); + + const [underlyingBalance, vaultTotalSupply, underlyingTotalSypply] = + await Promise.all([ + vaultContract.read.balance({ blockNumber }), + vaultContract.read.totalSupply({ blockNumber }), + underlyingContract.read.totalSupply({ blockNumber }), + ]); return { vault, blockNumber, - vaultTotalSupply: totalSupply, + vaultTotalSupply: vaultTotalSupply, isLiquidityEligible: underlyingClmBreakdown.isLiquidityEligible, balances: underlyingClmBreakdown.balances.map((tokenBalance) => ({ tokenAddress: tokenBalance.tokenAddress, - vaultBalance: (balance * tokenBalance.vaultBalance) / totalSupply, + vaultBalance: + (underlyingBalance * tokenBalance.vaultBalance) / underlyingTotalSypply, })), }; };