Skip to content

Commit

Permalink
Fix apy for rootstock before we harvest if every 3 days (#1565)
Browse files Browse the repository at this point in the history
  • Loading branch information
prevostc authored Oct 15, 2024
1 parent d00d746 commit b38e579
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/api/cowcentrated/getCowVaultsMeta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ async function fetchCowVaultsMeta(chainId: ApiChain): Promise<AnyCowClmMeta[]> {
return [];
}

const url = `${BEEFY_CLM_API}/api/v1/vaults/${chainId}/1.1d`;
// rootstock is expensive to harvest so we don't harvest it as often
// ask the api to compute metrics over a longer period of time
// to ensure we have some data to base metrics on
const period = chainId === 'rootstock' ? '3.1d' : '1.1d';
const url = `${BEEFY_CLM_API}/api/v1/vaults/${chainId}/${period}`;
const response = await fetch(url);
if (!response.ok) {
throw new Error(
Expand All @@ -49,9 +53,7 @@ async function fetchCowVaultsMeta(chainId: ApiChain): Promise<AnyCowClmMeta[]> {
return pools.map(pool => {
const apiVault = data.find(v => isAddressEqual(v.vaultAddress, pool.address));
if (!apiVault) {
console.error(
`Missing vault data from CLM API for ${chainId} ${pool.oracleId} ${pool.address}`
);
console.error(`Missing vault data from CLM API for ${chainId} ${pool.oracleId} ${pool.address}`);
return {
...pool,
currentPrice: '0',
Expand Down

0 comments on commit b38e579

Please sign in to comment.