-
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.
* Added timeswap dex * Added timeswap dex * Update sql file * Update _schema.yml * update sql file * Update timeswap_v2_optimism_base_trades.sql * update sql file * Update _schema.yml * update schema file * update schema file * Fix saddle finance test * Remove duped saddle_finance_optimism_base_trades --------- Co-authored-by: 0xRob <[email protected]> Co-authored-by: Huang Geyang <[email protected]> Co-authored-by: jeff-dude <[email protected]>
- Loading branch information
1 parent
c7484cf
commit ba26f64
Showing
7 changed files
with
103 additions
and
4 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
57 changes: 57 additions & 0 deletions
57
dbt_subprojects/dex/models/trades/optimism/platforms/timeswap_v2_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,57 @@ | ||
{{ | ||
config( | ||
schema = 'timeswap_v2_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 | ||
t.evt_block_number AS block_number | ||
-- , t.evt_block_date AS block_date | ||
, t.evt_block_time AS block_time | ||
, CAST(null AS VARBINARY) AS taker | ||
, t.contract_address AS maker | ||
, CASE WHEN t.token0AndLong0Amount < INT256 '0' THEN abs(t.token0AndLong0Amount) ELSE abs(t.token1AndLong1Amount) END AS token_bought_amount_raw | ||
, CASE WHEN t.token0AndLong0Amount < INT256 '0' THEN abs(t.token1AndLong1Amount) ELSE abs(t.token0AndLong0Amount) END AS token_sold_amount_raw | ||
, CASE WHEN t.token0AndLong0Amount < INT256 '0' THEN t.tokenTo ELSE t.longTo END AS token_bought_address | ||
, CASE WHEN t.token0AndLong0Amount < INT256 '0' THEN t.longTo ELSE t.tokenTo END AS token_sold_address | ||
, t.contract_address AS project_contract_address | ||
, t.evt_tx_hash AS tx_hash | ||
, t.evt_index AS evt_index | ||
, t.evt_tx_from AS tx_from | ||
, t.evt_tx_to AS tx_to | ||
FROM {{ source('timeswap_v2_optimism', 'TimeswapV2Option_evt_Swap') }} t | ||
{% if is_incremental() %} | ||
WHERE | ||
{{ incremental_predicate('t.evt_block_time') }} | ||
{% endif %} | ||
) | ||
|
||
SELECT | ||
'optimism' AS blockchain | ||
, 'timeswap' 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 | ||
, dexs.tx_from | ||
, dexs.tx_to | ||
FROM | ||
dexs |
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/timeswap_v2_optimism_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 | ||
optimism,timeswap,2,2024-02-08,0x90d645b281c3ed4426635085f55624e7d2a199616bb2629002d49b7e0f5e3016,15,0xee486841a813504c3466e0006167a57c073b6c4d,0xd6cb50081a0087be91066723211b50ee3753f0da,115891534,12828,3947076923076924 | ||
optimism,timeswap,2,2023-12-22,0xf70eac3e9afe21e0c2c8f676d55be49d8100f9234b964a2068f799ea5f0bcca6,36,0xee486841a813504c3466e0006167a57c073b6c4d,0xb3d1e41f84acd0e77f83473aa62fc8560c2a3c0c,113841782,219912892,157080637142857142857 |
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