Skip to content

Commit

Permalink
Initiate ink chain (duneanalytics#7469)
Browse files Browse the repository at this point in the history
* Add Ink sources

* Fix docs

* Update ink_base_sources.yml

* initiate ink

* fix bugs, remove tests

---------

Co-authored-by: jeff-dude <[email protected]>
  • Loading branch information
Hosuke and jeff-dude authored Jan 17, 2025
1 parent de9c7a0 commit df73c4b
Show file tree
Hide file tree
Showing 13 changed files with 903 additions and 5 deletions.
3 changes: 3 additions & 0 deletions dbt_subprojects/daily_spellbook/models/evms/evms_info.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
, "fantom"
, "flare"
, "gnosis"
, "ink"
, "kaia"
, "linea"
, "nova"
Expand Down Expand Up @@ -99,4 +100,6 @@ FROM (
, (88, 'viction', 'Viction', 'Layer 1', NULL, 'VIC', 0xC054751BdBD24Ae713BA3Dc9Bd9434aBe2abc1ce, 'https://vicscan.xyz/', timestamp '2018-12-14 07:50:20', NULL, NULL, NULL, true)
, (21000000, 'corn', 'Corn', 'Layer 1', NULL, 'BTCN', NULL, 'https://cornscan.io/', timestamp '2024-11-19 10:29:11', NULL, NULL, NULL, true)
, (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)
) 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)

Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ models:

- name: evms_info
meta:
blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle, mode, sei, ronin
blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle, mode, sei, ronin, ink
sector: evms
contributors: hildobby
config:
Expand Down
4 changes: 2 additions & 2 deletions dbt_subprojects/tokens/models/prices/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ models:

- name: prices_tokens
meta:
blockchain: arbitrum, avalanche_c, gnosis, polygon, optimism, ethereum, bnb, solana, fantom, celo, base, zksync, zora, linea, zkevm, blast, sei, nova, worldchain, kaia, ronin
blockchain: arbitrum, avalanche_c, gnosis, polygon, optimism, ethereum, bnb, solana, fantom, celo, base, zksync, zora, linea, zkevm, blast, sei, nova, worldchain, kaia, ronin, ink
sector: prices
contributors: aalan3, hildobby, pipistrella, viniabussafi, jeff-dude, hosuke
config:
Expand All @@ -171,7 +171,7 @@ models:

- name: prices_native_tokens
meta:
blockchain: arbitrum, avalanche_c, gnosis, polygon, optimism, ethereum, bnb, solana, fantom, celo, zksync, zora, sei, nova, worldchain, kaia, ronin
blockchain: arbitrum, avalanche_c, gnosis, polygon, optimism, ethereum, bnb, solana, fantom, celo, zksync, zora, sei, nova, worldchain, kaia, ronin, ink
sector: prices
contributors: aalan3, jeff-dude
config:
Expand Down
29 changes: 29 additions & 0 deletions dbt_subprojects/tokens/models/prices/ink/_schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: 2

models:
- name: prices_ink_tokens
meta:
blockchain: ink
sector: prices
contributors: jeff-dude
config:
tags: ['prices', 'tokens', 'usd', 'ink']
description: "Price tokens on ink 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. 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: [ "ink" ]
- 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"
23 changes: 23 additions & 0 deletions dbt_subprojects/tokens/models/prices/ink/prices_ink_tokens.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{% set blockchain = 'ink' %}

