mirror of
https://github.com/FlipsideCrypto/external-models.git
synced 2026-02-06 11:41:50 +00:00
add layerzero sybil data (#65)
This commit is contained in:
parent
ee4877e257
commit
f1747b4565
@ -70,6 +70,12 @@ Note: These tables ceased updating on Feburary 4th, 2024.
|
|||||||
|
|
||||||
- [tokenlists__ez_verified_tokens](https://flipsidecrypto.github.io/external-models/#!/model/model.external_models.tokenlists__ez_verified_tokens)
|
- [tokenlists__ez_verified_tokens](https://flipsidecrypto.github.io/external-models/#!/model/model.external_models.tokenlists__ez_verified_tokens)
|
||||||
|
|
||||||
|
**LayerZero**
|
||||||
|
|
||||||
|
[LayerZero Sybil Reporting Documentation](https://github.com/LayerZero-Labs/sybil-report/?tab=readme-ov-file)
|
||||||
|
|
||||||
|
- [layerzero__fact_transactions_snapshot](https://flipsidecrypto.github.io/external-models/#!/model/model.external_models.layerzero__fact_transactions_snapshot)
|
||||||
|
|
||||||
## **Helpful User-Defined Functions (UDFs)**
|
## **Helpful User-Defined Functions (UDFs)**
|
||||||
|
|
||||||
UDFs are custom functions built by the Flipside team that can be used in your queries to make your life easier.
|
UDFs are custom functions built by the Flipside team that can be used in your queries to make your life easier.
|
||||||
|
|||||||
23
models/layerzero/bronze/bronze__layerzero_txs_snapshot1.sql
Normal file
23
models/layerzero/bronze/bronze__layerzero_txs_snapshot1.sql
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{{ config (
|
||||||
|
materialized = 'view'
|
||||||
|
) }}
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
source_chain,
|
||||||
|
source_transaction_hash,
|
||||||
|
source_contract,
|
||||||
|
destination_chain,
|
||||||
|
destination_transaction_hash,
|
||||||
|
destination_contract,
|
||||||
|
sender_wallet,
|
||||||
|
source_timestamp_utc,
|
||||||
|
project,
|
||||||
|
native_drop_usd,
|
||||||
|
stargate_swap_usd,
|
||||||
|
SYSDATE() AS _inserted_timestamp,
|
||||||
|
'snapshot_one' AS snapshot_version
|
||||||
|
FROM
|
||||||
|
{{ source(
|
||||||
|
"layerzero",
|
||||||
|
"transactions"
|
||||||
|
) }}
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
{{ config(
|
||||||
|
materialized = 'view',
|
||||||
|
persist_docs ={ "relation": true,
|
||||||
|
"columns": true },
|
||||||
|
tags = ['layerzero'],
|
||||||
|
meta ={ 'database_tags':{ 'table':{ 'PROTOCOL': 'layerzero' } } }
|
||||||
|
) }}
|
||||||
|
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
source_chain,
|
||||||
|
source_transaction_hash,
|
||||||
|
source_contract,
|
||||||
|
destination_chain,
|
||||||
|
destination_transaction_hash,
|
||||||
|
destination_contract,
|
||||||
|
sender_wallet,
|
||||||
|
source_timestamp_utc,
|
||||||
|
project,
|
||||||
|
native_drop_usd,
|
||||||
|
stargate_swap_usd,
|
||||||
|
snapshot_version,
|
||||||
|
layerzero_txs_snapshot_id,
|
||||||
|
inserted_timestamp,
|
||||||
|
modified_timestamp
|
||||||
|
FROM
|
||||||
|
{{ ref('silver__layerzero_txs_snapshot') }}
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
version: 2
|
||||||
|
models:
|
||||||
|
- name: layerzero__fact_transactions_snapshot
|
||||||
|
description: This table records transactions data provided by LayerZero in their Sybil Reporting effort. You may refer to this github link for more information - https://github.com/LayerZero-Labs/sybil-report/?tab=readme-ov-file . Please reach out to the LayerZero team for any data discrepancies or questions.
|
||||||
|
|
||||||
|
columns:
|
||||||
|
- name: SOURCE_CHAIN
|
||||||
|
description: The chain where the transaction originated from.
|
||||||
|
- name: SOURCE_TRANSACTION_HASH
|
||||||
|
description: The transaction hash from the source chain.
|
||||||
|
- name: SOURCE_CONTRACT
|
||||||
|
description: The contract address from the source transaction.
|
||||||
|
- name: DESTINATION_CHAIN
|
||||||
|
description: The chain where the transaction is directed to.
|
||||||
|
- name: DESTINATION_TRANSACTION_HASH
|
||||||
|
description: The transaction hash on the destination chain.
|
||||||
|
- name: DESTINATION_CONTRACT
|
||||||
|
description: The contract address from the destination transaction.
|
||||||
|
- name: SENDER_WALLET
|
||||||
|
description: The wallet address that initiated the source transaction hash.
|
||||||
|
- name: SOURCE_TIMESTAMP_UTC
|
||||||
|
description: The timestamp of the source transaction hash in UTC.
|
||||||
|
- name: PROJECT
|
||||||
|
description: The name of the project.
|
||||||
|
- name: NATIVE_DROP_USD
|
||||||
|
description: The native drop in USD.
|
||||||
|
- name: STARGATE_SWAP_USD
|
||||||
|
description: The stargate swap in USD.
|
||||||
|
- name: SNAPSHOT_VERSION
|
||||||
|
description: The version number of the snapshot taken.
|
||||||
|
- name: LAYERZERO_TXS_SNAPSHOT_ID
|
||||||
|
description: '{{ doc("pk") }}'
|
||||||
|
- name: INSERTED_TIMESTAMP
|
||||||
|
description: '{{ doc("inserted_timestamp") }}'
|
||||||
|
- name: MODIFIED_TIMESTAMP
|
||||||
|
description: '{{ doc("modified_timestamp") }}'
|
||||||
143
models/layerzero/silver/silver__layerzero_txs_snapshot.sql
Normal file
143
models/layerzero/silver/silver__layerzero_txs_snapshot.sql
Normal file
@ -0,0 +1,143 @@
|
|||||||
|
{{ config(
|
||||||
|
materialized = "table",
|
||||||
|
unique_key = "layerzero_txs_snapshot_id",
|
||||||
|
cluster_by = "source_timestamp_utc::DATE",
|
||||||
|
tags = ['layerzero']
|
||||||
|
) }}
|
||||||
|
|
||||||
|
WITH base AS (
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
IFF(
|
||||||
|
source_chain = '""',
|
||||||
|
NULL,
|
||||||
|
REGEXP_REPLACE(
|
||||||
|
source_chain,
|
||||||
|
'^"|\\s*"$',
|
||||||
|
''
|
||||||
|
)
|
||||||
|
) AS source_chain,
|
||||||
|
IFF(
|
||||||
|
source_transaction_hash = '""',
|
||||||
|
NULL,
|
||||||
|
REGEXP_REPLACE(
|
||||||
|
source_transaction_hash,
|
||||||
|
'^"|\\s*"$',
|
||||||
|
''
|
||||||
|
)
|
||||||
|
) AS source_transaction_hash,
|
||||||
|
IFF(
|
||||||
|
source_contract = '""',
|
||||||
|
NULL,
|
||||||
|
REGEXP_REPLACE(
|
||||||
|
source_contract,
|
||||||
|
'^"|\\s*"$',
|
||||||
|
''
|
||||||
|
)
|
||||||
|
) AS source_contract,
|
||||||
|
IFF(
|
||||||
|
source_chain = '""',
|
||||||
|
NULL,
|
||||||
|
REGEXP_REPLACE(
|
||||||
|
destination_chain,
|
||||||
|
'^"|\\s*"$',
|
||||||
|
''
|
||||||
|
)
|
||||||
|
) AS destination_chain,
|
||||||
|
IFF(
|
||||||
|
destination_transaction_hash = '""',
|
||||||
|
NULL,
|
||||||
|
REGEXP_REPLACE(
|
||||||
|
destination_transaction_hash,
|
||||||
|
'^"|\\s*"$',
|
||||||
|
''
|
||||||
|
)
|
||||||
|
) AS destination_transaction_hash,
|
||||||
|
IFF(
|
||||||
|
destination_contract = '""',
|
||||||
|
NULL,
|
||||||
|
REGEXP_REPLACE(
|
||||||
|
destination_contract,
|
||||||
|
'^"|\\s*"$',
|
||||||
|
''
|
||||||
|
)
|
||||||
|
) AS destination_contract,
|
||||||
|
IFF(
|
||||||
|
sender_wallet = '""',
|
||||||
|
NULL,
|
||||||
|
REGEXP_REPLACE(
|
||||||
|
sender_wallet,
|
||||||
|
'^"|\\s*"$',
|
||||||
|
''
|
||||||
|
)
|
||||||
|
) AS sender_wallet,
|
||||||
|
TO_TIMESTAMP_NTZ(
|
||||||
|
IFF(
|
||||||
|
source_timestamp_utc = '""',
|
||||||
|
NULL,
|
||||||
|
REGEXP_REPLACE(
|
||||||
|
source_timestamp_utc,
|
||||||
|
'^"|\\s*"$',
|
||||||
|
''
|
||||||
|
)
|
||||||
|
)
|
||||||
|
) AS source_timestamp_utc,
|
||||||
|
IFF(
|
||||||
|
project = '""',
|
||||||
|
NULL,
|
||||||
|
REGEXP_REPLACE(
|
||||||
|
project,
|
||||||
|
'^"|\\s*"$',
|
||||||
|
''
|
||||||
|
)
|
||||||
|
) AS project,
|
||||||
|
IFF(
|
||||||
|
native_drop_usd = '""',
|
||||||
|
NULL,
|
||||||
|
REGEXP_REPLACE(
|
||||||
|
native_drop_usd,
|
||||||
|
'^"|\\s*"$',
|
||||||
|
''
|
||||||
|
)
|
||||||
|
) AS native_drop_usd,
|
||||||
|
IFF(
|
||||||
|
stargate_swap_usd = '""',
|
||||||
|
NULL,
|
||||||
|
REGEXP_REPLACE(
|
||||||
|
stargate_swap_usd,
|
||||||
|
'^"|\\s*"$',
|
||||||
|
''
|
||||||
|
)
|
||||||
|
) AS stargate_swap_usd,
|
||||||
|
ROW_NUMBER() over (
|
||||||
|
PARTITION BY source_transaction_hash
|
||||||
|
ORDER BY
|
||||||
|
source_chain ASC
|
||||||
|
) AS tx_rn,
|
||||||
|
snapshot_version,
|
||||||
|
_inserted_timestamp
|
||||||
|
FROM
|
||||||
|
{{ ref('bronze__layerzero_txs_snapshot1') }}
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
source_chain,
|
||||||
|
source_transaction_hash,
|
||||||
|
source_contract,
|
||||||
|
destination_chain,
|
||||||
|
destination_transaction_hash,
|
||||||
|
destination_contract,
|
||||||
|
sender_wallet,
|
||||||
|
source_timestamp_utc,
|
||||||
|
project,
|
||||||
|
native_drop_usd,
|
||||||
|
stargate_swap_usd,
|
||||||
|
tx_rn,
|
||||||
|
snapshot_version,
|
||||||
|
_inserted_timestamp,
|
||||||
|
{{ dbt_utils.generate_surrogate_key(
|
||||||
|
['source_transaction_hash', 'tx_rn', 'snapshot_version']
|
||||||
|
) }} AS layerzero_txs_snapshot_id,
|
||||||
|
SYSDATE() AS inserted_timestamp,
|
||||||
|
SYSDATE() AS modified_timestamp
|
||||||
|
FROM
|
||||||
|
base
|
||||||
11
models/layerzero/silver/silver__layerzero_txs_snapshot.yml
Normal file
11
models/layerzero/silver/silver__layerzero_txs_snapshot.yml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
version: 2
|
||||||
|
models:
|
||||||
|
- name: silver__layerzero_txs_snapshot
|
||||||
|
tests:
|
||||||
|
- dbt_utils.unique_combination_of_columns:
|
||||||
|
combination_of_columns:
|
||||||
|
- LAYERZERO_TXS_SNAPSHOT_ID
|
||||||
|
columns:
|
||||||
|
- name: SOURCE_TRANSACTION_HASH
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
@ -66,3 +66,8 @@ sources:
|
|||||||
tables:
|
tables:
|
||||||
- name: mev
|
- name: mev
|
||||||
- name: protect
|
- name: protect
|
||||||
|
- name: layerzero
|
||||||
|
database: external
|
||||||
|
schema: layerzero
|
||||||
|
tables:
|
||||||
|
- name: transactions
|
||||||
14
package-lock.yml
Normal file
14
package-lock.yml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
packages:
|
||||||
|
- package: calogica/dbt_expectations
|
||||||
|
version: 0.8.2
|
||||||
|
- package: dbt-labs/dbt_external_tables
|
||||||
|
version: 0.8.2
|
||||||
|
- package: dbt-labs/dbt_utils
|
||||||
|
version: 1.0.0
|
||||||
|
- git: https://github.com/FlipsideCrypto/fsc-utils.git
|
||||||
|
revision: b1e612ace7060a257e9622fe01b0854722c6fae7
|
||||||
|
- package: calogica/dbt_date
|
||||||
|
version: 0.7.2
|
||||||
|
- git: https://github.com/FlipsideCrypto/livequery-models.git
|
||||||
|
revision: 883675b4021cc9a777e12fe6be8114ab039ab365
|
||||||
|
sha1_hash: 014e9645cbaa3e1a154d08c8ae0c8317f385d6fc
|
||||||
Loading…
Reference in New Issue
Block a user