---
apiVersion: batch/v1
kind: Job
metadata:
  name: {{ .NAME }}
  namespace: {{ .NAMESPACE }}
spec:
  template:
    metadata:
      labels:
        app: {{ .NAME }}
    spec:
      restartPolicy: Never
      terminationGracePeriodSeconds: 40
      containers:
        - name: {{ .NAME }}
          image: {{ .IMAGE_NAME }}
          imagePullPolicy: Always
          env:
            - name: ENV
              value: "PRODUCTION"
            - name: LOG_LEVEL
              value: "DEBUG"
            - name: MONGODB_URI
              valueFrom:
                secretKeyRef:
                  name: mongodb
                  key: mongo-uri
            - name: MONGODB_DATABASE
              valueFrom:
                configMapKeyRef:
                  name: config
                  key: mongo-database
            - name: ACALA_BASE_URL
              value: {{ .ACALA_BASE_URL }}
            - name: ACALA_REQUESTS_PER_MINUTE
              value: "{{ .ACALA_REQUESTS_PER_MINUTE }}"
            - name: ALGORAND_BASE_URL
              value: {{ .ALGORAND_BASE_URL }}
            - name: ALGORAND_REQUESTS_PER_MINUTE
              value: "{{ .ALGORAND_REQUESTS_PER_MINUTE }}"
            - name: APTOS_BASE_URL
              value: {{ .APTOS_BASE_URL }}
            - name: APTOS_REQUESTS_PER_MINUTE
              value: "{{ .APTOS_REQUESTS_PER_MINUTE }}"
            - name: ARBITRUM_BASE_URL
              value: {{ .ARBITRUM_BASE_URL }}
            - name: ARBITRUM_REQUESTS_PER_MINUTE
              value: "{{ .ARBITRUM_REQUESTS_PER_MINUTE }}"
            - name: AVALANCHE_BASE_URL
              value: {{ .AVALANCHE_BASE_URL }}
            - name: AVALANCHE_REQUESTS_PER_MINUTE
              value: "{{ .AVALANCHE_REQUESTS_PER_MINUTE }}"
            - name: BASE_BASE_URL
              value: {{ .BASE_BASE_URL }}
            - name: BASE_REQUESTS_PER_MINUTE
              value: "{{ .BASE_REQUESTS_PER_MINUTE }}"
            - name: BSC_BASE_URL
              value: {{ .BSC_BASE_URL }}
            - name: BSC_REQUESTS_PER_MINUTE
              value: "{{ .BSC_REQUESTS_PER_MINUTE }}"
            - name: CELO_BASE_URL
              value: {{ .CELO_BASE_URL }}
            - name: CELO_REQUESTS_PER_MINUTE
              value: "{{ .CELO_REQUESTS_PER_MINUTE }}"
            - name: ETHEREUM_BASE_URL
              value: {{ .ETHEREUM_BASE_URL }}
            - name: ETHEREUM_REQUESTS_PER_MINUTE
              value: "{{ .ETHEREUM_REQUESTS_PER_MINUTE }}"
            - name: FANTOM_BASE_URL
              value: {{ .FANTOM_BASE_URL }}
            - name: FANTOM_REQUESTS_PER_MINUTE
              value: "{{ .FANTOM_REQUESTS_PER_MINUTE }}"
            - name: INJECTIVE_BASE_URL
              value: {{ .INJECTIVE_BASE_URL }}
            - name: INJECTIVE_REQUESTS_PER_MINUTE
              value: "{{ .INJECTIVE_REQUESTS_PER_MINUTE }}"
            - name: KARURA_BASE_URL
              value: {{ .KARURA_BASE_URL }}
            - name: KARURA_REQUESTS_PER_MINUTE
              value: "{{ .KARURA_REQUESTS_PER_MINUTE }}"
            - name: KLAYTN_BASE_URL
              value: {{ .KLAYTN_BASE_URL }}
            - name: KLAYTN_REQUESTS_PER_MINUTE
              value: "{{ .KLAYTN_REQUESTS_PER_MINUTE }}"
            - name: MOONBEAM_BASE_URL
              value: {{ .MOONBEAM_BASE_URL }}
            - name: MOONBEAM_REQUESTS_PER_MINUTE
              value: "{{ .MOONBEAM_REQUESTS_PER_MINUTE }}"
            - name: OASIS_BASE_URL
              value: {{ .OASIS_BASE_URL }}
            - name: OASIS_REQUESTS_PER_MINUTE
              value: "{{ .OASIS_REQUESTS_PER_MINUTE }}"
            - name: OPTIMISM_BASE_URL
              value: {{ .OPTIMISM_BASE_URL }}
            - name: OPTIMISM_REQUESTS_PER_MINUTE
              value: "{{ .OPTIMISM_REQUESTS_PER_MINUTE }}"
            - name: POLYGON_BASE_URL
              value: {{ .POLYGON_BASE_URL }}
            - name: POLYGON_REQUESTS_PER_MINUTE
              value: "{{ .POLYGON_REQUESTS_PER_MINUTE }}"
            - name: SOLANA_BASE_URL
              value: {{ .SOLANA_BASE_URL }}
            - name: SOLANA_REQUESTS_PER_MINUTE
              value: "{{ .SOLANA_REQUESTS_PER_MINUTE }}"
            - name: SUI_BASE_URL
              value: {{ .SUI_BASE_URL }}
            - name: SUI_REQUESTS_PER_MINUTE
              value: "{{ .SUI_REQUESTS_PER_MINUTE }}"
            - name: TERRA_BASE_URL
              value: {{ .TERRA_BASE_URL }}
            - name: TERRA_REQUESTS_PER_MINUTE
              value: "{{ .TERRA_REQUESTS_PER_MINUTE }}"
            - name: TERRA2_BASE_URL
              value: {{ .TERRA2_BASE_URL }}
            - name: TERRA2_REQUESTS_PER_MINUTE
              value: "{{ .TERRA2_REQUESTS_PER_MINUTE }}"
            - name: XPLA_BASE_URL
              value: {{ .XPLA_BASE_URL }}
            - name: XPLA_REQUESTS_PER_MINUTE
              value: "{{ .XPLA_REQUESTS_PER_MINUTE }}"
            - name: NUM_WORKERS
              value: "100"
            - name: BULK_SIZE
              value: "1000"
            - name: STRATEGY_NAME
              value: "{{ .STRATEGY_NAME }}"
            - name: STRATEGY_TIMESTAMP_AFTER
              value: "{{ .STRATEGY_TIMESTAMP_AFTER }}"
            - name: STRATEGY_TIMESTAMP_BEFORE
              value: "{{ .STRATEGY_TIMESTAMP_BEFORE }}"
          resources:
            limits:
              memory: {{ .RESOURCES_LIMITS_MEMORY }}
              cpu: {{ .RESOURCES_LIMITS_CPU }}
            requests:
              memory: {{ .RESOURCES_REQUESTS_MEMORY }}
              cpu: {{ .RESOURCES_REQUESTS_CPU }}
