-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Swapline DEX on Base #7284
Closed
Closed
Swapline DEX on Base #7284
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
98f8973
Saddle file added in sql
PatelPrinci 2dcc650
files added for saddle finance
PatelPrinci c5c1ca7
added files for swapline
PatelPrinci d0bf25e
source file added
PatelPrinci 610c9c5
Merge branch 'main' into swapline
PatelPrinci 602fb62
removed filter version which does not match seed version
PatelPrinci 96499a8
removed filter version which does not match seed version
PatelPrinci 3a7e6e8
Merge branch 'main' into swapline
PatelPrinci File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/swapline_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 = 'swapline_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, | ||
amount0In AS token_sold_amount_raw, | ||
amount0Out AS token_bought_amount_raw, | ||
sender AS token_sold_address, | ||
to AS token_bought_address, | ||
contract_address AS project_contract_address, | ||
evt_tx_hash AS tx_hash, | ||
evt_index AS evt_index | ||
FROM | ||
{{ source('swapline_base', 'SwaplinePair_evt_Swap') }} | ||
{% if is_incremental() %} | ||
WHERE | ||
{{ incremental_predicate('evt_block_time') }} | ||
{% endif %} | ||
) | ||
Comment on lines
+11
to
+30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we need to apply |
||
|
||
SELECT | ||
'base' AS blockchain, | ||
'swapline' 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
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/optimism/platforms/saddle_finance_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,50 @@ | ||
{{ config( | ||
schema = 'saddle_finance_optimism', | ||
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, | ||
tokensSold AS token_sold_amount_raw, | ||
tokensBought AS token_bought_amount_raw, | ||
CAST(soldId AS varbinary) AS token_sold_address, | ||
CAST(boughtId 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('saddle_finance_optimism', 'SwapFlashLoan_evt_TokenSwap') }} | ||
{% if is_incremental() %} | ||
WHERE | ||
{{ incremental_predicate('evt_block_time') }} | ||
{% endif %} | ||
) | ||
|
||
SELECT | ||
'optimism' AS blockchain, | ||
'saddle_finance' 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/saddle_finance_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,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 | ||
optimism,saddle_finance,1,2022-08-01 00:00,2022-08-05 00:00,2022-08-05 19:11,17943155,74907384,74857799085655995549,0x0000000000000000000000000000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000000000000000000000000001,0xd131f1bcdd547e067af447dd3c36c99d6be9fdeb,0xf6c2e0adc659007ba7c48446f5a4e4e94dfe08b5,0xf6c2e0adc659007ba7c48446f5a4e4e94dfe08b5,0xbccdcd4ab61e5ad3384eb173156c3c0507d3bb3f2d2f5a406379e74aafbec38d,3 |
2 changes: 2 additions & 0 deletions
2
dbt_subprojects/dex/seeds/trades/swapline_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,swapline,1,2024-10-01 00:00,2024-10-11 00:00,2024-10-11 11:52,20929092,0,7956190551055,0xfdf03f9b84babb7d8bf2fd583a85ba3858abd4c4,0xfdf03f9b84babb7d8bf2fd583a85ba3858abd4c4,0xb0385062b7516893e53aba24584b93fb20a3029f,0x19ceead7105607cd444f5ad10dd51356436095a1,0xe16d9cabbf84a8598e678e858d0e5000b279cb55,0xe51cb694f4c97883d1e9a695c044fae6d31da3d1ea12be3a1d11569c9772b90b,287 |
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 | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -201,4 +201,6 @@ sources: | |||||||||||||||||
tables: | ||||||||||||||||||
- name: UniswapV2Pair_evt_Swap | ||||||||||||||||||
- name: UniswapV2Factory_evt_PairCreated | ||||||||||||||||||
|
||||||||||||||||||
- name: swapline_base | ||||||||||||||||||
tables: | ||||||||||||||||||
- name: SwaplinePair_evt_Swap | ||||||||||||||||||
Comment on lines
+204
to
+206
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.