Skip to content
This repository was archived by the owner on Aug 12, 2023. It is now read-only.

Commit 98c5d63

Browse files
committed
Ensure taker is indexed properly
1 parent 86aa9a6 commit 98c5d63

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/index/fills/create-document.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ const calculateTradeCountContribution = relayerId => {
2929
const createDocument = fill => {
3030
const value = _.get(fill, 'conversions.USD.amount');
3131
const protocolFeeUSD = _.get(fill, 'conversions.USD.protocolFee');
32+
const taker = fill.takerMetadata.isContract
33+
? fill.transaction.from
34+
: fill.taker;
3235

3336
return {
3437
attributions: fill.attributions.map(attribution => ({
@@ -50,14 +53,14 @@ const createDocument = fill => {
5053
relayerId: fill.relayerId,
5154
senderAddress: fill.senderAddress,
5255
status: fill.status,
53-
taker: fill.takerMetadata.isContract ? fill.transaction.from : fill.taker,
56+
taker,
5457
transactionHash: fill.transactionHash,
5558
updatedAt: new Date(Date.now()).toISOString(),
5659
value: value === null ? undefined : value,
5760

5861
// This field helps to compute traderCount by allowing for cardinality
5962
// aggregation over maker & taker values.
60-
traders: [fill.maker, fill.taker],
63+
traders: [fill.maker, taker],
6164

6265
// These fields help to compute tradeVolume and tradeCount metrics in
6366
// Elasticsearch without the need for a 'trades' index.

0 commit comments

Comments
 (0)