[Blockchain Watcher] (MAYAN) Mapped mayan events (#1150)

* Mapped evm mayan events

* Mapped evm mayan events

* Improve imports

---------

Co-authored-by: julian merlo <julianmerlo@julians-MacBook-Pro.local>
This commit is contained in:
Julian 2024-02-26 15:50:57 -03:00 committed by GitHub
parent 4760c820c3
commit 3a6dafb9e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 69 additions and 14 deletions

View File

@ -1,6 +1,10 @@
import { HandleEvmConfig } from "./HandleEvmLogs";
import { EvmTransaction } from "../../entities";
import { StatRepository } from "../../repositories";
import {
EvmTransactionFoundAttributes,
TransactionFoundEvent,
EvmTransaction,
} from "../../entities";
/**
* Handling means mapping and forward to a given target.
@ -27,11 +31,11 @@ export class HandleEvmTransactions<T> {
public async handle(transactions: EvmTransaction[]): Promise<T[]> {
const mappedItems = transactions.map((transaction) => {
return this.mapper(transaction);
}) as T[];
}) as TransactionFoundEvent<EvmTransactionFoundAttributes>[];
const filterItems = mappedItems.filter((transaction) => {
if (transaction) {
this.report();
this.report(transaction.attributes.protocol);
return transaction;
}
}) as T[];
@ -40,10 +44,11 @@ export class HandleEvmTransactions<T> {
return filterItems;
}
private report() {
private report(protocol: string) {
const labels = {
job: this.cfg.id,
chain: this.cfg.chain ?? "",
protocol: protocol,
commitment: this.cfg.commitment,
};
this.statsRepo.count(this.cfg.metricName, labels);

View File

@ -101,6 +101,16 @@
"method": "MethodReceiveMessageCCTP"
}
]
},
{
"addresses": ["0xf3f04555f8fda510bfc77820fd6eb8446f59e72d"],
"type": "Mayan",
"methods": [
{
"methodId": "0x9945e3d3",
"method": "MethodRedeemed"
}
]
}
]
},
@ -225,6 +235,16 @@
"method": "MethodReceiveMessageCCTP"
}
]
},
{
"addresses": ["0xf3f04555f8fda510bfc77820fd6eb8446f59e72d"],
"type": "Mayan",
"methods": [
{
"methodId": "0x9945e3d3",
"method": "MethodRedeemed"
}
]
}
]
},
@ -278,6 +298,16 @@
"method": "MethodReceiveMessageAndSwap"
}
]
},
{
"addresses": ["0xf3f04555f8fda510bfc77820fd6eb8446f59e72d"],
"type": "Mayan",
"methods": [
{
"methodId": "0x9945e3d3",
"method": "MethodRedeemed"
}
]
}
]
},
@ -391,6 +421,16 @@
"method": "MethodReceiveMessageAndSwap"
}
]
},
{
"addresses": ["0xf3f04555f8fda510bfc77820fd6eb8446f59e72d"],
"type": "Mayan",
"methods": [
{
"methodId": "0x9945e3d3",
"method": "MethodRedeemed"
}
]
}
]
},
@ -578,6 +618,16 @@
"method": "MethodReceiveMessageCCTP"
}
]
},
{
"addresses": ["0xf3f04555f8fda510bfc77820fd6eb8446f59e72d"],
"type": "Mayan",
"methods": [
{
"methodId": "0x9945e3d3",
"method": "MethodRedeemed"
}
]
}
]
},

View File

@ -495,7 +495,7 @@ data:
"blockBatchSize": 100,
"commitment": "latest",
"interval": 5000,
"addresses": ["0x4cb69fae7e7af841e44e1a1c30af640739378bb2", "0x19330d10D9Cc8751218eaf51E8885D058642E08A", "0x0b2402144bb366a632d14b83f244d2e0e21bd39c", "0x48fa7528bfd6164ddf09df0ed22451cf59c84130"],
"addresses": ["0x4cb69fae7e7af841e44e1a1c30af640739378bb2", "0x19330d10D9Cc8751218eaf51E8885D058642E08A", "0x0b2402144bb366a632d14b83f244d2e0e21bd39c", "0x48fa7528bfd6164ddf09df0ed22451cf59c84130", "0xf3f04555f8fda510bfc77820fd6eb8446f59e72d"],
"chain": "arbitrum",
"chainId": 23,
"topics": ["0x1b2a7ff080b8cb6ff436ce0372e399692bbfb6d4ae5766fd8d58a7b8cc6142e6", "0xf02867db6908ee5f81fd178573ae9385837f0a0a72553f8c08306759a7e0f00e", "0xcaf280c8cfeba144da67230d9b009c8f868a75bac9a528fa0474be1ba317c169", "0xc2addcb063016f6dc1647fc8cd7206c3436cc4293c4acffe4feac288459ca7fc"]
@ -509,7 +509,7 @@ data:
"config": {
"abi": "",
"filter": {
"addresses": ["0x4cb69fae7e7af841e44e1a1c30af640739378bb2", "0x19330d10D9Cc8751218eaf51E8885D058642E08A", "0x0b2402144bb366a632d14b83f244d2e0e21bd39c", "0x48fa7528bfd6164ddf09df0ed22451cf59c84130"],
"addresses": ["0x4cb69fae7e7af841e44e1a1c30af640739378bb2", "0x19330d10D9Cc8751218eaf51E8885D058642E08A", "0x0b2402144bb366a632d14b83f244d2e0e21bd39c", "0x48fa7528bfd6164ddf09df0ed22451cf59c84130", "0xf3f04555f8fda510bfc77820fd6eb8446f59e72d"],
"topics": ["0x1b2a7ff080b8cb6ff436ce0372e399692bbfb6d4ae5766fd8d58a7b8cc6142e6", "0xf02867db6908ee5f81fd178573ae9385837f0a0a72553f8c08306759a7e0f00e", "0xcaf280c8cfeba144da67230d9b009c8f868a75bac9a528fa0474be1ba317c169", "0xc2addcb063016f6dc1647fc8cd7206c3436cc4293c4acffe4feac288459ca7fc"]
},
"metricName": "process_vaa_event"
@ -527,7 +527,7 @@ data:
"blockBatchSize": 100,
"commitment": "latest",
"interval": 5000,
"addresses": ["0x4cb69fae7e7af841e44e1a1c30af640739378bb2", "0x9daF8c91AEFAE50b9c0E69629D3F6Ca40cA3B3FE", "0x227babe533fa9a1085f5261210e0b7137e44437b"],
"addresses": ["0x4cb69fae7e7af841e44e1a1c30af640739378bb2", "0x9daF8c91AEFAE50b9c0E69629D3F6Ca40cA3B3FE", "0x227babe533fa9a1085f5261210e0b7137e44437b", "0xf3f04555f8fda510bfc77820fd6eb8446f59e72d"],
"chain": "polygon",
"chainId": 5,
"topics": ["0x1b2a7ff080b8cb6ff436ce0372e399692bbfb6d4ae5766fd8d58a7b8cc6142e6", "0xf02867db6908ee5f81fd178573ae9385837f0a0a72553f8c08306759a7e0f00e", "0xc2addcb063016f6dc1647fc8cd7206c3436cc4293c4acffe4feac288459ca7fc"]
@ -541,7 +541,7 @@ data:
"config": {
"abi": "",
"filter": {
"addresses": ["0x4cb69fae7e7af841e44e1a1c30af640739378bb2", "0x9daF8c91AEFAE50b9c0E69629D3F6Ca40cA3B3FE", "0x227babe533fa9a1085f5261210e0b7137e44437b"],
"addresses": ["0x4cb69fae7e7af841e44e1a1c30af640739378bb2", "0x9daF8c91AEFAE50b9c0E69629D3F6Ca40cA3B3FE", "0x227babe533fa9a1085f5261210e0b7137e44437b", "0xf3f04555f8fda510bfc77820fd6eb8446f59e72d"],
"topics": ["0x1b2a7ff080b8cb6ff436ce0372e399692bbfb6d4ae5766fd8d58a7b8cc6142e6", "0xf02867db6908ee5f81fd178573ae9385837f0a0a72553f8c08306759a7e0f00e", "0xc2addcb063016f6dc1647fc8cd7206c3436cc4293c4acffe4feac288459ca7fc"]
},
"metricName": "process_vaa_event"
@ -559,7 +559,7 @@ data:
"blockBatchSize": 100,
"commitment": "finalized",
"interval": 5000,
"addresses": ["0x4cb69fae7e7af841e44e1a1c30af640739378bb2", "0x6b25532e1060ce10cc3b0a99e5683b91bfde6982", "0xe565e118e75304dd3cf83dff409c90034b7ea18a"],
"addresses": ["0x4cb69fae7e7af841e44e1a1c30af640739378bb2", "0x6b25532e1060ce10cc3b0a99e5683b91bfde6982", "0xe565e118e75304dd3cf83dff409c90034b7ea18a", "0xf3f04555f8fda510bfc77820fd6eb8446f59e72d"],
"chain": "avalanche",
"chainId": 6,
"topics": ["0x1b2a7ff080b8cb6ff436ce0372e399692bbfb6d4ae5766fd8d58a7b8cc6142e6", "0xf02867db6908ee5f81fd178573ae9385837f0a0a72553f8c08306759a7e0f00e", "0xc2addcb063016f6dc1647fc8cd7206c3436cc4293c4acffe4feac288459ca7fc"]
@ -573,7 +573,7 @@ data:
"config": {
"abi": "",
"filter": {
"addresses": ["0x4cb69fae7e7af841e44e1a1c30af640739378bb2", "0x6b25532e1060ce10cc3b0a99e5683b91bfde6982", "0xe565e118e75304dd3cf83dff409c90034b7ea18a"],
"addresses": ["0x4cb69fae7e7af841e44e1a1c30af640739378bb2", "0x6b25532e1060ce10cc3b0a99e5683b91bfde6982", "0xe565e118e75304dd3cf83dff409c90034b7ea18a", "0xf3f04555f8fda510bfc77820fd6eb8446f59e72d"],
"topics": ["0x1b2a7ff080b8cb6ff436ce0372e399692bbfb6d4ae5766fd8d58a7b8cc6142e6", "0xf02867db6908ee5f81fd178573ae9385837f0a0a72553f8c08306759a7e0f00e", "0xc2addcb063016f6dc1647fc8cd7206c3436cc4293c4acffe4feac288459ca7fc"]
},
"metricName": "process_vaa_event"
@ -591,7 +591,7 @@ data:
"blockBatchSize": 100,
"commitment": "latest",
"interval": 15000,
"addresses": ["0x4cb69fae7e7af841e44e1a1c30af640739378bb2", "0xbd3fa81b58ba92a82136038b25adec7066af3155", "0x48b6101128c0ed1e208b7c910e60542a2ee6f476"],
"addresses": ["0x4cb69fae7e7af841e44e1a1c30af640739378bb2", "0xbd3fa81b58ba92a82136038b25adec7066af3155", "0x48b6101128c0ed1e208b7c910e60542a2ee6f476", "0xf3f04555f8fda510bfc77820fd6eb8446f59e72d"],
"chain": "ethereum",
"chainId": 2,
"topics": ["0x1b2a7ff080b8cb6ff436ce0372e399692bbfb6d4ae5766fd8d58a7b8cc6142e6", "0xf02867db6908ee5f81fd178573ae9385837f0a0a72553f8c08306759a7e0f00e", "0xc2addcb063016f6dc1647fc8cd7206c3436cc4293c4acffe4feac288459ca7fc"]
@ -605,7 +605,7 @@ data:
"config": {
"abi": "",
"filter": {
"addresses": ["0x4cb69fae7e7af841e44e1a1c30af640739378bb2", "0xbd3fa81b58ba92a82136038b25adec7066af3155", "0x48b6101128c0ed1e208b7c910e60542a2ee6f476"],
"addresses": ["0x4cb69fae7e7af841e44e1a1c30af640739378bb2", "0xbd3fa81b58ba92a82136038b25adec7066af3155", "0x48b6101128c0ed1e208b7c910e60542a2ee6f476", "0xf3f04555f8fda510bfc77820fd6eb8446f59e72d"],
"topics": ["0x1b2a7ff080b8cb6ff436ce0372e399692bbfb6d4ae5766fd8d58a7b8cc6142e6", "0xf02867db6908ee5f81fd178573ae9385837f0a0a72553f8c08306759a7e0f00e", "0xc2addcb063016f6dc1647fc8cd7206c3436cc4293c4acffe4feac288459ca7fc"]
},
"metricName": "process_vaa_event"
@ -685,7 +685,7 @@ data:
"blockBatchSize": 100,
"commitment": "latest",
"interval": 5000,
"addresses": ["0x05498574bd0fa99eecb01e1241661e7ee58f8a85"],
"addresses": ["0x05498574bd0fa99eecb01e1241661e7ee58f8a85", "0xf3f04555f8fda510bfc77820fd6eb8446f59e72d"],
"chain": "bsc",
"chainId": 4,
"topics": ["0xc2addcb063016f6dc1647fc8cd7206c3436cc4293c4acffe4feac288459ca7fc"]
@ -699,7 +699,7 @@ data:
"config": {
"abi": "",
"filter": {
"addresses": ["0x05498574bd0fa99eecb01e1241661e7ee58f8a85"],
"addresses": ["0x05498574bd0fa99eecb01e1241661e7ee58f8a85", "0xf3f04555f8fda510bfc77820fd6eb8446f59e72d"],
"topics": ["0xc2addcb063016f6dc1647fc8cd7206c3436cc4293c4acffe4feac288459ca7fc"]
},
"metricName": "process_vaa_event"