mirror of
https://github.com/FlipsideCrypto/solana-models.git
synced 2026-02-06 09:22:01 +00:00
An 2663/orca lp actions (#249)
* initial models * descriptions for liquidity pool columns * WIP * get mints that occur during swaps * correct description tag * update ymls * correct model references * update yml * update model references and column names * update incremental logic * update yml definitions * revise unique col combo * wip * remove null amounts * additional filter * add index+inner_index to unique key * create final joined table * set inner_index to -1 instead of null * inner_index refactoring * additional tests * exclude models from incremental
This commit is contained in:
parent
3253c2dada
commit
4bf749bcb7
2
.github/workflows/dbt_run_incremental.yml
vendored
2
.github/workflows/dbt_run_incremental.yml
vendored
@ -44,6 +44,6 @@ jobs:
|
||||
dbt run-operation run_sp_refresh_external_tables_full
|
||||
dbt run -s models/silver/silver__transactions.sql models/silver/silver__blocks.sql models/silver/silver__votes.sql models/silver/silver___inner_instructions.sql models/silver/silver___instructions.sql models/silver/silver__events.sql models/silver/silver___all_undecoded_instructions_data.sql
|
||||
dbt run-operation run_sp_refresh_external_tables_full
|
||||
dbt run -s ./models --exclude models/core models/silver/silver__transactions.sql models/silver/silver__blocks.sql models/silver/silver__votes.sql models/silver/silver___inner_instructions.sql models/silver/silver___instructions.sql models/silver/silver__events.sql models/silver/silver___all_undecoded_instructions_data.sql tag:share models/streamline models/silver/silver__daily_signers.sql models/silver/silver__signers.sql
|
||||
dbt run -s ./models --exclude models/core models/silver/silver__transactions.sql models/silver/silver__blocks.sql models/silver/silver__votes.sql models/silver/silver___inner_instructions.sql models/silver/silver___instructions.sql models/silver/silver__events.sql models/silver/silver___all_undecoded_instructions_data.sql tag:share models/streamline models/silver/silver__daily_signers.sql models/silver/silver__signers.sql models/silver/liquidity_pool
|
||||
dbt run --var '{"UPDATE_SNOWFLAKE_TAGS":True}' -s ./models/core --exclude models/core/core__ez_signers.sql
|
||||
|
||||
|
||||
20
data/testing__liquidity_pool_actions_orca.csv
Normal file
20
data/testing__liquidity_pool_actions_orca.csv
Normal file
@ -0,0 +1,20 @@
|
||||
tx_id, program_id, action, mint, amount, liquidity_provider, liquidity_pool_address
|
||||
277JGMpfmeFv3LJ1zCpi2JPdmwbwUDKxsz1ZjhxtT7dHgAb8FmKogSdNRkfnyxjmTnkijjWTfa76v6AELV2VkeAv,whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc,burnChecked,4SGcZAzbig2KKJrsrj9WFan14okMd436MpvHmm8FybRH,1,ct4kwUfvXrpeUpiAUsvuDydPLwQYPvbMAToNsDA4GkN,HJPjoWUrhoZzkNfRpHuieeFk9WcZWjwy6PBjZ81ngndJ
|
||||
277JGMpfmeFv3LJ1zCpi2JPdmwbwUDKxsz1ZjhxtT7dHgAb8FmKogSdNRkfnyxjmTnkijjWTfa76v6AELV2VkeAv,whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc,withdraw,So11111111111111111111111111111111111111112,0.002376752,ct4kwUfvXrpeUpiAUsvuDydPLwQYPvbMAToNsDA4GkN,HJPjoWUrhoZzkNfRpHuieeFk9WcZWjwy6PBjZ81ngndJ
|
||||
277JGMpfmeFv3LJ1zCpi2JPdmwbwUDKxsz1ZjhxtT7dHgAb8FmKogSdNRkfnyxjmTnkijjWTfa76v6AELV2VkeAv,whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc,withdraw,So11111111111111111111111111111111111111112,0.200031025,ct4kwUfvXrpeUpiAUsvuDydPLwQYPvbMAToNsDA4GkN,HJPjoWUrhoZzkNfRpHuieeFk9WcZWjwy6PBjZ81ngndJ
|
||||
277JGMpfmeFv3LJ1zCpi2JPdmwbwUDKxsz1ZjhxtT7dHgAb8FmKogSdNRkfnyxjmTnkijjWTfa76v6AELV2VkeAv,whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc,withdraw,EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v,14.468021,ct4kwUfvXrpeUpiAUsvuDydPLwQYPvbMAToNsDA4GkN,HJPjoWUrhoZzkNfRpHuieeFk9WcZWjwy6PBjZ81ngndJ
|
||||
277JGMpfmeFv3LJ1zCpi2JPdmwbwUDKxsz1ZjhxtT7dHgAb8FmKogSdNRkfnyxjmTnkijjWTfa76v6AELV2VkeAv,whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc,withdraw,EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v,0.079061,ct4kwUfvXrpeUpiAUsvuDydPLwQYPvbMAToNsDA4GkN,HJPjoWUrhoZzkNfRpHuieeFk9WcZWjwy6PBjZ81ngndJ
|
||||
29P5nj6g5ePUCHZRnEfJhzNWDaCeLeGP2p6D8udbxb2t5wuBXW8hdrzJ1m6ULsGk3PW3MwAvn2aurUck37sc7HDj,whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc,deposit,So11111111111111111111111111111111111111112,17.423980317,25FxT68TgdtctQgzTX9JcN6bijYRc227QmgFFDQ5HDBT,HJPjoWUrhoZzkNfRpHuieeFk9WcZWjwy6PBjZ81ngndJ
|
||||
29P5nj6g5ePUCHZRnEfJhzNWDaCeLeGP2p6D8udbxb2t5wuBXW8hdrzJ1m6ULsGk3PW3MwAvn2aurUck37sc7HDj,whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc,deposit,EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v,10.053721,25FxT68TgdtctQgzTX9JcN6bijYRc227QmgFFDQ5HDBT,HJPjoWUrhoZzkNfRpHuieeFk9WcZWjwy6PBjZ81ngndJ
|
||||
29P5nj6g5ePUCHZRnEfJhzNWDaCeLeGP2p6D8udbxb2t5wuBXW8hdrzJ1m6ULsGk3PW3MwAvn2aurUck37sc7HDj,whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc,mintTo,8Bd5ACK82vV2UpbfcwWyBTCTfAqQ1qCZm7U1pZEzrtCs,1,25FxT68TgdtctQgzTX9JcN6bijYRc227QmgFFDQ5HDBT,HJPjoWUrhoZzkNfRpHuieeFk9WcZWjwy6PBjZ81ngndJ
|
||||
3PdQf87gUGqRKrTXWzqpuduUVhe2cCfSFbmDbbJWQg4MwmsQu43esBRz3HQPsGZ98a8ZjtcNsxNDsrxhV1LBWNJn,9W959DqEETiGZocYWCQPaJ6sBmUzgfxXfqGeTEdp3aQP,deposit,EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v,25.481729,cZKTvY3efhSRJPcvDcUCZb7P8RbT9JDK8E3xFvKWpiC,87E4KtN7F4LivKhjqXaoQAvS3a8HnM4DnMUrbMrkVvXY
|
||||
3PdQf87gUGqRKrTXWzqpuduUVhe2cCfSFbmDbbJWQg4MwmsQu43esBRz3HQPsGZ98a8ZjtcNsxNDsrxhV1LBWNJn,9W959DqEETiGZocYWCQPaJ6sBmUzgfxXfqGeTEdp3aQP,deposit,AFbX8oGjGpmVFywbVouvhQSRmiW2aR1mohfahi4Y2AdB,5.200293301,cZKTvY3efhSRJPcvDcUCZb7P8RbT9JDK8E3xFvKWpiC,87E4KtN7F4LivKhjqXaoQAvS3a8HnM4DnMUrbMrkVvXY
|
||||
3PdQf87gUGqRKrTXWzqpuduUVhe2cCfSFbmDbbJWQg4MwmsQu43esBRz3HQPsGZ98a8ZjtcNsxNDsrxhV1LBWNJn,9W959DqEETiGZocYWCQPaJ6sBmUzgfxXfqGeTEdp3aQP,mintTo,E6FUnQHGHJVJg7oExVr5Moeaj1QpdpZQF5odYjHXWPZb,25.009461,cZKTvY3efhSRJPcvDcUCZb7P8RbT9JDK8E3xFvKWpiC,87E4KtN7F4LivKhjqXaoQAvS3a8HnM4DnMUrbMrkVvXY
|
||||
4yxURFgGKwq1rLCS3HsdZgM4xSe32geqEnbZXaei5xH9tiEF8SmBZxEsnFNEU3DqUoNes5PmSAucjgXex7EaCj6V,whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc,withdraw,So11111111111111111111111111111111111111112,0.185013166,FWnsiXcxjdBXQ3tEfEQQSB5utPW32Mcib59xcqvFSomJ,HJPjoWUrhoZzkNfRpHuieeFk9WcZWjwy6PBjZ81ngndJ
|
||||
4yxURFgGKwq1rLCS3HsdZgM4xSe32geqEnbZXaei5xH9tiEF8SmBZxEsnFNEU3DqUoNes5PmSAucjgXex7EaCj6V,whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc,withdraw,EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v,2.641745,FWnsiXcxjdBXQ3tEfEQQSB5utPW32Mcib59xcqvFSomJ,HJPjoWUrhoZzkNfRpHuieeFk9WcZWjwy6PBjZ81ngndJ
|
||||
5aw1saTnwJAaGLmmCXuGE5Q5UgPdd5C4UZDNgPo5Nt2S8Po7BW2ThyCLBQ1rpWwFtpKQE1qC1rbPgK4ecE1Kwuwf,DjVE6JNiYqPL2QXyCUUh8rNjHrbz9hXHNYt99MQ59qw1,burn,6SfhBAmuaGf9p3WAxeHJYCWMABnYUMrdzNdK5Stvvj4k,6.838449139,JAGGoZVPJ3q8D9yFV3kdGsUUCZgpKddTehwpSgcEUgoK,4kMBJ8x85BgyYKi4t7ZSCh4gHK8U5QWjARzGuMCPiaeu
|
||||
5aw1saTnwJAaGLmmCXuGE5Q5UgPdd5C4UZDNgPo5Nt2S8Po7BW2ThyCLBQ1rpWwFtpKQE1qC1rbPgK4ecE1Kwuwf,DjVE6JNiYqPL2QXyCUUh8rNjHrbz9hXHNYt99MQ59qw1,withdraw,8PMHT4swUMtBzgHnh5U564N5sjPSiUz2cjEQzFnnP1Fo,95.337533191,JAGGoZVPJ3q8D9yFV3kdGsUUCZgpKddTehwpSgcEUgoK,4kMBJ8x85BgyYKi4t7ZSCh4gHK8U5QWjARzGuMCPiaeu
|
||||
5aw1saTnwJAaGLmmCXuGE5Q5UgPdd5C4UZDNgPo5Nt2S8Po7BW2ThyCLBQ1rpWwFtpKQE1qC1rbPgK4ecE1Kwuwf,DjVE6JNiYqPL2QXyCUUh8rNjHrbz9hXHNYt99MQ59qw1,withdraw,So11111111111111111111111111111111111111112,0.103413378,JAGGoZVPJ3q8D9yFV3kdGsUUCZgpKddTehwpSgcEUgoK,4kMBJ8x85BgyYKi4t7ZSCh4gHK8U5QWjARzGuMCPiaeu
|
||||
CyMWi3QBdS7UrCygx6GZbvYDiD8vREbNKxs5FRMeqnShnZ5ASoYWaYqgdU6Vk561khbdaRYoif7WtD8oLKjLqpG,9W959DqEETiGZocYWCQPaJ6sBmUzgfxXfqGeTEdp3aQP,burn,E6FUnQHGHJVJg7oExVr5Moeaj1QpdpZQF5odYjHXWPZb,30.212857,4rLUZVgaC9AHea9gV22Fp8h9U62HqGLUrRJkD19r8Bsq,87E4KtN7F4LivKhjqXaoQAvS3a8HnM4DnMUrbMrkVvXY
|
||||
CyMWi3QBdS7UrCygx6GZbvYDiD8vREbNKxs5FRMeqnShnZ5ASoYWaYqgdU6Vk561khbdaRYoif7WtD8oLKjLqpG,9W959DqEETiGZocYWCQPaJ6sBmUzgfxXfqGeTEdp3aQP,withdraw,EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v,13.957577,4rLUZVgaC9AHea9gV22Fp8h9U62HqGLUrRJkD19r8Bsq,87E4KtN7F4LivKhjqXaoQAvS3a8HnM4DnMUrbMrkVvXY
|
||||
CyMWi3QBdS7UrCygx6GZbvYDiD8vREbNKxs5FRMeqnShnZ5ASoYWaYqgdU6Vk561khbdaRYoif7WtD8oLKjLqpG,9W959DqEETiGZocYWCQPaJ6sBmUzgfxXfqGeTEdp3aQP,withdraw,AFbX8oGjGpmVFywbVouvhQSRmiW2aR1mohfahi4Y2AdB,15.802547415,4rLUZVgaC9AHea9gV22Fp8h9U62HqGLUrRJkD19r8Bsq,87E4KtN7F4LivKhjqXaoQAvS3a8HnM4DnMUrbMrkVvXY
|
||||
|
5
models/descriptions/action.md
Normal file
5
models/descriptions/action.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs action %}
|
||||
|
||||
The type of event action being performed
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/liquidity_pool_address.md
Normal file
5
models/descriptions/liquidity_pool_address.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs liquidity_pool_address %}
|
||||
|
||||
Address of the liquidity pool
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/liquidity_provider.md
Normal file
5
models/descriptions/liquidity_provider.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs liquidity_provider %}
|
||||
|
||||
Wallet address initiating the deposit/withdraw or mint/burn
|
||||
|
||||
{% enddocs %}
|
||||
@ -0,0 +1,95 @@
|
||||
{{ config(
|
||||
materialized = 'incremental',
|
||||
unique_key = ["block_id","tx_id","index","inner_index"],
|
||||
incremental_predicates = ['DBT_INTERNAL_DEST.block_timestamp::date >= LEAST(current_date-7,(select min(block_timestamp)::date from ' ~ generate_tmp_view_name(this) ~ '))'],
|
||||
cluster_by = ['block_timestamp::DATE','_inserted_timestamp::DATE']
|
||||
) }}
|
||||
|
||||
WITH base_burn_actions AS (
|
||||
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
{{ ref('silver__burn_actions') }}
|
||||
|
||||
{% if is_incremental() %}
|
||||
where _inserted_timestamp >= (
|
||||
SELECT
|
||||
MAX(_inserted_timestamp)
|
||||
FROM
|
||||
{{ this }}
|
||||
)
|
||||
{% else %}
|
||||
where block_timestamp :: DATE >= '2021-02-14'
|
||||
{% endif %}
|
||||
),
|
||||
base_whirlpool_events AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
{{ ref('silver__liquidity_pool_events_orca') }}
|
||||
WHERE
|
||||
program_id IN (
|
||||
'9W959DqEETiGZocYWCQPaJ6sBmUzgfxXfqGeTEdp3aQP',
|
||||
'DjVE6JNiYqPL2QXyCUUh8rNjHrbz9hXHNYt99MQ59qw1'
|
||||
)
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= (
|
||||
SELECT
|
||||
MAX(_inserted_timestamp)
|
||||
FROM
|
||||
{{ this }}
|
||||
)
|
||||
{% else %}
|
||||
AND block_timestamp :: DATE >= '2021-02-14'
|
||||
{% endif %}
|
||||
),
|
||||
orca_burn_actions AS (
|
||||
SELECT
|
||||
b.*,
|
||||
COALESCE(
|
||||
e1.liquidity_provider,
|
||||
e2.liquidity_provider
|
||||
) AS liquidity_provider
|
||||
FROM
|
||||
base_burn_actions b
|
||||
LEFT JOIN base_whirlpool_events e1
|
||||
ON b.tx_id = e1.tx_id
|
||||
AND b.index = e1.index
|
||||
AND e1.inner_index = -1
|
||||
LEFT JOIN base_whirlpool_events e2
|
||||
ON b.tx_id = e2.tx_id
|
||||
AND b.index = e2.index
|
||||
AND e2.inner_index <> -1
|
||||
AND b.inner_index BETWEEN e2.lp_program_inner_index_start
|
||||
AND e2.lp_program_inner_index_end
|
||||
WHERE
|
||||
b.event_type = 'burn'
|
||||
AND(
|
||||
e1.tx_id IS NOT NULL
|
||||
OR e2.tx_id IS NOT NULL
|
||||
)
|
||||
)
|
||||
SELECT
|
||||
A.block_id,
|
||||
A.block_timestamp,
|
||||
A.tx_id,
|
||||
A.succeeded,
|
||||
A.index,
|
||||
A.inner_index,
|
||||
b.owner AS program_id,
|
||||
A.event_type AS action,
|
||||
A.mint,
|
||||
COALESCE(A.burn_amount / pow(10, m.decimals), A.burn_amount) AS amount,
|
||||
A.liquidity_provider,
|
||||
b.liquidity_pool AS liquidity_pool_address,
|
||||
A._inserted_timestamp
|
||||
FROM
|
||||
orca_burn_actions A
|
||||
INNER JOIN {{ ref('silver__initialization_pools_orca') }}
|
||||
b
|
||||
ON A.mint = b.pool_token
|
||||
LEFT JOIN {{ ref('silver__token_metadata') }}
|
||||
m
|
||||
ON A.mint = m.token_address
|
||||
@ -0,0 +1,66 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: silver__burns_orca_non_whirlpool
|
||||
tests:
|
||||
- dbt_utils.unique_combination_of_columns:
|
||||
combination_of_columns:
|
||||
- BLOCK_ID
|
||||
- TX_ID
|
||||
- INDEX
|
||||
- INNER_INDEX
|
||||
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
|
||||
- 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
|
||||
|
||||
@ -0,0 +1,59 @@
|
||||
{{ config(
|
||||
materialized = 'incremental',
|
||||
unique_key = ["block_id","tx_id","index","inner_index"],
|
||||
incremental_predicates = ['DBT_INTERNAL_DEST.block_timestamp::date >= LEAST(current_date-7,(select min(block_timestamp)::date from ' ~ generate_tmp_view_name(this) ~ '))'],
|
||||
cluster_by = ['block_timestamp::DATE','_inserted_timestamp::DATE']
|
||||
) }}
|
||||
-- Get whirlpool LP burns by finding existing whirlpool mints
|
||||
WITH base_burn_actions AS (
|
||||
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
{{ ref('silver__burn_actions') }}
|
||||
{% if is_incremental() %}
|
||||
where _inserted_timestamp >= (
|
||||
SELECT
|
||||
MAX(_inserted_timestamp)
|
||||
FROM
|
||||
{{ this }}
|
||||
)
|
||||
{% else %}
|
||||
where block_timestamp :: DATE >= '2022-03-10'
|
||||
{% endif %}
|
||||
),
|
||||
base_whirlpool_mints AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
{{ ref('silver__mints_orca_whirlpool') }}
|
||||
{% if is_incremental() %}
|
||||
where _inserted_timestamp >= (
|
||||
SELECT
|
||||
MAX(_inserted_timestamp)
|
||||
FROM
|
||||
{{ this }}
|
||||
)
|
||||
{% else %}
|
||||
where block_timestamp :: DATE >= '2022-03-10'
|
||||
{% endif %}
|
||||
)
|
||||
SELECT
|
||||
b.block_id,
|
||||
b.block_timestamp,
|
||||
b.tx_id,
|
||||
b.succeeded,
|
||||
b.index,
|
||||
COALESCE(b.inner_index, -1) AS inner_index,
|
||||
m.program_id,
|
||||
b.event_type AS action,
|
||||
b.mint,
|
||||
b.burn_amount AS amount,
|
||||
b.burn_authority AS liquidity_provider,
|
||||
m.liquidity_pool_address,
|
||||
b._inserted_timestamp
|
||||
FROM
|
||||
base_burn_actions b
|
||||
INNER JOIN base_whirlpool_mints m
|
||||
ON b.mint = m.mint
|
||||
qualify(row_number() over (partition by b.block_id, b.tx_id, b.index,b.inner_index order by b.index,b.inner_index)) = 1
|
||||
@ -0,0 +1,66 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: silver__burns_orca_whirlpool
|
||||
tests:
|
||||
- dbt_utils.unique_combination_of_columns:
|
||||
combination_of_columns:
|
||||
- BLOCK_ID
|
||||
- TX_ID
|
||||
- INDEX
|
||||
- INNER_INDEX
|
||||
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
|
||||
- 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
|
||||
|
||||
@ -0,0 +1,38 @@
|
||||
{{ config(
|
||||
materialized = 'view'
|
||||
) }}
|
||||
|
||||
with base as (
|
||||
select
|
||||
*
|
||||
from
|
||||
{{ ref('silver__burns_orca_non_whirlpool') }}
|
||||
union
|
||||
select
|
||||
*
|
||||
from
|
||||
{{ ref('silver__burns_orca_whirlpool') }}
|
||||
union
|
||||
select
|
||||
*
|
||||
from
|
||||
{{ ref('silver__mints_orca_non_whirlpool') }}
|
||||
union
|
||||
select
|
||||
*
|
||||
from
|
||||
{{ ref('silver__mints_orca_whirlpool') }}
|
||||
union
|
||||
select
|
||||
*
|
||||
from
|
||||
{{ ref('silver__pool_transfers_orca_non_whirlpool') }}
|
||||
union
|
||||
select
|
||||
*
|
||||
from
|
||||
{{ ref('silver__pool_transfers_orca_whirlpool') }}
|
||||
)
|
||||
select
|
||||
*
|
||||
from base
|
||||
@ -0,0 +1,84 @@
|
||||
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
|
||||
- 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
|
||||
|
||||
@ -0,0 +1,231 @@
|
||||
{{ config(
|
||||
materialized = 'incremental',
|
||||
unique_key = ["block_id","tx_id","index","inner_index"],
|
||||
incremental_predicates = ['DBT_INTERNAL_DEST.block_timestamp::date >= LEAST(current_date-7,(select min(block_timestamp)::date from ' ~ generate_tmp_view_name(this) ~ '))'],
|
||||
cluster_by = ['block_timestamp::DATE','_inserted_timestamp::DATE']
|
||||
) }}
|
||||
|
||||
WITH base_events AS(
|
||||
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
{{ ref('silver__events') }}
|
||||
WHERE
|
||||
(
|
||||
program_id IN (
|
||||
'whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc',
|
||||
'9W959DqEETiGZocYWCQPaJ6sBmUzgfxXfqGeTEdp3aQP',
|
||||
'DjVE6JNiYqPL2QXyCUUh8rNjHrbz9hXHNYt99MQ59qw1'
|
||||
)
|
||||
OR ARRAY_CONTAINS(
|
||||
'9W959DqEETiGZocYWCQPaJ6sBmUzgfxXfqGeTEdp3aQP' :: variant,
|
||||
inner_instruction_program_ids
|
||||
)
|
||||
OR ARRAY_CONTAINS(
|
||||
'whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc' :: variant,
|
||||
inner_instruction_program_ids
|
||||
)
|
||||
OR ARRAY_CONTAINS(
|
||||
'DjVE6JNiYqPL2QXyCUUh8rNjHrbz9hXHNYt99MQ59qw1' :: variant,
|
||||
inner_instruction_program_ids
|
||||
)
|
||||
)
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= (
|
||||
SELECT
|
||||
MAX(_inserted_timestamp)
|
||||
FROM
|
||||
{{ this }}
|
||||
)
|
||||
|
||||
{% else %}
|
||||
AND block_id > 65303193 -- first appearance of Orca program id
|
||||
{% endif %}
|
||||
),
|
||||
lp_events AS (
|
||||
SELECT
|
||||
e.*,
|
||||
signers [0] :: STRING AS liquidity_provider,
|
||||
silver.udf_get_jupv4_inner_programs(
|
||||
inner_instruction :instructions
|
||||
) AS inner_programs
|
||||
FROM
|
||||
base_events e
|
||||
),
|
||||
lp_events_w_inner_program_ids AS (
|
||||
SELECT
|
||||
lp_events.*,
|
||||
i.value :program_id :: STRING AS inner_lp_program_id,
|
||||
i.value :inner_index :: INT AS lp_program_inner_index_start,
|
||||
COALESCE(LEAD(lp_program_inner_index_start) over (PARTITION BY tx_id, lp_events.index
|
||||
ORDER BY
|
||||
lp_program_inner_index_start) -1, 999999) AS lp_program_inner_index_end
|
||||
FROM
|
||||
lp_events,
|
||||
TABLE(FLATTEN(inner_programs)) i),
|
||||
|
||||
outer_withdraws_and_deposits AS (
|
||||
SELECT
|
||||
block_timestamp,
|
||||
block_id,
|
||||
tx_id,
|
||||
succeeded,
|
||||
INDEX,
|
||||
-1 as inner_index,
|
||||
liquidity_provider,
|
||||
program_id,
|
||||
NULL AS lp_program_inner_index_start,
|
||||
NULL AS lp_program_inner_index_end,
|
||||
instruction AS event_instructions,
|
||||
ARRAY_SIZE(
|
||||
instruction :accounts
|
||||
) AS num_accts,
|
||||
_inserted_timestamp
|
||||
FROM
|
||||
lp_events
|
||||
WHERE
|
||||
(
|
||||
program_id IN (
|
||||
'DjVE6JNiYqPL2QXyCUUh8rNjHrbz9hXHNYt99MQ59qw1',
|
||||
'9W959DqEETiGZocYWCQPaJ6sBmUzgfxXfqGeTEdp3aQP'
|
||||
)
|
||||
OR (
|
||||
program_id = 'whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc'
|
||||
AND instruction :accounts [1] = 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA'
|
||||
)
|
||||
OR (
|
||||
program_id = 'whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc'
|
||||
AND ARRAY_SIZE(
|
||||
instruction :accounts
|
||||
) = 9
|
||||
)
|
||||
)
|
||||
),
|
||||
inner_withdraws_and_deposits AS (
|
||||
SELECT
|
||||
A.block_timestamp,
|
||||
A.block_id,
|
||||
A.tx_id,
|
||||
A.succeeded,
|
||||
A.index,
|
||||
ii.index AS inner_index,
|
||||
A.liquidity_provider,
|
||||
A.inner_lp_program_id AS program_id,
|
||||
A.lp_program_inner_index_start,
|
||||
A.lp_program_inner_index_end,
|
||||
ii.value AS event_instructions,
|
||||
ARRAY_SIZE(
|
||||
ii.value :accounts
|
||||
) AS num_accts,
|
||||
A._inserted_timestamp
|
||||
FROM
|
||||
lp_events_w_inner_program_ids A
|
||||
LEFT JOIN TABLE(FLATTEN(inner_instruction :instructions)) ii
|
||||
ON A.lp_program_inner_index_start = ii.index
|
||||
WHERE
|
||||
(
|
||||
A.inner_lp_program_id IN (
|
||||
'DjVE6JNiYqPL2QXyCUUh8rNjHrbz9hXHNYt99MQ59qw1',
|
||||
'9W959DqEETiGZocYWCQPaJ6sBmUzgfxXfqGeTEdp3aQP'
|
||||
)
|
||||
OR (
|
||||
A.inner_lp_program_id = 'whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc'
|
||||
AND ii.value :accounts [1] = 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA'
|
||||
AND ARRAY_SIZE(
|
||||
ii.value :accounts
|
||||
) > 10
|
||||
)
|
||||
)
|
||||
),
|
||||
combined AS(
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
outer_withdraws_and_deposits
|
||||
UNION
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
inner_withdraws_and_deposits
|
||||
),
|
||||
lp_events_with_swaps_removed AS (
|
||||
SELECT
|
||||
C.*
|
||||
FROM
|
||||
combined C
|
||||
LEFT JOIN {{ ref('silver__initialization_pools_orca') }}
|
||||
p1
|
||||
ON (
|
||||
event_instructions :accounts [6] :: STRING = p1.token_a_account
|
||||
OR event_instructions :accounts [6] :: STRING = p1.token_b_account
|
||||
)
|
||||
WHERE
|
||||
C.program_id = 'whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc'
|
||||
OR (
|
||||
C.program_id IN (
|
||||
'DjVE6JNiYqPL2QXyCUUh8rNjHrbz9hXHNYt99MQ59qw1',
|
||||
'9W959DqEETiGZocYWCQPaJ6sBmUzgfxXfqGeTEdp3aQP'
|
||||
)
|
||||
AND num_accts = 9
|
||||
)
|
||||
OR(
|
||||
C.program_id IN (
|
||||
'DjVE6JNiYqPL2QXyCUUh8rNjHrbz9hXHNYt99MQ59qw1',
|
||||
'9W959DqEETiGZocYWCQPaJ6sBmUzgfxXfqGeTEdp3aQP'
|
||||
)
|
||||
AND num_accts = 10
|
||||
AND p1.tx_id IS NOT NULL
|
||||
)
|
||||
OR(
|
||||
C.program_id IN (
|
||||
'DjVE6JNiYqPL2QXyCUUh8rNjHrbz9hXHNYt99MQ59qw1',
|
||||
'9W959DqEETiGZocYWCQPaJ6sBmUzgfxXfqGeTEdp3aQP'
|
||||
)
|
||||
AND num_accts = 11
|
||||
AND p1.tx_id IS NOT NULL
|
||||
)
|
||||
)
|
||||
SELECT
|
||||
A.*,
|
||||
CASE
|
||||
WHEN program_id = 'whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc'
|
||||
AND num_accts = 9 THEN 'whirlpool_fee_withdraw'
|
||||
WHEN program_id = 'whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc'
|
||||
AND num_accts > 9 THEN 'whirlpool_unknown'
|
||||
WHEN num_accts = 9
|
||||
AND A.program_id IN (
|
||||
'DjVE6JNiYqPL2QXyCUUh8rNjHrbz9hXHNYt99MQ59qw1',
|
||||
'9W959DqEETiGZocYWCQPaJ6sBmUzgfxXfqGeTEdp3aQP'
|
||||
) THEN 'deposit'
|
||||
WHEN num_accts = 11
|
||||
AND A.program_id IN (
|
||||
'DjVE6JNiYqPL2QXyCUUh8rNjHrbz9hXHNYt99MQ59qw1',
|
||||
'9W959DqEETiGZocYWCQPaJ6sBmUzgfxXfqGeTEdp3aQP'
|
||||
) THEN 'withdraw'
|
||||
WHEN num_accts = 10
|
||||
AND A.program_id IN (
|
||||
'DjVE6JNiYqPL2QXyCUUh8rNjHrbz9hXHNYt99MQ59qw1',
|
||||
'9W959DqEETiGZocYWCQPaJ6sBmUzgfxXfqGeTEdp3aQP'
|
||||
)
|
||||
AND p2.pool_token IS NOT NULL THEN 'deposit'
|
||||
WHEN num_accts = 10
|
||||
AND A.program_id IN (
|
||||
'DjVE6JNiYqPL2QXyCUUh8rNjHrbz9hXHNYt99MQ59qw1',
|
||||
'9W959DqEETiGZocYWCQPaJ6sBmUzgfxXfqGeTEdp3aQP'
|
||||
)
|
||||
AND p1.pool_token IS NOT NULL THEN 'withdraw'
|
||||
END AS action
|
||||
FROM
|
||||
lp_events_with_swaps_removed A
|
||||
LEFT JOIN {{ ref('silver__initialization_pools_orca') }}
|
||||
p1
|
||||
ON (
|
||||
A.event_instructions :accounts [3] :: STRING = p1.pool_token
|
||||
)
|
||||
LEFT JOIN {{ ref('silver__initialization_pools_orca') }}
|
||||
p2
|
||||
ON (
|
||||
A.event_instructions :accounts [7] :: STRING = p2.pool_token
|
||||
)
|
||||
@ -0,0 +1,64 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: silver__liquidity_pool_events_orca
|
||||
tests:
|
||||
- dbt_utils.unique_combination_of_columns:
|
||||
combination_of_columns:
|
||||
- BLOCK_ID
|
||||
- TX_ID
|
||||
- INDEX
|
||||
- INNER_INDEX
|
||||
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: LIQUIDITY_PROVIDER
|
||||
description: "{{ doc('liquidity_provider') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- name: PROGRAM_ID
|
||||
description: "{{ doc('program_id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- name: LP_PROGRAM_INNER_INDEX_START
|
||||
description: "start of range of orca pool events in inner instructions"
|
||||
- name: LP_PROGRAM_INNER_INDEX_END
|
||||
description: "end of range of orca pool events in inner instructions"
|
||||
- name: EVENT_INSTRUCTIONS
|
||||
description: "Instructions for Orca pool event"
|
||||
tests:
|
||||
- not_null
|
||||
- name: NUM_ACCTS
|
||||
description: "Number of accounts in event instructions"
|
||||
tests:
|
||||
- not_null
|
||||
- name: ACTION
|
||||
description: "{{ doc('action') }}"
|
||||
- name: _INSERTED_TIMESTAMP
|
||||
description: "{{ doc('_inserted_timestamp') }}"
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
@ -0,0 +1,166 @@
|
||||
{{ config(
|
||||
materialized = 'incremental',
|
||||
unique_key = ["block_id","tx_id","index","inner_index"],
|
||||
incremental_predicates = ['DBT_INTERNAL_DEST.block_timestamp::date >= LEAST(current_date-7,(select min(block_timestamp)::date from ' ~ generate_tmp_view_name(this) ~ '))'],
|
||||
cluster_by = ['block_timestamp::DATE','_inserted_timestamp::DATE']
|
||||
) }}
|
||||
|
||||
WITH base_mint_actions AS (
|
||||
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
{{ ref('silver__mint_actions') }}
|
||||
|
||||
{% if is_incremental() %}
|
||||
where _inserted_timestamp >= (
|
||||
SELECT
|
||||
MAX(_inserted_timestamp)
|
||||
FROM
|
||||
{{ this }}
|
||||
)
|
||||
|
||||
{% else %}
|
||||
where block_timestamp :: date >= '2021-02-14'
|
||||
{% endif %}
|
||||
),
|
||||
base_whirlpool_events AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
{{ ref('silver__liquidity_pool_events_orca') }}
|
||||
WHERE
|
||||
program_id IN (
|
||||
'9W959DqEETiGZocYWCQPaJ6sBmUzgfxXfqGeTEdp3aQP',
|
||||
'DjVE6JNiYqPL2QXyCUUh8rNjHrbz9hXHNYt99MQ59qw1'
|
||||
)
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= (
|
||||
SELECT
|
||||
MAX(_inserted_timestamp)
|
||||
FROM
|
||||
{{ this }}
|
||||
)
|
||||
|
||||
{% else %}
|
||||
AND block_timestamp :: date >= '2021-02-14'
|
||||
{% endif %}
|
||||
),
|
||||
orca_mint_actions AS (
|
||||
SELECT
|
||||
m.*,
|
||||
COALESCE(
|
||||
e1.liquidity_provider,
|
||||
e2.liquidity_provider
|
||||
) AS liquidity_provider
|
||||
FROM
|
||||
base_mint_actions m
|
||||
LEFT JOIN base_whirlpool_events e1
|
||||
ON m.tx_id = e1.tx_id
|
||||
AND m.index = e1.index
|
||||
AND e1.inner_index = -1
|
||||
LEFT JOIN base_whirlpool_events e2
|
||||
ON m.tx_id = e2.tx_id
|
||||
AND m.index = e2.index
|
||||
AND e2.inner_index <> -1
|
||||
AND m.inner_index BETWEEN e2.lp_program_inner_index_start
|
||||
AND e2.lp_program_inner_index_end
|
||||
WHERE
|
||||
m.event_type = 'mintTo'
|
||||
AND(
|
||||
e1.tx_id IS NOT NULL
|
||||
OR e2.tx_id IS NOT NULL
|
||||
)
|
||||
),
|
||||
pre_final_orca_mints AS(
|
||||
SELECT
|
||||
A.block_id,
|
||||
A.block_timestamp,
|
||||
A.tx_id,
|
||||
A.succeeded,
|
||||
A.index,
|
||||
A.inner_index,
|
||||
b.owner AS program_id,
|
||||
A.event_type AS action,
|
||||
A.mint,
|
||||
A.mint_amount,
|
||||
A.liquidity_provider,
|
||||
b.liquidity_pool AS liquidity_pool_address,
|
||||
A._inserted_timestamp
|
||||
FROM
|
||||
orca_mint_actions A
|
||||
INNER JOIN {{ ref('silver__initialization_pools_orca') }}
|
||||
b
|
||||
ON A.mint = b.pool_token
|
||||
),
|
||||
-- mints in swaps aren't captured in 'liqudity_pool_events' so they are accounted for here
|
||||
mints_in_swaps AS(
|
||||
SELECT
|
||||
A.block_id,
|
||||
A.block_timestamp,
|
||||
A.tx_id,
|
||||
A.succeeded,
|
||||
A.index,
|
||||
A.inner_index,
|
||||
b.owner AS program_id,
|
||||
A.event_type AS action,
|
||||
A.mint,
|
||||
A.mint_amount,
|
||||
A.mint_authority AS liquidity_provider,
|
||||
b.liquidity_pool AS liquidity_pool_address,
|
||||
A._inserted_timestamp
|
||||
FROM
|
||||
base_mint_actions A
|
||||
INNER JOIN {{ ref('silver__initialization_pools_orca') }}
|
||||
b
|
||||
ON A.mint = b.pool_token
|
||||
WHERE
|
||||
A.tx_id NOT IN (
|
||||
SELECT
|
||||
tx_id
|
||||
FROM
|
||||
pre_final_orca_mints
|
||||
)
|
||||
)
|
||||
SELECT
|
||||
A.block_id,
|
||||
A.block_timestamp,
|
||||
A.tx_id,
|
||||
A.succeeded,
|
||||
A.index,
|
||||
A.inner_index,
|
||||
A.program_id,
|
||||
A.action,
|
||||
A.mint,
|
||||
COALESCE(A.mint_amount / pow(10, m.decimals), A.mint_amount) AS amount,
|
||||
A.liquidity_provider,
|
||||
A.liquidity_pool_address,
|
||||
A._inserted_timestamp
|
||||
FROM
|
||||
pre_final_orca_mints A
|
||||
LEFT JOIN {{ ref('silver__token_metadata') }}
|
||||
m
|
||||
ON A.mint = m.token_address
|
||||
where liquidity_provider is not null and amount is not null
|
||||
UNION
|
||||
SELECT
|
||||
A.block_id,
|
||||
A.block_timestamp,
|
||||
A.tx_id,
|
||||
A.succeeded,
|
||||
A.index,
|
||||
A.inner_index,
|
||||
A.program_id,
|
||||
A.action,
|
||||
A.mint,
|
||||
COALESCE(A.mint_amount / pow(10, m.decimals), A.mint_amount) AS amount,
|
||||
A.liquidity_provider,
|
||||
A.liquidity_pool_address,
|
||||
A._inserted_timestamp
|
||||
FROM
|
||||
mints_in_swaps A
|
||||
LEFT JOIN {{ ref('silver__token_metadata') }}
|
||||
m
|
||||
ON A.mint = m.token_address
|
||||
where liquidity_provider is not null and amount is not null
|
||||
@ -0,0 +1,66 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: silver__mints_orca_non_whirlpool
|
||||
tests:
|
||||
- dbt_utils.unique_combination_of_columns:
|
||||
combination_of_columns:
|
||||
- BLOCK_ID
|
||||
- TX_ID
|
||||
- INDEX
|
||||
- INNER_INDEX
|
||||
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
|
||||
- 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
|
||||
|
||||
@ -0,0 +1,80 @@
|
||||
{{ config(
|
||||
materialized = 'incremental',
|
||||
unique_key = ["block_id","tx_id","index","inner_index"],
|
||||
incremental_predicates = ['DBT_INTERNAL_DEST.block_timestamp::date >= LEAST(current_date-7,(select min(block_timestamp)::date from ' ~ generate_tmp_view_name(this) ~ '))'],
|
||||
cluster_by = ['block_timestamp::DATE','_inserted_timestamp::DATE']
|
||||
) }}
|
||||
|
||||
WITH base_mint_actions AS (
|
||||
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
{{ ref('silver__mint_actions') }}
|
||||
|
||||
{% if is_incremental() %}
|
||||
where _inserted_timestamp >= (
|
||||
SELECT
|
||||
MAX(_inserted_timestamp)
|
||||
FROM
|
||||
{{ this }}
|
||||
)
|
||||
|
||||
{% else %}
|
||||
where block_timestamp :: date >= '2022-03-10'
|
||||
{% endif %}
|
||||
),
|
||||
base_whirlpool_events AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
{{ ref('silver__liquidity_pool_events_orca') }}
|
||||
WHERE
|
||||
program_id = 'whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc'
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= (
|
||||
SELECT
|
||||
MAX(_inserted_timestamp)
|
||||
FROM
|
||||
{{ this }}
|
||||
)
|
||||
|
||||
{% else %}
|
||||
AND block_timestamp :: date >= '2022-03-10'
|
||||
{% endif %}
|
||||
),
|
||||
orca_mint_actions AS (
|
||||
SELECT
|
||||
m.*,
|
||||
m.mint_authority AS liquidity_pool_address,
|
||||
e.liquidity_provider,
|
||||
e.program_id
|
||||
FROM
|
||||
base_mint_actions m
|
||||
INNER JOIN base_whirlpool_events e
|
||||
ON e.tx_id = m.tx_id
|
||||
WHERE
|
||||
m.event_type = 'mintTo'
|
||||
AND m.mint_amount = 1
|
||||
)
|
||||
SELECT
|
||||
A.block_id,
|
||||
A.block_timestamp,
|
||||
A.tx_id,
|
||||
A.succeeded,
|
||||
A.index,
|
||||
A.inner_index,
|
||||
A.program_id,
|
||||
A.event_type AS action,
|
||||
A.mint,
|
||||
A.mint_amount AS amount,
|
||||
A.liquidity_provider,
|
||||
A.liquidity_pool_address,
|
||||
A._inserted_timestamp
|
||||
FROM
|
||||
orca_mint_actions A
|
||||
INNER JOIN {{ ref('silver__initialization_pools_orca') }}
|
||||
b
|
||||
ON A.liquidity_pool_address = b.liquidity_pool
|
||||
qualify(row_number() over (partition by a.block_id, a.tx_id, a.index,a.inner_index order by a.index,a.inner_index)) = 1
|
||||
@ -0,0 +1,69 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: silver__mints_orca_whirlpool
|
||||
tests:
|
||||
- dbt_utils.unique_combination_of_columns:
|
||||
combination_of_columns:
|
||||
- BLOCK_ID
|
||||
- TX_ID
|
||||
- INDEX
|
||||
- INNER_INDEX
|
||||
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
|
||||
- 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
|
||||
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,149 @@
|
||||
{{ config(
|
||||
materialized = 'incremental',
|
||||
unique_key = ["block_id","tx_id","index","inner_index"],
|
||||
incremental_predicates = ['DBT_INTERNAL_DEST.block_timestamp::date >= LEAST(current_date-7,(select min(block_timestamp)::date from ' ~ generate_tmp_view_name(this) ~ '))'],
|
||||
cluster_by = ['block_timestamp::DATE','_inserted_timestamp::DATE']
|
||||
) }}
|
||||
|
||||
WITH base_orca_pool_events AS (
|
||||
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
{{ ref('silver__liquidity_pool_events_orca') }}
|
||||
WHERE
|
||||
program_id IN (
|
||||
'9W959DqEETiGZocYWCQPaJ6sBmUzgfxXfqGeTEdp3aQP',
|
||||
'DjVE6JNiYqPL2QXyCUUh8rNjHrbz9hXHNYt99MQ59qw1'
|
||||
)
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= (
|
||||
SELECT
|
||||
MAX(_inserted_timestamp)
|
||||
FROM
|
||||
{{ this }}
|
||||
)
|
||||
|
||||
{% else %}
|
||||
AND block_timestamp :: date >= '2021-02-14'
|
||||
{% endif %}
|
||||
),
|
||||
base_transfers AS (
|
||||
SELECT
|
||||
t.block_id,
|
||||
t.block_timestamp,
|
||||
t.tx_id,
|
||||
COALESCE(SPLIT_PART(t.index :: text, '.', 1) :: INT, INDEX :: INT) AS INDEX,
|
||||
NULLIF(SPLIT_PART(t.index :: text, '.', 2), '') :: INT AS inner_index,
|
||||
t.tx_from,
|
||||
t.tx_to,
|
||||
t.source_token_account,
|
||||
t.dest_token_account,
|
||||
t.amount,
|
||||
t.mint,
|
||||
t.succeeded,
|
||||
t._inserted_timestamp
|
||||
FROM
|
||||
{{ ref('silver__transfers') }}
|
||||
t
|
||||
WHERE
|
||||
tx_id IN (
|
||||
SELECT
|
||||
tx_id
|
||||
FROM
|
||||
base_orca_pool_events
|
||||
)
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= (
|
||||
SELECT
|
||||
MAX(_inserted_timestamp)
|
||||
FROM
|
||||
{{ this }}
|
||||
)
|
||||
|
||||
{% else %}
|
||||
AND block_timestamp :: date >= '2021-02-14'
|
||||
{% endif %}
|
||||
),
|
||||
non_whirlpool_txfers AS (
|
||||
SELECT
|
||||
t.*,
|
||||
COALESCE(
|
||||
l1.liquidity_provider,
|
||||
l2.liquidity_provider
|
||||
) AS liquidity_provider,
|
||||
COALESCE(
|
||||
l1.program_id,
|
||||
l2.program_id
|
||||
) AS program_id,
|
||||
COALESCE(
|
||||
l1.action,
|
||||
l2.action
|
||||
) AS action
|
||||
FROM
|
||||
base_transfers t
|
||||
LEFT JOIN base_orca_pool_events l1
|
||||
ON t.tx_id = l1.tx_id
|
||||
AND t.index = l1.index
|
||||
AND l1.inner_index = -1
|
||||
LEFT JOIN base_orca_pool_events l2
|
||||
ON t.tx_id = l2.tx_id
|
||||
AND t.index = l2.index
|
||||
AND l2.inner_index <> -1
|
||||
AND t.inner_index BETWEEN l2.lp_program_inner_index_start
|
||||
AND l2.lp_program_inner_index_end
|
||||
WHERE
|
||||
l1.program_id IN (
|
||||
'DjVE6JNiYqPL2QXyCUUh8rNjHrbz9hXHNYt99MQ59qw1',
|
||||
'9W959DqEETiGZocYWCQPaJ6sBmUzgfxXfqGeTEdp3aQP'
|
||||
)
|
||||
OR l2.program_id IN (
|
||||
'DjVE6JNiYqPL2QXyCUUh8rNjHrbz9hXHNYt99MQ59qw1',
|
||||
'9W959DqEETiGZocYWCQPaJ6sBmUzgfxXfqGeTEdp3aQP'
|
||||
)
|
||||
),
|
||||
pre_final AS (
|
||||
SELECT
|
||||
t.*,
|
||||
COALESCE(
|
||||
p1.liquidity_pool,
|
||||
p2.liquidity_pool
|
||||
) AS liquidity_pool_address
|
||||
FROM
|
||||
non_whirlpool_txfers t
|
||||
LEFT JOIN {{ ref('silver__initialization_pools_orca') }}
|
||||
p1
|
||||
ON (
|
||||
t.dest_token_account = p1.token_a_account
|
||||
OR t.dest_token_account = p1.token_b_account
|
||||
)
|
||||
AND t.action = 'deposit'
|
||||
LEFT JOIN {{ ref('silver__initialization_pools_orca') }}
|
||||
p2
|
||||
ON (
|
||||
t.source_token_account = p2.token_a_account
|
||||
OR t.source_token_account = p2.token_b_account
|
||||
)
|
||||
AND t.action = 'withdraw'
|
||||
WHERE
|
||||
p1.tx_id IS NOT NULL
|
||||
OR p2.tx_id IS NOT NULL
|
||||
)
|
||||
SELECT
|
||||
block_id,
|
||||
block_timestamp,
|
||||
tx_id,
|
||||
succeeded,
|
||||
INDEX,
|
||||
inner_index,
|
||||
program_id,
|
||||
action,
|
||||
mint,
|
||||
amount,
|
||||
liquidity_provider,
|
||||
liquidity_pool_address,
|
||||
_inserted_timestamp
|
||||
FROM
|
||||
pre_final
|
||||
@ -0,0 +1,67 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: silver__pool_transfers_orca_non_whirlpool
|
||||
tests:
|
||||
- dbt_utils.unique_combination_of_columns:
|
||||
combination_of_columns:
|
||||
- BLOCK_ID
|
||||
- TX_ID
|
||||
- INDEX
|
||||
- INNER_INDEX
|
||||
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
|
||||
|
||||
@ -0,0 +1,127 @@
|
||||
{{ config(
|
||||
materialized = 'incremental',
|
||||
unique_key = ["block_id","tx_id","index","inner_index"],
|
||||
incremental_predicates = ['DBT_INTERNAL_DEST.block_timestamp::date >= LEAST(current_date-7,(select min(block_timestamp)::date from ' ~ generate_tmp_view_name(this) ~ '))'],
|
||||
cluster_by = ['block_timestamp::DATE','_inserted_timestamp::DATE']
|
||||
) }}
|
||||
|
||||
WITH base_transfers AS (
|
||||
|
||||
SELECT
|
||||
t.block_id,
|
||||
t.block_timestamp,
|
||||
t.tx_id,
|
||||
COALESCE(SPLIT_PART(t.index :: text, '.', 1) :: INT, INDEX :: INT) AS INDEX,
|
||||
NULLIF(SPLIT_PART(t.index :: text, '.', 2), '') :: INT AS inner_index,
|
||||
t.tx_from,
|
||||
t.tx_to,
|
||||
t.source_token_account,
|
||||
t.dest_token_account,
|
||||
t.amount,
|
||||
t.mint,
|
||||
t.succeeded,
|
||||
t._inserted_timestamp
|
||||
FROM
|
||||
{{ ref('silver__transfers') }}
|
||||
t
|
||||
WHERE
|
||||
tx_id IN (
|
||||
SELECT
|
||||
tx_id
|
||||
FROM
|
||||
{{ ref('silver__liquidity_pool_events_orca') }}
|
||||
)
|
||||
|
||||
{% if is_incremental() %}
|
||||
and _inserted_timestamp >= (
|
||||
SELECT
|
||||
MAX(_inserted_timestamp)
|
||||
FROM
|
||||
{{ this }}
|
||||
)
|
||||
|
||||
{% else %}
|
||||
and block_timestamp :: date >= '2022-03-10'
|
||||
{% endif %}
|
||||
),
|
||||
whirlpool_txfers AS (
|
||||
SELECT
|
||||
t.*,
|
||||
COALESCE(
|
||||
l1.liquidity_provider,
|
||||
l2.liquidity_provider
|
||||
) AS liquidity_provider,
|
||||
COALESCE(
|
||||
l1.program_id,
|
||||
l2.program_id
|
||||
) AS program_id,
|
||||
COALESCE(
|
||||
l1.action,
|
||||
l2.action
|
||||
) AS action
|
||||
FROM
|
||||
base_transfers t
|
||||
LEFT JOIN {{ ref('silver__liquidity_pool_events_orca') }}
|
||||
l1
|
||||
ON t.tx_id = l1.tx_id
|
||||
AND t.index = l1.index
|
||||
AND l1.inner_index = -1
|
||||
LEFT JOIN {{ ref('silver__liquidity_pool_events_orca') }}
|
||||
l2
|
||||
ON t.tx_id = l2.tx_id
|
||||
AND t.index = l2.index
|
||||
AND l2.inner_index <> -1
|
||||
AND t.inner_index BETWEEN l2.lp_program_inner_index_start
|
||||
AND l2.lp_program_inner_index_end
|
||||
WHERE
|
||||
l1.program_id = 'whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc'
|
||||
OR l2.program_id = 'whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc'
|
||||
),
|
||||
pre_final AS (
|
||||
SELECT
|
||||
t.*,
|
||||
COALESCE(
|
||||
p1.liquidity_pool,
|
||||
p2.liquidity_pool
|
||||
) AS liquidity_pool_address,
|
||||
CASE
|
||||
WHEN t.action = 'whirlpool_fee_withdraw' THEN 'withdraw'
|
||||
WHEN t.action = 'whirlpool_unknown'
|
||||
AND p1.tx_id IS NOT NULL THEN 'deposit'
|
||||
WHEN t.action = 'whirlpool_unknown'
|
||||
AND p2.tx_id IS NOT NULL THEN 'withdraw'
|
||||
END AS action_true
|
||||
FROM
|
||||
whirlpool_txfers t
|
||||
LEFT JOIN {{ ref('silver__initialization_pools_orca') }}
|
||||
p1
|
||||
ON (
|
||||
t.dest_token_account = p1.token_a_account
|
||||
OR t.dest_token_account = p1.token_b_account
|
||||
)
|
||||
LEFT JOIN {{ ref('silver__initialization_pools_orca') }}
|
||||
p2
|
||||
ON (
|
||||
t.source_token_account = p2.token_a_account
|
||||
OR t.source_token_account = p2.token_b_account
|
||||
)
|
||||
WHERE
|
||||
p1.tx_id IS NOT NULL
|
||||
OR p2.tx_id IS NOT NULL
|
||||
)
|
||||
SELECT
|
||||
block_id,
|
||||
block_timestamp,
|
||||
tx_id,
|
||||
succeeded,
|
||||
INDEX,
|
||||
inner_index,
|
||||
program_id,
|
||||
action_true AS action,
|
||||
mint,
|
||||
amount,
|
||||
liquidity_provider,
|
||||
liquidity_pool_address,
|
||||
_inserted_timestamp
|
||||
FROM
|
||||
pre_final
|
||||
@ -0,0 +1,66 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: silver__pool_transfers_orca_whirlpool
|
||||
tests:
|
||||
- dbt_utils.unique_combination_of_columns:
|
||||
combination_of_columns:
|
||||
- BLOCK_ID
|
||||
- TX_ID
|
||||
- INDEX
|
||||
- INNER_INDEX
|
||||
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
|
||||
- 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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user