This commit is contained in:
aozhiwei 2023-07-04 16:32:53 +08:00
parent 7a6bfcdeff
commit 7a5e7980c7
2 changed files with 5 additions and 4 deletions

View File

@ -8,11 +8,13 @@
"events": [ "events": [
{ {
"contract_name": "HERO", "contract_name": "HERO",
"event_name": "Transfer" "event_name": "Transfer",
"init_block": 22260860
}, },
{ {
"contract_name": "CHIP", "contract_name": "CHIP",
"event_name": "Transfer" "event_name": "Transfer",
"init_block": 22260860
} }
] ]
} }

View File

@ -9,7 +9,6 @@ class PullBcEvent extends BaseService {
async init(bc, net, event) { async init(bc, net, event) {
const {err, conn} = await app.getDbConn('BcEventDb0'); const {err, conn} = await app.getDbConn('BcEventDb0');
this.conn = conn; this.conn = conn;
console.log(err, conn);
this.lastBlockNumber = 0; this.lastBlockNumber = 0;
this.bc = bc; this.bc = bc;
this.net = net; this.net = net;
@ -34,7 +33,7 @@ class PullBcEvent extends BaseService {
const fromBlock = await this.getFromBlock(); const fromBlock = await this.getFromBlock();
const toBlock = await this.calcToBlock(fromBlock); const toBlock = await this.calcToBlock(fromBlock);
if (toBlock > fromBlock) { if (toBlock > fromBlock) {
const events = await bc[this.getInstanceName()].getPastEvents( const events = await this.bc[this.getInstanceName()].getPastEvents(
this.getEventName(), this.getEventName(),
{ {
fromBlock: fromBlock, fromBlock: fromBlock,