-
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.
Merge branch 'main' into net_transfers_arbitrum
- Loading branch information
Showing
65 changed files
with
1,001 additions
and
30 deletions.
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
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
90 changes: 90 additions & 0 deletions
90
dbt_subprojects/dex/models/trades/base/platforms/otsea_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,90 @@ | ||
{{ config( | ||
schema = 'otsea_base', | ||
alias = 'base_trades', | ||
partition_by = ['block_month'], | ||
materialized = 'incremental', | ||
file_format = 'delta', | ||
incremental_strategy = 'merge', | ||
unique_key = ['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, | ||
swapped AS token_sold_amount_raw, | ||
received AS token_bought_amount_raw, | ||
CAST(token AS varbinary) AS token_sold_address, | ||
0x0000000000000000000000000000000000000000 AS token_bought_address, | ||
contract_address AS project_contract_address, | ||
evt_tx_hash AS tx_hash, | ||
evt_index AS evt_index | ||
FROM | ||
{{ source('otsea_base', 'OTSeaV2_evt_SwappedTokensForETH') }} | ||
{% if is_incremental() %} | ||
WHERE | ||
{{ incremental_predicate('evt_block_time') }} | ||
{% endif %} | ||
), | ||
eth_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, | ||
swapped AS token_sold_amount_raw, | ||
received AS token_bought_amount_raw, | ||
0x0000000000000000000000000000000000000000 AS token_sold_address, | ||
CAST(token AS varbinary) AS token_bought_address, | ||
contract_address AS project_contract_address, | ||
evt_tx_hash AS tx_hash, | ||
evt_index AS evt_index | ||
FROM | ||
{{ source('otsea_base', 'OTSeaV2_evt_SwappedETHForTokens') }} | ||
{% if is_incremental() %} | ||
WHERE | ||
{{ incremental_predicate('evt_block_time') }} | ||
{% endif %} | ||
) | ||
|
||
SELECT | ||
'base' AS blockchain, | ||
'otsea' AS project, | ||
'1' AS version, | ||
CAST(date_trunc('month', block_time) AS date) AS block_month, | ||
CAST(date_trunc('day', block_time) AS date) AS 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 | ||
FROM | ||
token_swaps | ||
UNION ALL | ||
SELECT | ||
'base' AS blockchain, | ||
'otsea' AS project, | ||
'1' AS version, | ||
CAST(date_trunc('month', block_time) AS date) AS block_month, | ||
CAST(date_trunc('day', block_time) AS date) AS 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 | ||
FROM | ||
eth_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
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
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
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
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
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
Oops, something went wrong.