@@ -29,6 +29,9 @@ const calculateTradeCountContribution = relayerId => {
2929const 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