Skip to content

Commit

Permalink
feedback revisions
Browse files Browse the repository at this point in the history
  • Loading branch information
themacexpert committed Nov 16, 2023
1 parent 038b95a commit a89f9f7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .snippets/code/tutorials/subsquid/main-with-logging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {assertNotNull} from '@subsquid/evm-processor'
import {TypeormDatabase} from '@subsquid/typeorm-store'
import * as erc20 from './abi/erc20'
import {Account, Transfer} from './model'
import {Block, CONTRACT_ADDRESS, Log, Transaction, ProcessorContext, processor} from './processor'
import {Block, CONTRACT_ADDRESS, Log, Transaction, processor} from './processor'

processor.run(new TypeormDatabase({supportHotBlocks: true}), async (ctx) => {
ctx.log.info('Processor started');
Expand Down
2 changes: 1 addition & 1 deletion .snippets/code/tutorials/subsquid/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {assertNotNull} from '@subsquid/evm-processor'
import {TypeormDatabase} from '@subsquid/typeorm-store'
import * as erc20 from './abi/erc20'
import {Account, Transfer} from './model'
import {Block, CONTRACT_ADDRESS, Log, Transaction, ProcessorContext, processor} from './processor'
import {Block, CONTRACT_ADDRESS, Log, Transaction, processor} from './processor'

processor.run(new TypeormDatabase({supportHotBlocks: true}), async (ctx) => {
let transfers: TransferEvent[] = []
Expand Down
8 changes: 3 additions & 5 deletions .snippets/code/tutorials/subsquid/processor.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {assertNotNull} from '@subsquid/util-internal'
import {lookupArchive} from '@subsquid/archive-registry'
import {
BlockHeader,
DataHandlerContext,
Expand All @@ -12,7 +11,7 @@ import {Store} from '@subsquid/typeorm-store'
import * as erc20 from './abi/erc20'

// Here you'll need to import the contract
export const CONTRACT_ADDRESS = 'INSERT_CONTRACT_ADDRESS'.toLowerCase();
export const contractAddress = 'INSERT_CONTRACT_ADDRESS'.toLowerCase();

export const processor = new EvmBatchProcessor()
.setDataSource({
Expand All @@ -32,7 +31,7 @@ export const processor = new EvmBatchProcessor()
},
})
.addLog({
address: [CONTRACT_ADDRESS],
address: [contractAddress],
topic0: [erc20.events.Transfer.topic],
transaction: true,
})
Expand All @@ -43,5 +42,4 @@ export const processor = new EvmBatchProcessor()
export type Fields = EvmBatchProcessorFields<typeof processor>
export type Block = BlockHeader<Fields>
export type Log = _Log<Fields>
export type Transaction = _Transaction<Fields>
export type ProcessorContext<Store> = DataHandlerContext<Store, Fields>
export type Transaction = _Transaction<Fields>
2 changes: 1 addition & 1 deletion builders/tutorials/subsquid.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ As mentioned, we'll first need to define the database schema for the transfer da
```


Now we can generate the entity classes from the schema, which we'll use when we process the transfer data:
Now we can generate the entity classes from the schema, which we'll use when we process the transfer data. This will create new classes for each entity in the `src/model/generated` directory.

```bash
sqd codegen
Expand Down

0 comments on commit a89f9f7

Please sign in to comment.