Skip to content

Commit

Permalink
fix: evm account mising
Browse files Browse the repository at this point in the history
  • Loading branch information
phamphong9981 committed Jul 29, 2024
1 parent ca9599b commit ffe48e1
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/services/evm/crawl_evm_account.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
Account,
AccountBalance,
BlockCheckpoint,
EvmInternalTransaction,
EVMTransaction,
} from '../../models';
import { BULL_JOB_NAME, SERVICE, ZERO_ADDRESS } from './constant';
Expand Down Expand Up @@ -77,15 +78,33 @@ export default class CrawlEvmAccountService extends BullableService {
.where('height', '>', startBlock)
.where('height', '<=', endBlock)
.orderBy('height', 'asc')
.select('from', 'to')
.select('from', 'to', 'contract_address as contractAddress')
.transacting(trx);
const participantsFromInternal = await EvmInternalTransaction.query()
.transacting(trx)
.joinRelated('evm_transaction')
.where('evm_transaction.height', '>', startBlock)
.andWhere('evm_transaction.height', '<=', endBlock)
.andWhere('evm_internal_transaction.error', null)
.select('from', 'to');
participants.forEach((partcicipant) => {
if (partcicipant.from !== ZERO_ADDRESS) {
accountsAddress.add(partcicipant.from);
}
if (partcicipant.to && partcicipant.to !== ZERO_ADDRESS) {
accountsAddress.add(partcicipant.to);
}
if (partcicipant.contractAddress) {
accountsAddress.add(partcicipant.contractAddress);
}
});
participantsFromInternal.forEach((participant) => {
if (participant.from !== ZERO_ADDRESS) {
accountsAddress.add(participant.from);
}
if (participant.to && participant.to !== ZERO_ADDRESS) {
accountsAddress.add(participant.to);
}
});
const [accountsInstances, height] = await this.getEvmAccountInstances(
Array.from(accountsAddress)
Expand Down

0 comments on commit ffe48e1

Please sign in to comment.