-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Init flare dex #7243
Draft
Hosuke
wants to merge
48
commits into
duneanalytics:main
Choose a base branch
from
Hosuke:1202-init-flare
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Init flare dex #7243
Changes from all commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
8592350
Init flare chain
Hosuke 7ab7883
fix price
Hosuke 5307ccd
Fix source
Hosuke 47524d5
Merge branch '1202-init-flare' of ssh://github.com/Hosuke/spellbook i…
Hosuke 1ed5702
Add tokens.erc20
Hosuke 390bf60
Merge branch 'main' into 1202-init-flare
Hosuke 124ad53
Update flare tokens
Hosuke e87fa52
Verify source table schema
Hosuke 24944a9
Fix source
Hosuke e965bf8
Complete docs block
Hosuke f4ac044
Update prices_flare_tokens.sql
Hosuke 715c31c
Fix native token
Hosuke 78a7222
Add yakufff's credit
Hosuke b8b0b02
Remove post_hook
Hosuke 2d80043
Update schema
Hosuke 3597854
Init flare dex
Hosuke 428cc8d
Merge branch 'main' into 1202-init-flare
Hosuke ab4b6bc
Fix param
Hosuke 0228adf
Update prices
Hosuke 1e2864f
Add flare dexes
Hosuke dd4aa1f
Add soruce
Hosuke 7bad8d6
Update dbt_subprojects/tokens/models/prices/flare/prices_flare_tokens…
Hosuke 946fd3d
Merge branch 'main' into 1202-init-flare
Hosuke c3eac5e
Fix macro name
Hosuke c7afb8d
Fix param
Hosuke b962d91
Remove blazeswap as source not available yet
Hosuke 4f90e63
Update dbt_subprojects/tokens/models/prices/flare/prices_flare_tokens…
Hosuke d8ea547
Remove sparkdex_v2 as source not available yet
Hosuke 7038f8b
Merge branch 'main' into 1202-init-flare
Hosuke 971bfa1
Add sparkdex into dex.info
Hosuke 74b7ac6
Add sparkdex seed
Hosuke fc179af
Merge branch 'main' into 1202-init-flare
Hosuke 0aabb40
Revert "Remove sparkdex_v2 as source not available yet"
Hosuke c11c6ba
Revert "Remove blazeswap as source not available yet"
Hosuke 5fa11d5
Merge branch 'main' into 1202-init-flare
Hosuke 66f1266
Update sources/_sector/dex/trades/flare/_sources.yml
Hosuke cc59fa1
Merge branch 'main' into 1202-init-flare
Hosuke c329da2
Update blazeswap_flare_base_trades
Hosuke 19c8ff8
Add test for blazeswap
Hosuke 3b93c79
Update sources/_sector/dex/trades/flare/_sources.yml
Hosuke 5cb7a4c
Update dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v2_…
Hosuke 89a1b29
Merge branch 'main' into 1202-init-flare
Hosuke 96dabd3
Refresh schema
Hosuke f405830
Try to fix bug
Hosuke 7da8284
Add seeds
Hosuke d921508
Add flare
Hosuke 99cb987
Merge branch 'main' into 1202-init-flare
0xRobin 431e6bd
Merge branch 'main' into 1202-init-flare
Hosuke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
version: 2 | ||
|
||
models: | ||
- name: dex_flare_base_trades | ||
meta: | ||
blockchain: flare | ||
sector: dex | ||
project: dex | ||
contributors: hosuke | ||
config: | ||
tags: ['flare', 'dex', 'trades'] | ||
description: > | ||
Flare DEX trades | ||
data_tests: | ||
- check_dex_info_relationship | ||
|
||
- name: enosys_v2_flare_base_trades | ||
meta: | ||
blockchain: flare | ||
sector: dex | ||
project: enosys | ||
contributors: hosuke | ||
config: | ||
tags: [ 'flare', 'dex', 'trades', 'enosys', 'v2' ] | ||
description: "Enosys V2 Flare base trades" | ||
data_tests: | ||
- dbt_utils.unique_combination_of_columns: | ||
combination_of_columns: | ||
- tx_hash | ||
- evt_index | ||
|
||
- name: enosys_v3_flare_base_trades | ||
meta: | ||
blockchain: flare | ||
sector: dex | ||
project: enosys | ||
contributors: hosuke | ||
config: | ||
tags: [ 'flare', 'dex', 'trades', 'enosys', 'v3' ] | ||
description: "Enosys V3 Flare base trades" | ||
data_tests: | ||
- dbt_utils.unique_combination_of_columns: | ||
combination_of_columns: | ||
- tx_hash | ||
- evt_index | ||
|
||
- name: sparkdex_v2_flare_base_trades | ||
meta: | ||
blockchain: flare | ||
sector: dex | ||
project: sparkdex | ||
contributors: hosuke | ||
config: | ||
tags: ['flare', 'dex', 'trades', 'sparkdex', 'v2'] | ||
description: "SparkDex (UniswapV2 fork) base trades on Flare" | ||
data_tests: | ||
- dbt_utils.unique_combination_of_columns: | ||
combination_of_columns: | ||
- tx_hash | ||
- evt_index | ||
- check_dex_base_trades_seed: | ||
seed_file: ref('sparkdex_flare_base_trades_seed') | ||
filter: | ||
version: 2 | ||
|
||
- name: sparkdex_v3_flare_base_trades | ||
meta: | ||
blockchain: flare | ||
sector: dex | ||
project: sparkdex | ||
contributors: hosuke | ||
config: | ||
tags: [ 'flare', 'dex', 'trades', 'sparkdex', 'v3' ] | ||
description: "SparkDex (UniswapV3 fork) base trades on Flare" | ||
data_tests: | ||
- dbt_utils.unique_combination_of_columns: | ||
combination_of_columns: | ||
- tx_hash | ||
- evt_index | ||
- check_dex_base_trades_seed: | ||
seed_file: ref('sparkdex_flare_base_trades_seed') | ||
filter: | ||
version: 3 | ||
|
||
- name: blazeswap_flare_base_trades | ||
meta: | ||
blockchain: flare | ||
sector: dex | ||
project: blazeswap | ||
contributors: hosuke | ||
config: | ||
tags: [ 'flare', 'dex', 'trades', 'blazeswap' ] | ||
description: "Blazeswap Flare base trades" | ||
data_tests: | ||
- dbt_utils.unique_combination_of_columns: | ||
combination_of_columns: | ||
- tx_hash | ||
- evt_index | ||
- check_dex_base_trades_seed: | ||
seed_file: ref('blazeswap_flare_base_trades_seed') |
52 changes: 52 additions & 0 deletions
52
dbt_subprojects/dex/models/trades/flare/dex_flare_base_trades.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{{ config( | ||
schema = 'dex_flare' | ||
, alias = 'base_trades' | ||
, materialized = 'view' | ||
) | ||
}} | ||
|
||
{% set base_models = [ | ||
ref('enosys_v2_flare_base_trades') | ||
, ref('enosys_v3_flare_base_trades') | ||
, ref('sparkdex_v2_flare_base_trades') | ||
, ref('sparkdex_v3_flare_base_trades') | ||
, ref('blazeswap_flare_base_trades') | ||
] %} | ||
|
||
WITH base_union AS ( | ||
SELECT * | ||
FROM ( | ||
{% for base_model in base_models %} | ||
SELECT | ||
blockchain | ||
, project | ||
, version | ||
, block_month | ||
, block_date | ||
, block_time | ||
, block_number | ||
, token_bought_amount_raw | ||
, token_sold_amount_raw | ||
, token_bought_address | ||
, token_sold_address | ||
, taker | ||
, maker | ||
, project_contract_address | ||
, tx_hash | ||
, evt_index | ||
FROM | ||
{{ base_model }} | ||
{% if not loop.last %} | ||
UNION ALL | ||
{% endif %} | ||
{% endfor %} | ||
) | ||
) | ||
|
||
{{ | ||
add_tx_columns( | ||
model_cte = 'base_union' | ||
, blockchain = 'flare' | ||
, columns = ['from', 'to', 'index'] | ||
) | ||
}} |
21 changes: 21 additions & 0 deletions
21
dbt_subprojects/dex/models/trades/flare/platforms/blazeswap_flare_base_trades.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{{ | ||
config( | ||
schema = 'blazeswap_flare', | ||
alias = 'base_trades', | ||
materialized = 'incremental', | ||
file_format = 'delta', | ||
incremental_strategy = 'merge', | ||
unique_key = ['tx_hash', 'evt_index'], | ||
incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] | ||
) | ||
}} | ||
|
||
{{ | ||
uniswap_compatible_v2_trades( | ||
blockchain = 'flare', | ||
project = 'blazeswap', | ||
version = '2', | ||
Pair_evt_Swap = source('blazeswap_flare', 'BLAZE_LP_evt_Swap'), | ||
Factory_evt_PairCreated = source('blazeswap_flare', 'BlazeSwapFactory_evt_PairCreated') | ||
) | ||
}} |
20 changes: 20 additions & 0 deletions
20
dbt_subprojects/dex/models/trades/flare/platforms/enosys_v2_flare_base_trades.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{{ config( | ||
schema = 'enosys_v2_flare' | ||
, alias = 'base_trades' | ||
, materialized = 'incremental' | ||
, file_format = 'delta' | ||
, incremental_strategy = 'merge' | ||
, unique_key = ['tx_hash', 'evt_index'] | ||
, incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] | ||
) | ||
}} | ||
|
||
{{ | ||
uniswap_compatible_v2_trades( | ||
blockchain = 'flare' | ||
, project = 'enosys' | ||
, version = '2' | ||
, Pair_evt_Swap = source('enosys_flare', 'EnosysDexPair_evt_Swap') | ||
, Factory_evt_PairCreated = source('enosys_flare', 'EnosysDexFactory_evt_PairCreated') | ||
) | ||
}} |
20 changes: 20 additions & 0 deletions
20
dbt_subprojects/dex/models/trades/flare/platforms/enosys_v3_flare_base_trades.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{{ config( | ||
schema = 'enosys_v3_flare' | ||
, alias = 'base_trades' | ||
, materialized = 'incremental' | ||
, file_format = 'delta' | ||
, incremental_strategy = 'merge' | ||
, unique_key = ['tx_hash', 'evt_index'] | ||
, incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] | ||
) | ||
}} | ||
|
||
{{ | ||
uniswap_compatible_v3_trades( | ||
blockchain = 'flare' | ||
, project = 'enosys' | ||
, version = '3' | ||
, Pair_evt_Swap = source('enosys_flare', 'EnosysDexV3Pool_evt_Swap') | ||
, Factory_evt_PoolCreated = source('enosys_flare', 'EnosysDexV3Factory_evt_PoolCreated') | ||
) | ||
}} |
21 changes: 21 additions & 0 deletions
21
dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v2_flare_base_trades.sql
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{{ | ||
config( | ||
schema = 'sparkdex_v2_flare', | ||
alias = 'base_trades', | ||
materialized = 'incremental', | ||
file_format = 'delta', | ||
incremental_strategy = 'merge', | ||
unique_key = ['tx_hash', 'evt_index'], | ||
incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] | ||
) | ||
}} | ||
|
||
{{ | ||
uniswap_compatible_v2_trades( | ||
blockchain = 'flare', | ||
project = 'sparkdex', | ||
version = '2', | ||
Pair_evt_Swap = source('sparkdex_flare', 'UniswapV2Pool_evt_Swap'), | ||
Factory_evt_PairCreated = source('sparkdex_flare', 'UniswapV2Factory_evt_PairCreated') | ||
) | ||
}} |
21 changes: 21 additions & 0 deletions
21
dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v3_flare_base_trades.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{{ | ||
config( | ||
schema = 'sparkdex_v3_flare', | ||
alias = 'base_trades', | ||
materialized = 'incremental', | ||
file_format = 'delta', | ||
incremental_strategy = 'merge', | ||
unique_key = ['tx_hash', 'evt_index'], | ||
incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] | ||
) | ||
}} | ||
|
||
{{ | ||
uniswap_compatible_v3_trades( | ||
blockchain = 'flare', | ||
project = 'sparkdex', | ||
version = '3', | ||
Pair_evt_Swap = source('sparkdex_flare', 'UniswapV3Pool_evt_Swap'), | ||
Factory_evt_PoolCreated = source('sparkdex_flare', 'UniswapV3Factory_evt_PoolCreated') | ||
) | ||
}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
dbt_subprojects/dex/seeds/trades/blazeswap_flare_base_trades_seed.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
blockchain,project,version,block_date,tx_hash,evt_index,token_bought_address,token_sold_address,block_number,token_bought_amount_raw,token_sold_amount_raw | ||
flare,blazeswap,2,2024-10-06,0x51407c99b67d71815b993420f8811900b5865cb673ba893ef07dcca5f85aa06d,30,0xe6505f92583103af7ed9974dec451a7af4e3a3be,0x1d80c49bbbcd1c0911346656b529df9e5c2f783d,30881152,1335216349117423088152,5497558138880000000000 | ||
flare,blazeswap,2,2024-10-17,0x55de50c11e29636db85763b75c25a2b718dc18b4fe2c37539e5f324ac52e6e24,30,0x1d80c49bbbcd1c0911346656b529df9e5c2f783d,0xe6505f92583103af7ed9974dec451a7af4e3a3be,31449410,105931708336615473057,44371879946728776388 |
5 changes: 5 additions & 0 deletions
5
dbt_subprojects/dex/seeds/trades/sparkdex_flare_base_trades_seed.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
blockchain,project,version,block_date,tx_hash,evt_index,token_bought_address,token_sold_address,block_number,token_bought_amount_raw,token_sold_amount_raw | ||
flare,sparkdex,2,2024-12-19,0x17b97c773299bb5432f7513ec1090b7182326dc6e8a8a772bbcc14639e2e5e74,16,0xfbda5f676cb37624f28265a144a48b0d6e87d3b6,0x1d80c49bbbcd1c0911346656b529df9e5c2f783d,34744392,164250,5873468685772181578 | ||
flare,sparkdex,2,2024-12-19,0xe1ac5909a57022912a5853ccb70e2de4604eae3c6dd3483fc719338cf18a0625,23,0xfbda5f676cb37624f28265a144a48b0d6e87d3b6,0x1d80c49bbbcd1c0911346656b529df9e5c2f783d,34747482,658,24000000000000000 | ||
flare,sparkdex,3,2024-12-04,0x2e172e22c714f28e9e8f29a89799ec5102397e29926a070a2bd11f92637106a3,10,0x1d80c49bbbcd1c0911346656b529df9e5c2f783d,0xfbda5f676cb37624f28265a144a48b0d6e87d3b6,34014169,4999999985390174801119,166057407 | ||
flare,sparkdex,3,2024-10-29,0x2e29ac0d54b4bd75c4788a285a9806ea57ed801b4c931a877b2a17aeaa3dafff,10,0xfbda5f676cb37624f28265a144a48b0d6e87d3b6,0x1d80c49bbbcd1c0911346656b529df9e5c2f783d,32113089,4955860,353988522618423672831 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
version: 2 | ||
|
||
sources: | ||
- name: blazeswap_flare | ||
tables: | ||
- name: BlazeSwapFactory_evt_PairCreated | ||
- name: BLAZE_LP_evt_Swap | ||
|
||
- name: sparkdex_flare | ||
tables: | ||
- name: UniswapV3Factory_evt_PoolCreated | ||
- name: UniswapV2Factory_evt_PairCreated | ||
- name: UniswapV3Pool_evt_Swap | ||
- name: UniswapV2Pool_evt_Swap | ||
|
||
- name: enosys_flare | ||
tables: | ||
- name: EnosysDexPair_evt_Swap | ||
- name: EnosysDexFactory_evt_PairCreated | ||
- name: EnosysDexV3Pool_evt_Swap | ||
- name: EnosysDexV3Factory_evt_PoolCreated |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sample trades