From 7671dfde1c8d88dc13a839915b7d4fb851c96eae Mon Sep 17 00:00:00 2001 From: Roman Petriv Date: Fri, 13 Oct 2023 01:48:22 +0300 Subject: [PATCH 1/5] feat: improve indexing for token transfers --- packages/api/src/token/token.entity.ts | 1 + .../src/transfer/addressTransfer.entity.ts | 7 ++- packages/api/src/transfer/transfer.entity.ts | 7 ++- packages/api/src/transfer/transfer.service.ts | 6 +- .../src/entities/addressTransfer.entity.ts | 7 ++- packages/worker/src/entities/token.entity.ts | 6 ++ .../worker/src/entities/transfer.entity.ts | 6 +- .../1697149578188-AddTokenTransferIndexes.ts | 55 +++++++++++++++++++ .../finalizeDeposit/default.handler.ts | 10 ++-- .../mint/ethMintFromL1.handler.ts | 2 + .../contractDeployerTransfer.handler.ts | 2 + .../transfer/default.handler.ts | 6 +- .../transfer/erc721Transfer.handler.ts | 2 + .../withdrawal/ethWithdrawalToL1.handler.ts | 2 + .../withdrawalInitiated/default.handler.ts | 10 ++-- .../transfer/interfaces/transfer.interface.ts | 2 + 16 files changed, 113 insertions(+), 18 deletions(-) create mode 100644 packages/worker/src/migrations/1697149578188-AddTokenTransferIndexes.ts diff --git a/packages/api/src/token/token.entity.ts b/packages/api/src/token/token.entity.ts index 2dbbdfaf17..5c4b55f6e5 100644 --- a/packages/api/src/token/token.entity.ts +++ b/packages/api/src/token/token.entity.ts @@ -3,6 +3,7 @@ import { BaseEntity } from "../common/entities/base.entity"; import { normalizeAddressTransformer } from "../common/transformers/normalizeAddress.transformer"; export enum TokenType { + ETH = "ETH", ERC20 = "ERC20", ERC721 = "ERC721", } diff --git a/packages/api/src/transfer/addressTransfer.entity.ts b/packages/api/src/transfer/addressTransfer.entity.ts index 597b32ff20..65e9677020 100644 --- a/packages/api/src/transfer/addressTransfer.entity.ts +++ b/packages/api/src/transfer/addressTransfer.entity.ts @@ -1,12 +1,14 @@ import { Entity, Column, Index, ManyToOne, JoinColumn, PrimaryColumn } from "typeorm"; import { BaseEntity } from "../common/entities/base.entity"; import { Transfer } from "./transfer.entity"; +import { TokenType } from "../token/token.entity"; import { bigIntNumberTransformer } from "../common/transformers/bigIntNumber.transformer"; import { normalizeAddressTransformer } from "../common/transformers/normalizeAddress.transformer"; @Entity({ name: "addressTransfers" }) @Index(["address", "isFeeOrRefund", "timestamp", "logIndex"]) -@Index(["address", "tokenAddress", "fields", "blockNumber", "logIndex"]) +@Index(["address", "tokenType", "blockNumber", "logIndex"]) +@Index(["address", "tokenAddress", "blockNumber", "logIndex"]) export class AddressTransfer extends BaseEntity { @PrimaryColumn({ generated: true, type: "bigint" }) public readonly number: number; @@ -32,6 +34,9 @@ export class AddressTransfer extends BaseEntity { @Column({ type: "timestamp" }) public readonly timestamp: Date; + @Column({ type: "enum", enum: TokenType, default: TokenType.ETH }) + public readonly tokenType: TokenType; + @Column({ type: "boolean" }) public readonly isFeeOrRefund: boolean; diff --git a/packages/api/src/transfer/transfer.entity.ts b/packages/api/src/transfer/transfer.entity.ts index f079a21a52..213fdff959 100644 --- a/packages/api/src/transfer/transfer.entity.ts +++ b/packages/api/src/transfer/transfer.entity.ts @@ -1,6 +1,6 @@ import { Entity, Column, Index, ManyToOne, JoinColumn, PrimaryColumn } from "typeorm"; import { BaseEntity } from "../common/entities/base.entity"; -import { Token } from "../token/token.entity"; +import { Token, TokenType } from "../token/token.entity"; import { normalizeAddressTransformer } from "../common/transformers/normalizeAddress.transformer"; import { bigIntNumberTransformer } from "../common/transformers/bigIntNumber.transformer"; import { hexTransformer } from "../common/transformers/hex.transformer"; @@ -19,7 +19,7 @@ export enum TransferType { @Index(["blockNumber", "logIndex"]) @Index(["transactionHash", "timestamp", "logIndex"]) @Index(["tokenAddress", "isFeeOrRefund", "timestamp", "logIndex"]) -@Index(["tokenAddress", "fields", "blockNumber", "logIndex"]) +@Index(["tokenAddress", "blockNumber", "logIndex"]) export class Transfer extends BaseEntity { @PrimaryColumn({ generated: true, type: "bigint", select: false }) public number: number; @@ -64,6 +64,9 @@ export class Transfer extends BaseEntity { @Column({ type: "enum", enum: TransferType, default: TransferType.Transfer }) public readonly type: TransferType; + @Column({ type: "enum", enum: TokenType, default: TokenType.ETH }) + public readonly tokenType: TokenType; + @Column({ type: "boolean", select: false }) public readonly isFeeOrRefund: boolean; diff --git a/packages/api/src/transfer/transfer.service.ts b/packages/api/src/transfer/transfer.service.ts index d038bfa55d..36b69bca6b 100644 --- a/packages/api/src/transfer/transfer.service.ts +++ b/packages/api/src/transfer/transfer.service.ts @@ -105,15 +105,14 @@ export class TransferService { queryBuilder.addSelect(["transactionReceipt.gasUsed", "transactionReceipt.cumulativeGasUsed"]); queryBuilder.where({ address, - fields: tokenType === TokenType.ERC721 ? Not(IsNull()) : IsNull(), }); if (tokenAddress) { queryBuilder.andWhere(`"addressTransfer"."tokenAddress" = :tokenAddress`, { tokenAddress: normalizeAddressTransformer.to(tokenAddress), }); } else { - queryBuilder.andWhere(`"addressTransfer"."tokenAddress" != :tokenAddress`, { - tokenAddress: normalizeAddressTransformer.to(L2_ETH_TOKEN_ADDRESS), + queryBuilder.andWhere(`"addressTransfer"."tokenType" = :tokenType`, { + tokenType, }); } if (startBlock !== undefined) { @@ -154,7 +153,6 @@ export class TransferService { queryBuilder.addSelect(["transactionReceipt.gasUsed", "transactionReceipt.cumulativeGasUsed"]); queryBuilder.where({ tokenAddress, - fields: tokenType === TokenType.ERC721 ? Not(IsNull()) : IsNull(), }); if (startBlock !== undefined) { queryBuilder.andWhere({ diff --git a/packages/worker/src/entities/addressTransfer.entity.ts b/packages/worker/src/entities/addressTransfer.entity.ts index f06de60459..edf6fe5177 100644 --- a/packages/worker/src/entities/addressTransfer.entity.ts +++ b/packages/worker/src/entities/addressTransfer.entity.ts @@ -2,6 +2,7 @@ import { Entity, Column, ManyToOne, JoinColumn, Index, PrimaryColumn } from "typ import { BaseEntity } from "./base.entity"; import { Block } from "./block.entity"; import { Transfer } from "./transfer.entity"; +import { TokenType } from "./token.entity"; import { hexTransformer } from "../transformers/hex.transformer"; import { bigIntNumberTransformer } from "../transformers/bigIntNumber.transformer"; import { transferFieldsTransformer } from "../transformers/transferFields.transformer"; @@ -9,7 +10,8 @@ import { TransferFields } from "../transfer/interfaces/transfer.interface"; @Entity({ name: "addressTransfers" }) @Index(["address", "isFeeOrRefund", "timestamp", "logIndex"]) -@Index(["address", "tokenAddress", "fields", "blockNumber", "logIndex"]) +@Index(["address", "tokenAddress", "blockNumber", "logIndex"]) +@Index(["address", "tokenType", "blockNumber", "logIndex"]) @Index(["address", "isInternal", "blockNumber", "logIndex"]) export class AddressTransfer extends BaseEntity { @PrimaryColumn({ generated: true, type: "bigint" }) @@ -40,6 +42,9 @@ export class AddressTransfer extends BaseEntity { @Column({ type: "timestamp" }) public readonly timestamp: Date; + @Column({ type: "enum", enum: TokenType, default: TokenType.ETH }) + public readonly tokenType: TokenType; + @Column({ type: "boolean" }) public readonly isFeeOrRefund: boolean; diff --git a/packages/worker/src/entities/token.entity.ts b/packages/worker/src/entities/token.entity.ts index 9e306c7797..50e1219de4 100644 --- a/packages/worker/src/entities/token.entity.ts +++ b/packages/worker/src/entities/token.entity.ts @@ -5,6 +5,12 @@ import { bigIntNumberTransformer } from "../transformers/bigIntNumber.transforme import { hexTransformer } from "../transformers/hex.transformer"; import { BaseEntity } from "./base.entity"; +export enum TokenType { + ETH = "ETH", + ERC20 = "ERC20", + ERC721 = "ERC721", +} + @Entity({ name: "tokens" }) @Check(`"symbol" <> ''`) @Index(["blockNumber", "logIndex"]) diff --git a/packages/worker/src/entities/transfer.entity.ts b/packages/worker/src/entities/transfer.entity.ts index 12fbc1a4ed..5aee62f47a 100644 --- a/packages/worker/src/entities/transfer.entity.ts +++ b/packages/worker/src/entities/transfer.entity.ts @@ -3,6 +3,7 @@ import { BigNumber } from "ethers"; import { CountableEntity } from "./countable.entity"; import { Block } from "./block.entity"; import { Transaction } from "./transaction.entity"; +import { TokenType } from "./token.entity"; import { bigNumberTransformer } from "../transformers/bigNumber.transformer"; import { transferFieldsTransformer } from "../transformers/transferFields.transformer"; import { hash64HexTransformer } from "../transformers/hash64Hex.transformer"; @@ -22,7 +23,7 @@ export enum TransferType { @Entity({ name: "transfers" }) @Index(["transactionHash", "timestamp", "logIndex"]) @Index(["tokenAddress", "isFeeOrRefund", "timestamp", "logIndex"]) -@Index(["tokenAddress", "fields", "blockNumber", "logIndex"]) +@Index(["tokenAddress", "blockNumber", "logIndex"]) @Index(["transactionHash", "isInternal", "blockNumber", "logIndex"]) @Index(["isInternal", "blockNumber", "logIndex"]) export class Transfer extends CountableEntity { @@ -65,6 +66,9 @@ export class Transfer extends CountableEntity { @Column({ type: "enum", enum: TransferType, default: TransferType.Transfer }) public readonly type: TransferType; + @Column({ type: "enum", enum: TokenType, default: TokenType.ETH }) + public readonly tokenType: TokenType; + @Column({ type: "boolean" }) public readonly isFeeOrRefund: boolean; diff --git a/packages/worker/src/migrations/1697149578188-AddTokenTransferIndexes.ts b/packages/worker/src/migrations/1697149578188-AddTokenTransferIndexes.ts new file mode 100644 index 0000000000..7e7082471a --- /dev/null +++ b/packages/worker/src/migrations/1697149578188-AddTokenTransferIndexes.ts @@ -0,0 +1,55 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class AddTokenTransferIndexes1697149578188 implements MigrationInterface { + name = "AddTokenTransferIndexes1697149578188"; + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`CREATE TYPE "public"."transfers_tokentype_enum" AS ENUM('ETH', 'ERC20', 'ERC721')`); + await queryRunner.query( + `ALTER TABLE "transfers" ADD "tokenType" "public"."transfers_tokentype_enum" NOT NULL DEFAULT 'ETH'` + ); + + await queryRunner.query(`UPDATE "transfers" SET "tokenType" = 'ERC721' WHERE "fields" IS NOT NULL`); + await queryRunner.query( + `UPDATE "transfers" SET "tokenType" = 'ERC20' WHERE "tokenAddress" != decode('000000000000000000000000000000000000800a', 'hex') AND "fields" IS NULL` + ); + + await queryRunner.query(`CREATE TYPE "public"."addressTransfers_tokentype_enum" AS ENUM('ETH', 'ERC20', 'ERC721')`); + await queryRunner.query( + `ALTER TABLE "addressTransfers" ADD "tokenType" "public"."addressTransfers_tokentype_enum" NOT NULL DEFAULT 'ETH'` + ); + + await queryRunner.query(`UPDATE "addressTransfers" SET "tokenType" = 'ERC721' WHERE "fields" IS NOT NULL`); + await queryRunner.query( + `UPDATE "addressTransfers" SET "tokenType" = 'ERC20' WHERE "tokenAddress" != decode('000000000000000000000000000000000000800a', 'hex') AND "fields" IS NULL` + ); + + await queryRunner.query( + `CREATE INDEX "IDX_81191c296b89f6e7bbe819b995" ON "transfers" ("tokenAddress", "blockNumber", "logIndex") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_e3a14ae1d50aa1835187e4bb4a" ON "addressTransfers" ("address", "tokenType", "blockNumber", "logIndex") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_aa3c56addbb167c7d036a7dc1e" ON "addressTransfers" ("address", "tokenAddress", "blockNumber", "logIndex") ` + ); + await queryRunner.query(`DROP INDEX "public"."IDX_fb96732095e7d0512f39f8a83b"`); + await queryRunner.query(`DROP INDEX "public"."IDX_cda11ccd43f408399fa92067c0"`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `CREATE INDEX "IDX_cda11ccd43f408399fa92067c0" ON "addressTransfers" ("address", "blockNumber", "logIndex", "tokenAddress", "fields") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_fb96732095e7d0512f39f8a83b" ON "transfers" ("blockNumber", "fields", "tokenAddress", "logIndex") ` + ); + await queryRunner.query(`DROP INDEX "public"."IDX_aa3c56addbb167c7d036a7dc1e"`); + await queryRunner.query(`DROP INDEX "public"."IDX_e3a14ae1d50aa1835187e4bb4a"`); + await queryRunner.query(`DROP INDEX "public"."IDX_81191c296b89f6e7bbe819b995"`); + await queryRunner.query(`ALTER TABLE "addressTransfers" DROP COLUMN "tokenType"`); + await queryRunner.query(`DROP TYPE "public"."addressTransfers_tokentype_enum"`); + await queryRunner.query(`ALTER TABLE "transfers" DROP COLUMN "tokenType"`); + await queryRunner.query(`DROP TYPE "public"."transfers_tokentype_enum"`); + } +} diff --git a/packages/worker/src/transfer/extractHandlers/finalizeDeposit/default.handler.ts b/packages/worker/src/transfer/extractHandlers/finalizeDeposit/default.handler.ts index 8171429843..db5f0f2c04 100644 --- a/packages/worker/src/transfer/extractHandlers/finalizeDeposit/default.handler.ts +++ b/packages/worker/src/transfer/extractHandlers/finalizeDeposit/default.handler.ts @@ -2,6 +2,7 @@ import { utils, types } from "zksync-web3"; import { Transfer } from "../../interfaces/transfer.interface"; import { ExtractTransferHandler } from "../../interfaces/extractTransferHandler.interface"; import { TransferType } from "../../../entities/transfer.entity"; +import { TokenType } from "../../../entities/token.entity"; import { unixTimeToDate } from "../../../utils/date"; import parseLog from "../../../utils/parseLog"; import { CONTRACT_INTERFACES } from "../../../constants"; @@ -14,17 +15,18 @@ export const defaultFinalizeDepositHandler: ExtractTransferHandler = { transactionDetails?: types.TransactionDetails ): Transfer => { const parsedLog = parseLog(CONTRACT_INTERFACES.L2_BRIDGE, log); + const tokenAddress = + parsedLog.args.l2Token === utils.ETH_ADDRESS ? utils.L2_ETH_TOKEN_ADDRESS : parsedLog.args.l2Token.toLowerCase(); + return { from: parsedLog.args.l1Sender.toLowerCase(), to: parsedLog.args.l2Receiver.toLowerCase(), transactionHash: log.transactionHash, blockNumber: log.blockNumber, amount: parsedLog.args.amount, - tokenAddress: - parsedLog.args.l2Token === utils.ETH_ADDRESS - ? utils.L2_ETH_TOKEN_ADDRESS - : parsedLog.args.l2Token.toLowerCase(), + tokenAddress, type: TransferType.Deposit, + tokenType: tokenAddress === utils.L2_ETH_TOKEN_ADDRESS ? TokenType.ETH : TokenType.ERC20, isFeeOrRefund: false, logIndex: log.logIndex, transactionIndex: log.transactionIndex, diff --git a/packages/worker/src/transfer/extractHandlers/mint/ethMintFromL1.handler.ts b/packages/worker/src/transfer/extractHandlers/mint/ethMintFromL1.handler.ts index c040854f3f..7b0a0220d9 100644 --- a/packages/worker/src/transfer/extractHandlers/mint/ethMintFromL1.handler.ts +++ b/packages/worker/src/transfer/extractHandlers/mint/ethMintFromL1.handler.ts @@ -2,6 +2,7 @@ import { utils, types } from "zksync-web3"; import { Transfer } from "../../interfaces/transfer.interface"; import { ExtractTransferHandler } from "../../interfaces/extractTransferHandler.interface"; import { TransferType } from "../../../entities/transfer.entity"; +import { TokenType } from "../../../entities/token.entity"; import { unixTimeToDate } from "../../../utils/date"; import parseLog from "../../../utils/parseLog"; import { CONTRACT_INTERFACES } from "../../../constants"; @@ -23,6 +24,7 @@ export const ethMintFromL1Handler: ExtractTransferHandler = { amount: parsedLog.args.amount, tokenAddress: utils.L2_ETH_TOKEN_ADDRESS, type: TransferType.Deposit, + tokenType: TokenType.ETH, isFeeOrRefund: false, logIndex: log.logIndex, transactionIndex: log.transactionIndex, diff --git a/packages/worker/src/transfer/extractHandlers/transfer/contractDeployerTransfer.handler.ts b/packages/worker/src/transfer/extractHandlers/transfer/contractDeployerTransfer.handler.ts index f9be96b4ba..76e0cbf12e 100644 --- a/packages/worker/src/transfer/extractHandlers/transfer/contractDeployerTransfer.handler.ts +++ b/packages/worker/src/transfer/extractHandlers/transfer/contractDeployerTransfer.handler.ts @@ -3,6 +3,7 @@ import { ExtractTransferHandler } from "../../interfaces/extractTransferHandler. import { Transfer } from "../../interfaces/transfer.interface"; import { ZERO_HASH_64 } from "../../../constants"; import { TransferType } from "../../../entities/transfer.entity"; +import { TokenType } from "../../../entities/token.entity"; import { unixTimeToDate } from "../../../utils/date"; import parseLog from "../../../utils/parseLog"; import { CONTRACT_INTERFACES } from "../../../constants"; @@ -28,6 +29,7 @@ export const contractDeployerTransferHandler: ExtractTransferHandler = { amount: parsedLog.args.value, tokenAddress: log.address.toLowerCase(), type: TransferType.Mint, + tokenType: TokenType.ERC20, isFeeOrRefund: false, logIndex: log.logIndex, transactionIndex: log.transactionIndex, diff --git a/packages/worker/src/transfer/extractHandlers/transfer/default.handler.ts b/packages/worker/src/transfer/extractHandlers/transfer/default.handler.ts index da5fe8bf2e..e14f386a1c 100644 --- a/packages/worker/src/transfer/extractHandlers/transfer/default.handler.ts +++ b/packages/worker/src/transfer/extractHandlers/transfer/default.handler.ts @@ -2,6 +2,7 @@ import { utils, types } from "zksync-web3"; import { Transfer } from "../../interfaces/transfer.interface"; import { ExtractTransferHandler } from "../../interfaces/extractTransferHandler.interface"; import { TransferType } from "../../../entities/transfer.entity"; +import { TokenType } from "../../../entities/token.entity"; import { unixTimeToDate } from "../../../utils/date"; import parseLog from "../../../utils/parseLog"; import { CONTRACT_INTERFACES } from "../../../constants"; @@ -22,14 +23,17 @@ export const defaultTransferHandler: ExtractTransferHandler = { transferType = TransferType.Refund; } + const tokenAddress = log.address.toLowerCase(); + return { from: parsedLog.args.from.toLowerCase(), to: parsedLog.args.to.toLowerCase(), transactionHash: log.transactionHash, blockNumber: log.blockNumber, amount: parsedLog.args.value, - tokenAddress: log.address.toLowerCase(), + tokenAddress, type: transferType, + tokenType: tokenAddress === utils.L2_ETH_TOKEN_ADDRESS ? TokenType.ETH : TokenType.ERC20, isFeeOrRefund: [TransferType.Fee, TransferType.Refund].includes(transferType), logIndex: log.logIndex, transactionIndex: log.transactionIndex, diff --git a/packages/worker/src/transfer/extractHandlers/transfer/erc721Transfer.handler.ts b/packages/worker/src/transfer/extractHandlers/transfer/erc721Transfer.handler.ts index d3b7b2f50e..e7245281c2 100644 --- a/packages/worker/src/transfer/extractHandlers/transfer/erc721Transfer.handler.ts +++ b/packages/worker/src/transfer/extractHandlers/transfer/erc721Transfer.handler.ts @@ -2,6 +2,7 @@ import { utils, types } from "zksync-web3"; import { Transfer } from "../../interfaces/transfer.interface"; import { ExtractTransferHandler } from "../../interfaces/extractTransferHandler.interface"; import { TransferType } from "../../../entities/transfer.entity"; +import { TokenType } from "../../../entities/token.entity"; import { unixTimeToDate } from "../../../utils/date"; import parseLog from "../../../utils/parseLog"; import { CONTRACT_INTERFACES } from "../../../constants"; @@ -34,6 +35,7 @@ export const erc721TransferHandler: ExtractTransferHandler = { }, tokenAddress: log.address.toLowerCase(), type, + tokenType: TokenType.ERC721, isFeeOrRefund: false, logIndex: log.logIndex, transactionIndex: log.transactionIndex, diff --git a/packages/worker/src/transfer/extractHandlers/withdrawal/ethWithdrawalToL1.handler.ts b/packages/worker/src/transfer/extractHandlers/withdrawal/ethWithdrawalToL1.handler.ts index c16d599bdf..c561eb88db 100644 --- a/packages/worker/src/transfer/extractHandlers/withdrawal/ethWithdrawalToL1.handler.ts +++ b/packages/worker/src/transfer/extractHandlers/withdrawal/ethWithdrawalToL1.handler.ts @@ -2,6 +2,7 @@ import { utils, types } from "zksync-web3"; import { Transfer } from "../../interfaces/transfer.interface"; import { ExtractTransferHandler } from "../../interfaces/extractTransferHandler.interface"; import { TransferType } from "../../../entities/transfer.entity"; +import { TokenType } from "../../../entities/token.entity"; import { unixTimeToDate } from "../../../utils/date"; import parseLog from "../../../utils/parseLog"; import { CONTRACT_INTERFACES } from "../../../constants"; @@ -22,6 +23,7 @@ export const ethWithdrawalToL1Handler: ExtractTransferHandler = { amount: parsedLog.args._amount, tokenAddress: utils.L2_ETH_TOKEN_ADDRESS, type: TransferType.Withdrawal, + tokenType: TokenType.ETH, isFeeOrRefund: false, logIndex: log.logIndex, transactionIndex: log.transactionIndex, diff --git a/packages/worker/src/transfer/extractHandlers/withdrawalInitiated/default.handler.ts b/packages/worker/src/transfer/extractHandlers/withdrawalInitiated/default.handler.ts index 31379c8bab..287ccf10d4 100644 --- a/packages/worker/src/transfer/extractHandlers/withdrawalInitiated/default.handler.ts +++ b/packages/worker/src/transfer/extractHandlers/withdrawalInitiated/default.handler.ts @@ -2,6 +2,7 @@ import { utils, types } from "zksync-web3"; import { Transfer } from "../../interfaces/transfer.interface"; import { ExtractTransferHandler } from "../../interfaces/extractTransferHandler.interface"; import { TransferType } from "../../../entities/transfer.entity"; +import { TokenType } from "../../../entities/token.entity"; import { unixTimeToDate } from "../../../utils/date"; import parseLog from "../../../utils/parseLog"; import { CONTRACT_INTERFACES } from "../../../constants"; @@ -15,17 +16,18 @@ export const defaultWithdrawalInitiatedHandler: ExtractTransferHandler = { ): Transfer => { const parsedLog = parseLog(CONTRACT_INTERFACES.L2_BRIDGE, log); + const tokenAddress = + parsedLog.args.l2Token === utils.ETH_ADDRESS ? utils.L2_ETH_TOKEN_ADDRESS : parsedLog.args.l2Token.toLowerCase(); + return { from: parsedLog.args.l2Sender.toLowerCase(), to: parsedLog.args.l1Receiver.toLowerCase(), transactionHash: log.transactionHash, blockNumber: log.blockNumber, amount: parsedLog.args.amount, - tokenAddress: - parsedLog.args.l2Token === utils.ETH_ADDRESS - ? utils.L2_ETH_TOKEN_ADDRESS - : parsedLog.args.l2Token.toLowerCase(), + tokenAddress, type: TransferType.Withdrawal, + tokenType: tokenAddress === utils.L2_ETH_TOKEN_ADDRESS ? TokenType.ETH : TokenType.ERC20, isFeeOrRefund: false, logIndex: log.logIndex, transactionIndex: log.transactionIndex, diff --git a/packages/worker/src/transfer/interfaces/transfer.interface.ts b/packages/worker/src/transfer/interfaces/transfer.interface.ts index 42745379a0..b8197f9f15 100644 --- a/packages/worker/src/transfer/interfaces/transfer.interface.ts +++ b/packages/worker/src/transfer/interfaces/transfer.interface.ts @@ -1,5 +1,6 @@ import { BigNumber } from "ethers"; import { TransferType } from "../../entities/transfer.entity"; +import { TokenType } from "../../entities/token.entity"; export interface TransferFields { tokenId?: BigNumber; @@ -15,6 +16,7 @@ export interface Transfer { amount: BigNumber; tokenAddress: string; type: TransferType; + tokenType: TokenType; isFeeOrRefund: boolean; logIndex: number; fields?: TransferFields; From 0067dcb648d8c5d6d6d72eb9ac1be7cee4d2a505 Mon Sep 17 00:00:00 2001 From: Roman Petriv Date: Fri, 13 Oct 2023 02:20:11 +0300 Subject: [PATCH 2/5] test: add unit tests --- .../api/src/transfer/transfer.service.spec.ts | 37 +++---- packages/api/src/transfer/transfer.service.ts | 3 +- .../finalizeDeposit/default.handler.spec.ts | 3 + .../mint/ethMintFromL1.handler.spec.ts | 6 ++ .../contractDeployerTransfer.handler.spec.ts | 6 ++ .../transfer/default.handler.spec.ts | 3 + .../transfer/erc721Transfer.handle.spec.ts | 6 ++ .../ethWithdrawalToL1.handler.spec.ts | 6 ++ .../default.handler.spec.ts | 3 + .../src/transfer/transfer.service.spec.ts | 102 ++++++++++++++++++ 10 files changed, 153 insertions(+), 22 deletions(-) diff --git a/packages/api/src/transfer/transfer.service.spec.ts b/packages/api/src/transfer/transfer.service.spec.ts index 79df6df828..1334328b4b 100644 --- a/packages/api/src/transfer/transfer.service.spec.ts +++ b/packages/api/src/transfer/transfer.service.spec.ts @@ -228,18 +228,17 @@ describe("TransferService", () => { }); describe("when token type is ERC20", () => { - it("adds ERC20 filter", async () => { + it("adds tokenAddress filter", async () => { await service.findTokenTransfers(filterOptions); expect(queryBuilderMock.where).toBeCalledTimes(1); expect(queryBuilderMock.where).toHaveBeenCalledWith({ tokenAddress: filterOptions.tokenAddress, - fields: typeorm.IsNull(), }); }); }); describe("when token type is ERC721", () => { - it("adds ERC721 filter", async () => { + it("adds tokenAddress filter", async () => { await service.findTokenTransfers({ ...filterOptions, tokenType: TokenType.ERC721, @@ -247,7 +246,6 @@ describe("TransferService", () => { expect(queryBuilderMock.where).toBeCalledTimes(1); expect(queryBuilderMock.where).toHaveBeenCalledWith({ tokenAddress: "tokenAddress", - fields: typeorm.Not(typeorm.IsNull()), }); }); }); @@ -345,13 +343,19 @@ describe("TransferService", () => { }); describe("when token type is ERC20", () => { - it("adds ERC20 filter", async () => { + it("adds address and ERC20 filter", async () => { await service.findTokenTransfers(filterOptions); expect(addressTransfersQueryBuilderMock.where).toBeCalledTimes(1); expect(addressTransfersQueryBuilderMock.where).toHaveBeenCalledWith({ address: filterOptions.address, - fields: typeorm.IsNull(), }); + expect(addressTransfersQueryBuilderMock.andWhere).toBeCalledTimes(1); + expect(addressTransfersQueryBuilderMock.andWhere).toHaveBeenCalledWith( + `"addressTransfer"."tokenType" = :tokenType`, + { + tokenType: TokenType.ERC20, + } + ); }); }); @@ -364,8 +368,14 @@ describe("TransferService", () => { expect(addressTransfersQueryBuilderMock.where).toBeCalledTimes(1); expect(addressTransfersQueryBuilderMock.where).toHaveBeenCalledWith({ address: filterOptions.address, - fields: typeorm.Not(typeorm.IsNull()), }); + expect(addressTransfersQueryBuilderMock.andWhere).toBeCalledTimes(1); + expect(addressTransfersQueryBuilderMock.andWhere).toHaveBeenCalledWith( + `"addressTransfer"."tokenType" = :tokenType`, + { + tokenType: TokenType.ERC721, + } + ); }); }); @@ -385,19 +395,6 @@ describe("TransferService", () => { }); }); - describe("when token address is not specified", () => { - it("adds filter to exclude ETH token", async () => { - await service.findTokenTransfers(filterOptions); - expect(addressTransfersQueryBuilderMock.andWhere).toBeCalledTimes(1); - expect(addressTransfersQueryBuilderMock.andWhere).toHaveBeenCalledWith( - `"addressTransfer"."tokenAddress" != :tokenAddress`, - { - tokenAddress: normalizeAddressTransformer.to(L2_ETH_TOKEN_ADDRESS), - } - ); - }); - }); - it("joins transfers and tokens records to the address transfers", async () => { await service.findTokenTransfers(filterOptions); expect(addressTransfersQueryBuilderMock.leftJoinAndSelect).toBeCalledTimes(2); diff --git a/packages/api/src/transfer/transfer.service.ts b/packages/api/src/transfer/transfer.service.ts index 36b69bca6b..9e677a34d0 100644 --- a/packages/api/src/transfer/transfer.service.ts +++ b/packages/api/src/transfer/transfer.service.ts @@ -1,9 +1,8 @@ import { BadRequestException, Injectable } from "@nestjs/common"; import { InjectRepository } from "@nestjs/typeorm"; -import { Repository, FindOperator, MoreThanOrEqual, LessThanOrEqual, IsNull, Not } from "typeorm"; +import { Repository, FindOperator, MoreThanOrEqual, LessThanOrEqual } from "typeorm"; import { Pagination } from "nestjs-typeorm-paginate"; import { paginate } from "../common/utils"; -import { L2_ETH_TOKEN_ADDRESS } from "../common/constants"; import { IPaginationOptions, SortingOrder } from "../common/types"; import { Transfer } from "./transfer.entity"; import { TokenType } from "../token/token.entity"; diff --git a/packages/worker/src/transfer/extractHandlers/finalizeDeposit/default.handler.spec.ts b/packages/worker/src/transfer/extractHandlers/finalizeDeposit/default.handler.spec.ts index 4a32692f83..1c8f6eaa23 100644 --- a/packages/worker/src/transfer/extractHandlers/finalizeDeposit/default.handler.spec.ts +++ b/packages/worker/src/transfer/extractHandlers/finalizeDeposit/default.handler.spec.ts @@ -3,6 +3,7 @@ import { types, utils } from "zksync-web3"; import { mock } from "jest-mock-extended"; import { ZERO_HASH_64 } from "../../../constants"; import { TransferType } from "../../../entities/transfer.entity"; +import { TokenType } from "../../../entities/token.entity"; import { defaultFinalizeDepositHandler } from "./default.handler"; describe("defaultFinalizeDepositHandler", () => { @@ -66,11 +67,13 @@ describe("defaultFinalizeDepositHandler", () => { log.topics[3] = ZERO_HASH_64; const result = defaultFinalizeDepositHandler.extract(log, blockDetails); expect(result.tokenAddress).toBe(utils.L2_ETH_TOKEN_ADDRESS); + expect(result.tokenType).toBe(TokenType.ETH); }); it("extracts transfer with tokenAddress field populated with lower cased l2Token", () => { const result = defaultFinalizeDepositHandler.extract(log, blockDetails); expect(result.tokenAddress).toBe("0xdc187378edd8ed1585fb47549cc5fe633295d571"); + expect(result.tokenType).toBe(TokenType.ERC20); }); it("extracts transfer of deposit type", () => { diff --git a/packages/worker/src/transfer/extractHandlers/mint/ethMintFromL1.handler.spec.ts b/packages/worker/src/transfer/extractHandlers/mint/ethMintFromL1.handler.spec.ts index ec816e5442..ff6441d3cd 100644 --- a/packages/worker/src/transfer/extractHandlers/mint/ethMintFromL1.handler.spec.ts +++ b/packages/worker/src/transfer/extractHandlers/mint/ethMintFromL1.handler.spec.ts @@ -2,6 +2,7 @@ import { BigNumber } from "ethers"; import { types, utils } from "zksync-web3"; import { mock } from "jest-mock-extended"; import { TransferType } from "../../../entities/transfer.entity"; +import { TokenType } from "../../../entities/token.entity"; import { ethMintFromL1Handler } from "./ethMintFromL1.handler"; describe("ethMintFromL1Handler", () => { @@ -60,6 +61,11 @@ describe("ethMintFromL1Handler", () => { expect(result.blockNumber).toBe(215276); }); + it("extracts transfer with tokenType as ETH", () => { + const result = ethMintFromL1Handler.extract(log, blockDetails); + expect(result.tokenType).toBe(TokenType.ETH); + }); + it("extracts transfer with populated amount", () => { const result = ethMintFromL1Handler.extract(log, blockDetails); expect(result.amount).toStrictEqual(BigNumber.from("0x6f05b59d3b20000")); diff --git a/packages/worker/src/transfer/extractHandlers/transfer/contractDeployerTransfer.handler.spec.ts b/packages/worker/src/transfer/extractHandlers/transfer/contractDeployerTransfer.handler.spec.ts index c9c5195eea..57e64e8949 100644 --- a/packages/worker/src/transfer/extractHandlers/transfer/contractDeployerTransfer.handler.spec.ts +++ b/packages/worker/src/transfer/extractHandlers/transfer/contractDeployerTransfer.handler.spec.ts @@ -2,6 +2,7 @@ import { BigNumber } from "ethers"; import { types } from "zksync-web3"; import { mock } from "jest-mock-extended"; import { TransferType } from "../../../entities/transfer.entity"; +import { TokenType } from "../../../entities/token.entity"; import { contractDeployerTransferHandler } from "./contractDeployerTransfer.handler"; describe("contractDeployerTransferHandler", () => { @@ -117,6 +118,11 @@ describe("contractDeployerTransferHandler", () => { expect(result.type).toBe(TransferType.Mint); }); + it("extracts transfer with ERC20 token type", () => { + const result = contractDeployerTransferHandler.extract(log, blockDetails); + expect(result.tokenType).toBe(TokenType.ERC20); + }); + it("adds isFeeOrRefund as false", () => { const result = contractDeployerTransferHandler.extract(log, blockDetails); expect(result.isFeeOrRefund).toBe(false); diff --git a/packages/worker/src/transfer/extractHandlers/transfer/default.handler.spec.ts b/packages/worker/src/transfer/extractHandlers/transfer/default.handler.spec.ts index 31af1998b8..20c96ec742 100644 --- a/packages/worker/src/transfer/extractHandlers/transfer/default.handler.spec.ts +++ b/packages/worker/src/transfer/extractHandlers/transfer/default.handler.spec.ts @@ -2,6 +2,7 @@ import { BigNumber } from "ethers"; import { types, utils } from "zksync-web3"; import { mock } from "jest-mock-extended"; import { TransferType } from "../../../entities/transfer.entity"; +import { TokenType } from "../../../entities/token.entity"; import { defaultTransferHandler } from "./default.handler"; describe("defaultTransferHandler", () => { @@ -101,11 +102,13 @@ describe("defaultTransferHandler", () => { log.address = utils.L2_ETH_TOKEN_ADDRESS; const result = defaultTransferHandler.extract(log, blockDetails); expect(result.tokenAddress).toBe(utils.L2_ETH_TOKEN_ADDRESS); + expect(result.tokenType).toBe(TokenType.ETH); }); it("extracts transfer with tokenAddress field populated with lower cased log address", () => { const result = defaultTransferHandler.extract(log, blockDetails); expect(result.tokenAddress).toBe("0xc7e0220d02d549c4846a6ec31d89c3b670ebe35c"); + expect(result.tokenType).toBe(TokenType.ERC20); }); it("extracts transfer of fee type if to address is a bootloader address", () => { diff --git a/packages/worker/src/transfer/extractHandlers/transfer/erc721Transfer.handle.spec.ts b/packages/worker/src/transfer/extractHandlers/transfer/erc721Transfer.handle.spec.ts index ff2bb1050c..38b74f0a14 100644 --- a/packages/worker/src/transfer/extractHandlers/transfer/erc721Transfer.handle.spec.ts +++ b/packages/worker/src/transfer/extractHandlers/transfer/erc721Transfer.handle.spec.ts @@ -3,6 +3,7 @@ import { types } from "zksync-web3"; import { mock } from "jest-mock-extended"; import { ZERO_HASH_64 } from "../../../constants"; import { TransferType } from "../../../entities/transfer.entity"; +import { TokenType } from "../../../entities/token.entity"; import { erc721TransferHandler } from "./erc721Transfer.handler"; describe("erc721TransferHandler", () => { @@ -90,6 +91,11 @@ describe("erc721TransferHandler", () => { expect(result.tokenAddress).toBe("0x89bcb56033920b8a654109faeb1f87e0c3358cad"); }); + it("extracts transfer of ERC721 token type", () => { + const result = erc721TransferHandler.extract(log, blockDetails); + expect(result.tokenType).toBe(TokenType.ERC721); + }); + it("extracts transfer of transfer type if from address is not a zero address", () => { const result = erc721TransferHandler.extract(log, blockDetails); expect(result.type).toBe(TransferType.Transfer); diff --git a/packages/worker/src/transfer/extractHandlers/withdrawal/ethWithdrawalToL1.handler.spec.ts b/packages/worker/src/transfer/extractHandlers/withdrawal/ethWithdrawalToL1.handler.spec.ts index e762d72b3b..a279e45014 100644 --- a/packages/worker/src/transfer/extractHandlers/withdrawal/ethWithdrawalToL1.handler.spec.ts +++ b/packages/worker/src/transfer/extractHandlers/withdrawal/ethWithdrawalToL1.handler.spec.ts @@ -2,6 +2,7 @@ import { BigNumber } from "ethers"; import { types, utils } from "zksync-web3"; import { mock } from "jest-mock-extended"; import { TransferType } from "../../../entities/transfer.entity"; +import { TokenType } from "../../../entities/token.entity"; import { ethWithdrawalToL1Handler } from "./ethWithdrawalToL1.handler"; describe("ethWithdrawalToL1Handler", () => { @@ -76,6 +77,11 @@ describe("ethWithdrawalToL1Handler", () => { expect(result.type).toBe(TransferType.Withdrawal); }); + it("extracts transfer of ETH token type", () => { + const result = ethWithdrawalToL1Handler.extract(log, blockDetails); + expect(result.tokenType).toBe(TokenType.ETH); + }); + it("adds isFeeOrRefund as false", () => { const result = ethWithdrawalToL1Handler.extract(log, blockDetails); expect(result.isFeeOrRefund).toBe(false); diff --git a/packages/worker/src/transfer/extractHandlers/withdrawalInitiated/default.handler.spec.ts b/packages/worker/src/transfer/extractHandlers/withdrawalInitiated/default.handler.spec.ts index 502d675ce9..76e6cec0e1 100644 --- a/packages/worker/src/transfer/extractHandlers/withdrawalInitiated/default.handler.spec.ts +++ b/packages/worker/src/transfer/extractHandlers/withdrawalInitiated/default.handler.spec.ts @@ -3,6 +3,7 @@ import { types, utils } from "zksync-web3"; import { mock } from "jest-mock-extended"; import { ZERO_HASH_64 } from "../../../constants"; import { TransferType } from "../../../entities/transfer.entity"; +import { TokenType } from "../../../entities/token.entity"; import { defaultWithdrawalInitiatedHandler } from "./default.handler"; describe("defaultWithdrawalInitiatedHandler", () => { @@ -66,11 +67,13 @@ describe("defaultWithdrawalInitiatedHandler", () => { log.topics[3] = ZERO_HASH_64; const result = defaultWithdrawalInitiatedHandler.extract(log, blockDetails); expect(result.tokenAddress).toBe(utils.L2_ETH_TOKEN_ADDRESS); + expect(result.tokenType).toBe(TokenType.ETH); }); it("extracts transfer with tokenAddress field populated with lower cased l2Token", () => { const result = defaultWithdrawalInitiatedHandler.extract(log, blockDetails); expect(result.tokenAddress).toBe("0xdc187378edd8ed1585fb47549cc5fe633295d571"); + expect(result.tokenType).toBe(TokenType.ERC20); }); it("extracts transfer of deposit type", () => { diff --git a/packages/worker/src/transfer/transfer.service.spec.ts b/packages/worker/src/transfer/transfer.service.spec.ts index 48ee501648..682e70ad48 100644 --- a/packages/worker/src/transfer/transfer.service.spec.ts +++ b/packages/worker/src/transfer/transfer.service.spec.ts @@ -6,6 +6,7 @@ import { types } from "zksync-web3"; import { TransferRepository } from "../repositories"; import { TransferService } from "./transfer.service"; import { BlockchainService } from "../blockchain/blockchain.service"; +import { TokenType } from "../entities/token.entity"; import * as ethDepositNoFee from "../../test/transactionReceipts/eth/deposit-no-fee.json"; import * as ethDepositZeroValue from "../../test/transactionReceipts/eth/deposit-zero-value.json"; @@ -119,6 +120,7 @@ describe("TransferService", () => { from: "0xd206eaf6819007535e893410cfa01885ce40e99a", to: "0xd206eaf6819007535e893410cfa01885ce40e99a", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0x7cc7cc0326af164b15de04de3b153a7a55afb14a7897298a0a84f9507d483d1d", type: "deposit", isFeeOrRefund: false, @@ -133,6 +135,7 @@ describe("TransferService", () => { from: "0xd206eaf6819007535e893410cfa01885ce40e99a", to: "0xd754ff5e8a6f257e162f72578a4bb0493c0681d8", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0x7cc7cc0326af164b15de04de3b153a7a55afb14a7897298a0a84f9507d483d1d", type: "transfer", isFeeOrRefund: false, @@ -147,6 +150,7 @@ describe("TransferService", () => { from: "0xd206eaf6819007535e893410cfa01885ce40e99a", to: "0xd206eaf6819007535e893410cfa01885ce40e99a", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0x7cc7cc0326af164b15de04de3b153a7a55afb14a7897298a0a84f9507d483d1d", type: "deposit", isFeeOrRefund: false, @@ -181,6 +185,7 @@ describe("TransferService", () => { blockNumber: 7485644, amount: BigNumber.from("0x2386f26fc10000"), tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, type: "deposit", isFeeOrRefund: false, isInternal: false, @@ -195,6 +200,7 @@ describe("TransferService", () => { blockNumber: 7485644, amount: BigNumber.from("0x2386f26fc10000"), tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, type: "transfer", isFeeOrRefund: false, isInternal: false, @@ -209,6 +215,7 @@ describe("TransferService", () => { blockNumber: 7485644, amount: BigNumber.from("0x0141b56ff62900"), tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, type: "fee", isFeeOrRefund: true, isInternal: false, @@ -223,6 +230,7 @@ describe("TransferService", () => { blockNumber: 7485644, amount: BigNumber.from("0x29eb1faec300"), tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, type: "refund", isFeeOrRefund: true, isInternal: false, @@ -256,6 +264,7 @@ describe("TransferService", () => { blockNumber: 7483775, amount: BigNumber.from("0x11c37937e08000"), tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, type: "deposit", isFeeOrRefund: false, isInternal: false, @@ -270,6 +279,7 @@ describe("TransferService", () => { blockNumber: 7483775, amount: BigNumber.from("0x11c37937e08000"), tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, type: "transfer", isFeeOrRefund: false, isInternal: false, @@ -284,6 +294,7 @@ describe("TransferService", () => { blockNumber: 7483775, amount: BigNumber.from("0x0150b5fa93bf00"), tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, type: "fee", isFeeOrRefund: true, isInternal: false, @@ -298,6 +309,7 @@ describe("TransferService", () => { blockNumber: 7483775, amount: BigNumber.from("0xdb01bc43a500"), tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, type: "refund", isFeeOrRefund: true, isInternal: false, @@ -331,6 +343,7 @@ describe("TransferService", () => { blockNumber: 7485219, amount: BigNumber.from("0x010425b6917e00"), tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, type: "fee", isFeeOrRefund: true, isInternal: false, @@ -345,6 +358,7 @@ describe("TransferService", () => { blockNumber: 7485219, amount: BigNumber.from("0x7c948f3acf00"), tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, type: "refund", isFeeOrRefund: true, isInternal: false, @@ -377,6 +391,7 @@ describe("TransferService", () => { from: "0x481e48ce19781c3ca573967216dee75fdcf70f54", to: "0x0000000000000000000000000000000000008001", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0xc697e19d80645ec37df566e1227edad4652d010e43c508bbd04efbaeb47e2c48", type: "fee", isFeeOrRefund: true, @@ -391,6 +406,7 @@ describe("TransferService", () => { from: "0x481e48ce19781c3ca573967216dee75fdcf70f54", to: "0xc9593dc3dcad5f3804aaa5af12a9d74d0c00e4b0", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0xc697e19d80645ec37df566e1227edad4652d010e43c508bbd04efbaeb47e2c48", type: "transfer", isFeeOrRefund: false, @@ -422,6 +438,7 @@ describe("TransferService", () => { from: "0xd2229549f09af28dd0c21b1ade77f739aa8406b5", to: "0x0000000000000000000000000000000000008001", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0x4ae2d3cf9b7e4d25b4323f7e8715521172bda4dfc88cfaf6b40c8cf80165b985", type: "fee", isFeeOrRefund: true, @@ -436,6 +453,7 @@ describe("TransferService", () => { from: "0xd2229549f09af28dd0c21b1ade77f739aa8406b5", to: "0x0000000000000000000000000000000000000000", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0x4ae2d3cf9b7e4d25b4323f7e8715521172bda4dfc88cfaf6b40c8cf80165b985", type: "transfer", isFeeOrRefund: false, @@ -469,6 +487,7 @@ describe("TransferService", () => { from: "0xd754ff5e8a6f257e162f72578a4bb0493c0681d8", to: "0x0000000000000000000000000000000000008001", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0x69d3dcb5822096bab259dbba2a1b42bdfd6d1e5c4169196893cf1998ab2ca85f", type: "fee", isFeeOrRefund: true, @@ -483,6 +502,7 @@ describe("TransferService", () => { from: "0xd754ff5e8a6f257e162f72578a4bb0493c0681d8", to: "0x000000000000000000000000000000000000800a", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0x69d3dcb5822096bab259dbba2a1b42bdfd6d1e5c4169196893cf1998ab2ca85f", type: "transfer", isFeeOrRefund: false, @@ -497,6 +517,7 @@ describe("TransferService", () => { from: "0xd754ff5e8a6f257e162f72578a4bb0493c0681d8", to: "0xd754ff5e8a6f257e162f72578a4bb0493c0681d8", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0x69d3dcb5822096bab259dbba2a1b42bdfd6d1e5c4169196893cf1998ab2ca85f", type: "withdrawal", isFeeOrRefund: false, @@ -511,6 +532,7 @@ describe("TransferService", () => { from: "0x0000000000000000000000000000000000008001", to: "0xd754ff5e8a6f257e162f72578a4bb0493c0681d8", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0x69d3dcb5822096bab259dbba2a1b42bdfd6d1e5c4169196893cf1998ab2ca85f", type: "refund", isFeeOrRefund: true, @@ -544,6 +566,7 @@ describe("TransferService", () => { from: "0xd754ff5e8a6f257e162f72578a4bb0493c0681d8", to: "0x0000000000000000000000000000000000008001", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0x33bfd18a0aea94ba39742a9a1df595462322ecbbb25c0f767a0bf6acb41dfb2f", type: "fee", isFeeOrRefund: true, @@ -558,6 +581,7 @@ describe("TransferService", () => { from: "0xd754ff5e8a6f257e162f72578a4bb0493c0681d8", to: "0x000000000000000000000000000000000000800a", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0x33bfd18a0aea94ba39742a9a1df595462322ecbbb25c0f767a0bf6acb41dfb2f", type: "transfer", isFeeOrRefund: false, @@ -572,6 +596,7 @@ describe("TransferService", () => { from: "0xd754ff5e8a6f257e162f72578a4bb0493c0681d8", to: "0xd206eaf6819007535e893410cfa01885ce40e99a", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0x33bfd18a0aea94ba39742a9a1df595462322ecbbb25c0f767a0bf6acb41dfb2f", type: "withdrawal", isFeeOrRefund: false, @@ -586,6 +611,7 @@ describe("TransferService", () => { from: "0x0000000000000000000000000000000000008001", to: "0xd754ff5e8a6f257e162f72578a4bb0493c0681d8", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0x33bfd18a0aea94ba39742a9a1df595462322ecbbb25c0f767a0bf6acb41dfb2f", type: "refund", isFeeOrRefund: true, @@ -619,6 +645,7 @@ describe("TransferService", () => { blockNumber: 7508823, amount: BigNumber.from("0xb782effd8200"), tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, type: "fee", isFeeOrRefund: true, isInternal: false, @@ -633,6 +660,7 @@ describe("TransferService", () => { blockNumber: 7508823, amount: BigNumber.from("0x00"), tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, type: "withdrawal", isFeeOrRefund: false, isInternal: false, @@ -647,6 +675,7 @@ describe("TransferService", () => { blockNumber: 7508823, amount: BigNumber.from("0x71e06f110780"), tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, type: "refund", isFeeOrRefund: true, isInternal: false, @@ -678,6 +707,7 @@ describe("TransferService", () => { from: "0xd754ff5e8a6f257e162f72578a4bb0493c0681d8", to: "0x0000000000000000000000000000000000008001", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0x33bfd18a0aea94ba39742a9a1df595462322ecbbb25c0f767a0bf6acb41dfb2f", type: "fee", isFeeOrRefund: true, @@ -692,6 +722,7 @@ describe("TransferService", () => { from: "0xd754ff5e8a6f257e162f72578a4bb0493c0681d8", to: "0x000000000000000000000000000000000000800a", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0x33bfd18a0aea94ba39742a9a1df595462322ecbbb25c0f767a0bf6acb41dfb2f", type: "transfer", isFeeOrRefund: false, @@ -706,6 +737,7 @@ describe("TransferService", () => { from: "0xd754ff5e8a6f257e162f72578a4bb0493c0681d8", to: "0xd206eaf6819007535e893410cfa01885ce40e99a", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0x33bfd18a0aea94ba39742a9a1df595462322ecbbb25c0f767a0bf6acb41dfb2f", type: "withdrawal", isFeeOrRefund: false, @@ -720,6 +752,7 @@ describe("TransferService", () => { from: "0x0000000000000000000000000000000000008001", to: "0xd754ff5e8a6f257e162f72578a4bb0493c0681d8", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0x33bfd18a0aea94ba39742a9a1df595462322ecbbb25c0f767a0bf6acb41dfb2f", type: "refund", isFeeOrRefund: true, @@ -754,6 +787,7 @@ describe("TransferService", () => { from: "0x0000000000000000000000000000000000000000", to: "0x481e48ce19781c3ca573967216dee75fdcf70f54", tokenAddress: "0x852a4599217e76aa725f0ada8bf832a1f57a8a91", + tokenType: TokenType.ERC20, transactionHash: "0x25f9bd9de8260b53e2765cddb6aaafce5256fca647434c72559f0a0fb77bd715", type: "transfer", isFeeOrRefund: false, @@ -768,6 +802,7 @@ describe("TransferService", () => { from: "0x481e48ce19781c3ca573967216dee75fdcf70f54", to: "0x481e48ce19781c3ca573967216dee75fdcf70f54", tokenAddress: "0x852a4599217e76aa725f0ada8bf832a1f57a8a91", + tokenType: TokenType.ERC20, transactionHash: "0x25f9bd9de8260b53e2765cddb6aaafce5256fca647434c72559f0a0fb77bd715", type: "deposit", isFeeOrRefund: false, @@ -800,6 +835,7 @@ describe("TransferService", () => { from: "0x481e48ce19781c3ca573967216dee75fdcf70f54", to: "0x0000000000000000000000000000000000008001", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0xf8835220234eecd1a6dfd4dc1be8594e6f076d73107497b665a97a6d694320ad", type: "fee", isFeeOrRefund: true, @@ -814,6 +850,7 @@ describe("TransferService", () => { from: "0x481e48ce19781c3ca573967216dee75fdcf70f54", to: "0xc9593dc3dcad5f3804aaa5af12a9d74d0c00e4b0", tokenAddress: "0x852a4599217e76aa725f0ada8bf832a1f57a8a91", + tokenType: TokenType.ERC20, transactionHash: "0xf8835220234eecd1a6dfd4dc1be8594e6f076d73107497b665a97a6d694320ad", type: "transfer", isFeeOrRefund: false, @@ -846,6 +883,7 @@ describe("TransferService", () => { from: "0x481e48ce19781c3ca573967216dee75fdcf70f54", to: "0x0000000000000000000000000000000000008001", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0x37f670de38b93e28c3ecf5ede9b4c96a4d26f2aa6c53bb6ffc7a040f559d8abb", type: "fee", isFeeOrRefund: true, @@ -860,6 +898,7 @@ describe("TransferService", () => { from: "0x481e48ce19781c3ca573967216dee75fdcf70f54", to: "0x0000000000000000000000000000000000000000", tokenAddress: "0x852a4599217e76aa725f0ada8bf832a1f57a8a91", + tokenType: TokenType.ERC20, transactionHash: "0x37f670de38b93e28c3ecf5ede9b4c96a4d26f2aa6c53bb6ffc7a040f559d8abb", type: "transfer", isFeeOrRefund: false, @@ -874,6 +913,7 @@ describe("TransferService", () => { from: "0x481e48ce19781c3ca573967216dee75fdcf70f54", to: "0x481e48ce19781c3ca573967216dee75fdcf70f54", tokenAddress: "0x852a4599217e76aa725f0ada8bf832a1f57a8a91", + tokenType: TokenType.ERC20, transactionHash: "0x37f670de38b93e28c3ecf5ede9b4c96a4d26f2aa6c53bb6ffc7a040f559d8abb", type: "withdrawal", isFeeOrRefund: false, @@ -906,6 +946,7 @@ describe("TransferService", () => { from: "0x481e48ce19781c3ca573967216dee75fdcf70f54", to: "0x0000000000000000000000000000000000008001", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0x85dc1a3b141cdc67ed5f787c688d9ea8976363c875b5c4d3347cac69bcd23108", type: "fee", isFeeOrRefund: true, @@ -920,6 +961,7 @@ describe("TransferService", () => { from: "0x481e48ce19781c3ca573967216dee75fdcf70f54", to: "0x0000000000000000000000000000000000000000", tokenAddress: "0x852a4599217e76aa725f0ada8bf832a1f57a8a91", + tokenType: TokenType.ERC20, transactionHash: "0x85dc1a3b141cdc67ed5f787c688d9ea8976363c875b5c4d3347cac69bcd23108", type: "transfer", isFeeOrRefund: false, @@ -934,6 +976,7 @@ describe("TransferService", () => { from: "0x481e48ce19781c3ca573967216dee75fdcf70f54", to: "0xc9593dc3dcad5f3804aaa5af12a9d74d0c00e4b0", tokenAddress: "0x852a4599217e76aa725f0ada8bf832a1f57a8a91", + tokenType: TokenType.ERC20, transactionHash: "0x85dc1a3b141cdc67ed5f787c688d9ea8976363c875b5c4d3347cac69bcd23108", type: "withdrawal", isFeeOrRefund: false, @@ -968,6 +1011,7 @@ describe("TransferService", () => { from: "0x481e48ce19781c3ca573967216dee75fdcf70f54", to: "0x0000000000000000000000000000000000008001", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0x7ec71b1d5369b830af3f7af4b1ef0f04e62cc3775b1c090434a93493d1b68632", type: "fee", isFeeOrRefund: true, @@ -1000,6 +1044,7 @@ describe("TransferService", () => { from: "0x481e48ce19781c3ca573967216dee75fdcf70f54", to: "0x0000000000000000000000000000000000008001", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0xaa4f89b2adc9ae0fc50d058ebc7d75ddd54b0d83c307474b09989def4a0f2fbe", type: "fee", isFeeOrRefund: true, @@ -1034,6 +1079,7 @@ describe("TransferService", () => { from: "0x481e48ce19781c3ca573967216dee75fdcf70f54", to: "0x0000000000000000000000000000000000008001", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0x55f31c010dc9ae929e192cd9950027e09b647543b3d7b0f866cb74bc7941009d", type: "fee", isFeeOrRefund: true, @@ -1048,6 +1094,7 @@ describe("TransferService", () => { from: "0x481e48ce19781c3ca573967216dee75fdcf70f54", to: "0x481e48ce19781c3ca573967216dee75fdcf70f54", tokenAddress: "0xd144ca8aa2e7dfecd56a3cccba1cd873c8e5db58", + tokenType: TokenType.ERC20, transactionHash: "0x55f31c010dc9ae929e192cd9950027e09b647543b3d7b0f866cb74bc7941009d", type: "mint", isFeeOrRefund: false, @@ -1080,6 +1127,7 @@ describe("TransferService", () => { from: "0x0000000000000000000000000000000000000000", to: "0xb7e2355b87ff9ae9b146ca6dcee9c02157937b01", tokenAddress: "0xdc187378edd8ed1585fb47549cc5fe633295d571", + tokenType: TokenType.ERC20, transactionHash: "0x5e018d2a81dbd1ef80ff45171dd241cb10670dcb091e324401ff8f52293841b0", type: "transfer", isFeeOrRefund: false, @@ -1094,6 +1142,7 @@ describe("TransferService", () => { from: "0xb7e2355b87ff9ae9b146ca6dcee9c02157937b01", to: "0xb7e2355b87ff9ae9b146ca6dcee9c02157937b01", tokenAddress: "0xdc187378edd8ed1585fb47549cc5fe633295d571", + tokenType: TokenType.ERC20, transactionHash: "0x5e018d2a81dbd1ef80ff45171dd241cb10670dcb091e324401ff8f52293841b0", type: "deposit", isFeeOrRefund: false, @@ -1127,6 +1176,7 @@ describe("TransferService", () => { blockNumber: 7483775, amount: BigNumber.from("0x11c37937e08000"), tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, type: "deposit", isFeeOrRefund: false, isInternal: false, @@ -1141,6 +1191,7 @@ describe("TransferService", () => { blockNumber: 7483775, amount: BigNumber.from("0x11c37937e08000"), tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, type: "transfer", isFeeOrRefund: false, isInternal: false, @@ -1155,6 +1206,7 @@ describe("TransferService", () => { blockNumber: 7483775, amount: BigNumber.from("0x0150b5fa93bf00"), tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, type: "fee", isFeeOrRefund: true, isInternal: false, @@ -1169,6 +1221,7 @@ describe("TransferService", () => { blockNumber: 7483775, amount: BigNumber.from("0xdb01bc43a500"), tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, type: "refund", isFeeOrRefund: true, isInternal: false, @@ -1200,6 +1253,7 @@ describe("TransferService", () => { from: "0xd206eaf6819007535e893410cfa01885ce40e99a", to: "0x0000000000000000000000000000000000008001", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0xbb9c4b21c235ada7be48da89ca574dfb3c1f9126f3b879060ace14e37239053d", type: "fee", isFeeOrRefund: true, @@ -1214,6 +1268,7 @@ describe("TransferService", () => { from: "0xd206eaf6819007535e893410cfa01885ce40e99a", to: "0xd754ff5e8a6f257e162f72578a4bb0493c0681d8", tokenAddress: "0x7aa5f26e03b12a78e3ff1c454547701443144c67", + tokenType: TokenType.ERC20, transactionHash: "0xbb9c4b21c235ada7be48da89ca574dfb3c1f9126f3b879060ace14e37239053d", type: "transfer", isFeeOrRefund: false, @@ -1247,6 +1302,7 @@ describe("TransferService", () => { blockNumber: 7492781, amount: BigNumber.from("0xc51affb6ed80"), tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, type: "fee", isFeeOrRefund: true, isInternal: false, @@ -1261,6 +1317,7 @@ describe("TransferService", () => { blockNumber: 7492781, amount: BigNumber.from("0x055de6a779bbac0000"), tokenAddress: "0x24a5f3f8b311b053a55c90cfff3bd2ee34c85fc0", + tokenType: TokenType.ERC20, type: "transfer", isFeeOrRefund: false, isInternal: false, @@ -1275,6 +1332,7 @@ describe("TransferService", () => { blockNumber: 7492781, amount: BigNumber.from("0x055de6a779bbac0000"), tokenAddress: "0x24a5f3f8b311b053a55c90cfff3bd2ee34c85fc0", + tokenType: TokenType.ERC20, type: "withdrawal", isFeeOrRefund: false, isInternal: false, @@ -1289,6 +1347,7 @@ describe("TransferService", () => { blockNumber: 7492781, amount: BigNumber.from("0x780bd72ca280"), tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, type: "refund", isFeeOrRefund: true, isInternal: false, @@ -1322,6 +1381,7 @@ describe("TransferService", () => { from: "0x481e48ce19781c3ca573967216dee75fdcf70f54", to: "0x0000000000000000000000000000000000008001", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0x9a9218b64947ffc0e7993c1dd2cbc3377b33c0773a445662e8c833ed17369cf3", type: "fee", isFeeOrRefund: true, @@ -1336,6 +1396,7 @@ describe("TransferService", () => { from: "0x481e48ce19781c3ca573967216dee75fdcf70f54", to: "0x08b222f412eb5d141fb32db443f2eed06ae65a24", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0x9a9218b64947ffc0e7993c1dd2cbc3377b33c0773a445662e8c833ed17369cf3", type: "transfer", isFeeOrRefund: false, @@ -1350,6 +1411,7 @@ describe("TransferService", () => { from: "0x08b222f412eb5d141fb32db443f2eed06ae65a24", to: "0x65ebd487e692d688f2a36fb833729076dc85ed34", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0x9a9218b64947ffc0e7993c1dd2cbc3377b33c0773a445662e8c833ed17369cf3", type: "transfer", isFeeOrRefund: false, @@ -1364,6 +1426,7 @@ describe("TransferService", () => { from: "0x481e48ce19781c3ca573967216dee75fdcf70f54", to: "0x65ebd487e692d688f2a36fb833729076dc85ed34", tokenAddress: "0x2baec5bca9f2052489ed30668f27ab4466f0bcb3", + tokenType: TokenType.ERC20, transactionHash: "0x9a9218b64947ffc0e7993c1dd2cbc3377b33c0773a445662e8c833ed17369cf3", type: "transfer", isFeeOrRefund: false, @@ -1378,6 +1441,7 @@ describe("TransferService", () => { from: "0x481e48ce19781c3ca573967216dee75fdcf70f54", to: "0x65ebd487e692d688f2a36fb833729076dc85ed34", tokenAddress: "0x852a4599217e76aa725f0ada8bf832a1f57a8a91", + tokenType: TokenType.ERC20, transactionHash: "0x9a9218b64947ffc0e7993c1dd2cbc3377b33c0773a445662e8c833ed17369cf3", type: "transfer", isFeeOrRefund: false, @@ -1392,6 +1456,7 @@ describe("TransferService", () => { from: "0x08b222f412eb5d141fb32db443f2eed06ae65a24", to: "0x65ebd487e692d688f2a36fb833729076dc85ed34", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0x9a9218b64947ffc0e7993c1dd2cbc3377b33c0773a445662e8c833ed17369cf3", type: "transfer", isFeeOrRefund: false, @@ -1406,6 +1471,7 @@ describe("TransferService", () => { from: "0x481e48ce19781c3ca573967216dee75fdcf70f54", to: "0x65ebd487e692d688f2a36fb833729076dc85ed34", tokenAddress: "0x2baec5bca9f2052489ed30668f27ab4466f0bcb3", + tokenType: TokenType.ERC20, transactionHash: "0x9a9218b64947ffc0e7993c1dd2cbc3377b33c0773a445662e8c833ed17369cf3", type: "transfer", isFeeOrRefund: false, @@ -1420,6 +1486,7 @@ describe("TransferService", () => { from: "0x481e48ce19781c3ca573967216dee75fdcf70f54", to: "0x65ebd487e692d688f2a36fb833729076dc85ed34", tokenAddress: "0x852a4599217e76aa725f0ada8bf832a1f57a8a91", + tokenType: TokenType.ERC20, transactionHash: "0x9a9218b64947ffc0e7993c1dd2cbc3377b33c0773a445662e8c833ed17369cf3", type: "transfer", isFeeOrRefund: false, @@ -1452,6 +1519,7 @@ describe("TransferService", () => { from: "0x481e48ce19781c3ca573967216dee75fdcf70f54", to: "0x0265d9a5af8af5fe070933e5e549d8fef08e09f4", tokenAddress: "0x2baec5bca9f2052489ed30668f27ab4466f0bcb3", + tokenType: TokenType.ERC20, transactionHash: "0xeae0368e1457fa55da486ffc772cc654d3d5b95faa220fa971ff73077fccd370", type: "transfer", isFeeOrRefund: false, @@ -1466,6 +1534,7 @@ describe("TransferService", () => { from: "0x0265d9a5af8af5fe070933e5e549d8fef08e09f4", to: "0x0000000000000000000000000000000000008001", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0xeae0368e1457fa55da486ffc772cc654d3d5b95faa220fa971ff73077fccd370", type: "fee", isFeeOrRefund: true, @@ -1480,6 +1549,7 @@ describe("TransferService", () => { from: "0x481e48ce19781c3ca573967216dee75fdcf70f54", to: "0x08b222f412eb5d141fb32db443f2eed06ae65a24", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0xeae0368e1457fa55da486ffc772cc654d3d5b95faa220fa971ff73077fccd370", type: "transfer", isFeeOrRefund: false, @@ -1494,6 +1564,7 @@ describe("TransferService", () => { from: "0x08b222f412eb5d141fb32db443f2eed06ae65a24", to: "0x65ebd487e692d688f2a36fb833729076dc85ed34", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0xeae0368e1457fa55da486ffc772cc654d3d5b95faa220fa971ff73077fccd370", type: "transfer", isFeeOrRefund: false, @@ -1508,6 +1579,7 @@ describe("TransferService", () => { from: "0x481e48ce19781c3ca573967216dee75fdcf70f54", to: "0x65ebd487e692d688f2a36fb833729076dc85ed34", tokenAddress: "0x2baec5bca9f2052489ed30668f27ab4466f0bcb3", + tokenType: TokenType.ERC20, transactionHash: "0xeae0368e1457fa55da486ffc772cc654d3d5b95faa220fa971ff73077fccd370", type: "transfer", isFeeOrRefund: false, @@ -1522,6 +1594,7 @@ describe("TransferService", () => { from: "0x481e48ce19781c3ca573967216dee75fdcf70f54", to: "0x65ebd487e692d688f2a36fb833729076dc85ed34", tokenAddress: "0x852a4599217e76aa725f0ada8bf832a1f57a8a91", + tokenType: TokenType.ERC20, transactionHash: "0xeae0368e1457fa55da486ffc772cc654d3d5b95faa220fa971ff73077fccd370", type: "transfer", isFeeOrRefund: false, @@ -1536,6 +1609,7 @@ describe("TransferService", () => { from: "0x08b222f412eb5d141fb32db443f2eed06ae65a24", to: "0x65ebd487e692d688f2a36fb833729076dc85ed34", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0xeae0368e1457fa55da486ffc772cc654d3d5b95faa220fa971ff73077fccd370", type: "transfer", isFeeOrRefund: false, @@ -1550,6 +1624,7 @@ describe("TransferService", () => { from: "0x481e48ce19781c3ca573967216dee75fdcf70f54", to: "0x65ebd487e692d688f2a36fb833729076dc85ed34", tokenAddress: "0x2baec5bca9f2052489ed30668f27ab4466f0bcb3", + tokenType: TokenType.ERC20, transactionHash: "0xeae0368e1457fa55da486ffc772cc654d3d5b95faa220fa971ff73077fccd370", type: "transfer", isFeeOrRefund: false, @@ -1564,6 +1639,7 @@ describe("TransferService", () => { from: "0x481e48ce19781c3ca573967216dee75fdcf70f54", to: "0x65ebd487e692d688f2a36fb833729076dc85ed34", tokenAddress: "0x852a4599217e76aa725f0ada8bf832a1f57a8a91", + tokenType: TokenType.ERC20, transactionHash: "0xeae0368e1457fa55da486ffc772cc654d3d5b95faa220fa971ff73077fccd370", type: "transfer", isFeeOrRefund: false, @@ -1596,6 +1672,7 @@ describe("TransferService", () => { from: "0x481e48ce19781c3ca573967216dee75fdcf70f54", to: "0x0265d9a5af8af5fe070933e5e549d8fef08e09f4", tokenAddress: "0x2baec5bca9f2052489ed30668f27ab4466f0bcb3", + tokenType: TokenType.ERC20, transactionHash: "0x8ed4aa94bb4a28ce174e435d60297d765885dff83a543b49ad57adedec99cfe3", type: "transfer", isFeeOrRefund: false, @@ -1610,6 +1687,7 @@ describe("TransferService", () => { from: "0x0265d9a5af8af5fe070933e5e549d8fef08e09f4", to: "0x0000000000000000000000000000000000008001", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0x8ed4aa94bb4a28ce174e435d60297d765885dff83a543b49ad57adedec99cfe3", type: "fee", isFeeOrRefund: true, @@ -1624,6 +1702,7 @@ describe("TransferService", () => { from: "0x481e48ce19781c3ca573967216dee75fdcf70f54", to: "0xbba0cf82ce98acd455bd34d7a53bb565a31372a6", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0x8ed4aa94bb4a28ce174e435d60297d765885dff83a543b49ad57adedec99cfe3", type: "transfer", isFeeOrRefund: false, @@ -1638,6 +1717,7 @@ describe("TransferService", () => { from: "0xbba0cf82ce98acd455bd34d7a53bb565a31372a6", to: "0x65ebd487e692d688f2a36fb833729076dc85ed34", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0x8ed4aa94bb4a28ce174e435d60297d765885dff83a543b49ad57adedec99cfe3", type: "transfer", isFeeOrRefund: false, @@ -1652,6 +1732,7 @@ describe("TransferService", () => { from: "0xbba0cf82ce98acd455bd34d7a53bb565a31372a6", to: "0xc9593dc3dcad5f3804aaa5af12a9d74d0c00e4b0", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0x8ed4aa94bb4a28ce174e435d60297d765885dff83a543b49ad57adedec99cfe3", type: "transfer", isFeeOrRefund: false, @@ -1686,6 +1767,7 @@ describe("TransferService", () => { from: "0xd206eaf6819007535e893410cfa01885ce40e99a", to: "0x0000000000000000000000000000000000008001", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0xc36a1b2d19085fbeff652e618a1e61d6d386f92cbe51373eac60077bb128b7cb", type: "fee", isFeeOrRefund: true, @@ -1718,6 +1800,7 @@ describe("TransferService", () => { from: "0x481e48ce19781c3ca573967216dee75fdcf70f54", to: "0x0000000000000000000000000000000000008001", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0x30e3abe6ac3a1b47d961213e1b1302377786f5cd537a6cd34dd3cd6473a319d0", type: "fee", isFeeOrRefund: true, @@ -1733,6 +1816,7 @@ describe("TransferService", () => { from: "0x481e48ce19781c3ca573967216dee75fdcf70f54", to: "0x481e48ce19781c3ca573967216dee75fdcf70f54", tokenAddress: "0x4a80888f58d004c5ef2013d2cf974f00f42dd934", + tokenType: TokenType.ERC721, transactionHash: "0x30e3abe6ac3a1b47d961213e1b1302377786f5cd537a6cd34dd3cd6473a319d0", type: "mint", isFeeOrRefund: false, @@ -1765,6 +1849,7 @@ describe("TransferService", () => { from: "0xd206eaf6819007535e893410cfa01885ce40e99a", to: "0x0000000000000000000000000000000000008001", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0x4833645ed34e16c9e2ce4d26fee2d730202ab3e76c0cd155557e7bb9344990be", type: "fee", isFeeOrRefund: true, @@ -1797,6 +1882,7 @@ describe("TransferService", () => { from: "0xd206eaf6819007535e893410cfa01885ce40e99a", to: "0x0000000000000000000000000000000000008001", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0x6bedb809e97f58d987aea7aad4fcfa8a3f5ecc3cde9a97093b2f3a1a170692a0", type: "fee", isFeeOrRefund: true, @@ -1812,6 +1898,7 @@ describe("TransferService", () => { from: "0xd206eaf6819007535e893410cfa01885ce40e99a", to: "0xd754ff5e8a6f257e162f72578a4bb0493c0681d8", tokenAddress: "0x89bcb56033920b8a654109faeb1f87e0c3358cad", + tokenType: TokenType.ERC721, transactionHash: "0x6bedb809e97f58d987aea7aad4fcfa8a3f5ecc3cde9a97093b2f3a1a170692a0", type: "transfer", isFeeOrRefund: false, @@ -1846,6 +1933,7 @@ describe("TransferService", () => { from: "0x481e48ce19781c3ca573967216dee75fdcf70f54", to: "0x0265d9a5af8af5fe070933e5e549d8fef08e09f4", tokenAddress: "0x2baec5bca9f2052489ed30668f27ab4466f0bcb3", + tokenType: TokenType.ERC20, transactionHash: "0x191c7e02d6a78b6da6116ea8347f3560627caa4b7fbf766f96eccbd09bacc433", type: "transfer", isFeeOrRefund: false, @@ -1860,6 +1948,7 @@ describe("TransferService", () => { from: "0x0265d9a5af8af5fe070933e5e549d8fef08e09f4", to: "0x0000000000000000000000000000000000008001", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0x191c7e02d6a78b6da6116ea8347f3560627caa4b7fbf766f96eccbd09bacc433", type: "fee", isFeeOrRefund: true, @@ -1894,6 +1983,7 @@ describe("TransferService", () => { from: "0xd206eaf6819007535e893410cfa01885ce40e99a", to: "0x0000000000000000000000000000000000008001", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0x2b9153e896c0d2651d2826e8e1a447c5e56a3e060ae7d60c2c0bfbcd966e4880", type: "fee", isFeeOrRefund: true, @@ -1936,6 +2026,7 @@ describe("TransferService", () => { from: "0xd206eaf6819007535e893410cfa01885ce40e99a", to: "0x0000000000000000000000000000000000008001", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0x8a7a99459d2278c83a8450cc36c0e5b75bee250a60e4b66dea182325afd8fa07", type: "fee", isFeeOrRefund: true, @@ -1971,6 +2062,7 @@ describe("TransferService", () => { from: "0x088282b61a8cc1014186076698e35bcc92e88b0d", to: "0x0000000000000000000000000000000000008001", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0xb12a02697dd2a0e414cb8f9436c6fb7a8eb82eb403e256644235a0c618ef508d", type: "fee", isFeeOrRefund: true, @@ -1985,6 +2077,7 @@ describe("TransferService", () => { from: "0x0000000000000000000000000000000000000000", to: "0x7869cd51c2483169e1ce06fa6912e7d1e3bf629b", tokenAddress: "0x6267080b2265a09371cc2763756dbacdaf09856e", + tokenType: TokenType.ERC20, transactionHash: "0xb12a02697dd2a0e414cb8f9436c6fb7a8eb82eb403e256644235a0c618ef508d", type: "transfer", isFeeOrRefund: false, @@ -1999,6 +2092,7 @@ describe("TransferService", () => { from: "0x0000000000000000000000000000000000008001", to: "0x088282b61a8cc1014186076698e35bcc92e88b0d", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0xb12a02697dd2a0e414cb8f9436c6fb7a8eb82eb403e256644235a0c618ef508d", type: "refund", isFeeOrRefund: true, @@ -2025,6 +2119,7 @@ describe("TransferService", () => { timestamp: receivedAt, to: "0x76ff48d4bd33b4d5943bc82b8ee9ccaf079bcaaf", tokenAddress: "0x39c4bdfac23d10180e01c09bedfa0a508d4ad4d3", + tokenType: TokenType.ERC721, transactionHash: "0x52cdf727855ce9310b69a75d84fa23662d451e2dbcea64f3b277db12d78ab9ef", transactionIndex: 1, type: "mint", @@ -2039,6 +2134,7 @@ describe("TransferService", () => { timestamp: receivedAt, to: "0x38686aa0f4e8fc2fd2910272671b26ff9c53c73a", tokenAddress: "0x6dd28c2c5b91dd63b4d4e78ecac7139878371768", + tokenType: TokenType.ERC721, transactionHash: "0x52cdf727855ce9310b69a75d84fa23662d451e2dbcea64f3b277db12d78ab9ef", transactionIndex: 1, type: "mint", @@ -2053,6 +2149,7 @@ describe("TransferService", () => { timestamp: receivedAt, to: "0x48686aa0f4e8fc2fd2910272671b26ff9c53c73a", tokenAddress: "0x6dd28c2c5b91dd63b4d4e78ecac7139878371768", + tokenType: TokenType.ERC721, transactionHash: "0x52cdf727855ce9310b69a75d84fa23662d451e2dbcea64f3b277db12d78ab9ef", transactionIndex: 1, type: "transfer", @@ -2085,6 +2182,7 @@ describe("TransferService", () => { blockNumber: 7485644, amount: BigNumber.from("0x2386f26fc10000"), tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, type: "deposit", isFeeOrRefund: false, isInternal: false, @@ -2099,6 +2197,7 @@ describe("TransferService", () => { blockNumber: 7485644, amount: BigNumber.from("0x2386f26fc10000"), tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, type: "transfer", isFeeOrRefund: false, isInternal: false, @@ -2113,6 +2212,7 @@ describe("TransferService", () => { blockNumber: 7485644, amount: BigNumber.from("0x0141b56ff62900"), tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, type: "fee", isFeeOrRefund: true, isInternal: false, @@ -2141,6 +2241,7 @@ describe("TransferService", () => { blockNumber: 7485644, amount: BigNumber.from("0x0141b56ff62900"), tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, type: "fee", isFeeOrRefund: true, isInternal: false, @@ -2168,6 +2269,7 @@ describe("TransferService", () => { from: "0x481e48ce19781c3ca573967216dee75fdcf70f54", to: "0x0000000000000000000000000000000000008001", tokenAddress: "0x000000000000000000000000000000000000800a", + tokenType: TokenType.ETH, transactionHash: "0x7ec71b1d5369b830af3f7af4b1ef0f04e62cc3775b1c090434a93493d1b68632", type: "fee", isFeeOrRefund: true, From c660d17edb3f11e163d324194dfaabd83c8e02e3 Mon Sep 17 00:00:00 2001 From: Roman Petriv Date: Fri, 13 Oct 2023 02:33:22 +0300 Subject: [PATCH 3/5] test: e2e tests --- packages/api/test/address.e2e-spec.ts | 7 ++++++- packages/api/test/token.e2e-spec.ts | 16 +++++++++++++++- packages/api/test/transaction.e2e-spec.ts | 13 ++++++++++++- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/packages/api/test/address.e2e-spec.ts b/packages/api/test/address.e2e-spec.ts index b5eee34877..02337af4ab 100644 --- a/packages/api/test/address.e2e-spec.ts +++ b/packages/api/test/address.e2e-spec.ts @@ -12,7 +12,7 @@ import { Transaction } from "../src/transaction/entities/transaction.entity"; import { AddressTransaction } from "../src/transaction/entities/addressTransaction.entity"; import { TransactionReceipt } from "../src/transaction/entities/transactionReceipt.entity"; import { Log } from "../src/log/log.entity"; -import { Token } from "../src/token/token.entity"; +import { Token, TokenType } from "../src/token/token.entity"; import { BatchDetails } from "../src/batch/batchDetails.entity"; import { Counter } from "../src/counter/counter.entity"; import { Transfer, TransferType } from "../src/transfer/transfer.entity"; @@ -310,6 +310,7 @@ describe("AddressController (e2e)", () => { transactionIndex: i, timestamp: new Date("2022-11-21T18:16:51.000Z"), type, + tokenType: i % 2 ? TokenType.ERC20 : TokenType.ETH, tokenAddress: i % 2 ? "0x97d0a23f34e535e44df8ba84c53a0945cf0eeb67" : "0x000000000000000000000000000000000000800a", logIndex: i, @@ -326,6 +327,7 @@ describe("AddressController (e2e)", () => { tokenAddress: transferSpec.tokenAddress, blockNumber: transferSpec.blockNumber, timestamp: transferSpec.timestamp, + tokenType: transferSpec.tokenType, isFeeOrRefund: transferSpec.isFeeOrRefund, logIndex: transferSpec.logIndex, isInternal: transferSpec.isInternal, @@ -1029,6 +1031,7 @@ describe("AddressController (e2e)", () => { tokenAddress: "0x97d0a23F34E535e44dF8ba84c53A0945cF0eEb67", transactionHash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e11", type: "mint", + tokenType: "ERC20", isInternal: false, }, { @@ -1048,6 +1051,7 @@ describe("AddressController (e2e)", () => { tokenAddress: "0x000000000000000000000000000000000000800A", transactionHash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e11", type: "transfer", + tokenType: "ETH", isInternal: false, }, { @@ -1067,6 +1071,7 @@ describe("AddressController (e2e)", () => { tokenAddress: "0x97d0a23F34E535e44dF8ba84c53A0945cF0eEb67", transactionHash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e11", type: "deposit", + tokenType: "ERC20", isInternal: false, }, ]) diff --git a/packages/api/test/token.e2e-spec.ts b/packages/api/test/token.e2e-spec.ts index 8e4b64d072..4db8d41e10 100644 --- a/packages/api/test/token.e2e-spec.ts +++ b/packages/api/test/token.e2e-spec.ts @@ -5,7 +5,7 @@ import { Repository } from "typeorm"; import { getRepositoryToken } from "@nestjs/typeorm"; import { AppModule } from "../src/app.module"; import { configureApp } from "../src/configureApp"; -import { Token } from "../src/token/token.entity"; +import { Token, TokenType } from "../src/token/token.entity"; import { BlockDetail } from "../src/block/blockDetail.entity"; import { Transaction } from "../src/transaction/entities/transaction.entity"; import { Transfer, TransferType } from "../src/transfer/transfer.entity"; @@ -108,6 +108,7 @@ describe("TokenController (e2e)", () => { tokenAddress: "0xd754ff5e8a6f257e162f72578a4bb0493c068101", amount: "1000", type: TransferType.Deposit, + tokenType: TokenType.ERC20, logIndex: transferIndex++, transactionIndex: 0, timestamp: "2022-11-21T18:16:51.000Z", @@ -123,6 +124,7 @@ describe("TokenController (e2e)", () => { tokenAddress: "0xd754ff5e8a6f257e162f72578a4bb0493c068101", amount: "1000", type: TransferType.Fee, + tokenType: TokenType.ERC20, logIndex: transferIndex++, transactionIndex: 0, timestamp: "2022-11-21T18:16:51.000Z", @@ -138,6 +140,7 @@ describe("TokenController (e2e)", () => { tokenAddress: "0xd754ff5e8a6f257e162f72578a4bb0493c068101", amount: "1000", type: TransferType.Mint, + tokenType: TokenType.ERC20, logIndex: transferIndex++, transactionIndex: 0, timestamp: "2022-11-21T18:16:51.000Z", @@ -153,6 +156,7 @@ describe("TokenController (e2e)", () => { tokenAddress: "0xd754ff5e8a6f257e162f72578a4bb0493c068101", amount: "1000", type: TransferType.Transfer, + tokenType: TokenType.ERC20, logIndex: transferIndex++, transactionIndex: 0, timestamp: "2022-11-21T18:16:51.000Z", @@ -168,6 +172,7 @@ describe("TokenController (e2e)", () => { tokenAddress: "0xd754ff5e8a6f257e162f72578a4bb0493c068101", amount: "1000", type: TransferType.Withdrawal, + tokenType: TokenType.ERC20, logIndex: transferIndex++, transactionIndex: 0, timestamp: "2022-11-21T18:16:51.000Z", @@ -183,6 +188,7 @@ describe("TokenController (e2e)", () => { tokenAddress: "0xd754ff5e8a6f257e162f72578a4bb0493c068101", amount: undefined, type: TransferType.Mint, + tokenType: TokenType.ERC721, fields: { tokenId: "1" }, logIndex: transferIndex++, transactionIndex: 0, @@ -199,6 +205,7 @@ describe("TokenController (e2e)", () => { tokenAddress: "0xd754ff5e8a6f257e162f72578a4bb0493c068101", amount: "1000", type: TransferType.Refund, + tokenType: TokenType.ERC20, logIndex: transferIndex++, transactionIndex: 0, timestamp: "2022-11-21T18:16:51.000Z", @@ -392,6 +399,7 @@ describe("TokenController (e2e)", () => { tokenAddress: "0xD754FF5E8a6F257E162f72578a4bB0493c068101", transactionHash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e10", type: "transfer", + tokenType: "ERC20", isInternal: false, }, { @@ -411,6 +419,7 @@ describe("TokenController (e2e)", () => { tokenAddress: "0xD754FF5E8a6F257E162f72578a4bB0493c068101", transactionHash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e10", type: "withdrawal", + tokenType: "ERC20", isInternal: false, }, { @@ -432,6 +441,7 @@ describe("TokenController (e2e)", () => { tokenAddress: "0xD754FF5E8a6F257E162f72578a4bB0493c068101", transactionHash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e10", type: "mint", + tokenType: "ERC721", isInternal: false, }, { @@ -451,6 +461,7 @@ describe("TokenController (e2e)", () => { tokenAddress: "0xD754FF5E8a6F257E162f72578a4bB0493c068101", transactionHash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e10", type: "deposit", + tokenType: "ERC20", isInternal: false, }, { @@ -470,6 +481,7 @@ describe("TokenController (e2e)", () => { tokenAddress: "0xD754FF5E8a6F257E162f72578a4bB0493c068101", transactionHash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e10", type: "mint", + tokenType: "ERC20", isInternal: false, }, { @@ -489,6 +501,7 @@ describe("TokenController (e2e)", () => { tokenAddress: "0xD754FF5E8a6F257E162f72578a4bB0493c068101", transactionHash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e10", type: "transfer", + tokenType: "ERC20", isInternal: false, }, { @@ -508,6 +521,7 @@ describe("TokenController (e2e)", () => { tokenAddress: "0xD754FF5E8a6F257E162f72578a4bB0493c068101", transactionHash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e10", type: "withdrawal", + tokenType: "ERC20", isInternal: false, }, ]) diff --git a/packages/api/test/transaction.e2e-spec.ts b/packages/api/test/transaction.e2e-spec.ts index c367034f60..61d66f96ac 100644 --- a/packages/api/test/transaction.e2e-spec.ts +++ b/packages/api/test/transaction.e2e-spec.ts @@ -5,7 +5,7 @@ import { Repository } from "typeorm"; import { getRepositoryToken } from "@nestjs/typeorm"; import { AppModule } from "../src/app.module"; import { configureApp } from "../src/configureApp"; -import { Token } from "../src/token/token.entity"; +import { Token, TokenType } from "../src/token/token.entity"; import { BlockDetail } from "../src/block/blockDetail.entity"; import { Transaction } from "../src/transaction/entities/transaction.entity"; import { AddressTransaction } from "../src/transaction/entities/addressTransaction.entity"; @@ -188,6 +188,7 @@ describe("TransactionController (e2e)", () => { transactionHash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e10", tokenAddress: i % 2 ? "0xd754ff5e8a6f257e162f72578a4bb0493c068101" : "0x000000000000000000000000000000000000800a", + tokenType: i % 2 ? TokenType.ERC20 : TokenType.ETH, amount: "2000", type, logIndex: i, @@ -1005,6 +1006,7 @@ describe("TransactionController (e2e)", () => { tokenAddress: "0x000000000000000000000000000000000000800A", transactionHash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e10", type: "deposit", + tokenType: "ETH", isInternal: false, }, { @@ -1024,6 +1026,7 @@ describe("TransactionController (e2e)", () => { tokenAddress: "0xD754FF5E8a6F257E162f72578a4bB0493c068101", transactionHash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e10", type: "transfer", + tokenType: "ERC20", isInternal: false, }, { @@ -1043,6 +1046,7 @@ describe("TransactionController (e2e)", () => { tokenAddress: "0x000000000000000000000000000000000000800A", transactionHash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e10", type: "withdrawal", + tokenType: "ETH", isInternal: false, }, { @@ -1062,6 +1066,7 @@ describe("TransactionController (e2e)", () => { tokenAddress: "0xD754FF5E8a6F257E162f72578a4bB0493c068101", transactionHash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e10", type: "fee", + tokenType: "ERC20", isInternal: false, }, { @@ -1081,6 +1086,7 @@ describe("TransactionController (e2e)", () => { tokenAddress: "0x000000000000000000000000000000000000800A", transactionHash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e10", type: "mint", + tokenType: "ETH", isInternal: false, }, { @@ -1100,6 +1106,7 @@ describe("TransactionController (e2e)", () => { tokenAddress: "0xD754FF5E8a6F257E162f72578a4bB0493c068101", transactionHash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e10", type: "refund", + tokenType: "ERC20", isInternal: false, }, { @@ -1119,6 +1126,7 @@ describe("TransactionController (e2e)", () => { tokenAddress: "0x000000000000000000000000000000000000800A", transactionHash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e10", type: "deposit", + tokenType: "ETH", isInternal: false, }, { @@ -1138,6 +1146,7 @@ describe("TransactionController (e2e)", () => { tokenAddress: "0xD754FF5E8a6F257E162f72578a4bB0493c068101", transactionHash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e10", type: "deposit", + tokenType: "ERC20", isInternal: false, }, { @@ -1157,6 +1166,7 @@ describe("TransactionController (e2e)", () => { tokenAddress: "0x000000000000000000000000000000000000800A", transactionHash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e10", type: "transfer", + tokenType: "ETH", isInternal: false, }, ]) @@ -1221,6 +1231,7 @@ describe("TransactionController (e2e)", () => { tokenAddress: "0x000000000000000000000000000000000000800A", transactionHash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e10", type: "deposit", + tokenType: "ETH", isInternal: false, }, ], From 5546c5ef825f95525c57319381fdba059ff72f9c Mon Sep 17 00:00:00 2001 From: Roman Petriv Date: Fri, 13 Oct 2023 02:36:21 +0300 Subject: [PATCH 4/5] chore: remove code formatting form PR template --- .github/pull_request_template.md | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 8ce206c849..54b4193537 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -17,4 +17,3 @@ - [ ] PR title corresponds to the body of PR (we generate changelog entries from PRs). - [ ] Tests for the changes have been added / updated. - [ ] Documentation comments have been added / updated. -- [ ] Code has been formatted via `zk fmt` and `zk lint`. From 84004eea0b5a646ae4252cc7acf792b37028511a Mon Sep 17 00:00:00 2001 From: Roman Petriv Date: Fri, 13 Oct 2023 02:46:33 +0300 Subject: [PATCH 5/5] chore: lint --- packages/api/src/transfer/transfer.service.spec.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/api/src/transfer/transfer.service.spec.ts b/packages/api/src/transfer/transfer.service.spec.ts index 1334328b4b..4b6a8f0308 100644 --- a/packages/api/src/transfer/transfer.service.spec.ts +++ b/packages/api/src/transfer/transfer.service.spec.ts @@ -16,7 +16,6 @@ import { TokenType } from "../token/token.entity"; import { AddressTransfer } from "./addressTransfer.entity"; import * as utils from "../common/utils"; import { normalizeAddressTransformer } from "../common/transformers/normalizeAddress.transformer"; -import { L2_ETH_TOKEN_ADDRESS } from "../common/constants"; jest.mock("../common/utils");