From 4862c5486835c3f2f176ae65f2bf69b28b208dc3 Mon Sep 17 00:00:00 2001 From: julian merlo Date: Fri, 26 Jan 2024 14:30:07 -0300 Subject: [PATCH] Create contractsMapperConfig json --- .../mappers/evm/contractsMapper.json | 787 ++++++++++++++++++ .../evm/evmRedeemedTransactionFoundMapper.ts | 14 + 2 files changed, 801 insertions(+) create mode 100644 blockchain-watcher/src/infrastructure/mappers/evm/contractsMapper.json diff --git a/blockchain-watcher/src/infrastructure/mappers/evm/contractsMapper.json b/blockchain-watcher/src/infrastructure/mappers/evm/contractsMapper.json new file mode 100644 index 00000000..4ab8c532 --- /dev/null +++ b/blockchain-watcher/src/infrastructure/mappers/evm/contractsMapper.json @@ -0,0 +1,787 @@ +{ + "contracts": [ + { + "chain": "ethereum", + "protocols": [ + { + "address": [ + "0xF890982f9310df57d00f659cf4fd87e65adEd8d7", + "0x3ee18B2214AFF97000D974cf647E7C347E8fa585" + ], + "type": "Token Bridge", + "methods": [ + { + "methodId": "0xc6878519", + "method": "MethodCompleteTransfer" + }, + { + "methodId": "0xff200cde", + "method": "MethodCompleteAndUnwrapETH" + }, + { + "methodId": "0xe8059810", + "method": "MethodCreateWrapped" + }, + { + "methodId": "0xf768441f", + "method": "MethodUpdateWrapped" + } + ] + }, + { + "address": [ + "0x9563a59C15842a6f322B10f69d1dD88b41f2E97B", + "0xcafd2f0a35a4459fa40c0517e17e6fa2939441ca" + ], + "type": "Relay", + "methods": [ + { + "methodId": "0x2f25e25f", + "method": "MethodCompleteTransferWithRelay" + } + ] + }, + { + "address": ["0xd8E1465908103eD5fd28e381920575fb09beb264"], + "type": "Swap", + "methods": [ + { + "methodId": "0x3d528f35", + "method": "MethodReceiveMessageAndSwap" + } + ] + }, + { + "address": [ + "0x4cb69FaE7e7Af841e44E1A1c30Af640739378bb2", + "0x4cb69fae7e7af841e44e1a1c30af640739378bb2" + ], + "type": "CCTP", + "methods": [ + { + "methodId": "0x0a55d735", + "method": "MethodRedeemTokensCCTP" + }, + { + "methodId": "0x57ecfd28", + "method": "MethodReceiveMessageCCTP" + } + ] + } + ] + }, + { + "chain": "ethereum-sepolia", + "contracts": [ + { + "address": ["0x4a8bc80Ed5a4067f1CCf107057b8270E0cC11A78"], + "type": "Token Bridge", + "methods": [ + { + "methodId": "0xc6878519", + "method": "MethodCompleteTransfer" + }, + { + "methodId": "0xff200cde", + "method": "MethodCompleteAndUnwrapETH" + }, + { + "methodId": "0xe8059810", + "method": "MethodCreateWrapped" + }, + { + "methodId": "0xf768441f", + "method": "MethodUpdateWrapped" + } + ] + }, + { + "address": ["0x2703483B1a5a7c577e8680de9Df8Be03c6f30e3c"], + "type": "CCTP", + "methods": [ + { + "methodId": "0x0a55d735", + "method": "MethodRedeemTokensCCTP" + }, + { + "methodId": "0x57ecfd28", + "method": "MethodReceiveMessageCCTP" + } + ] + } + ] + }, + { + "chain": "polygon", + "contracts": [ + { + "address": [ + "0x377D55a7928c046E18eEbb61977e714d2a76472a", + "0x5a58505a96D1dbf8dF91cB21B54419FC36e93fdE" + ], + "type": "Token Bridge", + "methods": [ + { + "methodId": "0xc6878519", + "method": "MethodCompleteTransfer" + }, + { + "methodId": "0xff200cde", + "method": "MethodCompleteAndUnwrapETH" + }, + { + "methodId": "0xe8059810", + "method": "MethodCreateWrapped" + }, + { + "methodId": "0xf768441f", + "method": "MethodUpdateWrapped" + } + ] + }, + { + "address": [ + "0x9563a59C15842a6f322B10f69d1dD88b41f2E97B", + "0xcafd2f0a35a4459fa40c0517e17e6fa2939441ca" + ], + "type": "Relay", + "methods": [ + { + "methodId": "0x2f25e25f", + "method": "MethodCompleteTransferWithRelay" + } + ] + }, + { + "address": [ + "0xc3D46e0266d95215589DE639cC4E93b79f88fc6C", + "0x09959798B95d00a3183d20FaC298E4594E599eab" + ], + "type": "tBTC", + "methods": [ + { + "methodId": "0x5d21a596", + "method": "MethodReceiveTbtc" + } + ] + }, + { + "address": ["0xf6C5FD2C8Ecba25420859f61Be0331e68316Ba01"], + "type": "Swap", + "methods": [ + { + "methodId": "0x3d528f35", + "method": "MethodReceiveMessageAndSwap" + } + ] + }, + { + "address": [ + "0x4cb69fae7e7af841e44e1a1c30af640739378bb2", + "0x4cb69fae7e7af841e44e1a1c30af640739378bb2" + ], + "type": "CCTP", + "methods": [ + { + "methodId": "0x0a55d735", + "method": "MethodRedeemTokensCCTP" + }, + { + "methodId": "0x57ecfd28", + "method": "MethodReceiveMessageCCTP" + } + ] + } + ] + }, + { + "chain": "bsc", + "contracts": [ + { + "address": [ + "0x9dcF9D205C9De35334D646BeE44b2D2859712A09", + "0xB6F6D86a8f9879A9c87f643768d9efc38c1Da6E7" + ], + "type": "Token Bridge", + "methods": [ + { + "methodId": "0xc6878519", + "method": "MethodCompleteTransfer" + }, + { + "methodId": "0xff200cde", + "method": "MethodCompleteAndUnwrapETH" + }, + { + "methodId": "0xe8059810", + "method": "MethodCreateWrapped" + }, + { + "methodId": "0xf768441f", + "method": "MethodUpdateWrapped" + } + ] + }, + { + "address": [ + "0x9563a59C15842a6f322B10f69d1dD88b41f2E97B", + "0xcafd2f0a35a4459fa40c0517e17e6fa2939441ca" + ], + "type": "Relay", + "methods": [ + { + "methodId": "0x2f25e25f", + "method": "MethodCompleteTransferWithRelay" + } + ] + } + ] + }, + { + "chain": "fantom", + "contracts": [ + { + "address": [ + "0x599CEa2204B4FaECd584Ab1F2b6aCA137a0afbE8", + "0x7C9Fc5741288cDFdD83CeB07f3ea7e22618D79D2" + ], + "type": "Token Bridge", + "methods": [ + { + "methodId": "0xc6878519", + "method": "MethodCompleteTransfer" + }, + { + "methodId": "0xff200cde", + "method": "MethodCompleteAndUnwrapETH" + }, + { + "methodId": "0xe8059810", + "method": "MethodCreateWrapped" + }, + { + "methodId": "0xf768441f", + "method": "MethodUpdateWrapped" + } + ] + }, + { + "address": [ + "0x9563a59C15842a6f322B10f69d1dD88b41f2E97B", + "0xcafd2f0a35a4459fa40c0517e17e6fa2939441ca" + ], + "type": "Relay", + "methods": [ + { + "methodId": "0x2f25e25f", + "method": "MethodCompleteTransferWithRelay" + } + ] + } + ] + }, + { + "chain": "avalanche", + "contracts": [ + { + "address": [ + "0x61E44E506Ca5659E6c0bba9b678586fA2d729756", + "0x0e082F06FF657D94310cB8cE8B0D9a04541d8052" + ], + "type": "Token Bridge", + "methods": [ + { + "methodId": "0xc6878519", + "method": "MethodCompleteTransfer" + }, + { + "methodId": "0xff200cde", + "method": "MethodCompleteAndUnwrapETH" + }, + { + "methodId": "0xe8059810", + "method": "MethodCreateWrapped" + }, + { + "methodId": "0xf768441f", + "method": "MethodUpdateWrapped" + } + ] + }, + { + "address": [ + "0x9563a59C15842a6f322B10f69d1dD88b41f2E97B", + "0xcafd2f0a35a4459fa40c0517e17e6fa2939441ca" + ], + "type": "Relay", + "methods": [ + { + "methodId": "0x2f25e25f", + "method": "MethodCompleteTransferWithRelay" + } + ] + }, + { + "address": [ + "0x4cb69fae7e7af841e44e1a1c30af640739378bb2", + "0x4cb69fae7e7af841e44e1a1c30af640739378bb2" + ], + "type": "CCTP", + "methods": [ + { + "methodId": "0x0a55d735", + "method": "MethodRedeemTokensCCTP" + }, + { + "methodId": "0x57ecfd28", + "method": "MethodReceiveMessageCCTP" + } + ] + } + ] + }, + { + "chain": "oasis", + "contracts": [ + { + "address": [ + "0x88d8004A9BdbfD9D28090A02010C19897a29605c", + "0x5848C791e09901b40A9Ef749f2a6735b418d7564" + ], + "type": "Token Bridge", + "methods": [ + { + "methodId": "0xc6878519", + "method": "MethodCompleteTransfer" + }, + { + "methodId": "0xff200cde", + "method": "MethodCompleteAndUnwrapETH" + }, + { + "methodId": "0xe8059810", + "method": "MethodCreateWrapped" + }, + { + "methodId": "0xf768441f", + "method": "MethodUpdateWrapped" + } + ] + } + ] + }, + { + "chain": "moonbean", + "contracts": [ + { + "address": [ + "0xbc976D4b9D57E57c3cA52e1Fd136C45FF7955A96", + "0xb1731c586ca89a23809861c6103f0b96b3f57d92" + ], + "type": "Token Bridge", + "methods": [ + { + "methodId": "0xc6878519", + "method": "MethodCompleteTransfer" + }, + { + "methodId": "0xff200cde", + "method": "MethodCompleteAndUnwrapETH" + }, + { + "methodId": "0xe8059810", + "method": "MethodCreateWrapped" + }, + { + "methodId": "0xf768441f", + "method": "MethodUpdateWrapped" + } + ] + }, + { + "address": [ + "0x9563a59C15842a6f322B10f69d1dD88b41f2E97B", + "0xcafd2f0a35a4459fa40c0517e17e6fa2939441ca" + ], + "type": "Relay", + "methods": [ + { + "methodId": "0x2f25e25f", + "method": "MethodCompleteTransferWithRelay" + } + ] + } + ] + }, + { + "chain": "celo", + "contracts": [ + { + "address": [ + "0x05ca6037eC51F8b712eD2E6Fa72219FEaE74E153", + "0x796Dff6D74F3E27060B71255Fe517BFb23C93eed" + ], + "type": "Token Bridge", + "methods": [ + { + "methodId": "0xc6878519", + "method": "MethodCompleteTransfer" + }, + { + "methodId": "0xff200cde", + "method": "MethodCompleteAndUnwrapETH" + }, + { + "methodId": "0xe8059810", + "method": "MethodCreateWrapped" + }, + { + "methodId": "0xf768441f", + "method": "MethodUpdateWrapped" + } + ] + }, + { + "address": [ + "0x9563a59C15842a6f322B10f69d1dD88b41f2E97B", + "0xcafd2f0a35a4459fa40c0517e17e6fa2939441ca" + ], + "type": "Relay", + "methods": [ + { + "methodId": "0x2f25e25f", + "method": "MethodCompleteTransferWithRelay" + } + ] + } + ] + }, + { + "chain": "arbitrum", + "contracts": [ + { + "address": [ + "0xC7A204bDBFe983FCD8d8E61D02b475D4073fF97e", + "0x23908A62110e21C04F3A4e011d24F901F911744A", + "0x0b2402144Bb366A632D14B83F244D2e0e21bD39c" + ], + "type": "Token Bridge", + "methods": [ + { + "methodId": "0xc6878519", + "method": "MethodCompleteTransfer" + }, + { + "methodId": "0xff200cde", + "method": "MethodCompleteAndUnwrapETH" + }, + { + "methodId": "0xe8059810", + "method": "MethodCreateWrapped" + }, + { + "methodId": "0xf768441f", + "method": "MethodUpdateWrapped" + } + ] + }, + { + "address": [ + "0xe3e0511EEbD87F08FbaE4486419cb5dFB06e1343", + "0x1293a54e160D1cd7075487898d65266081A15458" + ], + "type": "tBTC", + "methods": [ + { + "methodId": "0x5d21a596", + "method": "MethodReceiveTbtc" + } + ] + }, + { + "address": ["0xf8497FE5B0C5373778BFa0a001d476A21e01f09b"], + "type": "Swap", + "methods": [ + { + "methodId": "0x3d528f35", + "method": "MethodReceiveMessageAndSwap" + } + ] + }, + { + "address": [ + "0x4cb69fae7e7af841e44e1a1c30af640739378bb2", + "0x4cb69fae7e7af841e44e1a1c30af640739378bb2" + ], + "type": "CCTP", + "methods": [ + { + "methodId": "0x0a55d735", + "method": "MethodRedeemTokensCCTP" + }, + { + "methodId": "0x57ecfd28", + "method": "MethodReceiveMessageCCTP" + } + ] + } + ] + }, + { + "chain": "arbitrum-sepolia", + "contracts": [ + { + "address": [ + "0xC7A204bDBFe983FCD8d8E61D02b475D4073fF97e", + "0x6b9C8671cdDC8dEab9c719bB87cBd3e782bA6a35" + ], + "type": "Token Bridge", + "methods": [ + { + "methodId": "0xc6878519", + "method": "MethodCompleteTransfer" + }, + { + "methodId": "0xff200cde", + "method": "MethodCompleteAndUnwrapETH" + }, + { + "methodId": "0xe8059810", + "method": "MethodCreateWrapped" + }, + { + "methodId": "0xf768441f", + "method": "MethodUpdateWrapped" + } + ] + }, + { + "address": ["0x2703483B1a5a7c577e8680de9Df8Be03c6f30e3c"], + "type": "CCTP", + "methods": [ + { + "methodId": "0x0a55d735", + "method": "MethodRedeemTokensCCTP" + }, + { + "methodId": "0x57ecfd28", + "method": "MethodReceiveMessageCCTP" + } + ] + } + ] + }, + { + "chain": "optimism", + "contracts": [ + { + "address": [ + "0xC7A204bDBFe983FCD8d8E61D02b475D4073fF97e", + "0x1D68124e65faFC907325e3EDbF8c4d84499DAa8b" + ], + "type": "Token Bridge", + "methods": [ + { + "methodId": "0xc6878519", + "method": "MethodCompleteTransfer" + }, + { + "methodId": "0xff200cde", + "method": "MethodCompleteAndUnwrapETH" + }, + { + "methodId": "0xe8059810", + "method": "MethodCreateWrapped" + }, + { + "methodId": "0xf768441f", + "method": "MethodUpdateWrapped" + } + ] + }, + { + "address": [ + "0xc3D46e0266d95215589DE639cC4E93b79f88fc6C", + "0x1293a54e160D1cd7075487898d65266081A15458" + ], + "type": "tBTC", + "methods": [ + { + "methodId": "0x5d21a596", + "method": "MethodReceiveTbtc" + } + ] + }, + { + "address": ["0xcF205Fa51D33280D9B70321Ae6a3686FB2c178b2"], + "type": "Swap", + "methods": [ + { + "methodId": "0x3d528f35", + "method": "MethodReceiveMessageAndSwap" + } + ] + }, + { + "address": [ + "0x4cb69fae7e7af841e44e1a1c30af640739378bb2", + "0x4cb69fae7e7af841e44e1a1c30af640739378bb2" + ], + "type": "CCTP", + "methods": [ + { + "methodId": "0x0a55d735", + "method": "MethodRedeemTokensCCTP" + }, + { + "methodId": "0x57ecfd28", + "method": "MethodReceiveMessageCCTP" + } + ] + } + ] + }, + { + "chain": "optimism-sepolia", + "contracts": [ + { + "address": [ + "0x99737Ec4B815d816c49A385943baf0380e75c0Ac", + "0x31377888146f3253211EFEf5c676D41ECe7D58Fe" + ], + "type": "Token Bridge", + "methods": [ + { + "methodId": "0xc6878519", + "method": "MethodCompleteTransfer" + }, + { + "methodId": "0xff200cde", + "method": "MethodCompleteAndUnwrapETH" + }, + { + "methodId": "0xe8059810", + "method": "MethodCreateWrapped" + }, + { + "methodId": "0xf768441f", + "method": "MethodUpdateWrapped" + } + ] + }, + { + "address": ["0x2703483B1a5a7c577e8680de9Df8Be03c6f30e3c"], + "type": "CCTP", + "methods": [ + { + "methodId": "0x0a55d735", + "method": "MethodRedeemTokensCCTP" + }, + { + "methodId": "0x57ecfd28", + "method": "MethodReceiveMessageCCTP" + } + ] + } + ] + }, + { + "chain": "base", + "contracts": [ + { + "address": [ + "0xA31aa3FDb7aF7Db93d18DDA4e19F811342EDF780", + "0x8d2de8d2f73F1F4cAB472AC9A881C9b123C79627" + ], + "type": "Token Bridge", + "methods": [ + { + "methodId": "0xc6878519", + "method": "MethodCompleteTransfer" + }, + { + "methodId": "0xff200cde", + "method": "MethodCompleteAndUnwrapETH" + }, + { + "methodId": "0xe8059810", + "method": "MethodCreateWrapped" + }, + { + "methodId": "0xf768441f", + "method": "MethodUpdateWrapped" + } + ] + }, + { + "address": ["0x9816d7C448f79CdD4aF18c4Ae1726A14299E8C75"], + "type": "Swap", + "methods": [ + { + "methodId": "0x3d528f35", + "method": "MethodReceiveMessageAndSwap" + } + ] + }, + { + "address": [ + "0x4cb69fae7e7af841e44e1a1c30af640739378bb2", + "0x4cb69fae7e7af841e44e1a1c30af640739378bb2" + ], + "type": "CCTP", + "methods": [ + { + "methodId": "0x0a55d735", + "method": "MethodRedeemTokensCCTP" + }, + { + "methodId": "0x57ecfd28", + "method": "MethodReceiveMessageCCTP" + } + ] + } + ] + }, + { + "chain": "base-sepolia", + "contracts": [ + { + "address": ["0x79A1027a6A159502049F10906D333EC57E95F083"], + "type": "Token Bridge", + "methods": [ + { + "methodId": "0xc6878519", + "method": "MethodCompleteTransfer" + }, + { + "methodId": "0xff200cde", + "method": "MethodCompleteAndUnwrapETH" + }, + { + "methodId": "0xe8059810", + "method": "MethodCreateWrapped" + }, + { + "methodId": "0xf768441f", + "method": "MethodUpdateWrapped" + } + ] + }, + { + "address": ["0x2703483B1a5a7c577e8680de9Df8Be03c6f30e3c"], + "type": "CCTP", + "methods": [ + { + "methodId": "0x0a55d735", + "method": "MethodRedeemTokensCCTP" + }, + { + "methodId": "0x57ecfd28", + "method": "MethodReceiveMessageCCTP" + } + ] + } + ] + } + ] +} diff --git a/blockchain-watcher/src/infrastructure/mappers/evm/evmRedeemedTransactionFoundMapper.ts b/blockchain-watcher/src/infrastructure/mappers/evm/evmRedeemedTransactionFoundMapper.ts index 5b34b37e..21eba1b7 100644 --- a/blockchain-watcher/src/infrastructure/mappers/evm/evmRedeemedTransactionFoundMapper.ts +++ b/blockchain-watcher/src/infrastructure/mappers/evm/evmRedeemedTransactionFoundMapper.ts @@ -1,5 +1,6 @@ import { EvmTransaction, TransactionFound, TransactionFoundEvent } from "../../../domain/entities"; import { methodNameByAddressMapper } from "./methodNameByAddressMapper"; +import * as configData from "./contractsMapper.json"; import winston from "../../log"; const TX_STATUS_CONFIRMED = "0x1"; @@ -14,6 +15,8 @@ logger = winston.child({ module: "evmRedeemedTransactionFoundMapper" }); export const evmRedeemedTransactionFoundMapper = ( transaction: EvmTransaction ): TransactionFoundEvent => { + const contractsMapperConfig: ContractsMapperConfig = configData as ContractsMapperConfig; + const protocol = methodNameByAddressMapper( transaction.chain, transaction.environment, @@ -105,3 +108,14 @@ export enum status { TxStatusUnkonwn = "unknown", TxStatusFailed = "failed", } + +interface ContractsMapperConfig { + contracts: { + chain: string; + protocols: { + address: string[]; + type: string; + methods: { methodId: string; method: string }[]; + }[]; + }[]; +}