---          
apiVersion: v1
kind: Service
metadata:
  name: {{ .NAME }}-target-events-2
  namespace: {{ .NAMESPACE }}
  labels:
    app: {{ .NAME }}-target-events-2
spec:
  selector:
    app: {{ .NAME }}-target-events-2
  ports:
    - port: {{ .PORT }}
      targetPort: {{ .PORT }}
      name: {{ .NAME }}-target-events-2
      protocol: TCP
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: blockchain-watcher-target-events-2-pvc
  namespace: {{ .NAMESPACE }}
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Mi
  storageClassName: gp2
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ .NAME }}-target-events-2-jobs
  namespace: {{ .NAMESPACE }}
data:
  testnet-jobs.json: |-
    [
      {
        "id": "poll-redeemed-transactions-aptos",
        "chain": "aptos",
        "source": {
          "action": "PollAptos",
          "records": "GetAptosTransactions",
          "config": {
            "limitBatchSize": 100,
            "commitment": "finalized",
            "interval": 5000,
            "addresses": [
              "0x576410486a2da45eee6c949c995670112ddf2fbeedab20350d506328eefc9d4f",
              "0x1bdffae984043833ed7fe223f7af7a3f8902d04129b14f801823e64827da7130"
            ],
            "chain": "aptos",
            "chainId": 22,
            "filters": [
              {
                "address": "0x576410486a2da45eee6c949c995670112ddf2fbeedab20350d506328eefc9d4f",
                "type": "0x576410486a2da45eee6c949c995670112ddf2fbeedab20350d506328eefc9d4f::complete_transfer::submit_vaa_and_register_entry"
              },
              {
                "address": "0x1bdffae984043833ed7fe223f7af7a3f8902d04129b14f801823e64827da7130",
                "type": "0x1bdffae984043833ed7fe223f7af7a3f8902d04129b14f801823e64827da7130::complete_transfer::submit_vaa_and_register_entry"
              }
            ]
          }
        },
        "handlers": [
          {
            "action": "HandleAptosTransactions",
            "target": "sns",
            "mapper": "aptosRedeemedTransactionFoundMapper",
            "config": {
              "metricName": "process_vaa_event"
            }
          }
        ]
      },
      {
        "id": "poll-redeemed-transactions-fantom",
        "chain": "fantom",
        "source": {
          "action": "PollEvm",
          "records": "GetEvmTransactions",
          "config": {
            "blockBatchSize": 100,
            "commitment": "latest",
            "interval": 5000,
            "addresses": [
              "0x599cea2204b4faecd584ab1f2b6aca137a0afbe8",
              "0x63eD9318628D26BdCB15df58B53BB27231D1B227",
              "0x9563a59C15842a6f322B10f69d1dD88b41f2E97B"
            ],
            "chain": "fantom",
            "chainId": 10,
            "topics": [
              "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
            ]
          }
        },
        "handlers": [
          {
            "action": "HandleEvmTransactions",
            "target": "sns",
            "mapper": "evmRedeemedTransactionFoundMapper",
            "config": {
              "abi": "",
              "filter": {
                "addresses": [
                  "0x599cea2204b4faecd584ab1f2b6aca137a0afbe8",
                  "0x63eD9318628D26BdCB15df58B53BB27231D1B227",
                  "0x9563a59C15842a6f322B10f69d1dD88b41f2E97B"
                ],
                "topics": [
                  "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
                ]
              },
              "metricName": "process_vaa_event"
            }
          }
        ]
      },
      {
        "id": "poll-redeemed-transactions-oasis",
        "chain": "oasis",
        "source": {
          "action": "PollEvm",
          "records": "GetEvmTransactions",
          "config": {
            "blockBatchSize": 100,
            "commitment": "latest",
            "interval": 5000,
            "addresses": [
              "0x88d8004a9bdbfd9d28090a02010c19897a29605c",
              "0xC5c25B41AB0b797571620F5204Afa116A44c0ebA"
            ],
            "chain": "oasis",
            "chainId": 7,
            "topics": [
              "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
            ]
          }
        },
        "handlers": [
          {
            "action": "HandleEvmTransactions",
            "target": "sns",
            "mapper": "evmRedeemedTransactionFoundMapper",
            "config": {
              "abi": "",
              "filter": {
                "addresses": [
                  "0x88d8004a9bdbfd9d28090a02010c19897a29605c",
                  "0xC5c25B41AB0b797571620F5204Afa116A44c0ebA"
                ],
                "topics": [
                  "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
                ]
              },
              "metricName": "process_vaa_event"
            }
          }
        ]
      },
      {
        "id": "poll-redeemed-transactions-moonbeam",
        "chain": "moonbeam",
        "source": {
          "action": "PollEvm",
          "records": "GetEvmTransactions",
          "config": {
            "blockBatchSize": 100,
            "commitment": "latest",
            "interval": 5000,
            "addresses": [
              "0xbc976d4b9d57e57c3ca52e1fd136c45ff7955a96",
              "0x98A0F4B96972b32Fcb3BD03cAeB66A44a6aB9Edb",
              "0x0591C25ebd0580E0d4F27A82Fc2e24E7489CB5e0",
              "0x9563a59C15842a6f322B10f69d1dD88b41f2E97B"
            ],
            "chain": "moonbeam",
            "chainId": 16,
            "topics": [
              "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
            ]
          }
        },
        "handlers": [
          {
            "action": "HandleEvmTransactions",
            "target": "sns",
            "mapper": "evmRedeemedTransactionFoundMapper",
            "config": {
              "abi": "",
              "filter": {
                "addresses": [
                  "0xbc976d4b9d57e57c3ca52e1fd136c45ff7955a96",
                  "0x98A0F4B96972b32Fcb3BD03cAeB66A44a6aB9Edb",
                  "0x0591C25ebd0580E0d4F27A82Fc2e24E7489CB5e0",
                  "0x9563a59C15842a6f322B10f69d1dD88b41f2E97B"
                ],
                "topics": [
                  "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
                ]
              },
              "metricName": "process_vaa_event"
            }
          }
        ]
      },
      {
        "id": "poll-redeemed-transactions-celo",
        "chain": "celo",
        "source": {
          "action": "PollEvm",
          "records": "GetEvmTransactions",
          "config": {
            "blockBatchSize": 10,
            "commitment": "latest",
            "interval": 5000,
            "addresses": [
              "0x05ca6037ec51f8b712ed2e6fa72219feae74e153",
              "0xaCD8190F647a31E56A656748bC30F69259f245Db",
              "0x306B68267Deb7c5DfCDa3619E22E9Ca39C374f84",
              "0x9563a59C15842a6f322B10f69d1dD88b41f2E97B"
            ],
            "chain": "celo",
            "chainId": 14,
            "topics": [
              "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
            ]
          }
        },
        "handlers": [
          {
            "action": "HandleEvmTransactions",
            "target": "sns",
            "mapper": "evmRedeemedTransactionFoundMapper",
            "config": {
              "abi": "",
              "filter": {
                "addresses": [
                  "0x05ca6037ec51f8b712ed2e6fa72219feae74e153",
                  "0xaCD8190F647a31E56A656748bC30F69259f245Db",
                  "0x306B68267Deb7c5DfCDa3619E22E9Ca39C374f84",
                  "0x9563a59C15842a6f322B10f69d1dD88b41f2E97B"
                ],
                "topics": [
                  "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
                ]
              },
              "metricName": "process_vaa_event"
            }
          }
        ]
      },
      {
        "id": "poll-redeemed-transactions-scroll",
        "chain": "scroll",
        "source": {
          "action": "PollEvm",
          "records": "GetEvmTransactions",
          "config": {
            "blockBatchSize": 100,
            "commitment": "latest",
            "interval": 15000,
            "addresses": [
              "0x22427d90b7da3fa4642f7025a854c7254e4e45bf"
            ],
            "chain": "scroll",
            "chainId": 34,
            "topics": [
              "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
            ]
          }
        },
        "handlers": [
          {
            "action": "HandleEvmTransactions",
            "target": "sns",
            "mapper": "evmRedeemedTransactionFoundMapper",
            "config": {
              "abi": "",
              "filter": {
                "addresses": [
                  "0x22427d90b7da3fa4642f7025a854c7254e4e45bf"
                ],
                "topics": [
                  "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
                ]
              },
              "metricName": "process_vaa_event"
            }
          }
        ]
      }
    ]
  mainnet-jobs.json: |-
    [
      {
        "id": "poll-redeemed-transactions-aptos",
        "chain": "aptos",
        "source": {
          "action": "PollAptos",
          "records": "GetAptosTransactions",
          "config": {
            "limitBatchSize": 100,
            "commitment": "finalized",
            "interval": 3000,
            "addresses": [
              "0x576410486a2da45eee6c949c995670112ddf2fbeedab20350d506328eefc9d4f",
              "0x1bdffae984043833ed7fe223f7af7a3f8902d04129b14f801823e64827da7130"
            ],
            "chain": "aptos",
            "chainId": 22,
            "filters": [
              {
                "address": "0x576410486a2da45eee6c949c995670112ddf2fbeedab20350d506328eefc9d4f",
                "type": "0x576410486a2da45eee6c949c995670112ddf2fbeedab20350d506328eefc9d4f::complete_transfer::submit_vaa_and_register_entry"
              },
              {
                "address": "0x1bdffae984043833ed7fe223f7af7a3f8902d04129b14f801823e64827da7130",
                "type": "0x1bdffae984043833ed7fe223f7af7a3f8902d04129b14f801823e64827da7130::complete_transfer::submit_vaa_and_register_entry"
              }
            ]
          }
        },
        "handlers": [
          {
            "action": "HandleAptosTransactions",
            "target": "sns",
            "mapper": "aptosRedeemedTransactionFoundMapper",
            "config": {
              "metricName": "process_vaa_event"
            }
          }
        ]
      },
      {
        "id": "poll-redeemed-transactions-fantom",
        "chain": "fantom",
        "source": {
          "action": "PollEvm",
          "records": "GetEvmTransactions",
          "config": {
            "blockBatchSize": 100,
            "commitment": "latest",
            "interval": 5000,
            "addresses": [
              "0x7c9fc5741288cdfdd83ceb07f3ea7e22618d79d2",
              "0x8b47f02e7e20174c76af910adc0ad8a4b0342f4c",
              "0xA9c7119aBDa80d4a4E0C06C8F4d8cF5893234535",
              "0x27428dd2d3dd32a4d7f7c497eaaa23130d894911",
              "0xcafd2f0a35a4459fa40c0517e17e6fa2939441ca"
            ],
            "chain": "fantom",
            "chainId": 10,
            "topics": [
              "0xcaf280c8cfeba144da67230d9b009c8f868a75bac9a528fa0474be1ba317c169",
              "0x504e6efe18ab9eed10dc6501a417f5b12a2f7f2b1593aed9b89f9bce3cf29a91",
              "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
            ]
          }
        },
        "handlers": [
          {
            "action": "HandleEvmTransactions",
            "target": "sns",
            "mapper": "evmRedeemedTransactionFoundMapper",
            "config": {
              "abi": "",
              "filter": {
                "addresses": [
                  "0x7c9fc5741288cdfdd83ceb07f3ea7e22618d79d2",
                  "0x8b47f02e7e20174c76af910adc0ad8a4b0342f4c",
                  "0xA9c7119aBDa80d4a4E0C06C8F4d8cF5893234535",
                  "0x27428dd2d3dd32a4d7f7c497eaaa23130d894911",
                  "0xcafd2f0a35a4459fa40c0517e17e6fa2939441ca"
                ],
                "topics": [
                  "0xcaf280c8cfeba144da67230d9b009c8f868a75bac9a528fa0474be1ba317c169",
                  "0x504e6efe18ab9eed10dc6501a417f5b12a2f7f2b1593aed9b89f9bce3cf29a91",
                  "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
                ]
              },
              "metricName": "process_vaa_event"
            }
          }
        ]
      },
      {
        "id": "poll-redeemed-transactions-oasis",
        "chain": "oasis",
        "source": {
          "action": "PollEvm",
          "records": "GetEvmTransactions",
          "config": {
            "blockBatchSize": 100,
            "commitment": "latest",
            "interval": 5000,
            "addresses": [
              "0x5848c791e09901b40a9ef749f2a6735b418d7564",
              "0x04952D522Ff217f40B5Ef3cbF659EcA7b952a6c1"
            ],
            "chain": "oasis",
            "chainId": 7,
            "topics": [
              "0xcaf280c8cfeba144da67230d9b009c8f868a75bac9a528fa0474be1ba317c169",
              "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
            ]
          }
        },
        "handlers": [
          {
            "action": "HandleEvmTransactions",
            "target": "sns",
            "mapper": "evmRedeemedTransactionFoundMapper",
            "config": {
              "abi": "",
              "filter": {
                "addresses": [
                  "0x5848c791e09901b40a9ef749f2a6735b418d7564",
                  "0x04952D522Ff217f40B5Ef3cbF659EcA7b952a6c1"
                ],
                "topics": [
                  "0xcaf280c8cfeba144da67230d9b009c8f868a75bac9a528fa0474be1ba317c169",
                  "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
                ]
              },
              "metricName": "process_vaa_event"
            }
          }
        ]
      },
      {
        "id": "poll-redeemed-transactions-moonbeam",
        "chain": "moonbeam",
        "source": {
          "action": "PollEvm",
          "records": "GetEvmTransactions",
          "config": {
            "blockBatchSize": 100,
            "commitment": "latest",
            "interval": 5000,
            "addresses": [
              "0xb1731c586ca89a23809861c6103f0b96b3f57d92",
              "0x453cfbe096c0f8d763e8c5f24b441097d577bde2",
              "0x27428dd2d3dd32a4d7f7c497eaaa23130d894911",
              "0xcafd2f0a35a4459fa40c0517e17e6fa2939441ca"
            ],
            "chain": "moonbeam",
            "chainId": 16,
            "topics": [
              "0xcaf280c8cfeba144da67230d9b009c8f868a75bac9a528fa0474be1ba317c169",
              "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
            ]
          }
        },
        "handlers": [
          {
            "action": "HandleEvmTransactions",
            "target": "sns",
            "mapper": "evmRedeemedTransactionFoundMapper",
            "config": {
              "abi": "",
              "filter": {
                "addresses": [
                  "0xb1731c586ca89a23809861c6103f0b96b3f57d92",
                  "0x453cfbe096c0f8d763e8c5f24b441097d577bde2",
                  "0x27428dd2d3dd32a4d7f7c497eaaa23130d894911",
                  "0xcafd2f0a35a4459fa40c0517e17e6fa2939441ca"
                ],
                "topics": [
                  "0xcaf280c8cfeba144da67230d9b009c8f868a75bac9a528fa0474be1ba317c169",
                  "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
                ]
              },
              "metricName": "process_vaa_event"
            }
          }
        ]
      },
      {
        "id": "poll-redeemed-transactions-celo",
        "chain": "celo",
        "source": {
          "action": "PollEvm",
          "records": "GetEvmTransactions",
          "config": {
            "blockBatchSize": 10,
            "commitment": "latest",
            "interval": 5000,
            "addresses": [
              "0x796dff6d74f3e27060b71255fe517bfb23c93eed",
              "0xA6A377d75ca5c9052c9a77ED1e865Cc25Bd97bf3",
              "0x27428dd2d3dd32a4d7f7c497eaaa23130d894911",
              "0xcafd2f0a35a4459fa40c0517e17e6fa2939441ca"
            ],
            "chain": "celo",
            "chainId": 14,
            "topics": [
              "0xcaf280c8cfeba144da67230d9b009c8f868a75bac9a528fa0474be1ba317c169",
              "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
            ]
          }
        },
        "handlers": [
          {
            "action": "HandleEvmTransactions",
            "target": "sns",
            "mapper": "evmRedeemedTransactionFoundMapper",
            "config": {
              "abi": "",
              "filter": {
                "addresses": [
                  "0x796dff6d74f3e27060b71255fe517bfb23c93eed",
                  "0xA6A377d75ca5c9052c9a77ED1e865Cc25Bd97bf3",
                  "0x27428dd2d3dd32a4d7f7c497eaaa23130d894911",
                  "0xcafd2f0a35a4459fa40c0517e17e6fa2939441ca"
                ],
                "topics": [
                  "0xcaf280c8cfeba144da67230d9b009c8f868a75bac9a528fa0474be1ba317c169",
                  "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
                ]
              },
              "metricName": "process_vaa_event"
            }
          }
        ]
      },
      {
        "id": "poll-redeemed-transactions-scroll",
        "chain": "scroll",
        "source": {
          "action": "PollEvm",
          "records": "GetEvmTransactions",
          "config": {
            "blockBatchSize": 100,
            "commitment": "latest",
            "interval": 15000,
            "addresses": [
              "0x24850c6f61C438823F01B7A3BF2B89B72174Fa9d"
            ],
            "chain": "scroll",
            "chainId": 34,
            "topics": [
              "0xcaf280c8cfeba144da67230d9b009c8f868a75bac9a528fa0474be1ba317c169",
              "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
            ]
          }
        },
        "handlers": [
          {
            "action": "HandleEvmTransactions",
            "target": "sns",
            "mapper": "evmRedeemedTransactionFoundMapper",
            "config": {
              "abi": "",
              "filter": {
                "addresses": [
                  "0x24850c6f61C438823F01B7A3BF2B89B72174Fa9d"
                ],
                "topics": [
                  "0xcaf280c8cfeba144da67230d9b009c8f868a75bac9a528fa0474be1ba317c169",
                  "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
                ]
              },
              "metricName": "process_vaa_event"
            }
          }
        ]
      }
    ]
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ .NAME }}-target-events-2
  namespace: {{ .NAMESPACE }}
