---          
apiVersion: v1
kind: Service
metadata:
  name: {{ .NAME }}-source-events-2
  namespace: {{ .NAMESPACE }}
  labels:
    app: {{ .NAME }}-source-events-2
spec:
  selector:
    app: {{ .NAME }}-source-events-2
  ports:
    - port: {{ .PORT }}
      targetPort: {{ .PORT }}
      name: {{ .NAME }}-source-events-2
      protocol: TCP
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: blockchain-watcher-eth-1-pvc
  namespace: {{ .NAMESPACE }}
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Mi
  storageClassName: gp2
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ .NAME }}-source-events-2-jobs
  namespace: {{ .NAMESPACE }}
data:
  testnet-jobs.json: |-
    [
      {
        "id": "poll-log-message-published-optimism-sepolia",
        "chain": "optimism-sepolia",
        "source": {
          "action": "PollEvm",
          "config": {
            "blockBatchSize": 100,
            "commitment": "latest",
            "interval": 15000,
            "addresses": ["0x31377888146f3253211EFEf5c676D41ECe7D58Fe"],
            "chain": "optimism-sepolia",
            "chainId": 10005
          }
        },
        "handlers": [
          {
            "action": "HandleEvmLogs",
            "target": "sns",
            "mapper": "evmLogMessagePublishedMapper",
            "config": {
              "abi": "event LogMessagePublished(address indexed sender, uint64 sequence, uint32 nonce, bytes payload, uint8 consistencyLevel)",
              "filter": {
                "addresses": ["0x31377888146f3253211EFEf5c676D41ECe7D58Fe"],
                "topics": ["0x6eb224fb001ed210e379b335e35efe88672a8ce935d981a6896b27ffdf52a3b2"]
              },
              "metricName": "process_source_event"
            }
          }
        ]
      },
      {
        "id": "poll-log-message-published-base-sepolia",
        "chain": "base-sepolia",
        "source": {
          "action": "PollEvm",
          "config": {
            "blockBatchSize": 100,
            "commitment": "latest",
            "interval": 15000,
            "addresses": ["0x79A1027a6A159502049F10906D333EC57E95F083"],
            "chain": "base-sepolia",
            "chainId": 10004
          }
        },
        "handlers": [
          {
            "action": "HandleEvmLogs",
            "target": "sns",
            "mapper": "evmLogMessagePublishedMapper",
            "config": {
              "abi": "event LogMessagePublished(address indexed sender, uint64 sequence, uint32 nonce, bytes payload, uint8 consistencyLevel)",
              "filter": {
                "addresses": ["0x79A1027a6A159502049F10906D333EC57E95F083"],
                "topics": ["0x6eb224fb001ed210e379b335e35efe88672a8ce935d981a6896b27ffdf52a3b2"]
              },
              "metricName": "process_source_event"
            }
          }
        ]
      },
      {
        "id": "poll-log-message-published-celo",
        "chain": "celo",
        "source": {
          "action": "PollEvm",
          "config": {
            "blockBatchSize": 100,
            "commitment": "latest",
            "interval": 15000,
            "addresses": ["0x88505117CA88e7dd2eC6EA1E13f0948db2D50D56"],
            "chain": "celo",
            "chainId": 14
          }
        },
        "handlers": [
          {
            "action": "HandleEvmLogs",
            "target": "sns",
            "mapper": "evmLogMessagePublishedMapper",
            "config": {
              "abi": "event LogMessagePublished(address indexed sender, uint64 sequence, uint32 nonce, bytes payload, uint8 consistencyLevel)",
              "filter": {
                "addresses": ["0x88505117CA88e7dd2eC6EA1E13f0948db2D50D56"],
                "topics": ["0x6eb224fb001ed210e379b335e35efe88672a8ce935d981a6896b27ffdf52a3b2"]
              },
              "metricName": "process_source_event"
            }
          }
        ]
      },
      {
        "id": "poll-log-message-published-oasis",
        "chain": "oasis",
        "source": {
          "action": "PollEvm",
          "config": {
            "blockBatchSize": 100,
            "commitment": "latest",
            "interval": 15000,
            "addresses": ["0xc1C338397ffA53a2Eb12A7038b4eeb34791F8aCb"],
            "chain": "oasis",
            "chainId": 7
          }
        },
        "handlers": [
          {
            "action": "HandleEvmLogs",
            "target": "sns",
            "mapper": "evmLogMessagePublishedMapper",
            "config": {
              "abi": "event LogMessagePublished(address indexed sender, uint64 sequence, uint32 nonce, bytes payload, uint8 consistencyLevel)",
              "filter": {
                "addresses": ["0xc1C338397ffA53a2Eb12A7038b4eeb34791F8aCb"],
                "topics": ["0x6eb224fb001ed210e379b335e35efe88672a8ce935d981a6896b27ffdf52a3b2"]
              },
              "metricName": "process_source_event"
            }
          }
        ]
      },
      {
        "id": "poll-log-message-published-klaytn",
        "chain": "klaytn",
        "source": {
          "action": "PollEvm",
          "config": {
            "blockBatchSize": 100,
            "commitment": "latest",
            "interval": 15000,
            "addresses": ["0x1830CC6eE66c84D2F177B94D544967c774E624cA"],
            "chain": "klaytn",
            "chainId": 13
          }
        },
        "handlers": [
          {
            "action": "HandleEvmLogs",
            "target": "sns",
            "mapper": "evmLogMessagePublishedMapper",
            "config": {
              "abi": "event LogMessagePublished(address indexed sender, uint64 sequence, uint32 nonce, bytes payload, uint8 consistencyLevel)",
              "filter": {
                "addresses": ["0x1830CC6eE66c84D2F177B94D544967c774E624cA"],
                "topics": ["0x6eb224fb001ed210e379b335e35efe88672a8ce935d981a6896b27ffdf52a3b2"]
              },
              "metricName": "process_source_event"
            }
          }
        ]
      },
      {
        "id": "poll-log-message-published-polygon",
        "chain": "polygon",
        "source": {
          "action": "PollEvm",
          "config": {
            "blockBatchSize": 100,
            "commitment": "latest",
            "interval": 15000,
            "addresses": ["0x0CBE91CF822c73C2315FB05100C2F714765d5c20"],
            "chain": "polygon",
            "chainId": 5
          }
        },
        "handlers": [
          {
            "action": "HandleEvmLogs",
            "target": "sns",
            "mapper": "evmLogMessagePublishedMapper",
            "config": {
              "abi": "event LogMessagePublished(address indexed sender, uint64 sequence, uint32 nonce, bytes payload, uint8 consistencyLevel)",
              "filter": {
                "addresses": ["0x0CBE91CF822c73C2315FB05100C2F714765d5c20"],
                "topics": ["0x6eb224fb001ed210e379b335e35efe88672a8ce935d981a6896b27ffdf52a3b2"]
              },
              "metricName": "process_source_event"
            }
          }
        ]
      },
      {
        "id": "poll-log-message-published-polygon-sepolia",
        "chain": "polygon-sepolia",
        "source": {
          "action": "PollEvm",
          "config": {
            "blockBatchSize": 100,
            "commitment": "latest",
            "interval": 15000,
            "addresses": ["0x6b9C8671cdDC8dEab9c719bB87cBd3e782bA6a35"],
            "chain": "polygon-sepolia",
            "chainId": 10007
          }
        },
        "handlers": [
          {
            "action": "HandleEvmLogs",
            "target": "sns",
            "mapper": "evmLogMessagePublishedMapper",
            "config": {
              "abi": "event LogMessagePublished(address indexed sender, uint64 sequence, uint32 nonce, bytes payload, uint8 consistencyLevel)",
              "filter": {
                "addresses": ["0x6b9C8671cdDC8dEab9c719bB87cBd3e782bA6a35"],
                "topics": ["0x6eb224fb001ed210e379b335e35efe88672a8ce935d981a6896b27ffdf52a3b2"]
              },
              "metricName": "process_source_event"
            }
          }
        ]
      },
      {
        "id": "poll-log-message-published-scroll",
        "chain": "scroll",
        "source": {
          "action": "PollEvm",
          "config": {
            "blockBatchSize": 100,
            "commitment": "latest",
            "interval": 15000,
            "addresses": ["0x055f47f1250012c6b20c436570a76e52c17af2d5"],
            "chain": "scroll",
            "chainId": 34
          }
        },
        "handlers": [
          {
            "action": "HandleEvmLogs",
            "target": "sns",
            "mapper": "evmLogMessagePublishedMapper",
            "config": {
              "abi": "event LogMessagePublished(address indexed sender, uint64 sequence, uint32 nonce, bytes payload, uint8 consistencyLevel)",
              "filter": {
                "addresses": ["0x055f47f1250012c6b20c436570a76e52c17af2d5"],
                "topics": ["0x6eb224fb001ed210e379b335e35efe88672a8ce935d981a6896b27ffdf52a3b2"]
              },
              "metricName": "process_source_event"
            }
          }
        ]
      },
      {
        "id": "poll-log-message-published-wormchain",
        "chain": "wormchain",
        "source": {
          "action": "PollWormchain",
          "config": {
            "blockBatchSize": 100,
            "commitment": "latest",
            "interval": 5000,
            "addresses": ["wormhole16jzpxp0e8550c9aht6q9svcux30vtyyyyxv5w2l2djjra46580wsazcjwp"],
            "chain": "wormchain",
            "chainId": 3104
          }
        },
        "handlers": [
          {
            "action": "HandleWormchainLogs",
            "target": "sns",
            "mapper": "wormchainLogMessagePublishedMapper",
            "config": {
              "abi": "",
              "filter": {
                "addresses": ["wormhole16jzpxp0e8550c9aht6q9svcux30vtyyyyxv5w2l2djjra46580wsazcjwp"]
              },
              "metricName": "process_source_event"
            }
          }
        ]
      },
      {
        "id": "poll-log-message-published-blast",
        "chain": "blast",
        "source": {
          "action": "PollEvm",
          "config": {
            "blockBatchSize": 100,
            "commitment": "latest",
            "interval": 5000,
            "addresses": ["0x473e002D7add6fB67a4964F13bFd61280Ca46886"],
            "chain": "blast",
            "chainId": 36
          }
        },
        "handlers": [
          {
            "action": "HandleEvmLogs",
            "target": "sns",
            "mapper": "evmLogMessagePublishedMapper",
            "config": {
              "abi": "event LogMessagePublished(address indexed sender, uint64 sequence, uint32 nonce, bytes payload, uint8 consistencyLevel)",
              "filter": {
                "addresses": ["0x473e002D7add6fB67a4964F13bFd61280Ca46886"],
                "topics": ["0x6eb224fb001ed210e379b335e35efe88672a8ce935d981a6896b27ffdf52a3b2"]
              },
            "metricName": "process_source_event"
            }
          }
        ]
      }
    ]
  mainnet-jobs.json: |-
    [
      {
        "id": "poll-log-message-published-optimism",
        "chain": "optimism",
        "source": {
          "action": "PollEvm",
          "config": {
            "blockBatchSize": 100,
            "commitment": "latest",
            "interval": 5000,
            "addresses": ["0xEe91C335eab126dF5fDB3797EA9d6aD93aeC9722"],
            "chain": "optimism",
            "chainId": 24
          }
        },
        "handlers": [
          {
            "action": "HandleEvmLogs",
            "target": "sns",
            "mapper": "evmLogMessagePublishedMapper",
            "config": {
              "abi": "event LogMessagePublished(address indexed sender, uint64 sequence, uint32 nonce, bytes payload, uint8 consistencyLevel)",
              "filter": {
                "addresses": ["0xEe91C335eab126dF5fDB3797EA9d6aD93aeC9722"],
                "topics": ["0x6eb224fb001ed210e379b335e35efe88672a8ce935d981a6896b27ffdf52a3b2"]
              },
             "metricName": "process_source_event"
            }
          }
        ]
      },
      {
        "id": "poll-log-message-published-base",
        "chain": "base",
        "source": {
          "action": "PollEvm",
          "config": {
            "blockBatchSize": 100,
            "commitment": "latest",
            "interval": 5000,
            "addresses": ["0xbebdb6C8ddC678FfA9f8748f85C815C556Dd8ac6"],
            "chain": "base",
            "chainId": 30
          }
        },
        "handlers": [
          {
            "action": "HandleEvmLogs",
            "target": "sns",
            "mapper": "evmLogMessagePublishedMapper",
            "config": {
              "abi": "event LogMessagePublished(address indexed sender, uint64 sequence, uint32 nonce, bytes payload, uint8 consistencyLevel)",
              "filter": {
                "addresses": ["0xbebdb6C8ddC678FfA9f8748f85C815C556Dd8ac6"],
                "topics": ["0x6eb224fb001ed210e379b335e35efe88672a8ce935d981a6896b27ffdf52a3b2"]
              },
             "metricName": "process_source_event"
            }
          }
        ]
      },
      {
        "id": "poll-log-message-published-celo",
        "chain": "celo",
        "source": {
          "action": "PollEvm",
          "config": {
            "blockBatchSize": 100,
            "commitment": "latest",
            "interval": 5000,
            "addresses": ["0xa321448d90d4e5b0A732867c18eA198e75CAC48E"],
            "chain": "celo",
            "chainId": 14
          }
        },
        "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"]
              },
            "metricName": "process_source_event"
            }
          }
        ]
      },
      {
        "id": "poll-log-message-published-oasis",
        "chain": "oasis",
        "source": {
          "action": "PollEvm",
          "config": {
            "blockBatchSize": 100,
            "commitment": "latest",
            "interval": 5000,
            "addresses": ["0xfE8cD454b4A1CA468B57D79c0cc77Ef5B6f64585"],
            "chain": "oasis",
            "chainId": 7
          }
        },
        "handlers": [
          {
            "action": "HandleEvmLogs",
            "target": "sns",
            "mapper": "evmLogMessagePublishedMapper",
            "config": {
              "abi": "event LogMessagePublished(address indexed sender, uint64 sequence, uint32 nonce, bytes payload, uint8 consistencyLevel)",
              "filter": {
                "addresses": ["0xfE8cD454b4A1CA468B57D79c0cc77Ef5B6f64585"],
                "topics": ["0x6eb224fb001ed210e379b335e35efe88672a8ce935d981a6896b27ffdf52a3b2"]
              },
            "metricName": "process_source_event"
            }
          }
        ]
      },
      {
        "id": "poll-log-message-published-klaytn",
        "chain": "klaytn",
        "source": {
          "action": "PollEvm",
          "config": {
            "blockBatchSize": 100,
            "commitment": "latest",
            "interval": 5000,
            "addresses": ["0x0C21603c4f3a6387e241c0091A7EA39E43E90bb7"],
            "chain": "klaytn",
            "chainId": 13
          }
        },
        "handlers": [
          {
            "action": "HandleEvmLogs",
            "target": "sns",
            "mapper": "evmLogMessagePublishedMapper",
            "config": {
              "abi": "event LogMessagePublished(address indexed sender, uint64 sequence, uint32 nonce, bytes payload, uint8 consistencyLevel)",
              "filter": {
                "addresses": ["0x0C21603c4f3a6387e241c0091A7EA39E43E90bb7"],
                "topics": ["0x6eb224fb001ed210e379b335e35efe88672a8ce935d981a6896b27ffdf52a3b2"]
              },
            "metricName": "process_source_event"
            }
          }
        ]
      },
      {
        "id": "poll-log-message-published-polygon",
        "chain": "polygon",
        "source": {
          "action": "PollEvm",
          "config": {
            "blockBatchSize": 100,
            "commitment": "latest",
            "interval": 5000,
            "addresses": ["0x7A4B5a56256163F07b2C80A7cA55aBE66c4ec4d7"],
            "chain": "polygon",
            "chainId": 5
          }
        },
        "handlers": [
          {
            "action": "HandleEvmLogs",
            "target": "sns",
            "mapper": "evmLogMessagePublishedMapper",
            "config": {
              "abi": "event LogMessagePublished(address indexed sender, uint64 sequence, uint32 nonce, bytes payload, uint8 consistencyLevel)",
              "filter": {
                "addresses": ["0x7A4B5a56256163F07b2C80A7cA55aBE66c4ec4d7"],
                "topics": ["0x6eb224fb001ed210e379b335e35efe88672a8ce935d981a6896b27ffdf52a3b2"]
              },
            "metricName": "process_source_event"
            }
          }
        ]
      },
      {
        "id": "poll-log-message-published-wormchain",
        "chain": "wormchain",
        "source": {
          "action": "PollWormchain",
          "config": {
            "blockBatchSize": 100,
            "commitment": "latest",
            "interval": 5000,
            "addresses": ["wormhole1ufs3tlq4umljk0qfe8k5ya0x6hpavn897u2cnf9k0en9jr7qarqqaqfk2j"],
            "chain": "wormchain",
            "chainId": 3104
          }
        },
        "handlers": [
          {
            "action": "HandleWormchainLogs",
            "target": "sns",
            "mapper": "wormchainLogMessagePublishedMapper",
            "config": {
              "abi": "",
              "filter": {
                "addresses": ["wormhole1ufs3tlq4umljk0qfe8k5ya0x6hpavn897u2cnf9k0en9jr7qarqqaqfk2j"]
              },
              "metricName": "process_source_event"
            }
          }
        ]
      },
      {
        "id": "poll-log-message-published-blast",
        "chain": "blast",
        "source": {
          "action": "PollEvm",
          "config": {
            "blockBatchSize": 100,
            "commitment": "latest",
            "interval": 5000,
            "addresses": ["0xbebdb6C8ddC678FfA9f8748f85C815C556Dd8ac6"],
            "chain": "blast",
            "chainId": 36
          }
        },
        "handlers": [
          {
            "action": "HandleEvmLogs",
            "target": "sns",
            "mapper": "evmLogMessagePublishedMapper",
            "config": {
              "abi": "event LogMessagePublished(address indexed sender, uint64 sequence, uint32 nonce, bytes payload, uint8 consistencyLevel)",
              "filter": {
                "addresses": ["0xbebdb6C8ddC678FfA9f8748f85C815C556Dd8ac6"],
                "topics": ["0x6eb224fb001ed210e379b335e35efe88672a8ce935d981a6896b27ffdf52a3b2"]
              },
            "metricName": "process_source_event"
            }
          }
        ]
      },
      {
        "id": "poll-log-message-published-scroll",
        "chain": "scroll",
        "source": {
          "action": "PollEvm",
          "config": {
            "blockBatchSize": 100,
            "commitment": "latest",
            "interval": 15000,
            "addresses": ["0xbebdb6C8ddC678FfA9f8748f85C815C556Dd8ac6"],
            "chain": "scroll",
            "chainId": 34
          }
        },
        "handlers": [
          {
            "action": "HandleEvmLogs",
            "target": "sns",
            "mapper": "evmLogMessagePublishedMapper",
            "config": {
              "abi": "event LogMessagePublished(address indexed sender, uint64 sequence, uint32 nonce, bytes payload, uint8 consistencyLevel)",
              "filter": {
                "addresses": ["0xbebdb6C8ddC678FfA9f8748f85C815C556Dd8ac6"],
                "topics": ["0x6eb224fb001ed210e379b335e35efe88672a8ce935d981a6896b27ffdf52a3b2"]
              },
              "metricName": "process_source_event"
            }
          }
        ]
      }
    ]
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ .NAME }}-source-events-2
  namespace: {{ .NAMESPACE }}
