[Blockchain Watcher] Feature 798/enable evm acala chain (#837)

* Add fantom chain

* Mapped all chains in prod-mainnet

* Add fantom test

* feature-798/enable-evm-acala-chain

* Run prettier

* Resolve comment in PR

* Replace mainnet url

---------

Co-authored-by: Julian Merlo <julianmerlo@MacBook-Pro-de-Julian.local>
This commit is contained in:
Julian 2023-12-01 16:25:02 -03:00 committed by GitHub
parent 2836f4ffc2
commit 912049a0a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 101 additions and 3 deletions

View File

@ -3,7 +3,7 @@
"port": 9090,
"logLevel": "debug",
"dryRun": true,
"supportedChains": ["ethereum", "solana", "fantom", "karura"],
"supportedChains": ["ethereum", "solana", "fantom", "karura", "acala"],
"sns": {
"topicArn": "arn:aws:sns:us-east-1:000000000000:localstack-topic.fifo",
"region": "us-east-1",
@ -48,6 +48,13 @@
"chainId": 11,
"rpcs": ["https://eth-rpc-karura-testnet.aca-staging.network"],
"timeout": 10000
},
"acala": {
"name": "acala",
"network": "testnet",
"chainId": 12,
"rpcs": ["https://eth-rpc-acala-testnet.aca-staging.network"],
"timeout": 10000
}
}
}

View File

@ -15,6 +15,10 @@
"karura": {
"network": "mainnet",
"rpcs": ["https://eth-rpc-karura.aca-api.network"]
},
"acala": {
"network": "mainnet",
"rpcs": ["https://eth-rpc-acala.aca-api.network"]
}
}
}

View File

@ -27,6 +27,13 @@
"chainId": 11,
"rpcs": ["https://eth-rpc-karura.aca-api.network"],
"timeout": 10000
},
"acala": {
"name": "acala",
"network": "mainnet",
"chainId": 12,
"rpcs": ["https://eth-rpc-acala.aca-api.network"],
"timeout": 10000
}
}
}

View File

@ -15,7 +15,7 @@ import { HttpClient } from "./http/HttpClient";
import { JobRepository } from "../domain/repositories";
const SOLANA_CHAIN = "solana";
const EVM_CHAINS = ["ethereum", "fantom", "karura"];
const EVM_CHAINS = ["ethereum", "fantom", "karura", "acala"];
export class RepositoriesBuilder {
private cfg: Config;

View File

@ -32,7 +32,9 @@ describe("RepositoriesBuilder", () => {
it("should be return all repositories instances", async () => {
// When
const repos = new RepositoriesBuilder(configMock(["solana", "ethereum", "fantom", "karura"]));
const repos = new RepositoriesBuilder(
configMock(["solana", "ethereum", "fantom", "karura", "acala"])
);
// Then
const job = repos.getJobsRepository();
expect(job).toBeTruthy();
@ -40,6 +42,7 @@ describe("RepositoriesBuilder", () => {
expect(repos.getEvmBlockRepository("ethereum")).toBeInstanceOf(EvmJsonRPCBlockRepository);
expect(repos.getEvmBlockRepository("fantom")).toBeInstanceOf(EvmJsonRPCBlockRepository);
expect(repos.getEvmBlockRepository("karura")).toBeInstanceOf(EvmJsonRPCBlockRepository);
expect(repos.getEvmBlockRepository("acala")).toBeInstanceOf(EvmJsonRPCBlockRepository);
expect(repos.getMetadataRepository()).toBeInstanceOf(FileMetadataRepository);
expect(repos.getSnsEventRepository()).toBeInstanceOf(SnsEventRepository);
expect(repos.getStatsRepository()).toBeInstanceOf(PromStatRepository);

View File

@ -31,6 +31,13 @@ export const configMock = (chains: string[] = []): Config => {
rpcs: ["http://localhost"],
timeout: 10000,
},
acala: {
name: "acala",
network: "testnet",
chainId: 12,
rpcs: ["http://localhost"],
timeout: 10000,
},
};
const snsConfig: SnsConfig = {

View File

@ -135,6 +135,41 @@ data:
}
}
]
},
{
"id": "poll-log-message-published-acala",
"chain": "acala",
"source": {
"action": "PollEvmLogs",
"config": {
"blockBatchSize": 100,
"commitment": "latest",
"interval": 15000,
"addresses": [
"0x4377B49d559c0a9466477195C6AdC3D433e265c0"
],
"chain": "acala",
"topics": []
}
},
"handlers": [
{
"action": "HandleEvmLogs",
"target": "sns",
"mapper": "evmLogMessagePublishedMapper",
"config": {
"abi": "event LogMessagePublished(address indexed sender, uint64 sequence, uint32 nonce, bytes payload, uint8 consistencyLevel)",
"filter": {
"addresses": [
"0x4377B49d559c0a9466477195C6AdC3D433e265c0"
],
"topics": [
"0x6eb224fb001ed210e379b335e35efe88672a8ce935d981a6896b27ffdf52a3b2"
]
}
}
}
]
}
]
mainnet-jobs.json: |-
@ -237,6 +272,41 @@ data:
}
}
]
},
{
"id": "poll-log-message-published-acala",
"chain": "acala",
"source": {
"action": "PollEvmLogs",
"config": {
"blockBatchSize": 100,
"commitment": "latest",
"interval": 15000,
"addresses": [
"0xa321448d90d4e5b0A732867c18eA198e75CAC48E"
],
"chain": "acala",
"topics": []
}
},
"handlers": [
{
"action": "HandleEvmLogs",
"target": "sns",
"mapper": "evmLogMessagePublishedMapper",
"config": {
"abi": "event LogMessagePublished(address indexed sender, uint64 sequence, uint32 nonce, bytes payload, uint8 consistencyLevel)",
"filter": {
"addresses": [
"0xa321448d90d4e5b0A732867c18eA198e75CAC48E"
],
"topics": [
"0x6eb224fb001ed210e379b335e35efe88672a8ce935d981a6896b27ffdf52a3b2"
]
}
}
}
]
}
]
---