diff --git a/blockchain-watcher/config/custom-environment-variables.json b/blockchain-watcher/config/custom-environment-variables.json index 818d00fc..c16acfb3 100644 --- a/blockchain-watcher/config/custom-environment-variables.json +++ b/blockchain-watcher/config/custom-environment-variables.json @@ -188,6 +188,13 @@ "__format": "json" } }, + "xlayer": { + "network": "XLAYER_NETWORK", + "rpcs": { + "__name": "XLAYER_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 a55662b5..faaad94b 100644 --- a/blockchain-watcher/config/default.json +++ b/blockchain-watcher/config/default.json @@ -188,7 +188,14 @@ "name": "blast", "network": "testnet", "chainId": 36, - "rpcs": ["https://sepolia.blast.io"], + "rpcs": ["https://blast-sepolia.drpc.org"], + "timeout": 10000 + }, + "xlayer": { + "name": "xlayer", + "network": "testnet", + "chainId": 37, + "rpcs": ["https://xlayertestrpc.okx.com", "https://testrpc.xlayer.tech"], "timeout": 10000 }, "ethereum-sepolia": { diff --git a/blockchain-watcher/config/mainnet.json b/blockchain-watcher/config/mainnet.json index a8e73c4a..91dda78a 100644 --- a/blockchain-watcher/config/mainnet.json +++ b/blockchain-watcher/config/mainnet.json @@ -62,8 +62,7 @@ "network": "mainnet", "rpcs": [ "https://eth-rpc-karura.aca-api.network", - "https://eth-rpc-karura.aca-staging.network", - "https://rpc.evm.karura.network" + "https://eth-rpc-karura.aca-staging.network" ] }, "acala": { @@ -146,5 +145,9 @@ "network": "mainnet", "rpcs": ["https://rpc.ankr.com/"] } + }, + "xlayer": { + "network": "mainnet", + "rpcs": ["https://xlayerrpc.okx.com", "https://rpc.xlayer.tech"] } } diff --git a/blockchain-watcher/src/infrastructure/mappers/contractsMapperConfig.json b/blockchain-watcher/src/infrastructure/mappers/contractsMapperConfig.json index 5641ee5c..6af07ce1 100644 --- a/blockchain-watcher/src/infrastructure/mappers/contractsMapperConfig.json +++ b/blockchain-watcher/src/infrastructure/mappers/contractsMapperConfig.json @@ -1679,6 +1679,36 @@ ] } ] + }, + { + "chain": "xlayer", + "protocols": [ + { + "addresses": [ + "0x5537857664B0f9eFe38C9f320F75fEf23234D904", + "0xdA91a06299BBF302091B053c6B9EF86Eff0f930D" + ], + "type": "Token Bridge", + "methods": [ + { + "methodId": "0xc6878519", + "method": "MethodCompleteTransfer" + }, + { + "methodId": "0xff200cde", + "method": "MethodCompleteAndUnwrapETH" + }, + { + "methodId": "0xe8059810", + "method": "MethodCreateWrapped" + }, + { + "methodId": "0xf768441f", + "method": "MethodUpdateWrapped" + } + ] + } + ] } ] } diff --git a/blockchain-watcher/src/infrastructure/repositories/RepositoriesBuilder.ts b/blockchain-watcher/src/infrastructure/repositories/RepositoriesBuilder.ts index e196f295..548f2b4c 100644 --- a/blockchain-watcher/src/infrastructure/repositories/RepositoriesBuilder.ts +++ b/blockchain-watcher/src/infrastructure/repositories/RepositoriesBuilder.ts @@ -65,6 +65,7 @@ const EVM_CHAINS = new Map([ ["polygon-sepolia", "polygon-evmRepo"], ["blast", "evmRepo"], ["mantle", "evmRepo"], + ["xlayer", "evmRepo"], ]); const POOL_STRATEGY = "weighted"; diff --git a/blockchain-watcher/test/infrastructure/repositories/RepositoriesBuilder.test.ts b/blockchain-watcher/test/infrastructure/repositories/RepositoriesBuilder.test.ts index 6f7e8fad..26c3dd6f 100644 --- a/blockchain-watcher/test/infrastructure/repositories/RepositoriesBuilder.test.ts +++ b/blockchain-watcher/test/infrastructure/repositories/RepositoriesBuilder.test.ts @@ -110,6 +110,9 @@ describe("RepositoriesBuilder", () => { expect(repos.getEvmBlockRepository("mantle")).toBeInstanceOf( RateLimitedEvmJsonRPCBlockRepository ); + expect(repos.getEvmBlockRepository("xlayer")).toBeInstanceOf( + RateLimitedEvmJsonRPCBlockRepository + ); expect(repos.getAptosRepository()).toBeInstanceOf(RateLimitedAptosJsonRPCBlockRepository); expect(repos.getMetadataRepository()).toBeInstanceOf(FileMetadataRepository); expect(repos.getSnsEventRepository()).toBeInstanceOf(SnsEventRepository); diff --git a/blockchain-watcher/test/mocks/configMock.ts b/blockchain-watcher/test/mocks/configMock.ts index 4d5acfa8..7cec94ad 100644 --- a/blockchain-watcher/test/mocks/configMock.ts +++ b/blockchain-watcher/test/mocks/configMock.ts @@ -129,6 +129,13 @@ export const configMock = (): Config => { rpcs: ["http://localhost"], timeout: 10000, }, + xlayer: { + name: "xlayer", + network: "testnet", + chainId: 37, + rpcs: ["http://localhost"], + timeout: 10000, + }, "ethereum-sepolia": { name: "ethereum-sepolia", network: "sepolia", diff --git a/deploy/blockchain-watcher/workers/source-events-1.yaml b/deploy/blockchain-watcher/workers/source-events-1.yaml index c598d0b6..58c16e1d 100644 --- a/deploy/blockchain-watcher/workers/source-events-1.yaml +++ b/deploy/blockchain-watcher/workers/source-events-1.yaml @@ -657,6 +657,10 @@ spec: - name: SUI_RPCS value: '{{ .SUI_RPCS }}' {{ end }} + {{ if .KARURA_RPCS }} + - name: KARURA_RPCS + value: '{{ .KARURA_RPCS }}' + {{ end }} image: {{ .IMAGE_NAME }} resources: limits: diff --git a/deploy/blockchain-watcher/workers/source-events-3.yaml b/deploy/blockchain-watcher/workers/source-events-3.yaml index 2dc24156..41308559 100644 --- a/deploy/blockchain-watcher/workers/source-events-3.yaml +++ b/deploy/blockchain-watcher/workers/source-events-3.yaml @@ -125,6 +125,36 @@ data: } } ] + }, + { + "id": "poll-log-message-published-xlayer", + "chain": "xlayer", + "source": { + "action": "PollEvm", + "config": { + "blockBatchSize": 1, + "commitment": "latest", + "interval": 5000, + "addresses": ["0xA31aa3FDb7aF7Db93d18DDA4e19F811342EDF780"], + "chain": "xlayer", + "chainId": 37 + } + }, + "handlers": [ + { + "action": "HandleEvmLogs", + "target": "sns", + "mapper": "evmLogMessagePublishedMapper", + "config": { + "abi": "event LogMessagePublished(address indexed sender, uint64 sequence, uint32 nonce, bytes payload, uint8 consistencyLevel)", + "filter": { + "addresses": ["0xA31aa3FDb7aF7Db93d18DDA4e19F811342EDF780"], + "topics": ["0x6eb224fb001ed210e379b335e35efe88672a8ce935d981a6896b27ffdf52a3b2"] + }, + "metricName": "process_source_event" + } + } + ] } ] mainnet-jobs.json: |- @@ -188,6 +218,36 @@ data: } } ] + }, + { + "id": "poll-log-message-published-xlayer", + "chain": "xlayer", + "source": { + "action": "PollEvm", + "config": { + "blockBatchSize": 1, + "commitment": "latest", + "interval": 5000, + "addresses": ["0x194B123c5E96B9b2E49763619985790Dc241CAC0"], + "chain": "xlayer", + "chainId": 37 + } + }, + "handlers": [ + { + "action": "HandleEvmLogs", + "target": "sns", + "mapper": "evmLogMessagePublishedMapper", + "config": { + "abi": "event LogMessagePublished(address indexed sender, uint64 sequence, uint32 nonce, bytes payload, uint8 consistencyLevel)", + "filter": { + "addresses": ["0x194B123c5E96B9b2E49763619985790Dc241CAC0"], + "topics": ["0x6eb224fb001ed210e379b335e35efe88672a8ce935d981a6896b27ffdf52a3b2"] + }, + "metricName": "process_source_event" + } + } + ] } ] --- @@ -248,6 +308,10 @@ spec: - name: ETHEREUM_HOLESKY_RPCS value: '{{ .ETHEREUM_HOLESKY_RPCS }}' {{ end }} + {{ if .XLAYER_RPCS }} + - name: XLAYER_RPCS + value: '{{ .XLAYER_RPCS }}' + {{ end }} image: {{ .IMAGE_NAME }} resources: limits: diff --git a/deploy/blockchain-watcher/workers/target-events-3.yaml b/deploy/blockchain-watcher/workers/target-events-3.yaml index 44fbd25f..87a4178e 100644 --- a/deploy/blockchain-watcher/workers/target-events-3.yaml +++ b/deploy/blockchain-watcher/workers/target-events-3.yaml @@ -132,6 +132,46 @@ data: } } ] + }, + { + "id": "poll-redeemed-transactions-xlayer", + "chain": "xlayer", + "source": { + "action": "PollEvm", + "records": "GetEvmTransactions", + "config": { + "blockBatchSize": 1, + "commitment": "latest", + "interval": 5000, + "addresses": [ + "0xdA91a06299BBF302091B053c6B9EF86Eff0f930D" + ], + "chain": "xlayer", + "chainId": 37, + "topics": [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" + ] + } + }, + "handlers": [ + { + "action": "HandleEvmTransactions", + "target": "sns", + "mapper": "evmRedeemedTransactionFoundMapper", + "config": { + "abi": "", + "filter": { + "addresses": [ + "0xdA91a06299BBF302091B053c6B9EF86Eff0f930D" + ], + "topics": [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" + ] + }, + "metricName": "process_vaa_event" + } + } + ] } ] mainnet-jobs.json: |- @@ -243,6 +283,48 @@ data: } } ] + }, + { + "id": "poll-redeemed-transactions-xlayer", + "chain": "xlayer", + "source": { + "action": "PollEvm", + "records": "GetEvmTransactions", + "config": { + "blockBatchSize": 1, + "commitment": "latest", + "interval": 5000, + "addresses": [ + "0x5537857664B0f9eFe38C9f320F75fEf23234D904" + ], + "chain": "xlayer", + "chainId": 37, + "topics": [ + "0xcaf280c8cfeba144da67230d9b009c8f868a75bac9a528fa0474be1ba317c169", + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" + ] + } + }, + "handlers": [ + { + "action": "HandleEvmTransactions", + "target": "sns", + "mapper": "evmRedeemedTransactionFoundMapper", + "config": { + "abi": "", + "filter": { + "addresses": [ + "0x5537857664B0f9eFe38C9f320F75fEf23234D904" + ], + "topics": [ + "0xcaf280c8cfeba144da67230d9b009c8f868a75bac9a528fa0474be1ba317c169", + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" + ] + }, + "metricName": "process_vaa_event" + } + } + ] } ] --- @@ -295,6 +377,10 @@ spec: - name: BLAST_RPCS value: '{{ .BLAST_RPCS }}' {{ end }} + {{ if .XLAYER_RPCS }} + - name: XLAYER_RPCS + value: '{{ .XLAYER_RPCS }}' + {{ end }} image: {{ .IMAGE_NAME }} resources: limits: