oswap remove dupes

This commit is contained in:
slasher125
2023-03-08 14:39:03 +04:00
parent 871d230fcc
commit fd0e36f530

View File

@@ -2,29 +2,30 @@ const utils = require('../utils');
const OSWAP_STATS_ENDPOINT = 'https://v2-stats.oswap.io/api/v1';
const LIQUIDITY_PROVIDER_ENDPOINT = 'https://liquidity.obyte.org';
const COMMON_DATA = { chain: "Obyte", project: 'oswap' };
const COMMON_DATA = { chain: 'Obyte', project: 'oswap' };
const poolsFunction = async () => {
const poolsData = await utils.getData(
`${OSWAP_STATS_ENDPOINT}/yield`
);
const poolsData = await utils.getData(`${OSWAP_STATS_ENDPOINT}/yield`);
const apyRewards = await utils.getData(
`${LIQUIDITY_PROVIDER_ENDPOINT}/mining-apy`
);
const apyRewards = await utils.getData(
`${LIQUIDITY_PROVIDER_ENDPOINT}/mining-apy`
);
return poolsData.map(({ address, pool, apyBase, ...rest }) => ({
url: `https://oswap.io/#/swap/${address}`,
apyReward: apyRewards[address] || null,
apyBase,
rewardTokens: ['GBYTE'],
pool: `${address}-obyte`.toLowerCase(),
...rest,
...COMMON_DATA
})).filter(({ apyBase }) => apyBase !== null);
return poolsData
.map(({ address, pool, apyBase, ...rest }) => ({
url: `https://oswap.io/#/swap/${address}`,
apyReward: apyRewards[address] || null,
apyBase,
rewardTokens: ['GBYTE'],
pool: `${address}-obyte`.toLowerCase(),
...rest,
...COMMON_DATA,
}))
.filter(({ apyBase }) => apyBase !== null)
.filter((p) => p.symbol !== 'O-GBYTE-WBTC-WBTC');
};
module.exports = {
timetravel: false,
apy: poolsFunction,
};
timetravel: false,
apy: poolsFunction,
};