Skip to content

Commit

Permalink
Remove merkl check
Browse files Browse the repository at this point in the history
  • Loading branch information
prevostc committed Dec 9, 2024
1 parent e0c09e9 commit 702f1bd
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 109 deletions.
32 changes: 0 additions & 32 deletions src/lib/harvest-chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import {
reportOnMultipleHarvestAsyncCall,
reportOnSingleHarvestAsyncCall,
} from './harvest-report';
import { type MerklTokenData, fetchMerklTokenData, hasPendingMerklRewards } from './merkl';
import type { BeefyVault } from './vault';

const logger = rootLogger.child({ module: 'harvest-chain' });
Expand Down Expand Up @@ -101,7 +100,6 @@ export async function harvestChain({
paused: false,
blockNumber: 0n,
harvestResultData: '0x',
merklTokenData: null,
gas: createGasEstimationReport({
rawGasPrice,
rawGasAmountEstimation: 0n,
Expand All @@ -124,25 +122,6 @@ export async function harvestChain({
const timeSinceLastHarvestMs = now.getTime() - lastHarvestDate.getTime();
const isLastHarvestRecent = timeSinceLastHarvestMs < rpcConfig.harvest.targetTimeBetweenHarvestsMs;

// fetch merkl token data if there is no estimated rewards
// this is just for the case where it's a vault that only has merkl rewards
const merklTokenData: MerklTokenData | null = null;

// TODO: re-enable this.
// this is supposed to be a fallback for when the lens returns 0 rewards
// but it's not working as expected and vaults get harvested every time the script runs
// instead of every 24 hours.
// if (callReward === 0n) {
// try {
// merklTokenData = await fetchMerklTokenData(item.vault);
// } catch (error) {
// logger.error({
// msg: 'Error fetching merkl token data',
// data: { error, vault: item.vault },
// });
// }
// }

return {
estimatedCallRewardsWei: callReward,
harvestWillSucceed: success,
Expand All @@ -152,7 +131,6 @@ export async function harvestChain({
paused,
blockNumber,
harvestResultData: harvestResult,
merklTokenData: merklTokenData,
gas: createGasEstimationReport({
rawGasPrice,
rawGasAmountEstimation: gasUsed,
Expand Down Expand Up @@ -299,16 +277,6 @@ export async function harvestChain({
}

if (item.simulation.estimatedCallRewardsWei === 0n) {
// sometimes the lens returns 0 rewards but there are still pending merkl rewards
if (item.simulation.merklTokenData && hasPendingMerklRewards(item.simulation.merklTokenData)) {
return {
shouldHarvest: true,
level: 'info',
merklTokenData: item.simulation.merklTokenData,
notHarvestingReason: 'estimated call rewards is 0, but there are pending merkl rewards',
};
}

if (item.simulation.isLastHarvestRecent) {
return {
shouldHarvest: false,
Expand Down
8 changes: 0 additions & 8 deletions src/lib/harvest-report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import type { Async, TimingData } from '../util/async';
import type { Chain } from './chain';
import type { CollectorBalance } from './collector-balance';
import type { GasEstimationReport } from './gas';
import type { MerklTokenData } from './merkl';
import type { ReportAsyncStatus } from './report-error-status';
import { type AItem, type AKey, type AVal, reportOnMultipleAsyncCall, reportOnSingleAsyncCall } from './reports';
import type { BeefyVault } from './vault';
Expand Down Expand Up @@ -38,7 +37,6 @@ type HarvestReportSimulation = Async<{
paused: boolean;
blockNumber: bigint;
harvestResultData: Hex;
merklTokenData: MerklTokenData | null;
}>;

export type HarvestReportDecision = Async<
Expand Down Expand Up @@ -105,12 +103,6 @@ export type HarvestReportDecision = Async<
level: 'info';
notHarvestingReason: 'strategy paused';
}
| {
shouldHarvest: true;
level: 'info';
merklTokenData: MerklTokenData;
notHarvestingReason: 'estimated call rewards is 0, but there are pending merkl rewards';
}
| {
shouldHarvest: false;
level: 'info';
Expand Down
69 changes: 0 additions & 69 deletions src/lib/merkl.ts

This file was deleted.

0 comments on commit 702f1bd

Please sign in to comment.