Skip to content

Commit

Permalink
Init flare chain
Browse files Browse the repository at this point in the history
  • Loading branch information
Hosuke committed Dec 2, 2024
1 parent 4f27a03 commit 8592350
Show file tree
Hide file tree
Showing 11 changed files with 362 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ FROM ( values
,('Metadium Mainnet' ,'META' ,'META' ,'11' ,'11' ,'https://metadium.com' ,'')
,('Metadium Testnet' ,'META' ,'KAL' ,'12' ,'12' ,'https://metadium.com' ,'')
,('Diode Testnet Staging' ,'DIODE' ,'sDIODE' ,'13' ,'13' ,'https://diode.io/staging' ,'')
,('Flare Mainnet' ,'FLR' ,'FLR' ,'14' ,'14' ,'https://flare.xyz' ,'https://flare-explorer.flare.network')
,('Flare Mainnet', 'FLR', 'FLR', '14', '14', 'https://flare.network', 'https://flare-explorer.flare.network')
,('Diode Prenet' ,'DIODE' ,'DIODE' ,'15' ,'15' ,'https://diode.io/prenet' ,'')
,('Flare Testnet Coston' ,'FLR' ,'CFLR' ,'16' ,'16' ,'https://flare.xyz' ,'https://coston-explorer.flare.network')
,('Flare Testnet Coston', 'CFLR', 'CFLR', '16', '16', 'https://flare.network', 'https://coston-explorer.flare.network')
,('ThaiChain 2.0 ThaiFi' ,'TCH' ,'TFI' ,'17' ,'17' ,'https://exp.thaifi.com' ,'')
,('ThunderCore Testnet' ,'TST' ,'TST' ,'18' ,'18' ,'https://thundercore.com' ,'https://explorer-testnet.thundercore.com')
,('Songbird Canary-Network' ,'SGB' ,'SGB' ,'19' ,'19' ,'https://flare.xyz' ,'https://songbird-explorer.flare.network')
,('Songbird Canary-Network' ,'SGB' ,'SGB' ,'19' ,'19' ,'https://flare.network' ,'https://songbird-explorer.flare.network')
,('Elastos Smart Chain' ,'ETH' ,'ELA' ,'20' ,'20' ,'https://www.elastos.org/' ,'https://esc.elastos.io')
,('Elastos Smart Chain Testnet' ,'ETH' ,'tELA' ,'21' ,'21' ,'https://www.elastos.org/' ,'https://esc-testnet.elastos.io')
,('ELA-DID-Sidechain Mainnet' ,'ETH' ,'ELA' ,'22' ,'22' ,'https://www.elastos.org/' ,'')
Expand Down
3 changes: 2 additions & 1 deletion dbt_subprojects/daily_spellbook/models/evms/evms_info.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
, "celo"
, "ethereum"
, "fantom"
, "flare"
, "gnosis"
, "kaia"
, "linea"
Expand Down Expand Up @@ -90,5 +91,5 @@ FROM (
, (5000, 'mantle', 'Mantle', 'Layer 2', 'Optimistic Rollup', 'MNT', 0x78c1b0c915c4faa5fffa6cabf0219da63d7f4cb8, 'https://mantlescan.xyz/', timestamp '2023-07-02 18:21', 'Optimistic Virtual Machine', 'Ethereum', 'Ethereum', true)
, (42170, 'nova', 'Arbitrum Nova', 'Layer 2', 'Optimistic Rollup', 'ETH', 0x722e8bdd2ce80a4422e880164f2079488e115365, 'https://nova-explorer.arbitrum.io/', timestamp '2022-06-25 04:01', 'Arbitrum', 'Ethereum', 'Ethereum', true)
, (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)
) 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/flare/_schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: 2

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

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

SELECT
token_id
, '{{ blockchain }}' as blockchain
, symbol
, contract_address
, decimals
FROM
(
VALUES
('flare-flare', 'WFLR', 0x1D80c49BbBCd1C0911346656B529DF9E5c2F783d, 18)
-- Note: Currently only WFLR has a reliable price feed. Other tokens will be added
-- when they have established price feeds on major price aggregators.
) as temp (token_id, symbol, contract_address, decimals)
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ FROM
('eos-eos', null, 'EOS', null, null),
('etc-ethereum-classic', null, 'ETC', null, null),
('eth-ethereum', null, 'ETH', null, null),
('flare-flare', null, 'FLR', null, null),
('ftm-fantom', null, 'FTM', null, null),
('hbar-hedera-hashgraph', null, 'HBAR', null, null),
('icp-internet-computer', null, 'ICP', null, null),
Expand Down
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 @@ -15,6 +15,7 @@
, "celo"
, "ethereum"
, "fantom"
, "flare"
, "gnosis"
, "kaia"
, "linea"
Expand Down Expand Up @@ -45,6 +46,7 @@ ref('prices_native_tokens')
,ref('prices_cardano_tokens')
,ref('prices_ethereum_tokens')
,ref('prices_fantom_tokens')
,ref('prices_flare_tokens')
,ref('prices_gnosis_tokens')
,ref('prices_optimism_tokens')
,ref('prices_polygon_tokens')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ WITH trusted_tokens AS (
, ('ethereum', 0x2260fac5e5542a773aa44fbcfedf7c193bc2c599)
, ('ethereum', 0xf939e0a03fb07f59a73314e73794be0e57ac1b4e)
, ('fantom', 0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83)
, ('flare', 0x1D80c49BbBCd1C0911346656B529DF9E5c2F783d)
, ('fantom', 0x04068da6c83afcfa0e13ba15a6696662335d5b75)
, ('fantom', 0x74b23882a30290451a17c44f4f05243b6b58c76d)
, ('fantom', 0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e)
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
blockchain: arbitrum, avalanche_c, bnb, ethereum, gnosis, mantle, optimism, fantom, polygon, base, blast, sepolia, sei, nova, worldchain, kaia, ronin, boba, flare
sector: tokens
contributors: hildobby, 0xManny, dot2dotseurat, soispoke, mtitus6, wuligy, angus_1, Henrystats, viniabussafi, jeff-dude, rantum, hosuke
config:
tags: ['tokens','erc20', 'arbitrum', 'avalanche_c', 'bnb', 'ethereum', 'gnosis', 'mantle', 'optimism', 'fantom', 'base', 'blast', 'sei', 'nova', 'linea', 'worldchain', 'kaia', 'ronin']
tags: ['tokens','erc20', 'arbitrum', 'avalanche_c', 'bnb', 'ethereum', 'gnosis', 'mantle', 'optimism', 'fantom', 'base', 'blast', 'sei', 'nova', 'linea', 'worldchain', 'kaia', 'ronin', 'boba', 'flare']
description: >
Crosschain ERC20 tokens
data_tests:
Expand Down
30 changes: 30 additions & 0 deletions dbt_subprojects/tokens/models/tokens/flare/tokens_flare_erc20.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{{
config(
schema = 'tokens_flare',
alias = 'erc20',
post_hook = '{{ expose_spells(\'["flare"]\',
"sector",
"tokens",
\'["hosuke"]\') }}'
)
}}

SELECT DISTINCT
'flare' as blockchain,
contract_address,
symbol,
decimals,
token_name as name
FROM (
VALUES
-- Base tokens
(0x1D80c49BbBCd1C0911346656B529DF9E5c2F783d, 'Wrapped Flare', 'WFLR', 18),
-- Other tokens
(0x282b88514A52FcAdCD92b742745398f3574697d4, 'Finu', 'FINU', 18),
(0x64cB9bE6323c7a2cE39773674F380da30663bae4, 'ScottyCash', 'SCOTTY', 18),
(0xDE373AE127A11E756A9D1cc7743816928B239283, 'DAX.BEST', 'DAX', 18),
(0x932E691aA8c8306C4bB0b19F3f00a284371be8Ba, 'Phili Inu', 'PHIL', 18),
(0x22757fb83836e3F9F0F353126cACD3B1Dc82a387, 'FlareFox', 'FLX', 18),
(0xa80C114A90565C03BDCAbC1fcF913cC225d2c5ab, 'F-Asset Token', 'FASSET', 18),
(0xc6B19B06A92B337Cbca5f7334d29d45ec4d5E532, 'Dog on Moon', 'Moon', 18)
) as temp (contract_address, token_name, symbol, decimals)
75 changes: 75 additions & 0 deletions sources/_base_sources/evm/flare_docs_block.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{% docs flare_transactions_doc %}

The `flare.transactions` table contains detailed information about transactions on the flare blockchain. It includes:

- Block information: number, timestamp, hash
- Transaction details: hash, from_address, to_address, value
- Gas data: gas_price, gas_limit, gas_used
- Status: success or failure
- Input data for contract interactions
- Nonce
- Transaction type

This table is used for analyzing transaction patterns, gas usage, value transfers, and overall network activity on flare.

{% enddocs %}

{% docs flare_traces_doc %}

The `flare.traces` table contains records of execution steps for transactions on the flare blockchain. Each trace represents an atomic operation that modifies the state of the Ethereum Virtual Machine (EVM). Key components include:

- Transaction hash
- Block number and timestamp
- From and to addresses
- Value transferred
- Input data
- Call type (e.g., CALL, DELEGATECALL, CREATE)
- Gas information
- Error messages (if any)

This table is essential for:
- Analyzing internal transactions
- Debugging smart contract interactions
- Tracking value flows through complex transactions
- Understanding contract creation and deployment

{% enddocs %}

{% docs flare_logs_doc %}

The `flare.logs` table contains information about event logs emitted by smart contracts on the flare blockchain. It includes:

- Block information: number, timestamp
- Transaction hash
- Contract address (emitting the event)
- Topic0 (event signature)
- Additional topics (indexed parameters)
- Data field (non-indexed parameters)
- Log index

This table is crucial for:
- Tracking on-chain events
- Monitoring contract activity
- Analyzing token transfers
- Following protocol-specific events

{% enddocs %}

{% docs flare_contracts_doc %}

The `flare.contracts` table tracks decoded contracts on flare, including:

- Contract address
- Bytecode
- Contract name
- Namespace
- ABI
- Creation details

This table is used for:
- Contract verification
- Smart contract analysis
- Protocol research
- Development and debugging

{% enddocs %}
Loading

0 comments on commit 8592350

Please sign in to comment.