{{ 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.e', 0xF1815bd50389c46847f0Bda824eC8da914045D14, 6)
) as temp (token_id, symbol, contract_address, decimals)
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 @@ -19,6 +19,7 @@
, "fantom"
, "flare"
, "gnosis"
, "ink"
, "kaia"
, "linea"
, "nova"
Expand Down Expand Up @@ -74,6 +75,7 @@ ref('prices_native_tokens')
,ref('prices_viction_tokens')
,ref('prices_corn_tokens')
,ref('prices_sonic_tokens')
,ref('prices_ink_tokens')
] %}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ WITH trusted_tokens AS (
, ('gnosis', 0x8e5bbbb09ed1ebde8674cda39a0c169401db4252)
, ('gnosis', 0x44fa8e6f47987339850636f88629646662444217)
, ('gnosis', 0xdd96b45877d0e8361a4ddb732da741e97f3191ff)
, ('ink', 0x4200000000000000000000000000000000000006)
, ('ink', 0xf1815bd50389c46847f0bda824ec8da914045d14)
, ('kaia', 0x5c13e303a62fc5dedf5b52d66873f2e59fedadc2)
, ('kaia', 0x608792deb376cce1c9fa4d0e6b7b44f507cffa6a)
, ('kaia', 0x19aac5f612f524b754ca7e7c41cbfa2e981a4432)
Expand Down
4 changes: 2 additions & 2 deletions dbt_subprojects/tokens/models/tokens/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ version: 2
models:
- name: tokens_erc20
meta:
blockchain: arbitrum, avalanche_c, bnb, ethereum, gnosis, mantle, optimism, fantom, polygon, base, blast, sepolia, sei, nova, worldchain, kaia, ronin, boba, flare, viction, sonic
blockchain: arbitrum, avalanche_c, bnb, ethereum, gnosis, mantle, optimism, fantom, polygon, base, blast, sepolia, sei, nova, worldchain, kaia, ronin, boba, flare, viction, sonic, ink
sector: tokens
contributors: hildobby, 0xManny, dot2dotseurat, soispoke, mtitus6, wuligy, angus_1, Henrystats, viniabussafi, jeff-dude, rantum, hosuke, irishlatte19
config:
tags: ['tokens','erc20', 'arbitrum', 'avalanche_c', 'bnb', 'ethereum', 'gnosis', 'mantle', 'optimism', 'fantom', 'base', 'blast', 'sei', 'nova', 'linea', 'worldchain', 'kaia', 'ronin', 'boba', 'flare', 'viction', 'sonic']
tags: ['tokens','erc20', 'arbitrum', 'avalanche_c', 'bnb', 'ethereum', 'gnosis', 'mantle', 'optimism', 'fantom', 'base', 'blast', 'sei', 'nova', 'linea', 'worldchain', 'kaia', 'ronin', 'boba', 'flare', 'viction', 'sonic', 'ink']

description: >
Crosschain ERC20 tokens
Expand Down
21 changes: 21 additions & 0 deletions dbt_subprojects/tokens/models/tokens/ink/_schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: 2

models:
- name: tokens_ink_erc20
meta:
blockchain: ink
sector: tokens
project: erc20
contributors: jeff-dude
config:
tags: ['table', 'erc20', 'ink']
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"
20 changes: 20 additions & 0 deletions dbt_subprojects/tokens/models/tokens/ink/tokens_ink_erc20.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{
config(
schema = 'tokens_ink'
,alias = 'erc20'
,tags = ['static']
,materialized = 'table'
)
}}

SELECT
contract_address
, symbol
, decimals
FROM (VALUES
(0x4200000000000000000000000000000000000006, 'WETH', 18)
, (0xf1815bd50389c46847f0bda824ec8da914045d14, 'USDC.e', 6)
, (0xca5f2ccbd9c40b32657df57c716de44237f80f05, 'KRAKEN', 18)
, (0x2e1ac42aef8dc9fb4c661d017273e93ba82d3d0e, 'IAGENT', 18)
, (0xbf0cafcbaaf0be8221ae8d630500984edc908861, 'SQUIDS', 18)
) 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 @@ -18,6 +18,7 @@
,"fuse"
,"gnosis"
,"goerli"
,"ink"
,"kaia"
,"linea"
,"mantle"
Expand Down Expand Up @@ -79,6 +80,7 @@
,'tokens_viction': {'blockchain': 'viction', 'model': ref('tokens_viction_erc20')}
,'tokens_sonic': {'blockchain': 'sonic', 'model': ref('tokens_sonic_erc20')}
,'tokens_corn': {'blockchain': 'corn', 'model': ref('tokens_corn_erc20')}
,'tokens_ink': {'blockchain': 'ink', 'model': ref('tokens_ink_erc20')}
} %}

with automated_source as (
Expand Down
Loading

0 comments on commit df73c4b

Please sign in to comment.