From 4f1a93b7f5531097d713b4070dd2bb9d5ddaf2e2 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 2 Aug 2024 17:23:53 +0300 Subject: [PATCH] update yieldflow (#11168) --- projects/yieldflow/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/yieldflow/index.js b/projects/yieldflow/index.js index 867f5af47660..94b58c40caa6 100644 --- a/projects/yieldflow/index.js +++ b/projects/yieldflow/index.js @@ -1,3 +1,5 @@ +const ADDRESSES = require('../helper/coreAssets.json') + const abi = { "getCurrentTokenId": "function currentTokenId() view returns (uint)", "getPositions": "function positions(uint256 tokenId) view returns (uint96 nonce,address operator,address token0,address token1,uint24 fee,int24 tickLower,int24 tickUpper,uint128 liquidity,uint256 feeGrowthInside0LastX128,uint256 feeGrowthInside1LastX128,uint128 tokensOwed0,uint128 tokensOwed1)", @@ -73,11 +75,12 @@ async function tvl(api) { const liquidities = await api.multiCall({ abi: abi.getPositions, calls: positionManagers.map((v, i) => ({ target: v, params: tokenIds[i] })) }) const tokenAmounts = await api.multiCall({ abi: abi.getAmountsForTicks, calls: liquidities.map((v, i) => ({ target: managers[i], params: [v.tickLower, v.tickUpper, v.liquidity] })) }) + const ownerTokens = liquidities.map((v, i) => [[v.token0, v.token1, ADDRESSES.null], managers[i]]) liquidities.forEach((v, i) => { api.add(v.token0, tokenAmounts[i][0]) api.add(v.token1, tokenAmounts[i][1]) }) - return api.getBalances() + return api.sumTokens({ ownerTokens }) } module.exports = {