spec:
  replicas: 1
  selector:
    matchLabels:
      app: {{ .NAME }}-target-events-2
  template:
    metadata:
      labels:
        app: {{ .NAME }}-target-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 .AVALANCHE_RPCS }}
            - name: AVALANCHE_RPCS
              value: '{{ .AVALANCHE_RPCS }}'
            {{ end }}
            {{ if .ETHEREUM_SEPOLIA_RPCS }}
            - name: ETHEREUM_SEPOLIA_RPCS
              value: '{{ .ETHEREUM_SEPOLIA_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 .ARBITRUM_SEPOLIA_RPCS }}
            - name: ARBITRUM_SEPOLIA_RPCS
              value: '{{ .ARBITRUM_SEPOLIA_RPCS }}'
            {{ end }}
            {{ if .ETHEREUM_HOLESKY_RPCS }}
            - name: ETHEREUM_HOLESKY_RPCS
              value: '{{ .ETHEREUM_HOLESKY_RPCS }}'
            {{ end }}
            {{ if .CELO_RPCS }}
            - name: CELO_RPCS
              value: '{{ .CELO_RPCS }}'
            {{ end }}
            {{ if .APTOS_RPCS }}
            - name: APTOS_RPCS
              value: '{{ .APTOS_RPCS }}'
            {{ end }}
            {{ if .SCROLL_RPCS }}
            - name: SCROLL_RPCS
              value: '{{ .SCROLL_RPCS }}'
            {{ end }}
            {{ if .MOONBEAM_RPCS }}
            - name: MOONBEAM_RPCS
              value: '{{ .MOONBEAM_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-target-events-2-pvc
        - name: jobs-volume
          configMap:
            name: {{ .NAME }}-target-events-2-jobs
            items:
              - key: {{ .BLOCKCHAIN_ENV }}-jobs.json
                path: jobs.json
