diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 6f379b8b..cadb7099 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -21,6 +21,7 @@ model Transfer { toDomainId Int? destination String? amount String? + securityModel Int? status TransferStatus deposit Deposit? execution Execution? @@ -71,7 +72,6 @@ model Deposit { blockNumber String depositData String timestamp DateTime? - handlerResponse String } model Execution { diff --git a/src/indexer/index.ts b/src/indexer/index.ts index 2f4460e1..9406e4ee 100644 --- a/src/indexer/index.ts +++ b/src/indexer/index.ts @@ -73,6 +73,8 @@ init() async function init(): Promise<{ domainIndexers: Array; app: FastifyInstance; cron: CronJob }> { const sharedConfig = await getSharedConfig(process.env.SHARED_CONFIG_URL!) + const sharedConfigX = await getSharedConfig(process.env.SHARED_CONFIG_URL_X!) + sharedConfig.domains = sharedConfig.domains.concat(sharedConfigX.domains) const chainAnalysisUrl = process.env.CHAIN_ANALYSIS_URL || "" const chainAnalysisApiKey = process.env.CHAIN_ANALYSIS_API_KEY || "" diff --git a/src/indexer/repository/transfer.ts b/src/indexer/repository/transfer.ts index 64084727..d4dc1825 100644 --- a/src/indexer/repository/transfer.ts +++ b/src/indexer/repository/transfer.ts @@ -20,6 +20,7 @@ export type TransferMetadata = { fromDomainId: string toDomainId: string resourceID: string + securityModel: number timestamp: Date deposit: Deposit resource: { @@ -69,6 +70,7 @@ class TransferRepository { }, }, usdValue: decodedLog.usdValue, + securityModel: decodedLog.securityModel, } return await this.transfer.upsert({ @@ -102,7 +104,7 @@ class TransferRepository { public async insertSubstrateDepositTransfer( substrateDepositData: Pick< DecodedDepositLog, - "depositNonce" | "sender" | "amount" | "destination" | "resourceID" | "toDomainId" | "fromDomainId" + "depositNonce" | "sender" | "amount" | "destination" | "resourceID" | "toDomainId" | "fromDomainId" | "securityModel" > & { usdValue: number }, ): Promise { const transferData = { @@ -133,6 +135,7 @@ class TransferRepository { }, }, usdValue: substrateDepositData.usdValue, + securityModel: substrateDepositData.securityModel || 1, } return await this.transfer.create({ data: transferData }) @@ -198,7 +201,11 @@ class TransferRepository { toDomainId, sender, usdValue, - }: Pick & { + securityModel, + }: Pick< + DecodedDepositLog, + "depositNonce" | "sender" | "amount" | "destination" | "resourceID" | "fromDomainId" | "toDomainId" | "securityModel" + > & { usdValue: number | null }, id: string, @@ -228,7 +235,8 @@ class TransferRepository { }, }, usdValue: usdValue, - } as Pick + securityModel: securityModel, + } as Pick return await this.transfer.update({ where: { id: id }, data: transferData }) } diff --git a/src/indexer/services/evmIndexer/evmTypes.ts b/src/indexer/services/evmIndexer/evmTypes.ts index 8b84b553..706ebaac 100644 --- a/src/indexer/services/evmIndexer/evmTypes.ts +++ b/src/indexer/services/evmIndexer/evmTypes.ts @@ -19,7 +19,7 @@ export type DecodedDepositLog = { txHash: string timestamp: number depositData: string - handlerResponse: string + securityModel: number transferType: string amount: string senderStatus?: string diff --git a/src/indexer/services/substrateIndexer/substrateTypes.ts b/src/indexer/services/substrateIndexer/substrateTypes.ts index 1b2c730f..1c608dfb 100644 --- a/src/indexer/services/substrateIndexer/substrateTypes.ts +++ b/src/indexer/services/substrateIndexer/substrateTypes.ts @@ -4,7 +4,7 @@ SPDX-License-Identifier: LGPL-3.0-only */ import { XcmAssetId } from "@polkadot/types/interfaces" -export type RawProposalExecutionData = { originDomainId: string; depositNonce: string; dataHash: string } +export type RawProposalExecutionData = { originDomainId: string; depositNonce: string } export type RawDepositData = { destDomainId: string @@ -13,7 +13,7 @@ export type RawDepositData = { sender: string transferType: string depositData: string - handlerResponse: string + securityModel: number } export type RawFeeCollectedData = { @@ -24,9 +24,9 @@ export type RawFeeCollectedData = { feeAssetId: XcmAssetId } -export type RawFailedHandlerExecutionData = Omit & { error: string } +export type RawFailedHandlerExecutionData = RawProposalExecutionData & { error: string } -export type ProposalExecutionDataToSave = Omit & { +export type ProposalExecutionDataToSave = RawProposalExecutionData & { txIdentifier: string blockNumber: string timestamp: number @@ -36,7 +36,7 @@ export type FeeCollectedDataToSave = RawFeeCollectedData & { txIdentifier: string } -export type FailedHandlerExecutionToSave = Omit & { +export type FailedHandlerExecutionToSave = RawProposalExecutionData & { error: string txIdentifier: string blockNumber: string diff --git a/src/indexer/utils/evm/index.ts b/src/indexer/utils/evm/index.ts index 79b9c59f..753b34ee 100644 --- a/src/indexer/utils/evm/index.ts +++ b/src/indexer/utils/evm/index.ts @@ -108,7 +108,7 @@ export async function parseDeposit( txHash: log.transactionHash, timestamp: blockUnixTimestamp, depositData: decodedLog.args.data as string, - handlerResponse: decodedLog.args.handlerResponse as string, + securityModel: (decodedLog.args.securityModel as number) || 1, transferType: resourceType, amount: decodeAmountsOrTokenId(decodedLog.args.data as string, resourceDecimals, resourceType) as string, fee: await getFee(provider, fromDomain.feeRouter, fromDomain, decodedLog), @@ -315,7 +315,6 @@ export async function saveDepositLogs( blockNumber: decodedLog.blockNumber.toString(), depositData: decodedLog.depositData, timestamp: new Date(decodedLog.timestamp * 1000), - handlerResponse: decodedLog.handlerResponse, transferId: transfer.id, } const depositExists = await depositRepository.findDeposit(transfer.id) diff --git a/src/indexer/utils/substrate/index.ts b/src/indexer/utils/substrate/index.ts index 86d4424a..e9b42acc 100644 --- a/src/indexer/utils/substrate/index.ts +++ b/src/indexer/utils/substrate/index.ts @@ -113,10 +113,10 @@ export async function saveDeposit( txIdentifier, blockNumber, depositData, - handlerResponse, sender, resourceId, timestamp, + securityModel, } = substrateDepositData const currentDomain = sharedConfig.domains.find(domain => domain.id === originDomainId) @@ -147,7 +147,7 @@ export async function saveDeposit( destination: `0x${depositData.substring(2).slice(128, depositData.length - 1)}`, } as Pick< DecodedDepositLog, - "depositNonce" | "amount" | "destination" | "resourceID" | "toDomainId" | "fromDomainId" | "timestamp" | "sender" + "depositNonce" | "amount" | "destination" | "resourceID" | "toDomainId" | "fromDomainId" | "timestamp" | "sender" | "securityModel" > & { usdValue: number } if (transfer.accountId !== null) { @@ -177,9 +177,10 @@ export async function saveDeposit( timestamp: timestamp, destination: `0x${depositData.substring(2).slice(128, depositData.length - 1)}`, usdValue: amountInUSD, + securityModel: securityModel, } as Pick< DecodedDepositLog, - "depositNonce" | "sender" | "amount" | "destination" | "resourceID" | "toDomainId" | "fromDomainId" | "timestamp" + "depositNonce" | "sender" | "amount" | "destination" | "resourceID" | "toDomainId" | "fromDomainId" | "timestamp" | "securityModel" > & { usdValue: number } await accountRepository.insertAccount({ id: sender, addressStatus: "" }) @@ -194,7 +195,6 @@ export async function saveDeposit( blockNumber: blockNumber, depositData: depositData, timestamp: new Date(timestamp), - handlerResponse: handlerResponse, transferId: transfer.id, } await depositRepository.insertDeposit(deposit) @@ -273,7 +273,7 @@ export async function saveEvents( for (const depositEvent of depositEvents) { const txIdentifier = `${block}-${depositEvent.phase.asApplyExtrinsic}` //this is like the txHash but for the substrate const { data } = depositEvent.event.toHuman() - const { destDomainId, resourceId, depositNonce, sender, transferType, depositData, handlerResponse } = data + const { destDomainId, resourceId, depositNonce, sender, transferType, depositData, securityModel } = data await saveDepositToDb( domain, block.toString(), @@ -284,10 +284,10 @@ export async function saveEvents( sender, transferType, depositData, - handlerResponse, txIdentifier, blockNumber: `${block}`, timestamp, + securityModel: securityModel, }, transferRepository, depositRepository, diff --git a/src/interfaces/TransfersInterfaces/index.ts b/src/interfaces/TransfersInterfaces/index.ts index 956e696e..3f45b26d 100644 --- a/src/interfaces/TransfersInterfaces/index.ts +++ b/src/interfaces/TransfersInterfaces/index.ts @@ -74,7 +74,6 @@ export type IncludedQueryParams = { txHash: boolean blockNumber: boolean depositData: boolean - handlerResponse: boolean timestamp: boolean } } diff --git a/src/scripts/classes/PriceCalculation.ts b/src/scripts/classes/PriceCalculation.ts index 3e07f3da..0828b3f1 100644 --- a/src/scripts/classes/PriceCalculation.ts +++ b/src/scripts/classes/PriceCalculation.ts @@ -58,6 +58,7 @@ export class PriceCalculation implements IFixInterface { sender: transfer.accountId!, toDomainId: String(transfer.toDomainId!), usdValue: newValue, + securityModel: transfer.securityModel!, }, transfer.id, ) diff --git a/src/seed/seeder.ts b/src/seed/seeder.ts index f0ecf1d5..cc49ae3e 100644 --- a/src/seed/seeder.ts +++ b/src/seed/seeder.ts @@ -100,7 +100,7 @@ const seeder = async (): Promise => { console.log(`Adding ${domainsWithRpcURL.length} domains`) for (const pl of onlyTokensTransfers) { - const { destinationDomainID, resourceID, depositNonce, user, data, handlerResponse } = pl.parsedData.args + const { destinationDomainID, resourceID, depositNonce, user, data} = pl.parsedData.args const { txHash, blockNumber } = pl const destinationDomain = domainsWithRpcURL.find(domain => domain.id === destinationDomainID) @@ -177,7 +177,6 @@ const seeder = async (): Promise => { txHash, blockNumber, depositData: data as string, - handlerResponse: handlerResponse as string, }, execution: { txHash, @@ -222,7 +221,6 @@ const seeder = async (): Promise => { txHash: augmentedTransfer.deposit.txHash, blockNumber: `${augmentedTransfer.deposit.blockNumber}`, depositData: augmentedTransfer.deposit.depositData, - handlerResponse: augmentedTransfer.deposit.handlerResponse, }, }, execution: { diff --git a/src/utils/helpers.ts b/src/utils/helpers.ts index da8d788f..d10b54be 100644 --- a/src/utils/helpers.ts +++ b/src/utils/helpers.ts @@ -2,7 +2,7 @@ The Licensed Work is (c) 2023 Sygma SPDX-License-Identifier: LGPL-3.0-only */ -import { Signer, ethers, AbiCoder } from "ethers" +import { Signer, ethers } from "ethers" import { ERC20Handler__factory as Erc20HandlerFactory, ERC721Handler__factory as Erc721HandlerFactory } from "@buildwithsygma/sygma-contracts" import { sleep } from "../indexer/utils/substrate" import { EvmBridgeConfig, HandlersMap, SygmaConfig } from "../sygmaTypes" @@ -12,17 +12,6 @@ export function getNetworkName(domainId: number, sygmaConfig: SygmaConfig): stri return sygmaConfig.chains.find(c => c.domainId === domainId)?.name || "" } -export function decodeDataHash(data: string): { amount: string; destinationRecipientAddress: string } { - const abiCoder = AbiCoder.defaultAbiCoder() - const decodedData = abiCoder.decode(["uint", "uint"], data) - const destinationRecipientAddressLen = Number(decodedData.toArray()[1]) * 2 // adjusted for bytes - const result = { - amount: `${decodedData.toArray()[0] as string}`, - destinationRecipientAddress: `0x${data.slice(130, 130 + destinationRecipientAddressLen)}`, - } - return result -} - export function convertMillisecondsToMinutes(duration: number): number { return duration / 1000 / 60 } @@ -70,7 +59,6 @@ export const getTransferQueryParams = (): IncludedQueryParams => { txHash: true, blockNumber: true, depositData: true, - handlerResponse: true, timestamp: true, }, }, diff --git a/swagger.yaml b/swagger.yaml index 75d57257..ca474e04 100644 --- a/swagger.yaml +++ b/swagger.yaml @@ -101,7 +101,6 @@ paths: txHash: "0x0a457e0c76dc5945466c0f0f2bb6c39f5e5be5f48323fa29ec02295b5df4de4d" blockNumber: "12984723" depositData: "0x0000000000000000000000000000000000000000000000000000000000000001" - handlerResponse: "0x436f6e76657274696e6720726573706f6e73652066726f6d2068616e646c6572" fee: id: 60f7da143ce83aef2d325dd3 amount: 500000000000000000 @@ -148,7 +147,6 @@ paths: txHash: "0x0a457e0c76dc5945466c0f0f2bb6c39f5e5be5f48323fa29ec02295b5df4de4d" blockNumber: "12984723" depositData: "0x0000000000000000000000000000000000000000000000000000000000000001" - handlerResponse: "0x8f7a67e5b31c7a259098b8c760f5a3f1e8102aa615fe5db5d86de18d52c5a5a5" fee: id: 61a4f4c2ab4d8145c6db5f09 amount: 1000000000000000000 @@ -448,6 +446,9 @@ components: destination: type: string example: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e" + securityModel: + type: integer + example: 1 TransferStatus: type: string @@ -527,10 +528,6 @@ components: depositData: type: string example: "0x1234567890abcdef" - handlerResponse: - type: string - nullable: true - example: "0x1234567890abcdef" Execution: type: object @@ -556,8 +553,4 @@ components: handlerResponse: type: string nullable: true - example: "0x1234567890abcdef" - dataHash: - type: string - nullable: true - example: "0x9876543210abcdef" + example: "0x1234567890abcdef" \ No newline at end of file diff --git a/tests/e2e/domainAndResourceRoute.spec.ts b/tests/e2e/domainAndResourceRoute.spec.ts index ddeb6cd7..e20b356c 100644 --- a/tests/e2e/domainAndResourceRoute.spec.ts +++ b/tests/e2e/domainAndResourceRoute.spec.ts @@ -86,6 +86,7 @@ describe("Get all transfers for a specific resource between source and destinati }, toDomain: { name: "evm2", lastIndexedBlock: transfers[0].toDomain.lastIndexedBlock, id: 2 }, fromDomain: { name: "Ethereum 1", lastIndexedBlock: transfers[0].fromDomain.lastIndexedBlock, id: 1 }, + securityModel: 1, fee: { id: transfers[0].fee.id, transferId: transfers[0].id, @@ -104,7 +105,6 @@ describe("Get all transfers for a specific resource between source and destinati blockNumber: "591", depositData: "0x0000000000000000000000000000000000000000000000001fdd50eb1da26c1000000000000000000000000000000000000000000000000000000000000000148e0a907331554af72563bd8d43051c2e64be5d35000000000000000000000000000000000000000000000000000000000000000c6d657461646174612e75726c", - handlerResponse: "0x6d657461646174612e746573746d657461646174612e75726c", timestamp: "2023-07-17T08:31:22.000Z", }, execution: { @@ -145,6 +145,7 @@ describe("Get all transfers for a specific resource between source and destinati }, toDomain: { name: "evm2", lastIndexedBlock: transfers[0].toDomain.lastIndexedBlock, id: 2 }, fromDomain: { name: "Ethereum 1", lastIndexedBlock: transfers[0].fromDomain.lastIndexedBlock, id: 1 }, + securityModel: 1, fee: { amount: "1000000000000000", id: transfers[0].fee.id, @@ -163,7 +164,6 @@ describe("Get all transfers for a specific resource between source and destinati blockNumber: "623", depositData: "0x0000000000000000000000000000000000000000000000000000000000030d400004ea287d1514b1387b365ae7294ea13bad9db83436e671dd16ba145c1f5961696bad2e73f73417f07ef55c62a2dc5b47ed248f568cc8f9fe4371a1d1fab88a62af595f8efb9aeff6f0e043b7ea33b10000000000000000000000005c1f5961696bad2e73f73417f07ef55c62a2dc5b", - handlerResponse: "0x", timestamp: "2023-07-17T08:32:27.000Z", }, execution: { diff --git a/tests/e2e/indexing.spec.ts b/tests/e2e/indexing.spec.ts index d2381ae8..800510a4 100644 --- a/tests/e2e/indexing.spec.ts +++ b/tests/e2e/indexing.spec.ts @@ -134,6 +134,7 @@ describe("Indexer e2e tests", function () { }, toDomain: { name: "evm2", lastIndexedBlock: transfer[0].toDomain.lastIndexedBlock, id: 2 }, fromDomain: { name: "Ethereum 1", lastIndexedBlock: transfer[0].fromDomain.lastIndexedBlock, id: 1 }, + securityModel: 1, fee: { amount: "1000000000000000", id: transfer[0].fee.id, @@ -152,7 +153,6 @@ describe("Indexer e2e tests", function () { blockNumber: "628", depositData: "0x000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000148e0a907331554af72563bd8d43051c2e64be5d350102", - handlerResponse: "0x", timestamp: "2023-07-17T08:32:37.000Z", }, execution: { @@ -191,6 +191,7 @@ describe("Indexer e2e tests", function () { }, toDomain: { name: "evm2", lastIndexedBlock: transfer[0].toDomain.lastIndexedBlock, id: 2 }, fromDomain: { name: "Ethereum 1", lastIndexedBlock: transfer[0].fromDomain.lastIndexedBlock, id: 1 }, + securityModel: 1, fee: { amount: "1000000000000000", id: transfer[0].fee.id, @@ -209,7 +210,6 @@ describe("Indexer e2e tests", function () { blockNumber: "591", depositData: "0x0000000000000000000000000000000000000000000000001fdd50eb1da26c1000000000000000000000000000000000000000000000000000000000000000148e0a907331554af72563bd8d43051c2e64be5d35000000000000000000000000000000000000000000000000000000000000000c6d657461646174612e75726c", - handlerResponse: "0x6d657461646174612e746573746d657461646174612e75726c", timestamp: "2023-07-17T08:31:22.000Z", }, execution: { @@ -248,6 +248,7 @@ describe("Indexer e2e tests", function () { }, toDomain: { name: "evm2", lastIndexedBlock: transfer[0].toDomain.lastIndexedBlock, id: 2 }, fromDomain: { name: "Ethereum 1", lastIndexedBlock: transfer[0].fromDomain.lastIndexedBlock, id: 1 }, + securityModel: 1, fee: { amount: "1000000000000000", id: transfer[0].fee.id, @@ -266,7 +267,6 @@ describe("Indexer e2e tests", function () { blockNumber: "623", depositData: "0x0000000000000000000000000000000000000000000000000000000000030d400004ea287d1514b1387b365ae7294ea13bad9db83436e671dd16ba145c1f5961696bad2e73f73417f07ef55c62a2dc5b47ed248f568cc8f9fe4371a1d1fab88a62af595f8efb9aeff6f0e043b7ea33b10000000000000000000000005c1f5961696bad2e73f73417f07ef55c62a2dc5b", - handlerResponse: "0x", timestamp: "2023-07-17T08:32:27.000Z", }, execution: { @@ -305,6 +305,7 @@ describe("Indexer e2e tests", function () { }, toDomain: { name: "evm2", lastIndexedBlock: transfer[0].toDomain.lastIndexedBlock, id: 2 }, fromDomain: { name: "Ethereum 1", lastIndexedBlock: transfer[0].fromDomain.lastIndexedBlock, id: 1 }, + securityModel: 1, fee: { amount: "1000000000000000", id: transfer[0].fee.id, @@ -323,7 +324,6 @@ describe("Indexer e2e tests", function () { blockNumber: "598", depositData: "0x000000000000000000000000000000000000000000000000000000000000002030bb0f28498d8bc6272403413a967b2098aa4d7c7422d4ff2ff2c6c2bdc44af3", - handlerResponse: "0x", timestamp: "2023-07-17T08:31:36.000Z", }, execution: { @@ -362,6 +362,7 @@ describe("Indexer e2e tests", function () { }, toDomain: { name: "Ethereum 1", lastIndexedBlock: transfer[0].toDomain.lastIndexedBlock, id: 1 }, fromDomain: { name: "Substrate", lastIndexedBlock: transfer[0].fromDomain.lastIndexedBlock, id: 3 }, + securityModel: 1, fee: { amount: "50", id: transfer[0].fee.id, @@ -380,7 +381,6 @@ describe("Indexer e2e tests", function () { blockNumber: "356", depositData: "0x00000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000000145c1f5961696bad2e73f73417f07ef55c62a2dc5b", - handlerResponse: "", timestamp: "2023-07-17T08:29:12.000Z", }, execution: { @@ -419,6 +419,7 @@ describe("Indexer e2e tests", function () { }, toDomain: { name: "Substrate", lastIndexedBlock: transfer[0].toDomain.lastIndexedBlock, id: 3 }, fromDomain: { name: "Ethereum 1", lastIndexedBlock: transfer[0].fromDomain.lastIndexedBlock, id: 1 }, + securityModel: 1, fee: { amount: "1000000000000000", id: transfer[0].fee.id, @@ -437,7 +438,6 @@ describe("Indexer e2e tests", function () { blockNumber: "516", depositData: "0x00000000000000000000000000000000000000000000000000005af3107a4000000000000000000000000000000000000000000000000000000000000000002400010100d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d", - handlerResponse: "0x", timestamp: "2023-07-17T08:28:51.000Z", }, execution: { diff --git a/tests/e2e/resourceRoute.spec.ts b/tests/e2e/resourceRoute.spec.ts index 78121ebb..7c56e114 100644 --- a/tests/e2e/resourceRoute.spec.ts +++ b/tests/e2e/resourceRoute.spec.ts @@ -95,6 +95,7 @@ describe("Get all transfers for a specific resource", function () { }, toDomain: { name: "evm2", lastIndexedBlock: transfers[0].toDomain.lastIndexedBlock, id: 2 }, fromDomain: { name: "Ethereum 1", lastIndexedBlock: transfers[0].fromDomain.lastIndexedBlock, id: 1 }, + securityModel: 1, fee: { amount: "1000000000000000", id: transfers[0].fee.id, @@ -113,7 +114,6 @@ describe("Get all transfers for a specific resource", function () { blockNumber: "591", depositData: "0x0000000000000000000000000000000000000000000000001fdd50eb1da26c1000000000000000000000000000000000000000000000000000000000000000148e0a907331554af72563bd8d43051c2e64be5d35000000000000000000000000000000000000000000000000000000000000000c6d657461646174612e75726c", - handlerResponse: "0x6d657461646174612e746573746d657461646174612e75726c", timestamp: "2023-07-17T08:31:22.000Z", }, execution: { @@ -152,6 +152,7 @@ describe("Get all transfers for a specific resource", function () { }, toDomain: { name: "evm2", lastIndexedBlock: transfers[0].toDomain.lastIndexedBlock, id: 2 }, fromDomain: { name: "Ethereum 1", lastIndexedBlock: transfers[0].fromDomain.lastIndexedBlock, id: 1 }, + securityModel: 1, fee: { amount: "1000000000000000", id: transfers[0].fee.id, @@ -170,7 +171,6 @@ describe("Get all transfers for a specific resource", function () { blockNumber: "623", depositData: "0x0000000000000000000000000000000000000000000000000000000000030d400004ea287d1514b1387b365ae7294ea13bad9db83436e671dd16ba145c1f5961696bad2e73f73417f07ef55c62a2dc5b47ed248f568cc8f9fe4371a1d1fab88a62af595f8efb9aeff6f0e043b7ea33b10000000000000000000000005c1f5961696bad2e73f73417f07ef55c62a2dc5b", - handlerResponse: "0x", timestamp: "2023-07-17T08:32:27.000Z", }, execution: { @@ -209,6 +209,7 @@ describe("Get all transfers for a specific resource", function () { }, toDomain: { name: "evm2", lastIndexedBlock: transfers[0].toDomain.lastIndexedBlock, id: 2 }, fromDomain: { name: "Ethereum 1", lastIndexedBlock: transfers[0].fromDomain.lastIndexedBlock, id: 1 }, + securityModel: 1, fee: { amount: "1000000000000000", id: transfers[0].fee.id, @@ -227,7 +228,6 @@ describe("Get all transfers for a specific resource", function () { blockNumber: "598", depositData: "0x000000000000000000000000000000000000000000000000000000000000002030bb0f28498d8bc6272403413a967b2098aa4d7c7422d4ff2ff2c6c2bdc44af3", - handlerResponse: "0x", timestamp: "2023-07-17T08:31:36.000Z", }, execution: { diff --git a/tests/mockTxs.ts b/tests/mockTxs.ts index 97ea45ba..4da3f3e2 100644 --- a/tests/mockTxs.ts +++ b/tests/mockTxs.ts @@ -22,11 +22,9 @@ const mockTransfers = { status: 1, sourceTokenAddress: "0xda8556c2485048eee3de91085347c3210785323c", destinationTokenAddress: "0xda8556c2485048eee3de91085347c3210785323c", - handlerResponse: null, proposalExecutionEvent: { originDomainID: 1, depositNonce: 10, - dataHash: "0x5ef98301782da0d86bea1c3dd38d7008f61ecc067f70329d59b7293286fece9d", by: "0x24962717f8fA5BA3b931bACaF9ac03924EB475a0", }, failedHandlerExecutionEvent: null, @@ -49,11 +47,9 @@ const mockTransfers = { status: 1, sourceTokenAddress: "0xda8556c2485048eee3de91085347c3210785323c", destinationTokenAddress: "0xda8556c2485048eee3de91085347c3210785323c", - handlerResponse: null, proposalExecutionEvent: { originDomainID: 1, depositNonce: 9, - dataHash: "0x5ef98301782da0d86bea1c3dd38d7008f61ecc067f70329d59b7293286fece9d", by: "0x24962717f8fA5BA3b931bACaF9ac03924EB475a0", }, failedHandlerExecutionEvent: null, @@ -76,11 +72,9 @@ const mockTransfers = { status: 1, sourceTokenAddress: "0xda8556c2485048eee3de91085347c3210785323c", destinationTokenAddress: "0xda8556c2485048eee3de91085347c3210785323c", - handlerResponse: null, proposalExecutionEvent: { originDomainID: 1, depositNonce: 8, - dataHash: "0x5ef98301782da0d86bea1c3dd38d7008f61ecc067f70329d59b7293286fece9d", by: "0x24962717f8fA5BA3b931bACaF9ac03924EB475a0", }, failedHandlerExecutionEvent: null, @@ -103,11 +97,9 @@ const mockTransfers = { status: 1, sourceTokenAddress: "0xda8556c2485048eee3de91085347c3210785323c", destinationTokenAddress: "0xda8556c2485048eee3de91085347c3210785323c", - handlerResponse: null, proposalExecutionEvent: { originDomainID: 1, depositNonce: 7, - dataHash: "0x5ef98301782da0d86bea1c3dd38d7008f61ecc067f70329d59b7293286fece9d", by: "0x4CEEf6139f00F9F4535Ad19640Ff7A0137708485", }, failedHandlerExecutionEvent: null, @@ -130,11 +122,9 @@ const mockTransfers = { status: 1, sourceTokenAddress: "0xda8556c2485048eee3de91085347c3210785323c", destinationTokenAddress: "0xda8556c2485048eee3de91085347c3210785323c", - handlerResponse: null, proposalExecutionEvent: { originDomainID: 1, depositNonce: 6, - dataHash: "0x5ef98301782da0d86bea1c3dd38d7008f61ecc067f70329d59b7293286fece9d", by: "0x148FfB2074A9e59eD58142822b3eB3fcBffb0cd7", }, failedHandlerExecutionEvent: null, @@ -157,11 +147,9 @@ const mockTransfers = { status: 1, sourceTokenAddress: "0xda8556c2485048eee3de91085347c3210785323c", destinationTokenAddress: "0xda8556c2485048eee3de91085347c3210785323c", - handlerResponse: null, proposalExecutionEvent: { originDomainID: 1, depositNonce: 5, - dataHash: "0x5ef98301782da0d86bea1c3dd38d7008f61ecc067f70329d59b7293286fece9d", by: "0x148FfB2074A9e59eD58142822b3eB3fcBffb0cd7", }, failedHandlerExecutionEvent: null, @@ -184,11 +172,9 @@ const mockTransfers = { status: 1, sourceTokenAddress: "0xda8556c2485048eee3de91085347c3210785323c", destinationTokenAddress: "0xda8556c2485048eee3de91085347c3210785323c", - handlerResponse: null, proposalExecutionEvent: { originDomainID: 1, depositNonce: 4, - dataHash: "0x5ef98301782da0d86bea1c3dd38d7008f61ecc067f70329d59b7293286fece9d", by: "0x24962717f8fA5BA3b931bACaF9ac03924EB475a0", }, failedHandlerExecutionEvent: null, @@ -211,11 +197,9 @@ const mockTransfers = { status: 1, sourceTokenAddress: "0xda8556c2485048eee3de91085347c3210785323c", destinationTokenAddress: "0xda8556c2485048eee3de91085347c3210785323c", - handlerResponse: null, proposalExecutionEvent: { originDomainID: 1, depositNonce: 3, - dataHash: "0x5ef98301782da0d86bea1c3dd38d7008f61ecc067f70329d59b7293286fece9d", by: "0x148FfB2074A9e59eD58142822b3eB3fcBffb0cd7", }, failedHandlerExecutionEvent: null, @@ -238,11 +222,9 @@ const mockTransfers = { status: 1, sourceTokenAddress: "0xda8556c2485048eee3de91085347c3210785323c", destinationTokenAddress: "0xda8556c2485048eee3de91085347c3210785323c", - handlerResponse: null, proposalExecutionEvent: { originDomainID: 1, depositNonce: 2, - dataHash: "0x5ef98301782da0d86bea1c3dd38d7008f61ecc067f70329d59b7293286fece9d", by: "0x4CEEf6139f00F9F4535Ad19640Ff7A0137708485", }, failedHandlerExecutionEvent: null, @@ -265,11 +247,9 @@ const mockTransfers = { status: 1, sourceTokenAddress: "0xda8556c2485048eee3de91085347c3210785323c", destinationTokenAddress: "0xda8556c2485048eee3de91085347c3210785323c", - handlerResponse: null, proposalExecutionEvent: { originDomainID: 1, depositNonce: 1, - dataHash: "0x5ef98301782da0d86bea1c3dd38d7008f61ecc067f70329d59b7293286fece9d", by: "0x4CEEf6139f00F9F4535Ad19640Ff7A0137708485", }, failedHandlerExecutionEvent: null, @@ -292,11 +272,9 @@ const mockTransfers = { status: 1, sourceTokenAddress: "0xda8556c2485048eee3de91085347c3210785323c", destinationTokenAddress: "0xda8556c2485048eee3de91085347c3210785323c", - handlerResponse: null, proposalExecutionEvent: { originDomainID: 1, depositNonce: 1, - dataHash: "0x5ef98301782da0d86bea1c3dd38d7008f61ecc067f70329d59b7293286fece9d", by: "0x4CEEf6139f00F9F4535Ad19640Ff7A0137708485", }, failedHandlerExecutionEvent: null, @@ -319,11 +297,9 @@ const mockTransfers = { status: 1, sourceTokenAddress: "0xda8556c2485048eee3de91085347c3210785323c", destinationTokenAddress: "0xda8556c2485048eee3de91085347c3210785323c", - handlerResponse: null, proposalExecutionEvent: { originDomainID: 1, depositNonce: 1, - dataHash: "0x5ef98301782da0d86bea1c3dd38d7008f61ecc067f70329d59b7293286fece9d", by: "0x4CEEf6139f00F9F4535Ad19640Ff7A0137708485", }, failedHandlerExecutionEvent: null, @@ -346,11 +322,9 @@ const mockTransfers = { status: 1, sourceTokenAddress: "0xda8556c2485048eee3de91085347c3210785323c", destinationTokenAddress: "0xda8556c2485048eee3de91085347c3210785323c", - handlerResponse: null, proposalExecutionEvent: { originDomainID: 1, depositNonce: 1, - dataHash: "0x5ef98301782da0d86bea1c3dd38d7008f61ecc067f70329d59b7293286fece9d", by: "0x4CEEf6139f00F9F4535Ad19640Ff7A0137708485", }, failedHandlerExecutionEvent: null, @@ -373,11 +347,9 @@ const mockTransfers = { status: 1, sourceTokenAddress: "0xda8556c2485048eee3de91085347c3210785323c", destinationTokenAddress: "0xda8556c2485048eee3de91085347c3210785323c", - handlerResponse: null, proposalExecutionEvent: { originDomainID: 1, depositNonce: 1, - dataHash: "0x5ef98301782da0d86bea1c3dd38d7008f61ecc067f70329d59b7293286fece9d", by: "0x4CEEf6139f00F9F4535Ad19640Ff7A0137708485", }, failedHandlerExecutionEvent: null, @@ -400,11 +372,9 @@ const mockTransfers = { status: 1, sourceTokenAddress: "0xda8556c2485048eee3de91085347c3210785323c", destinationTokenAddress: "0xda8556c2485048eee3de91085347c3210785323c", - handlerResponse: null, proposalExecutionEvent: { originDomainID: 1, depositNonce: 1, - dataHash: "0x5ef98301782da0d86bea1c3dd38d7008f61ecc067f70329d59b7293286fece9d", by: "0x4CEEf6139f00F9F4535Ad19640Ff7A0137708485", }, failedHandlerExecutionEvent: null, @@ -427,11 +397,9 @@ const mockTransfers = { status: 1, sourceTokenAddress: "0xda8556c2485048eee3de91085347c3210785323c", destinationTokenAddress: "0xda8556c2485048eee3de91085347c3210785323c", - handlerResponse: null, proposalExecutionEvent: { originDomainID: 1, depositNonce: 1, - dataHash: "0x5ef98301782da0d86bea1c3dd38d7008f61ecc067f70329d59b7293286fece9d", by: "0x4CEEf6139f00F9F4535Ad19640Ff7A0137708485", }, failedHandlerExecutionEvent: null, @@ -454,11 +422,9 @@ const mockTransfers = { status: 1, sourceTokenAddress: "0xda8556c2485048eee3de91085347c3210785323c", destinationTokenAddress: "0xda8556c2485048eee3de91085347c3210785323c", - handlerResponse: null, proposalExecutionEvent: { originDomainID: 1, depositNonce: 1, - dataHash: "0x5ef98301782da0d86bea1c3dd38d7008f61ecc067f70329d59b7293286fece9d", by: "0x4CEEf6139f00F9F4535Ad19640Ff7A0137708485", }, failedHandlerExecutionEvent: null, @@ -481,11 +447,9 @@ const mockTransfers = { status: 1, sourceTokenAddress: "0xda8556c2485048eee3de91085347c3210785323c", destinationTokenAddress: "0xda8556c2485048eee3de91085347c3210785323c", - handlerResponse: null, proposalExecutionEvent: { originDomainID: 1, depositNonce: 1, - dataHash: "0x5ef98301782da0d86bea1c3dd38d7008f61ecc067f70329d59b7293286fece9d", by: "0x4CEEf6139f00F9F4535Ad19640Ff7A0137708485", }, failedHandlerExecutionEvent: null, @@ -508,11 +472,9 @@ const mockTransfers = { status: 1, sourceTokenAddress: "0xda8556c2485048eee3de91085347c3210785323c", destinationTokenAddress: "0xda8556c2485048eee3de91085347c3210785323c", - handlerResponse: null, proposalExecutionEvent: { originDomainID: 1, depositNonce: 1, - dataHash: "0x5ef98301782da0d86bea1c3dd38d7008f61ecc067f70329d59b7293286fece9d", by: "0x4CEEf6139f00F9F4535Ad19640Ff7A0137708485", }, failedHandlerExecutionEvent: null, @@ -535,11 +497,9 @@ const mockTransfers = { status: 1, sourceTokenAddress: "0xda8556c2485048eee3de91085347c3210785323c", destinationTokenAddress: "0xda8556c2485048eee3de91085347c3210785323c", - handlerResponse: null, proposalExecutionEvent: { originDomainID: 1, depositNonce: 1, - dataHash: "0x5ef98301782da0d86bea1c3dd38d7008f61ecc067f70329d59b7293286fece9d", by: "0x4CEEf6139f00F9F4535Ad19640Ff7A0137708485", }, failedHandlerExecutionEvent: null, diff --git a/tests/unit/monitoringService.spec.ts b/tests/unit/monitoringService.spec.ts index 0bce161a..2c41511e 100644 --- a/tests/unit/monitoringService.spec.ts +++ b/tests/unit/monitoringService.spec.ts @@ -44,6 +44,7 @@ describe("Monitoring service testing", function () { accountId: "0x5C1F5961696BaD2e73f73417f07EF55C62a2dC5b", message: "", usdValue: null, + securityModel: 1, resource: { type: "nonfungible", id: "0x0000000000000000000000000000000000000000000000000000000000000200", @@ -64,7 +65,6 @@ describe("Monitoring service testing", function () { blockNumber: "591", depositData: "0x0000000000000000000000000000000000000000000000001fdd50eb1da26c1000000000000000000000000000000000000000000000000000000000000000148e0a907331554af72563bd8d43051c2e64be5d35000000000000000000000000000000000000000000000000000000000000000c6d657461646174612e75726c", - handlerResponse: "0x6d657461646174612e746573746d657461646174612e75726c", }, execution: { txHash: "0x3de2201e548a8332aaa50147a2fb02e2b6669184f042b4dbcf23b4f5d40edcfb", @@ -103,6 +103,7 @@ describe("Monitoring service testing", function () { accountId: "0x5C1F5961696BaD2e73f73417f07EF55C62a2dC5b", message: "", usdValue: null, + securityModel: 1, resource: { type: "nonfungible", id: "0x0000000000000000000000000000000000000000000000000000000000000200", @@ -123,7 +124,6 @@ describe("Monitoring service testing", function () { timestamp: new Date(Date.now() - 20 * 60 * 1000), depositData: "0x0000000000000000000000000000000000000000000000001fdd50eb1da26c1000000000000000000000000000000000000000000000000000000000000000148e0a907331554af72563bd8d43051c2e64be5d35000000000000000000000000000000000000000000000000000000000000000c6d657461646174612e75726c", - handlerResponse: "0x6d657461646174612e746573746d657461646174612e75726c", }, execution: { txHash: "0x3de2201e548a8332aaa50147a2fb02e2b6669184f042b4dbcf23b4f5d40edcfb", @@ -162,6 +162,7 @@ describe("Monitoring service testing", function () { accountId: "0x5C1F5961696BaD2e73f73417f07EF55C62a2dC5b", message: "", usdValue: null, + securityModel: 1, resource: { type: "nonfungible", id: "0x0000000000000000000000000000000000000000000000000000000000000200", @@ -182,7 +183,6 @@ describe("Monitoring service testing", function () { timestamp: new Date(Date.now() - 5 * 60 * 1000), depositData: "0x0000000000000000000000000000000000000000000000001fdd50eb1da26c1000000000000000000000000000000000000000000000000000000000000000148e0a907331554af72563bd8d43051c2e64be5d35000000000000000000000000000000000000000000000000000000000000000c6d657461646174612e75726c", - handlerResponse: "0x6d657461646174612e746573746d657461646174612e75726c", }, execution: { txHash: "0x3de2201e548a8332aaa50147a2fb02e2b6669184f042b4dbcf23b4f5d40edcfb",