Skip to content

Commit

Permalink
Simplify patch
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-snx committed Nov 11, 2024
1 parent c8ad04a commit c0065f1
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions indexers-v2/patches/@subsquid+squid-gen-evm+1.2.1.patch
Original file line number Diff line number Diff line change
@@ -1,27 +1,16 @@
diff --git a/node_modules/@subsquid/squid-gen-evm/lib/core.js b/node_modules/@subsquid/squid-gen-evm/lib/core.js
index 2839b6f..823fce0 100644
index 2839b6f..902f4eb 100644
--- a/node_modules/@subsquid/squid-gen-evm/lib/core.js
+++ b/node_modules/@subsquid/squid-gen-evm/lib/core.js
@@ -28,6 +28,11 @@ class CoreCodegen {
this.printImports();
this.out.line();
let targetPrinter = this.getTargetPrinter();
+ this.out.line(`import { loadNetworkConfig } from './config'`);
+ this.out.line(`const networkName = process.env.NETWORK_NAME || 'arbitrum_mainnet'`);
+ this.out.line(`const configName = process.env.CONFIG_NAME || 'default'`);
+ this.out.line(`const config = loadNetworkConfig(networkName)`);
+ this.out.line(`const rangeTo = config.configs[configName].range.to`);
this.out.line(`processor.run(db, async (ctx) => {`);
this.out.indentation(() => {
targetPrinter.printPreBatch();
@@ -38,6 +43,13 @@ class CoreCodegen {
@@ -38,6 +38,14 @@ class CoreCodegen {
`new Date(block.header.timestamp)`,
]);
this.out.line();
+ this.out.block(`if (typeof rangeTo !== 'undefined' && block.header.height >= Number(rangeTo))`, () => {
+ let rangeTo = this.options.contracts[0].range.to;
+ this.out.block(`if (typeof ${rangeTo} !== 'undefined' && block.header.height >= Number(${rangeTo}))`, () => {
+ this.out.line(`ctx.store.setForceFlush(true)`);
+ });
+ this.out.block(`else if (typeof rangeTo === 'undefined')`, () => {
+ this.out.block(`else if (typeof ${rangeTo} === 'undefined')`, () => {
+ this.out.line(`ctx.store.setForceFlush(true)`);
+ });
+ this.out.line();
Expand Down

0 comments on commit c0065f1

Please sign in to comment.