Skip to content

Commit 402dffe

Browse files
authored
Merge pull request #1 from hyperithm/hyperithm
merge
2 parents c9bb075 + c05ce8d commit 402dffe

File tree

1 file changed

+99
-3
lines changed

1 file changed

+99
-3
lines changed

projects/hyperithm/index.js

Lines changed: 99 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,110 @@
1+
const ADDRESSES = require('../helper/coreAssets.json');
12
const { getCuratorExport } = require("../helper/curators");
23

4+
// MIDAS CONTRACTS CONFIGURATION
5+
const MIDAS_MHYPER = {
6+
ethereum: {
7+
token: '0x9b5528528656DBC094765E2abB79F293c21191B9',
8+
priceFeed: '0x43881b05c3be68b2d33eb70addf9f666c5005f68',
9+
},
10+
plasma: {
11+
token: '0xb31bea5c2a43f942a3800558b1aa25978da75f8a',
12+
priceFeed: '0xfc3e47c4da8f3a01ac76c3c5ecfbfc302e1a08f0',
13+
}
14+
};
15+
16+
const MIDAS_MXRP = {
17+
bsc: {
18+
token: '0xc8739fbBd54C587a2ad43b50CbcC30ae34FE9e34',
19+
priceFeed: '0x3BdE0b7B59769Ec00c44C77090D88feB4516E731',
20+
},
21+
xrplevm: {
22+
token: '0x06e0B0F1A644Bb9881f675Ef266CeC15a63a3d47',
23+
priceFeed: '0xFF64785Ee22D764F8E79812102d3Fa7f2d3437Af',
24+
}
25+
};
26+
27+
// MIDAS TVL CALCULATION
28+
async function getMidasTvl(api, config) {
29+
const totalSupply = await api.call({
30+
target: config.token,
31+
abi: 'uint256:totalSupply',
32+
});
33+
34+
const rate = await api.call({
35+
target: config.priceFeed,
36+
abi: 'int256:lastAnswer',
37+
});
38+
39+
const supply = Number(totalSupply) / 1e18;
40+
const sharePrice = Number(rate) / 1e8;
41+
return supply * sharePrice;
42+
}
43+
44+
// VAULT CONFIGURATIONS BY BLOCKCHAIN
345
const configs = {
446
methodology: 'Count all assets are deposited in all vaults curated by Hyperithm.',
547
blockchains: {
648
ethereum: {
749
morphoVaultOwners: [
8-
'0x16fa314141C76D4a0675f5e8e3CCBE4E0fA22C7c',
50+
'0xC56EA16EA06B0a6A7b3B03B2f48751e549bE40fD',
51+
'0x16fa314141C76D4a0675f5e8e3CCBE4E0fA22C7c'
52+
],
53+
euler: [
54+
'0x3cd3718f8f047aA32F775E2cb4245A164E1C99fB',
55+
]
56+
},
57+
arbitrum: {
58+
morphoVaultOwners: [
59+
'0xC56EA16EA06B0a6A7b3B03B2f48751e549bE40fD',
960
],
1061
},
62+
hyperliquid: {
63+
morphoVaultOwners: [
64+
'0x51afd54ff95c77A15E40E83DB020908f33557c97',
65+
],
66+
},
67+
plasma: {
68+
erc4626: [
69+
'0xb74760fd26400030620027dd29d19d74d514700e' // Gearbox Hyperithm USDT0
70+
]
71+
}
1172
}
12-
}
73+
};
74+
75+
const adapterExport = getCuratorExport(configs);
76+
77+
const ethereumTvl = adapterExport.ethereum.tvl;
78+
adapterExport.ethereum.tvl = async (api) => {
79+
await ethereumTvl(api);
80+
81+
const midasTvl = await getMidasTvl(api, MIDAS_MHYPER.ethereum);
82+
api.add(ADDRESSES.ethereum.USDC, midasTvl * 1e6);
83+
};
84+
85+
const plasmaTvl = adapterExport.plasma.tvl;
86+
adapterExport.plasma.tvl = async (api) => {
87+
await plasmaTvl(api);
88+
const midasTvl = await getMidasTvl(api, MIDAS_MHYPER.plasma);
89+
api.add(ADDRESSES.plasma.USDT0, midasTvl * 1e6);
90+
};
91+
92+
const bscTvl = adapterExport.bsc?.tvl;
93+
adapterExport.bsc = {
94+
tvl: async (api) => {
95+
if (bscTvl) await bscTvl(api);
96+
const xrpAmount = await getMidasTvl(api, MIDAS_MXRP.bsc);
97+
api.add("0x1D2F0da169ceB9fC7B3144628dB156f3F6c60dBE", xrpAmount * 1e18);
98+
}
99+
};
100+
101+
const xrplevmTvl = adapterExport.xrplevm?.tvl;
102+
adapterExport.xrplevm = {
103+
tvl: async (api) => {
104+
if (xrplevmTvl) await xrplevmTvl(api);
105+
const xrpAmount = await getMidasTvl(api, MIDAS_MXRP.xrplevm);
106+
api.add(ADDRESSES.xrplevm.XRP, xrpAmount * 1e18);
107+
}
108+
};
13109

14-
module.exports = getCuratorExport(configs)
110+
module.exports = adapterExport;

0 commit comments

Comments
 (0)