Skip to content

Commit

Permalink
Prune optional methods in indexer and database interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
nikugogoi committed Nov 23, 2022
1 parent 034ec0b commit e61bd51
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/erc20-watcher/src/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ export class Database implements DatabaseInterface {
await this._baseDatabase.removeStates(repo, blockNumber, kind);
}

async removeStatesAfterBlock (dbTx: QueryRunner, blockNumber: number): Promise<void> {
const repo = dbTx.manager.getRepository(State);

await this._baseDatabase.removeStatesAfterBlock(repo, blockNumber);
}

async getStateSyncStatus (): Promise<StateSyncStatus | undefined> {
const repo = this._conn.getRepository(StateSyncStatus);

Expand Down
14 changes: 14 additions & 0 deletions packages/erc20-watcher/src/indexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,16 @@ export class Indexer implements IndexerInterface {
// TODO Implement
}

async processInitialState (contractAddress: string, blockHash: string): Promise<any> {
// TODO: Call initial state hook.
return undefined;
}

async processStateCheckpoint (contractAddress: string, blockHash: string): Promise<boolean> {
// TODO: Call checkpoint hook.
return false;
}

async processCheckpoint (blockHash: string): Promise<void> {
// TODO Implement
}
Expand Down Expand Up @@ -463,6 +473,10 @@ export class Indexer implements IndexerInterface {
this._baseIndexer.updateStateStatusMap(address, stateStatus);
}

cacheContract (contract: Contract): void {
return this._baseIndexer.cacheContract(contract);
}

async saveEventEntity (dbEvent: Event): Promise<Event> {
return this._baseIndexer.saveEventEntity(dbEvent);
}
Expand Down
6 changes: 6 additions & 0 deletions packages/uni-watcher/src/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ export class Database implements DatabaseInterface {
await this._baseDatabase.removeStates(repo, blockNumber, kind);
}

async removeStatesAfterBlock (dbTx: QueryRunner, blockNumber: number): Promise<void> {
const repo = dbTx.manager.getRepository(State);

await this._baseDatabase.removeStatesAfterBlock(repo, blockNumber);
}

async getStateSyncStatus (): Promise<StateSyncStatus | undefined> {
const repo = this._conn.getRepository(StateSyncStatus);

Expand Down
10 changes: 10 additions & 0 deletions packages/uni-watcher/src/indexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,16 @@ export class Indexer implements IndexerInterface {
// TODO Implement
}

async processInitialState (contractAddress: string, blockHash: string): Promise<any> {
// TODO: Call initial state hook.
return undefined;
}

async processStateCheckpoint (contractAddress: string, blockHash: string): Promise<boolean> {
// TODO: Call checkpoint hook.
return false;
}

async processCheckpoint (blockHash: string): Promise<void> {
// TODO Implement
}
Expand Down

0 comments on commit e61bd51

Please sign in to comment.