Skip to content
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

Add zkSwap Finance to dex.trades for zkSync #5690

Merged
merged 6 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions models/_sector/dex/trades/zksync/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,20 @@ models:
- evt_index
- check_dex_base_trades_seed:
seed_file: ref('spacefi_zksync_base_trades_seed')

- name: zkswap_finance_zksync_base_trades
meta:
blockchain: zksync
sector: dex
project: zkswap_finance
contributors: lgingerich
config:
tags: [ 'zksync', 'dex', 'trades', 'zkswap_finance' ]
description: "zkSwap Finance zksync base trades"
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- tx_hash
- evt_index
- check_dex_base_trades_seed:
seed_file: ref('zkswap_finance_zksync_base_trades_seed')
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
, ref('uniswap_v3_zksync_base_trades')
, ref('mute_zksync_base_trades')
, ref('spacefi_v1_zksync_base_trades')
, ref('zkswap_finance_zksync_base_trades')
] %}

WITH base_union AS (
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{
config(
schema = 'zkswap_finance_zksync',
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')]
)
}}

{{
uniswap_compatible_v2_trades(
blockchain = 'zksync',
project = 'zkswap_finance',
version = '1',
Pair_evt_Swap = source('zkswap_finance_zksync', 'ZFPair_evt_Swap'),
Factory_evt_PairCreated = source('zkswap_finance_zksync', 'Factory_evt_PairCreated')
)
}}
1 change: 1 addition & 0 deletions models/dex/dex_info.sql
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,5 @@ FROM (VALUES
, ('syncswap', 'SyncSwap', 'Direct', 'SyncSwap')
, ('mute', 'Mute', 'Direct', 'Mute')
, ('spacefi', 'SpaceFi', 'Direct', 'SpaceFi')
, ('zkswap_finance', 'zkSwap Finance', 'Direct', 'zkSwapFinance')
) AS temp_table (project, name, marketplace_type, x_username)
15 changes: 15 additions & 0 deletions seeds/_sector/dex/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3196,3 +3196,18 @@ seeds:
token_bought_amount_raw: uint256
token_sold_amount_raw: uint256
block_date: timestamp

- name: zkswap_finance_zksync_base_trades_seed
config:
column_types:
blockchain: varchar
project: varchar
version: varchar
tx_hash: varbinary
evt_index: uint256
block_number: uint256
token_bought_address: varbinary
token_sold_address: varbinary
token_bought_amount_raw: uint256
token_sold_amount_raw: uint256
block_date: timestamp
3 changes: 3 additions & 0 deletions seeds/_sector/dex/zkswap_finance_zksync_base_trades_seed.csv
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
zksync,zkswap_finance,1,2024-03-27,0xd9904a2f5ba6123080822d41c3392f43b5596df070405119282e3d3dacebb060,210,0x3355df6d4c9c3035724fd0e3914de96a5a83aaf4,0x493257fd37edb34451f62edf8d2a0c418852ba4c,30012651,94688371,94714471
zksync,zkswap_finance,1,2024-03-27,0xd595017ca2937ee8117721601605d373d2b9db4bc4fc68af2d676a25aa6531cc,593,0x5aea5775959fbc2557cc8789bc1bf90a239d9a91,0x3355df6d4c9c3035724fd0e3914de96a5a83aaf4,29979948,5030613878243119,17996667
4 changes: 4 additions & 0 deletions sources/_sector/dex/trades/zksync/_sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ sources:
tables:
- name: UniswapV2Pool_evt_Swap
- name: SwapFactory_evt_PairCreated
- name: zkswap_finance_zksync
tables:
- name: ZFPair_evt_Swap
- name: Factory_evt_PairCreated
Loading