mirror of
https://github.com/FlipsideCrypto/solana-models.git
synced 2026-02-06 11:27:00 +00:00
* wip * fix naming * revamp bridges * split models * updates * update tests and get inner events * fix pk * further exclude mayan * exclude fee amounts * add debridge tests --------- Co-authored-by: Desmond Hui <desmond@flipsidecrypto.com>
93 lines
1.9 KiB
SQL
93 lines
1.9 KiB
SQL
{{ config(
|
|
materialized = 'view',
|
|
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'BRIDGE' }} },
|
|
tags = ["scheduled_non_core"],
|
|
) }}
|
|
|
|
SELECT
|
|
block_timestamp,
|
|
block_id,
|
|
tx_id,
|
|
succeeded,
|
|
INDEX,
|
|
program_id,
|
|
platform,
|
|
direction,
|
|
user_address,
|
|
amount,
|
|
mint,
|
|
COALESCE (
|
|
bridge_wormhole_transfers_id,
|
|
{{ dbt_utils.generate_surrogate_key(
|
|
['block_id','tx_id', 'index','direction']
|
|
) }}
|
|
) AS fact_bridge_activity_id,
|
|
COALESCE(
|
|
inserted_timestamp,
|
|
'2000-01-01'
|
|
) AS inserted_timestamp,
|
|
COALESCE(
|
|
modified_timestamp,
|
|
'2000-01-01'
|
|
) AS modified_timestamp
|
|
FROM
|
|
{{ ref('silver__bridge_wormhole_transfers') }}
|
|
union all
|
|
SELECT
|
|
block_timestamp,
|
|
block_id,
|
|
tx_id,
|
|
succeeded,
|
|
INDEX,
|
|
program_id,
|
|
platform,
|
|
direction,
|
|
user_address,
|
|
amount,
|
|
mint,
|
|
COALESCE (
|
|
bridge_debridge_transfers_id,
|
|
{{ dbt_utils.generate_surrogate_key(
|
|
['block_id','tx_id', 'index']
|
|
) }}
|
|
) AS fact_bridge_activity_id,
|
|
COALESCE(
|
|
inserted_timestamp,
|
|
'2000-01-01'
|
|
) AS inserted_timestamp,
|
|
COALESCE(
|
|
modified_timestamp,
|
|
'2000-01-01'
|
|
) AS modified_timestamp
|
|
FROM
|
|
{{ ref('silver__bridge_debridge_transfers') }}
|
|
union all
|
|
SELECT
|
|
block_timestamp,
|
|
block_id,
|
|
tx_id,
|
|
succeeded,
|
|
INDEX,
|
|
program_id,
|
|
platform,
|
|
direction,
|
|
user_address,
|
|
amount,
|
|
mint,
|
|
COALESCE (
|
|
bridge_mayan_transfers_id,
|
|
{{ dbt_utils.generate_surrogate_key(
|
|
['block_id','tx_id', 'index']
|
|
) }}
|
|
) AS fact_bridge_activity_id,
|
|
COALESCE(
|
|
inserted_timestamp,
|
|
'2000-01-01'
|
|
) AS inserted_timestamp,
|
|
COALESCE(
|
|
modified_timestamp,
|
|
'2000-01-01'
|
|
) AS modified_timestamp
|
|
FROM
|
|
{{ ref('silver__bridge_mayan_transfers') }}
|