Skip to content

Commit

Permalink
fix(data-fetcher): calculate contract address for EVM transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
petarTxFusion committed Dec 10, 2024
1 parent 8ea4838 commit 75dbdbe
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/data-fetcher/src/transaction/transaction.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { types } from "zksync-ethers";
import { BlockchainService } from "../blockchain/blockchain.service";
import { TRANSACTION_PROCESSING_DURATION_METRIC_NAME, GET_TRANSACTION_INFO_DURATION_METRIC_NAME } from "../metrics";
import { LogService, LogsData } from "../log/log.service";
import { getCreateAddress } from "ethers";

export interface TransactionInfo extends types.TransactionResponse {
fee: string;
Expand Down Expand Up @@ -83,8 +84,9 @@ export class TransactionService {

const isEvmLike = transactionInfo.to === null;
const toAddress = isEvmLike ? "0x" : transactionInfo.to;
const contractAddress =
isEvmLike && logsData.contractAddresses?.length > 0 ? logsData.contractAddresses[0].address : "";
const contractAddress = isEvmLike
? getCreateAddress({ from: transactionInfo.from, nonce: transactionInfo.nonce })
: "";

const updatedTransactionInfo = {
...transactionInfo,
Expand Down

0 comments on commit 75dbdbe

Please sign in to comment.