Skip to content

Commit

Permalink
refactor: erc20 balance big query (#902)
Browse files Browse the repository at this point in the history
  • Loading branch information
phamphong9981 authored Sep 12, 2024
1 parent 8a24294 commit 3c44725
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/services/evm/erc20_handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,10 +342,16 @@ export class Erc20Handler {
.joinRelated('account')
.whereIn(
['account.evm_address', 'denom'],
[
...erc20Activities.map((e) => [e.from, e.erc20_contract_address]),
...erc20Activities.map((e) => [e.to, e.erc20_contract_address]),
]
_.uniqWith(
[
...erc20Activities.map((e) => [
e.from,
e.erc20_contract_address,
]),
...erc20Activities.map((e) => [e.to, e.erc20_contract_address]),
],
_.isEqual
)
),
(o) => `${o.account_id}_${o.denom}`
);
Expand All @@ -354,7 +360,7 @@ export class Erc20Handler {
.transacting(trx)
.whereIn(
'address',
erc20Activities.map((e) => e.erc20_contract_address)
_.uniq(erc20Activities.map((e) => e.erc20_contract_address))
),
'address'
);
Expand Down

0 comments on commit 3c44725

Please sign in to comment.