|
| 1 | +import { BridgeAdapter, ContractEventParams, PartialContractEventParams } from "../../helpers/bridgeAdapter.type"; |
| 2 | +import { getTxDataFromEVMEventLogs } from "../../helpers/processTransactions"; |
| 3 | + |
| 4 | +// const WRAPPED_ERC20_ON_SHIMMER_EVM: Record<string, string> = { |
| 5 | +// USDC: "0xeCE555d37C37D55a6341b80cF35ef3BC57401d1A", |
| 6 | +// USDT: "0xa4f8C7C1018b9dD3be5835bF00f335D9910aF6Bd", |
| 7 | +// WBTC: "0xb0119035d08CB5f467F9ed8Eae4E5f9626Aa7402", |
| 8 | +// ETH: "0x4638C9fb4eFFe36C49d8931BB713126063BF38f9", |
| 9 | +// AVAX: "0xEAf8553fD72417C994525178fC917882d5AEc725", |
| 10 | +// MATIC: "0xE6373A7Bb9B5a3e71D1761a6Cb4992AD8537Bf28", |
| 11 | +// BNB: "0x2A6F394085B8E33fbD9dcFc776BCE4ed95F1900D", |
| 12 | +// FTM: "0x8C96Dd1A8B1952Ce6F3a582170bb173eD591D40D", |
| 13 | +// }; |
| 14 | + |
| 15 | +const WRAPPED_TOKEN_BRIDGE_ON_SHIMMER_EVM = "0x9C6D5a71FdD306329287a835e9B8EDb7F0F17898"; |
| 16 | + |
| 17 | +const constructParams = () => { |
| 18 | + const eventParamsList = new Array(); |
| 19 | + |
| 20 | + const depositEventParams: ContractEventParams = { |
| 21 | + target: WRAPPED_TOKEN_BRIDGE_ON_SHIMMER_EVM, |
| 22 | + topic: "WrapToken(address,address,uint16,address,uint256)", |
| 23 | + abi: ["event WrapToken(address localToken, address remoteToken, uint16 remoteChainId, address to, uint256 amount)"], |
| 24 | + logKeys: { |
| 25 | + blockNumber: "blockNumber", |
| 26 | + txHash: "transactionHash", |
| 27 | + }, |
| 28 | + argKeys: { |
| 29 | + from: "to", |
| 30 | + to: "to", |
| 31 | + token: "localToken", |
| 32 | + amount: "amount", |
| 33 | + }, |
| 34 | + isDeposit: true, |
| 35 | + }; |
| 36 | + |
| 37 | + const withdrawEventParams: ContractEventParams = { |
| 38 | + target: WRAPPED_TOKEN_BRIDGE_ON_SHIMMER_EVM, |
| 39 | + topic: "UnwrapToken(address,address,uint16,address,uint256)", |
| 40 | + abi: [ |
| 41 | + "event UnwrapToken(address localToken, address remoteToken, uint16 remoteChainId, address to, uint256 amount)", |
| 42 | + ], |
| 43 | + logKeys: { |
| 44 | + blockNumber: "blockNumber", |
| 45 | + txHash: "transactionHash", |
| 46 | + }, |
| 47 | + argKeys: { |
| 48 | + from: "to", |
| 49 | + to: "to", |
| 50 | + token: "localToken", |
| 51 | + amount: "amount", |
| 52 | + }, |
| 53 | + isDeposit: false, |
| 54 | + }; |
| 55 | + |
| 56 | + eventParamsList.push(depositEventParams); |
| 57 | + eventParamsList.push(withdrawEventParams); |
| 58 | + |
| 59 | + return async (fromBlock: number, toBlock: number) => |
| 60 | + getTxDataFromEVMEventLogs("shimmerbridge", "shimmer_evm", fromBlock, toBlock, eventParamsList); |
| 61 | +}; |
| 62 | + |
| 63 | +// On ShimmerBridge, ShimmerEVM is the only destination chain from other EVM chains like Ethereum, Polygon and etc |
| 64 | +const adapter: BridgeAdapter = { |
| 65 | + shimmer_evm: constructParams(), |
| 66 | +}; |
| 67 | + |
| 68 | +export default adapter; |
0 commit comments