Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Init unichain #7642

Merged
merged 3 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions dbt_subprojects/daily_spellbook/models/evms/evms_info.sql
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
, "scroll"
, "sei"
, "sonic"
, "unichain"
, "viction"
, "worldchain"
, "zksync"
Expand Down Expand Up @@ -103,5 +104,6 @@ FROM (
, (57073, 'ink', 'Ink', 'Layer 2', 'Optimistic Rollup', 'ETH', 0x4200000000000000000000000000000000000006, 'https://explorer.inkonchain.com/', timestamp '2024-12-06 15:20', 'OP Stack', 'Ethereum Blobs', 'Ethereum', true)
, (2741, 'abstract', 'Abstract', 'Layer 2', 'Optimistic Rollup', 'ETH', 0x3439153EB7AF838Ad19d56E1571FBD09333C2809, 'https://explorer.testnet.abs.xyz/', timestamp '2024-06-17 22:39', 'OP Stack', 'Ethereum Blobs', 'Ethereum', true)
, (80094, 'berachain', 'Berachain', 'Layer 1', NULL, 'BERA', NULL, 'https://berascan.com/', timestamp '2024-01-20 14:14:11', NULL, NULL, NULL, true)
, (130, 'unichain', 'Unichain', 'Layer 2', 'Optimistic Rollup', 'ETH', 0x4200000000000000000000000000000000000006, 'https://uniscan.xyz/', timestamp '2024-11-04 19:26', 'OP Stack', 'Ethereum Blobs', 'Ethereum', true)
) AS temp_table (chain_id, blockchain, name, chain_type, rollup_type, native_token_symbol, wrapped_native_token_address, explorer_link, first_block_time, codebase, data_availability, settlement, is_on_dune)

2 changes: 2 additions & 0 deletions dbt_subprojects/tokens/models/prices/prices_tokens.sql
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
, "sei"
, "solana"
, "sonic"
, "unichain"
, "viction"
, "worldchain"
, "zksync"
Expand Down Expand Up @@ -77,6 +78,7 @@ ref('prices_native_tokens')
,ref('prices_corn_tokens')
,ref('prices_sonic_tokens')
,ref('prices_ink_tokens')
,ref('prices_unichain_tokens')
,ref('prices_abstract_tokens')
,ref('prices_berachain_tokens')
] %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ WITH trusted_tokens AS (
, ('berachain', 0x5d3a1ff2b6bab83b63cd9ad0787074081a52ef34) -- USDe
, ('berachain', 0x7dcc39b4d1c53cb31e1abc0e358b43987fef80f7) -- weETH
, ('berachain', 0xecac9c5f704e954931349da37f60e39f515c11c1) -- LBTC
, ('unichain', 0x4200000000000000000000000000000000000006) -- WETH
, ('unichain', 0x078d782b760474a361dda0af3839290b0ef57ad6) -- USDC
, ('unichain', 0x8f187aa05619a017077f5308904739877ce9ea21) -- UNI
, ('unichain', 0x20cab320a855b39f724131c69424240519573f81) -- DAI
) AS t (blockchain, contract_address)
), erc20 as (
SELECT
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: 2

models:
- name: prices_unichain_tokens
meta:
blockchain: unichain
sector: prices
contributors: hosuke
config:
tags: ['prices', 'tokens', 'usd', 'unichain']
description: "Price tokens on unichain chain"
data_tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- contract_address
columns:
- name: token_id
description: "Id of the token at coinpaprika. This id is required to pull the price feed data. NOTE: Not all tokens are listed at coinpaprika - consider using price data from DEX sources in this case or submit a listing request at coinpaprika."
- name: blockchain
description: "Native blockchain of the token, if any"
data_tests:
- accepted_values:
values: [ "unichain" ]
- name: contract_address
description: "Contract address of the token, if any"
- name: symbol
description: "Token symbol"
- name: decimals
description: "Number of decimals for the token contract"
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{% set blockchain = 'unichain' %}

{{ config(
schema = 'prices_' + blockchain,
alias = 'tokens',
materialized = 'table',
file_format = 'delta',
tags = ['static']
)
}}

SELECT
token_id
, '{{ blockchain }}' as blockchain
, symbol
, contract_address
, decimals
FROM
(
VALUES
('weth-weth', 'WETH', 0x4200000000000000000000000000000000000006, 18)
, ('usdc-usd-coin', 'USDC', 0x078d782b760474a361dda0af3839290b0ef57ad6, 6)
, ('uni-uniswap', 'UNI', 0x8f187aa05619a017077f5308904739877ce9ea21, 18)
, ('dai-dai', 'DAI', 0x20cab320a855b39f724131c69424240519573f81, 18)
) as temp (token_id, symbol, contract_address, decimals)
2 changes: 2 additions & 0 deletions dbt_subprojects/tokens/models/tokens/tokens_erc20.sql
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
,"bob"
,"sonic"
,"berachain"
,"unichain"
]\',
"sector",
"tokens",
Expand Down Expand Up @@ -85,6 +86,7 @@
,'tokens_ink': {'blockchain': 'ink', 'model': ref('tokens_ink_erc20')}
,'tokens_abstract': {'blockchain': 'abstract', 'model': ref('tokens_abstract_erc20')}
,'tokens_berachain': {'blockchain': 'berachain', 'model': ref('tokens_berachain_erc20')}
,'tokens_unichain': {'blockchain': 'unichain', 'model': ref('tokens_unichain_erc20')}
} %}

with automated_source as (
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{
config(
schema = 'tokens_unichain'
,alias = 'erc20'
,tags = ['static']
,materialized = 'table'
)
}}

SELECT
contract_address
, symbol
, decimals
FROM (VALUES
(0x4200000000000000000000000000000000000006, 'WETH', 18)
, (0x078d782b760474a361dda0af3839290b0ef57ad6, 'USDC', 6)
, (0x8f187aa05619a017077f5308904739877ce9ea21, 'UNI', 18)
, (0x20cab320a855b39f724131c69424240519573f81, 'DAI', 18)
) AS temp_table (contract_address, symbol, decimals)
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: 2

models:
- name: tokens_unichain_erc20
meta:
blockchain: unichain
sector: tokens
contributors: hosuke
config:
tags: ['tokens', 'unichain']
description: "Known tokens on Unichain"
columns:
- name: contract_address
description: "Token contract address"
tests:
- unique
- name: symbol
description: "Token symbol"
- name: decimals
description: "Number of decimals the token has"
- name: token_name
description: "Name of the token"
Loading