Skip to content
3 changes: 1 addition & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 18 additions & 2 deletions src/adaptors/lagoon/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ const gqlQueries = {
totalAssetsUsd
weeklyApr {
linearNetAprWithoutExtraYields
incentives {
apr
}
airdrops {
apr
}
}
}
}
Expand All @@ -66,18 +72,28 @@ const apy = async () => {
skip += 100;
}
const _pools = allVaults.map((vault) => {
const { linearNetAprWithoutExtraYields, incentives, airdrops } =
vault.state.weeklyApr;

const sumApr = (items) =>
items.reduce((acc, { apr }) => acc + (apr ?? 0), 0);

const apyBase = linearNetAprWithoutExtraYields || 0;
const apyReward = sumApr(incentives ?? []) + sumApr(airdrops ?? []) || 0;
if (apyBase === 0 && apyReward === 0) return null;
return {
pool: `lagoon-${vault.address}-${chain}`,
chain,
project: 'lagoon',
symbol: vault.symbol,
apyBase: vault.state.weeklyApr.linearNetAprWithoutExtraYields,
apyBase,
apyReward,
tvlUsd: vault.state.totalAssetsUsd || 0,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls add rewardTokens field

underlyingTokens: [vault.asset.address],
url: `https://app.lagoon.finance/vault/${vault.chain.id}/${vault.address}`,
};
});
pools = pools.concat(_pools);
pools = pools.concat(_pools.filter(Boolean));
}

return pools;
Expand Down
Loading