Skip to content

Commit

Permalink
DUX-762 Init sonic chain (#7341)
Browse files Browse the repository at this point in the history
* Init sonic chain

* Update dbt_subprojects/daily_spellbook/models/evms/evms_info.sql

* Add docs

* Modify docs

* Update dbt_subprojects/daily_spellbook/models/evms/evms_info.sql

* Add sonic prices

* Add beets

* fix BEETS

* fix weth address, update prices and trusted tokens, add unique test

---------

Co-authored-by: jeff-dude <[email protected]>
Co-authored-by: 0xRob <[email protected]>
Co-authored-by: jeff-dude <[email protected]>
  • Loading branch information
4 people authored Jan 3, 2025
1 parent 23d8110 commit 70f01d0
Show file tree
Hide file tree
Showing 8 changed files with 920 additions and 3 deletions.
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 @@ -22,6 +22,7 @@
, "ronin"
, "scroll"
, "sei"
, "sonic"
, "viction"
, "worldchain"
, "zksync"
Expand Down Expand Up @@ -95,4 +96,5 @@ FROM (
, (2020, 'ronin', 'Ronin', 'Layer 1', null, 'RON', 0xe514d9deb7966c8be0ca922de8a064264ea6bcd4, 'https://app.roninchain.com/', timestamp '2021-01-25 10:49', NULL, NULL, NULL, true)
, (14, 'flare', 'Flare', 'Layer 1', NULL, 'FLR', NULL, 'https://flare-explorer.flare.network/', timestamp '2022-07-13 15:32', NULL, NULL, NULL, true)
, (88, 'viction', 'Viction', 'Layer 1', NULL, 'VIC', 0xC054751BdBD24Ae713BA3Dc9Bd9434aBe2abc1ce, 'https://vicscan.xyz/', timestamp '2018-12-14 07:50:20', 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)
) 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 @@ -27,6 +27,7 @@
, "scroll"
, "sei"
, "solana"
, "sonic"
, "viction"
, "worldchain"
, "zksync"
Expand Down Expand Up @@ -70,6 +71,7 @@ ref('prices_native_tokens')
,ref('prices_ronin_tokens')
,ref('prices_boba_tokens')
,ref('prices_viction_tokens')
,ref('prices_sonic_tokens')
] %}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ WITH trusted_tokens AS (
, ('solana', from_base58('mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So'))
, ('solana', from_base58('Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB'))
, ('solana', from_base58('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'))
, ('sonic', 0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38)
, ('sonic', 0x29219dd400f2Bf60E5a23d13Be72B486D4038894)
, ('sonic', 0x50c42dEAcD8Fc9773493ED674b675bE577f2634b)
, ('sonic', 0xe715cba7b5ccb33790cebff1436809d36cb17e57)
, ('worldchain', 0x2cFc85d8E48F8EAB294be644d9E25C3030863003)
, ('worldchain', 0x79A02482A880bCE3F13e09Da970dC34db4CD24d1)
, ('worldchain', 0x03C7054BCB39f7b2e5B2c7AcB37583e32D70Cfa3)
Expand Down
24 changes: 24 additions & 0 deletions dbt_subprojects/tokens/models/prices/sonic/_schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: 2

models:
- name: prices_sonic_tokens
meta:
blockchain: sonic
sector: tokens
contributors: hosuke
config:
tags: ['tokens', 'sonic', 'prices']
description: "Token prices and metadata on Sonic"
columns:
- name: token_id
description: "Unique identifier for the token"
- name: blockchain
description: "Blockchain where the token is deployed"
- name: symbol
description: "Token symbol"
- name: contract_address
description: "Contract address of the token"
data_tests:
- unique
- name: decimals
description: "Number of decimal places for the token"
26 changes: 26 additions & 0 deletions dbt_subprojects/tokens/models/prices/sonic/prices_sonic_tokens.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{% set blockchain = 'sonic' %}

{{ 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
('ftm-fantom', 'wS', 0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38, 18) -- looks like FTM <--> S token are same price and 1:1 upgrade according to docs
, ('usdc-usd-coin', 'USDC.e', 0x29219dd400f2Bf60E5a23d13Be72B486D4038894, 6)
, ('weth-weth', 'WETH', 0x50c42dEAcD8Fc9773493ED674b675bE577f2634b, 18)
, ('euroc-euro-coin', 'EURC.e', 0xe715cba7b5ccb33790cebff1436809d36cb17e57, 6)
, ('beets-beethoven-x', 'BEETS', 0x2d0e0814e62d80056181f5cd932274405966e4f0, 18)
) as temp (token_id, symbol, contract_address, decimals)
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ SELECT
, symbol
, decimals
FROM (VALUES
(0x309C92261178fA0CF748A855e90Ae73FDb79EBc7, 'WETH', 18)
, (0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38, 'WS', 18)
(0x50c42dEAcD8Fc9773493ED674b675bE577f2634b, 'WETH', 18)
, (0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38, 'wS', 18)
, (0x29219dd400f2Bf60E5a23d13Be72B486D4038894, 'USDC.e', 6)
, (0xe715cba7b5ccb33790cebff1436809d36cb17e57, 'EURC.e', 6)
, (0xf2f9f482a395b4dd5b5b92173b7d62f3aff92884, 'DOG', 18)
Expand All @@ -23,5 +23,5 @@ FROM (VALUES
, (0x2030170901a9d87f6bd0ca9b8ad130119c7e1173, 'BABYSONIC', 9)
, (0xe5da20f15420ad15de0fa650600afc998bbe3955, 'stS', 18)
, (0xd4a5c68a1ed1fc2bb06cba2d90d6adeee7503671, 'HOOPS', 18)

, (0x2d0e0814e62d80056181f5cd932274405966e4f0, 'BEETS', 18)
) as temp (contract_address, symbol, decimals)
Loading

0 comments on commit 70f01d0

Please sign in to comment.