version: 2
models:
  - name: silver__liquidity_pool_actions_orca
    tests:
      - dbt_utils.unique_combination_of_columns:
          combination_of_columns:
            - BLOCK_ID
            - TX_ID
            - INDEX
            - INNER_INDEX
          where: block_timestamp::date > current_date - 30
      - compare_model_subset:
          name: silver__liquidity_pool_actions_orca_business_logic_test
          compare_model: ref('testing__liquidity_pool_actions_orca')
          compare_columns: 
            - tx_id
            - program_id
            - action
            - mint
            - amount
            - liquidity_provider
            - liquidity_pool_address
          model_condition: "where tx_id in ('277JGMpfmeFv3LJ1zCpi2JPdmwbwUDKxsz1ZjhxtT7dHgAb8FmKogSdNRkfnyxjmTnkijjWTfa76v6AELV2VkeAv',
          '29P5nj6g5ePUCHZRnEfJhzNWDaCeLeGP2p6D8udbxb2t5wuBXW8hdrzJ1m6ULsGk3PW3MwAvn2aurUck37sc7HDj',
          '3PdQf87gUGqRKrTXWzqpuduUVhe2cCfSFbmDbbJWQg4MwmsQu43esBRz3HQPsGZ98a8ZjtcNsxNDsrxhV1LBWNJn',
          '4yxURFgGKwq1rLCS3HsdZgM4xSe32geqEnbZXaei5xH9tiEF8SmBZxEsnFNEU3DqUoNes5PmSAucjgXex7EaCj6V',
          '5aw1saTnwJAaGLmmCXuGE5Q5UgPdd5C4UZDNgPo5Nt2S8Po7BW2ThyCLBQ1rpWwFtpKQE1qC1rbPgK4ecE1Kwuwf',
          'CyMWi3QBdS7UrCygx6GZbvYDiD8vREbNKxs5FRMeqnShnZ5ASoYWaYqgdU6Vk561khbdaRYoif7WtD8oLKjLqpG')"
    columns:
      - name: BLOCK_TIMESTAMP
        description: "{{ doc('block_timestamp') }}"
        tests:
          - dbt_expectations.expect_row_values_to_have_recent_data:
              datepart: day
              interval: 2
      - name: BLOCK_ID
        description: "{{ doc('block_id') }}"
        tests:
          - not_null
      - name: TX_ID
        description: "{{ doc('tx_id') }}"
        tests:
          - not_null
      - name: SUCCEEDED
        description: "{{ doc('tx_succeeded') }}"
        tests:
          - not_null
      - name: INDEX
        description: "{{ doc('index') }}"
        tests:
          - not_null
      - name: INNER_INDEX
        description: "Position of event within inner instructions"
        tests:
          - not_null
      - name: PROGRAM_ID
        description: "{{ doc('program_id') }}"
        tests: 
          - not_null
      - name: ACTION
        description: "{{ doc('action') }}"
        tests: 
          - not_null
      - name: MINT
        description: "{{ doc('mint') }}"
        tests: 
          - not_null:
              where: block_id > 69393037
      - name: AMOUNT
        description: "{{ doc('amount') }}"
        tests: 
          - not_null
      - name: LIQUIDITY_PROVIDER
        description: "{{ doc('liquidity_provider') }}"
        tests: 
          - not_null
      - name: LIQUIDITY_POOL_ADDRESS
        description: "{{ doc('liquidity_pool_address') }}"
        tests: 
          - not_null
      - name: _INSERTED_TIMESTAMP
        description: "{{ doc('_inserted_timestamp') }}"
        tests: 
          - not_null
      - name: LIQUIDITY_POOL_ACTIONS_ORCA_ID
        description: '{{ doc("pk") }}'   
        tests: 
          - unique
      - name: INSERTED_TIMESTAMP
        description: '{{ doc("inserted_timestamp") }}'   
        tests: 
          - not_null
      - name: MODIFIED_TIMESTAMP
        description: '{{ doc("modified_timestamp") }}' 
        tests: 
          - not_null
      - name: _INVOCATION_ID
        description: '{{ doc("_invocation_id") }}' 
        tests: 
          - not_null: 
              name: test_silver__not_null_liquidity_pool_actions_orca__invocation_id

