-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Init flare chain * fix price * Fix source * Add tokens.erc20 * Update flare tokens * Verify source table schema * Fix source * Complete docs block * Update prices_flare_tokens.sql * Fix native token * Add yakufff's credit * Remove post_hook * Update schema * Init flare dex * Fix param * Update prices * Add flare dexes * Add soruce * Update dbt_subprojects/tokens/models/prices/flare/prices_flare_tokens.sql * Fix macro name * Fix param * Remove blazeswap as source not available yet * Update dbt_subprojects/tokens/models/prices/flare/prices_flare_tokens.sql * Remove sparkdex_v2 as source not available yet * Add sparkdex into dex.info * Add sparkdex seed * Revert "Remove sparkdex_v2 as source not available yet" This reverts commit d8ea547. * Revert "Remove blazeswap as source not available yet" This reverts commit b962d91. * Update sources/_sector/dex/trades/flare/_sources.yml * Update blazeswap_flare_base_trades * Add test for blazeswap * Update sources/_sector/dex/trades/flare/_sources.yml * Update dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v2_flare_base_trades.sql * Refresh schema * Try to fix bug * Add seeds * Add flare * update enosys v2 source * update enosys v2 source * add all projects to dex info * Update dbt_subprojects/dex/models/trades/dex_base_trades.sql * Update dbt_subprojects/dex/models/trades/_schema.yml * Revert "Update dbt_subprojects/dex/models/trades/dex_base_trades.sql" This reverts commit 90f0256. * feat(dex/flare): remove enosys v3 trades - Remove enosys v3 model and its references - Keep enosys v2, sparkdex v2/v3, and blazeswap in flare trades * Revert "Update dbt_subprojects/dex/models/trades/_schema.yml" This reverts commit e72e698. --------- Co-authored-by: 0xRob <[email protected]> Co-authored-by: jeff-dude <[email protected]>
- Loading branch information
1 parent
dd38855
commit 37d914e
Showing
13 changed files
with
283 additions
and
1 deletion.
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,85 @@ | ||
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: 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') |
51 changes: 51 additions & 0 deletions
51
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,51 @@ | ||
{{ config( | ||
schema = 'dex_flare' | ||
, alias = 'base_trades' | ||
, materialized = 'view' | ||
) | ||
}} | ||
|
||
{% set base_models = [ | ||
ref('enosys_v2_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', 'EnosysPair_evt_Swap') | ||
, Factory_evt_PairCreated = source('enosys_flare', 'EnosysDexFactory_evt_PairCreated') | ||
) | ||
}} |
21 changes: 21 additions & 0 deletions
21
dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_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,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: EnosysPair_evt_Swap | ||
- name: EnosysDexFactory_evt_PairCreated | ||
- name: EnosysDexV3Pool_evt_Swap | ||
- name: EnosysDexV3Factory_evt_PoolCreated |