Skip to content

Commit

Permalink
Create Ronin Transfers (#7133)
Browse files Browse the repository at this point in the history
* Create tokens_ronin_base_transfers.sql

* Create Ronin Transfers

* Added authorship

* Add schema

* Add ronin in tokens_transfers

---------

Co-authored-by: Huang Geyang <Sukebeta@outlook.com>
  • Loading branch information
peterrliem and Hosuke authored Nov 18, 2024
1 parent 5225455 commit fae1b26
Show file tree
Hide file tree
Showing 4 changed files with 153 additions and 0 deletions.
106 changes: 106 additions & 0 deletions dbt_subprojects/tokens/models/transfers_and_balances/ronin/_schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
version: 2

models:
- name: tokens_ronin_base_transfers
meta:
blockchain: ronin
sector: tokens
contributors: aalan3, jeff-dude, peterrliem, hosuke
config:
tags: ['tokens','transfers', 'ronin']
description: >
Token transfers
data_tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- block_date
- unique_key
columns:
- name: unique_key
description: "Surrogate key to identify unique row"
- name: blockchain
description: "The blockchain of the transfers"
- name: block_date
description: "The date of the block"
- name: block_time
description: "The time of the block"
- name: block_number
description: "The block number"
- name: tx_hash
description: "The transaction hash"
- name: evt_index
description: "The log event index of the transfer if any"
- name: trace_address
description: "The trace address of the transfer if any"
- name: token_standard
description: "The token standard of the transfer"
- name: tx_from
description: "The transaction sender"
- name: tx_to
description: "The transaction receiver"
- name: tx_index
description: "The transaction index"
- name: from
description: "The sender of the transfer"
- name: to
description: "The receiver of the transfer"
- name: contract_address
description: "The contract address of the transfer"
- name: amount_raw
description: "The raw amount of the transfer"

- name: tokens_ronin_transfers
meta:
blockchain: ronin
sector: tokens
contributors: aalan3, jeff-dude, peterrliem, hosuke
config:
tags: ['tokens','transfers', 'ronin']
description: >
Token transfers
data_tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- block_date
- unique_key
columns:
- name: unique_key
description: "Surrogate key to identify unique row"
- name: blockchain
description: "The blockchain of the transfers"
- name: block_date
description: "The date of the block"
- name: block_time
description: "The time of the block"
- name: block_number
description: "The block number"
- name: tx_hash
description: "The transaction hash"
- name: evt_index
description: "The log event index of the transfer if any"
- name: trace_address
description: "The trace address of the transfer if any"
- name: token_standard
description: "The token standard of the transfer"
- name: tx_from
description: "The transaction sender"
- name: tx_to
description: "The transaction receiver"
- name: tx_index
description: "The transaction index"
- name: from
description: "The sender of the transfer"
- name: to
description: "The receiver of the transfer"
- name: contract_address
description: "The contract address of the transfer"
- name: symbol
description: "The token symbol transferred"
- name: amount_raw
description: "The raw amount of the transfer"
- name: amount
description: "The formatted amount of the transfer"
- name: price_usd
description: "The USD price used to calculate the amount_usd"
- name: amount_usd
description: "The USD amount of the transfer"
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{config(
schema = 'tokens_ronin',
alias = 'base_transfers',
partition_by = ['block_month'],
materialized = 'incremental',
file_format = 'delta',
incremental_strategy = 'merge',
incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')],
unique_key = ['block_date','unique_key'],
)
}}

{{transfers_base(
blockchain='ronin',
traces = source('ronin','traces'),
transactions = source('ronin','transactions'),
erc20_transfers = source('erc20_ronin','evt_transfer'),
native_contract_address = null
)
}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{{config(
schema = 'tokens_ronin',
alias = 'transfers',
partition_by = ['block_month'],
materialized = 'incremental',
file_format = 'delta',
incremental_strategy = 'merge',
unique_key = ['block_date','unique_key'],
incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_date')],
post_hook='{{ expose_spells(\'["ronin"]\',
"sector",
"tokens",
\'["aalan3", "jeff-dude", "peterrliem"]\') }}'
)
}}

{{
transfers_enrich(
base_transfers = ref('tokens_ronin_base_transfers')
, tokens_erc20_model = source('tokens', 'erc20')
, prices_model = source('prices', 'usd')
, evms_info_model = source('evms','info')
, transfers_start_date = '2021-01-24'
, blockchain = 'ronin'
)
}}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
,'mantle'
,'optimism'
,'polygon'
,'ronin'
,'scroll'
,'sei'
,'tron'
Expand Down

0 comments on commit fae1b26

Please sign in to comment.