forked from duneanalytics/spellbook
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Huang Geyang <[email protected]>
- Loading branch information
Showing
5 changed files
with
72 additions
and
12 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
49 changes: 49 additions & 0 deletions
49
models/_sector/dex/trades/optimism/platforms/wardenswap_optimism_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,49 @@ | ||
{{ | ||
config( | ||
schema = 'wardenswap_optimism', | ||
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')] | ||
) | ||
}} | ||
|
||
WITH dexs AS ( | ||
SELECT | ||
evt_block_number AS block_number, | ||
evt_block_time AS block_time, | ||
trader AS taker, | ||
receiver AS maker, | ||
destAmount AS token_bought_amount_raw, | ||
srcAmount AS token_sold_amount_raw, | ||
destAsset AS token_bought_address, | ||
srcAsset AS token_sold_address, | ||
contract_address AS project_contract_address, | ||
evt_tx_hash AS tx_hash, | ||
evt_index | ||
FROM {{ source('wardenswap_optimism', 'WardenRouterV2_L2_evt_Trade') }} t | ||
{% if is_incremental() %} | ||
WHERE {{ incremental_predicate('t.evt_block_time') }} | ||
{% endif %} | ||
) | ||
|
||
SELECT | ||
'optimism' AS blockchain, | ||
'wardenswap' AS project, | ||
'2' AS version, | ||
CAST(date_trunc('month', dexs.block_time) AS date) AS block_month, | ||
CAST(date_trunc('day', dexs.block_time) AS date) AS block_date, | ||
dexs.block_time, | ||
dexs.block_number, | ||
dexs.token_bought_amount_raw, | ||
dexs.token_sold_amount_raw, | ||
dexs.token_bought_address, | ||
dexs.token_sold_address, | ||
dexs.taker, | ||
dexs.maker, | ||
dexs.project_contract_address, | ||
dexs.tx_hash, | ||
dexs.evt_index | ||
FROM dexs |
11 changes: 0 additions & 11 deletions
11
models/wardenswap/optimism/wardenswap_optimism_sources.yml
This file was deleted.
Oops, something went wrong.