-
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.
- Loading branch information
1 parent
33275ef
commit 1704dd7
Showing
7 changed files
with
90 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
50 changes: 50 additions & 0 deletions
50
dbt_subprojects/dex/models/trades/base/platforms/jojo_base_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,50 @@ | ||
{{ config( | ||
schema = 'jojo_base', | ||
alias = 'base_trades', | ||
partition_by = ['block_month'], | ||
materialized = 'incremental', | ||
file_format = 'delta', | ||
incremental_strategy = 'merge', | ||
unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index'] | ||
) }} | ||
|
||
WITH token_swaps AS ( | ||
SELECT | ||
evt_block_number AS block_number, | ||
CAST(evt_block_time AS timestamp(3) with time zone) AS block_time, | ||
evt_tx_from AS maker, | ||
evt_tx_to AS taker, | ||
payAmount AS token_sold_amount_raw, | ||
receivedAmount AS token_bought_amount_raw, | ||
fromToken AS token_sold_address, | ||
toToken AS token_bought_address, | ||
contract_address AS project_contract_address, | ||
evt_tx_hash AS tx_hash, | ||
evt_index AS evt_index | ||
FROM | ||
{{ source('jojo_base', 'FundingRateArbitrage_evt_Swap') }} | ||
{% if is_incremental() %} | ||
WHERE | ||
{{ incremental_predicate('evt_block_time') }} | ||
{% endif %} | ||
) | ||
|
||
SELECT | ||
'base' AS blockchain, | ||
'jojo' AS project, | ||
'1' AS version, | ||
CAST(date_trunc('month', token_swaps.block_time) AS date) AS block_month, | ||
CAST(date_trunc('day', token_swaps.block_time) AS date) AS block_date, | ||
token_swaps.block_time, | ||
token_swaps.block_number, | ||
token_swaps.token_sold_amount_raw, | ||
token_swaps.token_bought_amount_raw, | ||
token_swaps.token_sold_address, | ||
token_swaps.token_bought_address, | ||
token_swaps.maker, | ||
token_swaps.taker, | ||
token_swaps.project_contract_address, | ||
token_swaps.tx_hash, | ||
token_swaps.evt_index | ||
FROM | ||
token_swaps |
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
2 changes: 2 additions & 0 deletions
2
dbt_subprojects/dex/seeds/trades/jojo_base_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,2 @@ | ||
blockchain,project,version,block_month,block_date,block_time,block_number,token_sold_amount_raw,token_bought_amount_raw,token_sold_address,token_bought_address,maker,taker,project_contract_address,tx_hash,evt_index | ||
base,jojo,1,2024-05-01 00:00,2024-05-29 00:00,2024-05-29 02:08,15079594,30000000000,7308115452705510033,0x833589fcd6edb6e08f4c7c32d4f71b54bda02913,0x2ae3f1ec7f1f5012cfeab0185bfc7aa3cf0dec22,0xf7debaf84774b0e4da659ede243c8a84a2afcd14,0x8b7e1924ff57eec8ebd87254e4de6ff397f039d3,0x8b7e1924ff57eec8ebd87254e4de6ff397f039d3,0x2a68b8ffa1c93e692b8fb4584c856ddd4bfef9f5100d977d92d4b65a8be8ddf3,62 |
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