Skip to content

Commit 8aca105

Browse files
committed
fix harmony
1 parent 85c2115 commit 8aca105

File tree

16 files changed

+46
-33
lines changed

16 files changed

+46
-33
lines changed

projects/comfymoney/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const sdk = require("@defillama/sdk");
22
const { unwrapUniswapLPs } = require("../helper/unwrapLPs");
33
const { staking } = require("../helper/staking");
4-
const { fixHarmonyBalances } = require("../helper/portedTokens");
4+
const { getFixBalances } = require("../helper/portedTokens");
55
const { getBlock } = require("../helper/getBlock");
66

77
const comfyTokenAddress = "0x702f78E81Cf3DfaE89648b5a9e2e1aa8db1De546";
@@ -49,7 +49,7 @@ async function calcPool2(block, chain) {
4949
chain,
5050
(addr) => `${chain}:${addr}`
5151
);
52-
fixHarmonyBalances(balances);
52+
(await getFixBalances('harmony'))(balances);
5353
return balances;
5454
}
5555

projects/defikingdoms/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const { calculateUniTvl } = require("../helper/calculateUniTvl");
22
const { staking } = require("../helper/staking");
33
const { getBlock } = require("../helper/getBlock");
4-
const { fixHarmonyBalances, transformHarmonyAddress } = require("../helper/portedTokens");
4+
const { getFixBalances, } = require("../helper/portedTokens");
55

