Skip to content

Commit

Permalink
Maker triggers fork handling
Browse files Browse the repository at this point in the history
  • Loading branch information
piekczyk committed Sep 25, 2024
1 parent 85b9ca9 commit ae7bd93
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions features/automation/api/automationTriggersData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ async function loadTriggerDataFromSubgraph({
},
})) as SubgraphsResponses['Discover']['getMakerTriggersOld']

// handling for cases where testing on fork
// subgraph operates only on mainnet
if (!response.cdps[0]) {
return {
isAutomationDataLoaded: true,
isAutomationEnabled: false,
triggers: [],
chainId,
}
}

// get only active triggers
const triggers = response.cdps[0].triggers.filter(
(trigger) => !trigger.removedBlock && !trigger.executedBlock,
Expand Down

0 comments on commit ae7bd93

Please sign in to comment.