Skip to content

Commit c05ce8d

Browse files
committed
add mXRP
1 parent c919b51 commit c05ce8d

File tree

1 file changed

+32
-3
lines changed

1 file changed

+32
-3
lines changed

projects/hyperithm/index.js

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,32 @@ const MIDAS_MHYPER = {
1313
}
1414
};
1515

16+
const MIDAS_MXRP = {
17+
bsc: {
18+
token: '0xc8739fbBd54C587a2ad43b50CbcC30ae34FE9e34',
19+
priceFeed: '0x3BdE0b7B59769Ec00c44C77090D88feB4516E731',
20+
},
21+
xrplevm: {
22+
token: '0x06e0B0F1A644Bb9881f675Ef266CeC15a63a3d47',
23+
priceFeed: '0xFF64785Ee22D764F8E79812102d3Fa7f2d3437Af',
24+
}
25+
};
26+
1627
// MIDAS TVL CALCULATION
1728
async function getMidasTvl(api, config) {
1829
const totalSupply = await api.call({
1930
target: config.token,
2031
abi: 'uint256:totalSupply',
2132
});
2233

23-
const price = await api.call({
34+
const rate = await api.call({
2435
target: config.priceFeed,
2536
abi: 'int256:lastAnswer',
2637
});
2738

2839
const supply = Number(totalSupply) / 1e18;
29-
const priceUSD = Number(price) / 1e8;
30-
return supply * priceUSD;
40+
const sharePrice = Number(rate) / 1e8;
41+
return supply * sharePrice;
3142
}
3243

3344
// VAULT CONFIGURATIONS BY BLOCKCHAIN
@@ -78,4 +89,22 @@ adapterExport.plasma.tvl = async (api) => {
7889
api.add(ADDRESSES.plasma.USDT0, midasTvl * 1e6);
7990
};
8091

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+
};
109+
81110
module.exports = adapterExport;

0 commit comments

Comments
 (0)