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

Initiate corn in spellbook #7394

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
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 @@ -10,6 +10,7 @@
, "bnb"
, "boba"
, "celo"
, "corn"
, "ethereum"
, "fantom"
, "flare"
Expand Down Expand Up @@ -96,5 +97,6 @@ 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)
, (21000000, 'corn', 'Corn', 'Layer 1', NULL, 'BTCN', NULL, 'https://cornscan.io/', timestamp '2024-11-19 10:29:11', NULL, NULL, NULL, false)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
, (21000000, 'corn', 'Corn', 'Layer 1', NULL, 'BTCN', NULL, 'https://cornscan.io/', timestamp '2024-11-19 10:29:11', NULL, NULL, NULL, false)
, (21000000, 'corn', 'Corn', 'Layer 1', NULL, 'BTCN', NULL, 'https://cornscan.io/', timestamp '2024-11-19 10:29:11', NULL, NULL, NULL, true)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

think we're safe to say true now, right?

, (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)
29 changes: 29 additions & 0 deletions dbt_subprojects/tokens/models/prices/corn/_schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: 2

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

{{ 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
('wbtc-wrapped-bitcoin', 'wBTCN', 0xda5ddd7270381a7c2717ad10d1c0ecb19e3cdfb2, 18)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good question, let me ask 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, we should be good to use bitcoin pricing for this. here is answer from corn team:

As per BTCN's pricing, it is designed to be pegged to the price of BTC indeed. It accomplishes this by introducing 1:1 backing to wBTC and cbBTC (both tightly pegged to BTC) and, hence, efficient arbitraging. BTCN's liquidity is starting to build up on Corn and hasn't met the standards for price trackers and Oracles. For this reason, assuming a 1:1 peg to BTC should be accurate enough for analytics/visualization purposes. Eventually, as it gets listed by Oracles and trackers, we should switch to its true market value.

, ('lbtc-lombard-staked-btc', 'LBTC', 0xecAc9C5F704e954931349Da37F60E39f515c11c1, 8)
, ('usdce-usd-coine', 'USDC.e', 0xDF0B24095e15044538866576754F3C964e902Ee6, 6)
, ('pumpbtc-pumpbtc', 'pumpBTC', 0xF469fBD2abcd6B9de8E169d128226C0Fc90a012e, 8)
) 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 @@ -14,6 +14,7 @@
, "boba"
, "cardano"
, "celo"
, "corn"
, "ethereum"
, "fantom"
, "flare"
Expand Down Expand Up @@ -71,6 +72,7 @@ ref('prices_native_tokens')
,ref('prices_ronin_tokens')
,ref('prices_boba_tokens')
,ref('prices_viction_tokens')
,ref('prices_corn_tokens')
,ref('prices_sonic_tokens')
] %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ WITH trusted_tokens AS (
, ('celo', 0xd629eb00deced2a080b7ec630ef6ac117e614f1b)
, ('celo', 0x639a647fbe20b6c8ac19e48e2de44ea792c62c5c)
, ('celo', 0x48065fbbe25f71c9282ddf5e1cd6d6a887483d5e)
, ('corn', 0xda5ddd7270381a7c2717ad10d1c0ecb19e3cdfb2) -- WBTCN
, ('corn', 0xecac9c5f704e954931349da37f60e39f515c11c1) -- LBTC
, ('corn', 0xdf0b24095e15044538866576754f3c964e902ee6) -- USDC.e
, ('corn', 0xf469fbd2abcd6b9de8e169d128226c0fc90a012e) -- pumpBTC
, ('ethereum', 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2)
, ('ethereum', 0xdac17f958d2ee523a2206206994597c13d831ec7)
, ('ethereum', 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48)
Expand Down
25 changes: 25 additions & 0 deletions dbt_subprojects/tokens/models/tokens/corn/schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: 2

models:
- name: tokens_corn_erc20
meta:
blockchain: corn
sector: tokens
contributors: hosuke
config:
tags: ['tokens', 'corn', 'erc20']
description: "Known CORN ERC20 tokens"
columns:
- name: contract_address
description: "Contract address of the ERC20 token"
data_tests:
- unique
- not_null
- name: symbol
description: "Symbol of the token"
data_tests:
- not_null
- name: decimals
description: "Number of decimals the token has"
data_tests:
- not_null
19 changes: 19 additions & 0 deletions dbt_subprojects/tokens/models/tokens/corn/tokens_corn_erc20.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{
config(
schema = 'tokens_corn'
,alias = 'erc20'
,tags = ['static']
,materialized = 'table'
)
}}

SELECT
contract_address
, symbol
, decimals
FROM (VALUES
(0xda5ddd7270381a7c2717ad10d1c0ecb19e3cdfb2, 'wBTCN', 18)
, (0xecAc9C5F704e954931349Da37F60E39f515c11c1, 'LBTC', 8)
, (0xDF0B24095e15044538866576754F3C964e902Ee6, 'USDC.e', 6)
, (0xF469fBD2abcd6B9de8E169d128226C0Fc90a012e, 'pumpBTC', 8)
) as temp (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 @@ -12,6 +12,7 @@
,"bnb"
,"boba"
,"celo"
,"corn"
,"ethereum"
,"fantom"
,"fuse"
Expand Down Expand Up @@ -77,6 +78,7 @@
,'tokens_boba': {'blockchain': 'boba', 'model': ref('tokens_boba_erc20')}
,'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')}
} %}

with automated_source as (
Expand Down
Loading
Loading