update silver and gold tables

This commit is contained in:
San Yong 2025-06-06 15:42:04 +08:00
parent 1757fdc14c
commit ad78b77be7
3 changed files with 119 additions and 1 deletions

View File

@ -5,7 +5,7 @@
meta={
'database_tags':{
'table': {
'PROTOCOL': 'CURVE, FRAXSWAP, KYBERSWAP, PANGOLIN, PHARAOH, PLATYPUS, SUSHISWAP, TRADER JOE, UNISWAP',
'PROTOCOL': 'CURVE, FRAXSWAP, KYBERSWAP, PANGOLIN, PHARAOH, PLATYPUS, SUSHISWAP, TRADER JOE, UNISWAP, DEXALOT, ARENA',
'PURPOSE': 'DEX, SWAPS'
}
}

View File

@ -17,6 +17,41 @@ WITH contracts AS (
FROM
{{ ref('silver__contracts') }}
),
arena AS (
SELECT
block_number,
block_timestamp,
tx_hash,
contract_address,
pool_address,
NULL AS pool_name,
NULL AS fee,
NULL AS tick_spacing,
token0,
token1,
NULL AS token2,
NULL AS token3,
NULL AS token4,
NULL AS token5,
NULL AS token6,
NULL AS token7,
'arena-trade' AS platform,
'v1' AS version,
_log_id AS _id,
_inserted_timestamp
FROM
{{ ref('silver_dex__arena_pools') }}
{% if is_incremental() and 'arena' not in var('HEAL_MODELS') %}
WHERE
_inserted_timestamp >= (
SELECT
MAX(_inserted_timestamp) - INTERVAL '{{ var("LOOKBACK", "4 hours") }}'
FROM
{{ this }}
)
{% endif %}
),
balancer AS (
SELECT
block_number,
@ -542,6 +577,11 @@ WHERE
{% endif %}
),
all_pools AS (
SELECT
*
FROM
arena
UNION ALL
SELECT
*
FROM

View File

@ -713,6 +713,74 @@ WHERE
)
{% endif %}
),
arena AS (
SELECT
block_number,
block_timestamp,
tx_hash,
origin_function_signature,
origin_from_address,
origin_to_address,
contract_address,
event_name,
amount_in_unadj,
amount_out_unadj,
token_in,
token_out,
sender,
tx_to,
event_index,
platform,
'v1' AS version,
_log_id,
_inserted_timestamp
FROM
{{ ref('silver_dex__arena_swaps') }}
{% if is_incremental() and 'arena' not in var('HEAL_MODELS') %}
WHERE
_inserted_timestamp >= (
SELECT
MAX(_inserted_timestamp) - INTERVAL '{{ var("LOOKBACK", "4 hours") }}'
FROM
{{ this }}
)
{% endif %}
),
dexalot AS (
SELECT
block_number,
block_timestamp,
tx_hash,
origin_function_signature,
origin_from_address,
origin_to_address,
contract_address,
event_name,
amount_in_unadj,
amount_out_unadj,
token_in,
token_out,
sender,
tx_to,
event_index,
platform,
'v1' AS version,
_log_id,
modified_timestamp AS _inserted_timestamp
FROM
{{ ref('silver_dex__dexalot_swaps') }}
{% if is_incremental() and 'dexalot' not in var('HEAL_MODELS') %}
WHERE
_inserted_timestamp >= (
SELECT
MAX(_inserted_timestamp) - INTERVAL '{{ var("LOOKBACK", "4 hours") }}'
FROM
{{ this }}
)
{% endif %}
),
all_dex AS (
SELECT
*
@ -813,6 +881,16 @@ all_dex AS (
*
FROM
pharaoh_v2
UNION ALL
SELECT
*
FROM
arena
UNION ALL
SELECT
*
FROM
dexalot
),
complete_dex_swaps AS (
SELECT