diff --git a/blockchain-watcher/config/custom-environment-variables.json b/blockchain-watcher/config/custom-environment-variables.json index 8bd3c1ec3..44263a630 100644 --- a/blockchain-watcher/config/custom-environment-variables.json +++ b/blockchain-watcher/config/custom-environment-variables.json @@ -221,6 +221,13 @@ "__format": "json" } }, + "unichain": { + "network": "UNICHAIN_NETWORK", + "rpcs": { + "__name": "UNICHAIN_RPCS", + "__format": "json" + } + }, "polygon-sepolia": { "network": "POLYGON_SEPOLIA_NETWORK", "rpcs": { diff --git a/blockchain-watcher/config/default.json b/blockchain-watcher/config/default.json index 49f6fe652..e8d771333 100644 --- a/blockchain-watcher/config/default.json +++ b/blockchain-watcher/config/default.json @@ -247,6 +247,13 @@ "rpcs": ["https://testnet.snaxchain.io/"], "timeout": 10000 }, + "unichain": { + "name": "unichain", + "network": "testnet", + "chainId": 44, + "rpcs": ["https://sepolia.unichain.org"], + "timeout": 10000 + }, "evmos": { "name": "evmos", "network": "testnet", diff --git a/blockchain-watcher/src/infrastructure/repositories/RepositoriesBuilder.ts b/blockchain-watcher/src/infrastructure/repositories/RepositoriesBuilder.ts index b31dfee3d..8b642bfd4 100644 --- a/blockchain-watcher/src/infrastructure/repositories/RepositoriesBuilder.ts +++ b/blockchain-watcher/src/infrastructure/repositories/RepositoriesBuilder.ts @@ -80,6 +80,7 @@ const EVM_CHAINS = new Map([ ["xlayer", "evmRepo"], ["snaxchain", "evmRepo"], ["berachain", "evmRepo"], + ["unichain", "evmRepo"], ]); const POOL_STRATEGY = "healthy"; diff --git a/blockchain-watcher/test/infrastructure/repositories/RepositoriesBuilder.test.ts b/blockchain-watcher/test/infrastructure/repositories/RepositoriesBuilder.test.ts index f9c6a0efd..993ccb504 100644 --- a/blockchain-watcher/test/infrastructure/repositories/RepositoriesBuilder.test.ts +++ b/blockchain-watcher/test/infrastructure/repositories/RepositoriesBuilder.test.ts @@ -118,6 +118,9 @@ describe("RepositoriesBuilder", () => { expect(repos.getEvmBlockRepository("berachain")).toBeInstanceOf( RateLimitedEvmJsonRPCBlockRepository ); + expect(repos.getEvmBlockRepository("unichain")).toBeInstanceOf( + RateLimitedEvmJsonRPCBlockRepository + ); expect(repos.getAlgorandRepository()).toBeInstanceOf(RateLimitedAlgorandJsonRPCBlockRepository); expect(repos.getAptosRepository()).toBeInstanceOf(RateLimitedAptosJsonRPCBlockRepository); expect(repos.getMetadataRepository()).toBeInstanceOf(FileMetadataRepository); diff --git a/blockchain-watcher/test/mocks/configMock.ts b/blockchain-watcher/test/mocks/configMock.ts index 278d427a9..3993d3af2 100644 --- a/blockchain-watcher/test/mocks/configMock.ts +++ b/blockchain-watcher/test/mocks/configMock.ts @@ -193,6 +193,13 @@ export const configMock = (): Config => { rpcs: ["http://localhost"], timeout: 10000, }, + unichain: { + name: "unichain", + network: "testnet", + chainId: 44, + rpcs: ["http://localhost"], + timeout: 10000, + }, evmos: { name: "evmos", network: "testnet", diff --git a/deploy/blockchain-watcher/env/production-mainnet.env b/deploy/blockchain-watcher/env/production-mainnet.env index 733085d32..e8e78fe3e 100644 --- a/deploy/blockchain-watcher/env/production-mainnet.env +++ b/deploy/blockchain-watcher/env/production-mainnet.env @@ -67,4 +67,5 @@ TERRA_RPCS='["https://terra-classic-rpc.publicnode.com:443"]' TERRA2_RPCS='["https://terra-rpc.polkachu.com","https://rpc-terra-01.stakeflow.io","https://terra-rpc.publicnode.com:443"]' OASIS_RPCS='["https://emerald.oasis.dev"]' SNAXCHAIN_RPCS='["https://mainnet.snaxchain.io/"]' -BERACHAIN_RPCS= \ No newline at end of file +BERACHAIN_RPCS= +UNICHAIN_RPCS= \ No newline at end of file diff --git a/deploy/blockchain-watcher/env/production-testnet.env b/deploy/blockchain-watcher/env/production-testnet.env index 6813723c0..e2d06b9d4 100644 --- a/deploy/blockchain-watcher/env/production-testnet.env +++ b/deploy/blockchain-watcher/env/production-testnet.env @@ -63,4 +63,5 @@ ETHEREUM_RPCS= TERRA_RPCS= TERRA2_RPCS= NEAR_RPCS= -BERACHAIN_RPCS= \ No newline at end of file +BERACHAIN_RPCS= +UNICHAIN_RPCS= \ No newline at end of file diff --git a/deploy/blockchain-watcher/env/staging-mainnet.env b/deploy/blockchain-watcher/env/staging-mainnet.env index ce6527383..e325d8f12 100644 --- a/deploy/blockchain-watcher/env/staging-mainnet.env +++ b/deploy/blockchain-watcher/env/staging-mainnet.env @@ -64,4 +64,5 @@ TERRA_RPCS='["https://terra-classic-rpc.publicnode.com:443"]' TERRA2_RPCS='["https://terra-rpc.polkachu.com","https://rpc-terra-01.stakeflow.io","https://terra-rpc.publicnode.com:443"]' OASIS_RPCS='["https://emerald.oasis.dev"]' SNAXCHAIN_RPCS='["https://mainnet.snaxchain.io/"]' -BERACHAIN_RPCS= \ No newline at end of file +BERACHAIN_RPCS= +UNICHAIN_RPCS= \ No newline at end of file diff --git a/deploy/blockchain-watcher/env/staging-testnet.env b/deploy/blockchain-watcher/env/staging-testnet.env index aed08a842..55ed5be70 100644 --- a/deploy/blockchain-watcher/env/staging-testnet.env +++ b/deploy/blockchain-watcher/env/staging-testnet.env @@ -64,4 +64,5 @@ ETHEREUM_RPCS= TERRA_RPCS= TERRA2_RPCS= NEAR_RPCS= -BERACHAIN_RPCS= \ No newline at end of file +BERACHAIN_RPCS= +UNICHAIN_RPCS= \ No newline at end of file diff --git a/deploy/blockchain-watcher/workers/source-events-3.yaml b/deploy/blockchain-watcher/workers/source-events-3.yaml index 911526f1a..a1eac7813 100644 --- a/deploy/blockchain-watcher/workers/source-events-3.yaml +++ b/deploy/blockchain-watcher/workers/source-events-3.yaml @@ -236,6 +236,45 @@ data: } } ] + }, + { + "id": "poll-log-message-published-unichain-latest", + "chain": "unichain", + "source": { + "repository": "evmRepo", + "action": "PollEvm", + "config": { + "blockBatchSize": 100, + "commitment": "latest", + "interval": 5000, + "filters": [ + { + "addresses": ["0xBB73cB66C26740F31d1FabDC6b7A46a038A300dd"], + "type": "Portal Token Bridge", + "topics": ["0x6eb224fb001ed210e379b335e35efe88672a8ce935d981a6896b27ffdf52a3b2"] + } + ], + "chain": "unichain", + "chainId": 44 + } + }, + "handlers": [ + { + "action": "HandleEvmLogs", + "target": "sns", + "mapper": "evmLogMessagePublishedMapper", + "config": { + "abis": [ + { + "abi": "event LogMessagePublished(address indexed sender, uint64 sequence, uint32 nonce, bytes payload, uint8 consistencyLevel)", + "topic": "0x6eb224fb001ed210e379b335e35efe88672a8ce935d981a6896b27ffdf52a3b2", + "type": "Portal Token Bridge" + } + ], + "metricName": "process_source_event" + } + } + ] } ] mainnet-jobs.json: |- @@ -363,47 +402,6 @@ data: } ] }, - { - "id": "poll-log-message-published-terra-immediate", - "chain": "terra", - "source": { - "action": "PollCosmos", - "repository": "cosmosRepo", - "config": { - "blockBatchSize": 100, - "commitment": "immediate", - "environment": "mainnet", - "interval": 60000, - "filter": { - "addresses": [ - "terra1dq03ugtd40zu9hcgdzrsq6z2z4hwhc9tqk2uy5" - ] - }, - "chain": "terra", - "chainId": 3 - } - }, - "handlers": [ - { - "action": "HandleCosmosTransactions", - "target": "sns", - "mapper": "cosmosLogMessagePublishedMapper", - "config": { - "filter": { - "addresses": [ - "terra1dq03ugtd40zu9hcgdzrsq6z2z4hwhc9tqk2uy5" - ] - }, - "metricName": "process_source_event", - "metricLabels": { - "job": "poll-log-message-published-terra", - "chain": "terra", - "commitment": "immediate" - } - } - } - ] - }, { "id": "poll-log-message-published-terra2-immediate", "chain": "terra2", diff --git a/deploy/blockchain-watcher/workers/target-events-3.yaml b/deploy/blockchain-watcher/workers/target-events-3.yaml index 4b904f484..fa72153e0 100644 --- a/deploy/blockchain-watcher/workers/target-events-3.yaml +++ b/deploy/blockchain-watcher/workers/target-events-3.yaml @@ -280,6 +280,41 @@ data: } } ] + }, + { + "id": "poll-redeemed-transactions-unichain-latest", + "chain": "unichain", + "source": { + "action": "PollEvm", + "repository": "evmRepo", + "records": "GetEvmTransactions", + "config": { + "blockBatchSize": 100, + "commitment": "latest", + "environment": "testnet", + "interval": 15000, + "filters": [ + { + "addresses": [], + "type": "Portal Token Bridge (Connect, Portico, Omniswap, tBTC, etc)", + "topics": ["0xcaf280c8cfeba144da67230d9b009c8f868a75bac9a528fa0474be1ba317c169"], + "strategy": "GetTransactionsByLogFiltersStrategy" + } + ], + "chain": "unichain", + "chainId": 44 + } + }, + "handlers": [ + { + "action": "HandleEvmTransactions", + "target": "sns", + "mapper": "evmRedeemedTransactionFoundMapper", + "config": { + "metricName": "process_vaa_event" + } + } + ] } ] mainnet-jobs.json: |-