version: 2
models:
  - name: silver__staking_lp_actions_labeled_2
    description: Table for staking & LP actions that contains additional information about the validator.
    recent_date_filter: &recent_date_filter
      config:
        where: _inserted_timestamp >= current_date - 7
    data_tests:
      - compare_model_subset:
          name: silver__staking_lp_actions_labeled_2_business_logic_test
          compare_model: ref('testing__staking_lp_actions_labeled_2')
          compare_columns: 
            - stake_account
            - tx_id
            - index
            - inner_index
            - event_type
            - stake_authority
            - withdraw_authority
            - stake_active
            - vote_account
            - validator_name
          model_condition: "where 
            (
              stake_account in ('HvqBJ9qJtbFWuTzMncqh7hgeUtHeh8zDsCPrrSPJbRvi',
                '35bXuoR23q2Rwn2g6o2kUThJRokxEVsbuYCyNt4Mr43H',
                'HhpVdoyt1w2pe2wT3AeYti7PF8o1tZr4t3VDQ8QS2C9L',
                'H6M8LzYL6qKxqVZDQYAmCJfY6KF3MwqNVNijYmHQmLK7')
              or
              tx_id in ('WHHEQJ2hrUEnq429azYapvAFS3wccDd262BEVzPgp1JhFzwFBDzmW9MPfLXRLeTHpfj97nXx8k9sQTdUZ4fqJQt',
                '3WnXfFQtHeRrutF8BbgpUirBRBR5CjNNqKMdSv3bomRBHDTbn5gn3WQ5GHBhgZNH6KnxCdEwu76GL33axi3vMFWJ',
                '3jUYmgu4ASwGTPtkpDeLgSX3wY1DTLPhXNHf6xj4wTy881keCUKz2TBMEza3THnmKRL6imFM32sp6m8g4nX8v7Jd',
                '51UcpfRBPjzDa8BNuWtmd5RaMWYG2GoNpsvfFE2zr1VyTxqr62vvRnuwBGUunx3D4uxCpqgGJ5E9YssMoYw3F4Wz',
                '2QEoYQN7sV9cyqXQksLikT65WJbvG9nePnAnhRgCXV35CkLRWroGcje9XQyypegdrsHfoGqEZLLKBpiCk82dXGh7',
                '63FGsSQ843DMkdVeQauNkrij3NYSTJHUBmF3VoE8qFCnkPpivSjrBk48rFtvgzvMrzDv88YiSzXV21JBp4XK3AwW',
                '3DwTtQRT8hKkcGgpT8wEuepwgRDZ8TAs1yD6kgPc6egwJZJ1H8Sw8VgXgTC3BC6NE5DpbsrMdtwcE8b81gt6oVcC',
                '3z6h9aooG6cPwQCAPur5HTT2vMxC3gGDzWCk3mc5AXkWRJ9yxzANXYBuYL68KwUa4zehgHFALGovGiXargMSzTEs',
                'apikDqVczz6jwvqxABJ81YHMXRaHSj4WAGyKTUQzvnV547oKDFgCVpa87oay8FqW9FrKJtedYyqXpi6uzkZGd3H',
                '3URQbmJCcSVLeLDJW9Dfkit8Y3jGxRofzk7GCXhSE7Aum1MgpcZzkSJBprX5SzGXDRaJA56ks9rFCZFZ7foNqSip',
                '6774K5Q6nYMBiX1bjwr14ScZHwJddcEWvx9NwRspN8yqHVvRkdgGhGfhd6zDJKQQCW3PbqqkbmETsFTq6ywBr1eV')
            )"
      - dbt_utils.unique_combination_of_columns:
          combination_of_columns:
            - BLOCK_ID
            - TX_ID
            - INDEX
            - INNER_INDEX
            - EVENT_TYPE
          where: >
            block_timestamp::DATE > current_date - 30
    columns:
      - name: BLOCK_TIMESTAMP
        description: "{{ doc('block_timestamp') }}"
        data_tests:
          - not_null: *recent_date_filter
      - name: BLOCK_ID
        description: "{{ doc('block_id') }}"
        data_tests:
          - not_null: *recent_date_filter
      - name: TX_ID
        description: "{{ doc('tx_id') }}"
        data_tests:
          - not_null: *recent_date_filter
      - name: INDEX
        description: "{{ doc('index') }}"
        data_tests:
          - not_null: *recent_date_filter
      - name: INNER_INDEX
        description: "{{ doc('inner_index') }}"
      - name: SUCCEEDED
        description: "{{ doc('tx_succeeded') }}"
        data_tests:
          - not_null: *recent_date_filter
      - name: EVENT_TYPE
        description: "{{ doc('event_type') }}"
        data_tests:
          - not_null: *recent_date_filter
      - name: SIGNERS
        description: List of accounts that signed the transaction
        data_tests:
          - not_null: *recent_date_filter
      - name: STAKE_AUTHORITY
        description: "{{ doc('stake_authority') }}"
      - name: WITHDRAW_AUTHORITY
        description: "{{ doc('withdraw_authority') }}"
      - name: STAKE_ACCOUNT
        description: "{{ doc('stake_account') }}"
        data_tests:
          - not_null: *recent_date_filter
      - name: PARENT_STAKE_ACCOUNT
        description: The parent stake account of the stake account.
      - name: STAKE_ACTIVE
        description: Whether the stake account is active.
      - name: WITHDRAW_AMOUNT
        description: The amount of SOL being withdrawn from the stake account.
      - name: WITHDRAW_DESTINATION
        description: The destination wallet address of the withdrawn SOL.
      - name: MOVE_AMOUNT
        description: The amount of SOL being moved from the stake account.
      - name: MOVE_DESTINATION
        description: The destination wallet address of the moved SOL.
      - name: PRE_TX_STAKED_BALANCE
        description: The amount of Solana belonging to the stake account before the transaction.
      - name: POST_TX_STAKED_BALANCE
        description: The amount of Solana belonging to the stake account after the transaction.
      - name: VOTE_ACCOUNT
        description: A voting account belonging to the validator. 
      - name: NODE_PUBKEY
        description: A unique key belonging to the validator node. 
      - name: VALIDATOR_RANK
        description: The rank of the validator by amount of delegated SOL. 
      - name: COMMISSION
        description: The percentage of staked earnings given to the validator.
      - name: VALIDATOR_NAME
        description: The name of the validator.
      - name: _INSERTED_TIMESTAMP
        description: "{{ doc('_inserted_timestamp') }}"
        data_tests: 
          - not_null
      - name: STAKING_LP_ACTIONS_LABELED_2_ID
        description: '{{ doc("pk") }}'   
        data_tests: 
          - unique: *recent_date_filter
      - name: INSERTED_TIMESTAMP
        description: '{{ doc("inserted_timestamp") }}'   
        data_tests: 
          - not_null: *recent_date_filter
      - name: MODIFIED_TIMESTAMP
        description: '{{ doc("modified_timestamp") }}' 
        data_tests: 
          - not_null: *recent_date_filter
      - name: _INVOCATION_ID
        description: '{{ doc("_invocation_id") }}' 
        data_tests: 
          - not_null: 
              name: test_silver__not_null_staking_lp_actions_labeled_2_invocation_id
              <<: *recent_date_filter
