From 578a50c22660118a863be117c0a0f61e885eff34 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 27 Apr 2022 20:13:35 +0530 Subject: [PATCH] Fix adapter for metacrona, cougarswap --- projects/cougarswap/index.js | 2 +- projects/helper/masterchef.js | 6 +++++- projects/helper/utils.js | 4 ++++ projects/metacrono-finance/index.js | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/projects/cougarswap/index.js b/projects/cougarswap/index.js index 202089431..c06047554 100644 --- a/projects/cougarswap/index.js +++ b/projects/cougarswap/index.js @@ -39,5 +39,5 @@ module.exports = { ...masterChefExports(MasterChefContractCronos, "cronos", CGS_Cronos, false), ...masterChefExports(MasterChefContractMoonbeam, "moonbeam", CGS_Moonbeam, false), methodology: - "TVL includes all Farms and Pools seccion through MasterChef Contracts", + "TVL includes all Farms and Pools seccion through MasterChef Contracts" }; diff --git a/projects/helper/masterchef.js b/projects/helper/masterchef.js index d92b79b24..5464a4b60 100644 --- a/projects/helper/masterchef.js +++ b/projects/helper/masterchef.js @@ -8,7 +8,7 @@ const getReservesAbi = require("./abis/getReserves.json"); const userInfoAbi = require("./abis/userInfo.json"); const { getBlock } = require('./getBlock'); const { default: BigNumber } = require('bignumber.js'); -const { getChainTransform } = require('../helper/portedTokens'); +const { getChainTransform, getFixBalances } = require('../helper/portedTokens'); async function getPoolInfo(masterChef, block, chain, poolInfoAbi = abi.poolInfo) { const poolLength = ( @@ -274,6 +274,10 @@ function masterChefExports(masterChef, chain, stakingTokenRaw, tokenIsOnCoingeck }) } + if (chain === 'cronos') { + const fixBalances = await getFixBalances(chain) + Object.values(balances).map(fixBalances) + } balanceResolve(balances) return balances.tvl }; diff --git a/projects/helper/utils.js b/projects/helper/utils.js index 670d0a35b..5676faa6d 100644 --- a/projects/helper/utils.js +++ b/projects/helper/utils.js @@ -121,6 +121,10 @@ function createIncrementArray(length) { function isLP(symbol) { if (!symbol) return false + if (symbol.startsWith('ZLK-LP')) { + console.log('Blacklisting Zenlink LP because they have different abi for get reservers', symbol) + return false + } return symbol.includes('LP') || symbol.includes('PGL') || symbol.includes('UNI-V2') || symbol === "PNDA-V2" || symbol.includes('GREEN-V2') } diff --git a/projects/metacrono-finance/index.js b/projects/metacrono-finance/index.js index 46ee745c1..77bf16584 100644 --- a/projects/metacrono-finance/index.js +++ b/projects/metacrono-finance/index.js @@ -4,5 +4,5 @@ const token = "0x92926DAcCE437955aa47F0DFC7F5C8FCd728b36E"; const masterchef = "0x5F680E57778651f7Cb14678655822ABc469acacf"; module.exports = { - ...masterChefExports(masterchef, "cronos", token, false) + ...masterChefExports(masterchef, "cronos", token, false), } \ No newline at end of file