Skip to content

Commit

Permalink
Init berachain (#7631)
Browse files Browse the repository at this point in the history
* Init berachain

* Add berachain tokens

* Update transfers

* Add berachain into roll-ups
  • Loading branch information
Hosuke authored Feb 10, 2025
1 parent 435d596 commit 4b6790b
Show file tree
Hide file tree
Showing 10 changed files with 945 additions and 0 deletions.
1 change: 1 addition & 0 deletions dbt_subprojects/daily_spellbook/models/evms/evms_info.sql
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,6 @@ FROM (
, (146, 'sonic', 'Sonic', 'Layer 1', NULL, 'SONIC', NULL, 'https://sonicscan.org/', timestamp '2024-12-01 00:00', NULL, NULL, NULL, true)
, (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)
) 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)

29 changes: 29 additions & 0 deletions dbt_subprojects/tokens/models/prices/berachain/_schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: 2

models:
- name: prices_berachain_tokens
meta:
blockchain: berachain
sector: prices
contributors: hosuke
config:
tags: ['prices', 'tokens', 'usd', 'berachain']
description: "Price tokens on Berachain EVM 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."
- name: blockchain
description: "Native blockchain of the token, if any"
data_tests:
- accepted_values:
values: [ "berachain" ]
- 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,24 @@
{% set blockchain = 'berachain' %}

{{ 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
('usde-ethena-usde', 'USDe', 0x5d3a1ff2b6bab83b63cd9ad0787074081a52ef34, 18)
, ('weeth-wrapped-eeth', 'weETH', 0x7dcc39b4d1c53cb31e1abc0e358b43987fef80f7, 18)
, ('lbtc-lombard-staked-btc', 'LBTC', 0xecac9c5f704e954931349da37f60e39f515c11c1, 8)
) as temp (token_id, symbol, contract_address, decimals)
1 change: 1 addition & 0 deletions dbt_subprojects/tokens/models/prices/prices_tokens.sql
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ ref('prices_native_tokens')
,ref('prices_sonic_tokens')
,ref('prices_ink_tokens')
,ref('prices_abstract_tokens')
,ref('prices_berachain_tokens')
] %}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ WITH trusted_tokens AS (
, ('zksync', 0x000000000000000000000000000000000000800a)
, ('zksync', 0xbbeb516fb02a01611cbbe0453fe3c580d7281011)
, ('zora', 0x4200000000000000000000000000000000000006)
, ('berachain', 0x5d3a1ff2b6bab83b63cd9ad0787074081a52ef34) -- USDe
, ('berachain', 0x7dcc39b4d1c53cb31e1abc0e358b43987fef80f7) -- weETH
, ('berachain', 0xecac9c5f704e954931349da37f60e39f515c11c1) -- LBTC
) AS t (blockchain, contract_address)
), erc20 as (
SELECT
Expand Down
21 changes: 21 additions & 0 deletions dbt_subprojects/tokens/models/tokens/berachain/_schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: 2

models:
- name: tokens_berachain_erc20
meta:
blockchain: berachain
sector: tokens
project: erc20
contributors: hosuke
config:
tags: ['table', 'erc20', 'berachain']
description: "ERC20 Token Addresses, Symbols and Decimals"
columns:
- name: contract_address
description: "ERC20 token contract address"
data_tests:
- unique
- name: symbol
description: "ERC20 token symbol"
- name: decimals
description: "Number of decimals, refers to how divisible an ERC20 token can be"
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{
config(
schema = 'tokens_berachain'
,alias = 'erc20'
,tags = ['static']
,materialized = 'table'
)
}}

SELECT
contract_address
, symbol
, decimals
FROM (VALUES
(0x5d3a1ff2b6bab83b63cd9ad0787074081a52ef34, 'USDe', 18)
, (0x7dcc39b4d1c53cb31e1abc0e358b43987fef80f7, 'weETH', 18)
, (0xecac9c5f704e954931349da37f60e39f515c11c1, 'LBTC', 8)
) AS temp_table (contract_address, symbol, 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 @@ -36,6 +36,7 @@
,"zora"
,"bob"
,"sonic"
,"berachain"
]\',
"sector",
"tokens",
Expand Down Expand Up @@ -83,6 +84,7 @@
,'tokens_corn': {'blockchain': 'corn', 'model': ref('tokens_corn_erc20')}
,'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')}
} %}

with automated_source as (
Expand Down
Loading

0 comments on commit 4b6790b

Please sign in to comment.