Skip to content

Commit

Permalink
Add gridex on polygon to dex.trades (#6143)
Browse files Browse the repository at this point in the history
* Add gridex on polygon to dex.trades

* update seed

* Add gridex_polygon_base_trades_seed schema

---------

Co-authored-by: Huang Geyang <[email protected]>
Co-authored-by: jeff-dude <[email protected]>
  • Loading branch information
3 people authored Jun 18, 2024
1 parent 6f401a1 commit ae2d873
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 1 deletion.
20 changes: 20 additions & 0 deletions dex/models/trades/polygon/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -324,3 +324,23 @@ models:
seed_file: ref('uniswap_polygon_base_trades_seed')
filter:
version: 2

- name: gridex_polygon_base_trades
meta:
blockchain: polygon
sector: dex
project: gridex
contributors: blanchemaria6
config:
tags: [ 'polygon', 'dex', 'trades', 'gridex' ]
description: "gridex polygon base trades"
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- tx_hash
- evt_index
- check_dex_base_trades_seed:
seed_file: ref('gridex_polygon_base_trades_seed')
filter:
version: 1

1 change: 1 addition & 0 deletions dex/models/trades/polygon/dex_polygon_base_trades.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
, ref('xchange_polygon_base_trades')
, ref('dooar_polygon_base_trades')
, ref('uniswap_v2_polygon_base_trades')
, ref('gridex_polygon_base_trades')
] %}

WITH base_union AS (
Expand Down
25 changes: 25 additions & 0 deletions dex/models/trades/polygon/platforms/gridex_polygon_base_trades.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{{
config(
schema = 'gridex_polygon',
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_v3_trades(
blockchain = 'polygon',
project = 'gridex',
version = '1',
Pair_evt_Swap = source('gridex_polygon', 'GridPair_evt_Swap'),
Factory_evt_PoolCreated = source('gridex_polygon', 'GridFactory_evt_GridCreated'),
taker_column_name = 'sender',
maker_column_name = 'recipient',
optional_columns = null,
pair_column_name = 'grid'
)
}}
16 changes: 15 additions & 1 deletion dex/seeds/trades/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3616,6 +3616,21 @@ seeds:
token_sold_amount_raw: uint256
block_date: timestamp

- name: gridex_polygon_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

- name: horizondex_linea_base_trades_seed
config:
column_types:
Expand Down Expand Up @@ -3660,4 +3675,3 @@ seeds:
token_bought_amount_raw: uint256
token_sold_amount_raw: uint256
block_date: timestamp

2 changes: 2 additions & 0 deletions dex/seeds/trades/gridex_polygon_base_trades_seed.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
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
polygon,gridex,1,2023-09-05,0x66c372a49c17f07337b331fe5e76ceda9b968e6cf22170c88281632637e53276,120,0x2791bca1f2de4661ed88a30c99a7a9449aa84174,0x924442a46eac25646b520da8d78218ae8ff437c2,47167864,72079513,30000000000000000000000
5 changes: 5 additions & 0 deletions sources/_sector/dex/trades/polygon/_sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,8 @@ sources:
tables:
- name: DooarSwapV2Pair_evt_Swap
- name: DooarSwapV2Factory_evt_PairCreated
- name: gridex_polygon
tables:
- name: GridFactory_evt_GridCreated
- name: GridPair_evt_Swap

0 comments on commit ae2d873

Please sign in to comment.