spec:
  replicas: 1
  selector:
    matchLabels:
      app: {{ .NAME }}-source-events-2
  template:
    metadata:
      labels:
        app: {{ .NAME }}-source-events-2
      annotations:
        prometheus.io/scrape: "true"
        prometheus.io/port: "{{ .PORT }}"
    spec:
      containers:
        - name: {{ .NAME }}
          env:
            - name: NODE_ENV
              value: {{ .NODE_ENV }}
            - name: PORT
              value: "{{ .PORT }}"
            - name: LOG_LEVEL
              value: {{ .LOG_LEVEL }}
            - name: BLOCKCHAIN_ENV
              value: {{ .BLOCKCHAIN_ENV }}
            - name: DRY_RUN_ENABLED
              value: "{{ .DRY_RUN_ENABLED }}"
            - name: SNS_TOPIC_ARN
              value: {{ .SNS_TOPIC_ARN }}
            - name: SNS_REGION
              value: {{ .SNS_REGION }}
            - name: JOBS_DIR
              value: /home/node/app/jobs
            {{ if .BASE_RPCS }}
            - name: BASE_RPCS
              value: '{{ .BASE_RPCS }}'
            {{ end }}
            {{ if .OPTIMISM_RPCS }}
            - name: OPTIMISM_RPCS
              value: '{{ .OPTIMISM_RPCS }}'
            {{ end }}
            {{ if .ARBITRUM_RPCS }}
            - name: ARBITRUM_RPCS
              value: '{{ .ARBITRUM_RPCS }}'
            {{ end }}
            {{ if .POLYGON_RPCS }}
            - name: POLYGON_RPCS
              value: '{{ .POLYGON_RPCS }}'
            {{ end }}
            {{ if .BASE_SEPOLIA_RPCS }}
            - name: BASE_SEPOLIA_RPCS
              value: '{{ .BASE_SEPOLIA_RPCS }}'
            {{ end }}
            {{ if .OPTIMISM_SEPOLIA_RPCS }}
            - name: OPTIMISM_SEPOLIA_RPCS
              value: '{{ .OPTIMISM_SEPOLIA_RPCS }}'
            {{ end }}
            {{ if .CELO_RPCS }}
            - name: CELO_RPCS
              value: '{{ .CELO_RPCS }}'
            {{ end }}
            {{ if .SCROLL_RPCS }}
            - name: SCROLL_RPCS
              value: '{{ .SCROLL_RPCS }}'
            {{ end }}
            {{ if .POLYGON_SEPOLIA_RPCS }}
            - name: POLYGON_SEPOLIA_RPCS
              value: '{{ .POLYGON_SEPOLIA_RPCS }}'
            {{ end }}
            {{ if .ARBITRUM_SEPOLIA_RPCS }}
            - name: ARBITRUM_SEPOLIA_RPCS
              value: '{{ .ARBITRUM_SEPOLIA_RPCS }}'
            {{ end }}
            {{ if .BLAST_RPCS }}
            - name: BLAST_RPCS
              value: '{{ .BLAST_RPCS }}'
            {{ end }}
          image: {{ .IMAGE_NAME }}
          resources:
            limits:
              cpu: {{ .RESOURCES_LIMITS_CPU }}
              memory: {{ .RESOURCES_LIMITS_MEMORY }}
            requests:
              cpu: {{ .RESOURCES_REQUESTS_CPU }}
              memory: {{ .RESOURCES_REQUESTS_MEMORY }}
          volumeMounts:
            - name: metadata-volume
              mountPath: /home/node/app/metadata-repo 
            - name: jobs-volume
              mountPath: /home/node/app/jobs
      restartPolicy: Always
      serviceAccountName: blockchain-watcher
      terminationGracePeriodSeconds: 30
      volumes:
        - name: metadata-volume
          persistentVolumeClaim:
            claimName: blockchain-watcher-eth-1-pvc
        - name: jobs-volume
          configMap:
            name: {{ .NAME }}-source-events-2-jobs
            items:
              - key: {{ .BLOCKCHAIN_ENV }}-jobs.json
                path: jobs.json