66
/*
77
const { request, gql } = require("graphql-request");
@@ -38,7 +38,7 @@ async function tvl(timestamp, _ethBlock, chainBlocks) {
3838
0,
3939
true
4040
);
41-
fixHarmonyBalances(balances)
41+
(await getFixBalances('harmony'))(balances);
4242
delete balances["harmony:0xed0b4b0f0e2c17646682fc98ace09feb99af3ade"]
4343

4444
return balances

projects/dogeswap-org/index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
const { getUniTVL } = require('../helper/unknownTokens')
2+
const ethers = require("ethers")
3+
const { config } = require('@defillama/sdk/build/api');
4+
5+
config.setProvider("dogechain", new ethers.providers.StaticJsonRpcProvider(
6+
"https://rpc.dogechain.dog",
7+
{
8+
name: "dogechain",
9+
chainId: 2000,
10+
}
11+
))
212

313
module.exports = {
414
misrepresentedTokens: true,

projects/euphoria/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const { staking } = require('../helper/staking');
22
const { sumTokensAndLPsSharedOwners } = require('../helper/unwrapLPs');
33
const { transformHarmonyAddress } = require('../helper/portedTokens');
44
const { getBlock } = require('../helper/getBlock');
5-
const { fixHarmonyBalances } = require('../helper/portedTokens');
5+
const { getFixBalances } = require('../helper/portedTokens');
66

77
const wagmiAddresses = {
88
staking: '0x95066025af40F7f7832f61422802cD1e13C23753',
@@ -46,7 +46,7 @@ async function tvl(time, ethBlock, chainBlocks) {
4646
transform
4747
);
4848

49-
fixHarmonyBalances(balances);
49+
(await getFixBalances('harmony'))(balances);
5050

5151
return balances;
5252
}

projects/fuzzfinance/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
const sdk = require("@defillama/sdk");
33
// const { toUSDTBalances } = require('../helper/balances');
44
const { calculateUniTvl } = require("../helper/calculateUniTvl");
5-
const { fixHarmonyBalances } = require("../helper/portedTokens");
5+
const { getFixBalances } = require("../helper/portedTokens");
66

77
const fuzz = "0x984b969a8e82f5ce1121ceb03f96ff5bb3f71fee";
88
const factory = "0x5245d2136dc79Df222f00695C0c29d0c4d0E98A6";
@@ -48,7 +48,7 @@ async function tvl(timestamp, block, chainBlocks) {
4848
0,
4949
true
5050
);
51-
fixHarmonyBalances(balances);
51+
(await getFixBalances('harmony'))(balances);
5252
return balances;
5353
}
5454

projects/helper/portedTokens.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,11 @@ async function getFixBalances(chain) {
214214
return fixBalancesMapping[chain] || dummyFn;
215215
}
216216

217+
function getFixBalancesSync(chain) {
218+
const dummyFn = i => i;
219+
return fixBalancesMapping[chain] || dummyFn;
220+
}
221+
217222
const fixBalancesMapping = {};
218223

219224
for (const chain of Object.keys(fixBalancesTokens)) {
@@ -278,4 +283,5 @@ module.exports = {
278283
transformArbitrumAddress,
279284
transformIotexAddress,
280285
stripTokenHeader,
286+
getFixBalancesSync,
281287
};

projects/onedaofinance/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const { ohmTvl } = require('../helper/ohm')
2-
const { fixHarmonyBalances } = require('../helper/portedTokens')
2+
const { getFixBalancesSync } = require('../helper/portedTokens')
33

44
const replacements = {
55
"0x224e64ec1bdce3870a6a6c777edd450454068fec":"0xa47c8bf37f92abed4a126bda807a7b7498661acd", //UST
@@ -20,5 +20,5 @@ module.exports= {
2020
["0xcf664087a5bb0237a0bad6742852ec6c8d69a27a", false], // WONE
2121
["0x224e64ec1bdce3870a6a6c777edd450454068fec", false] // WUST
2222
], "harmony", "0x9cAc73eA219e5F8a96485c937E2C8A617f7F4f37", "0x947394294F75D7502977AC6813FD99f77C2931ec",addr=>{
23-
return replacements[addr] || `harmony:${addr}`}, fixHarmonyBalances)
23+
return replacements[addr] || `harmony:${addr}`}, getFixBalancesSync('harmony'))
2424
}

projects/parrotegg/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const sdk = require("@defillama/sdk");
2-
const { transformArbitrumAddress, transformPolygonAddress, transformHarmonyAddress, fixHarmonyBalances } = require("../helper/portedTokens");
2+
const { transformArbitrumAddress, transformPolygonAddress, transformHarmonyAddress, getFixBalancesSync } = require("../helper/portedTokens");
33
const { addFundsInMasterChef } = require('../helper/masterchef');
44
const IOTEX_CG_MAPPING = require("./iotex_coingecko_mapping.json")
55
const STAKING_CONTRACT_ARBITRUM = "0x1cCf20F4eE3EFD291267c07268BEcbFDFd192311"; //MASTERCHEF ARBITRUM
@@ -62,7 +62,7 @@ const harmonyTvl = async (timestamp, ethBlock, chainBlocks) => {
6262
delete balances['0xC36769DFcDF05B2949F206FC34C8870707D33C89']; //TOKEN ADDRESS
6363
delete balances['0xC36769DFcDF05B2949F206FC34C8870707D33C89']; //TOKEN ADDRESS
6464

65-
fixHarmonyBalances(balances)
65+
getFixBalancesSync('harmony')(balances);
6666

6767
return balances;
6868
};

projects/qidao/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const { sumTokens, unwrapUniswapLPs } = require("../helper/unwrapLPs");
22
const sdk = require("@defillama/sdk");
33
const abi = require("./abi.json");
44
const { BigNumber } = require("bignumber.js");
5-
const { fixHarmonyBalances, getChainTransform } = require("../helper/portedTokens");
5+
const { getFixBalancesSync, getChainTransform } = require("../helper/portedTokens");
66
const { handleYearnTokens } = require("../creditum/helper.js");
77

88
async function handleMooTokens(balances, block, chain, tokens) {
@@ -533,7 +533,7 @@ async function harmony(timestamp, block, chainBlocks) {
533533
return `harmony:${addr}`;
534534
}
535535
);
536-
fixHarmonyBalances(balances);
536+
getFixBalancesSync('harmony')(balances);
537537
return balances;
538538
}
539539

projects/reverse/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const { ohmTvl } = require('../helper/ohm')
2-
const { fixHarmonyBalances } = require('../helper/portedTokens')
2+
const { getFixBalancesSync } = require('../helper/portedTokens')
33

44
const replacements = {
55
"0x224e64ec1bdce3870a6a6c777edd450454068fec":"0xa47c8bf37f92abed4a126bda807a7b7498661acd", //UST
@@ -13,4 +13,4 @@ module.exports = ohmTvl(treasury, [
1313
["0x224e64ec1bdce3870a6a6c777edd450454068fec", false],
1414
], "harmony", "0xeea71889c062c135014ec34825a1958c87a2ac61", "0xed0b4b0f0e2c17646682fc98ace09feb99af3ade", addr=>{
1515
return replacements[addr] ?? `harmony:${addr}`
16-
}, fixHarmonyBalances)
16+
}, getFixBalancesSync('harmony'))

0 commit comments

Comments
 (0)