Skip to content

Commit 3259f5f

Browse files
feat: add oku to dex.trades on tezos_evm (#9883)
* feat: add oku to dex.trades on tezos_evm Co-authored-by: Cursor <cursoragent@cursor.com> * chore: make catalyst-dex-integration skill PR-ready Co-authored-by: Cursor <cursoragent@cursor.com> * chore: open catalyst-dex-integration PRs ready for review Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent a1c0ed8 commit 3259f5f

11 files changed

Lines changed: 217 additions & 1 deletion

File tree

.claude/skills/catalyst-dex-integration/SKILL.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ fallback sequence when `query_id` is required: create query with `createDuneQuer
3838

3939
## git workflow
4040
1. **verify `main` is up to date:** fetch latest, pull if behind, exit if diverged.
41-
2. **create branch:** name `<issue_id>-<chain>-dex-integration`, create off `main`, checkout, warn if exists. don't commit/push anything.
41+
2. **create branch:** name `<issue_id>-<chain>-dex-integration`, create off `main`, checkout, warn if exists.
4242

4343
## additional prep
4444
- verify decoded dex tables exist: use dune mcp **executeQueryById** with `query_id: 6318398`, `query_parameters: [{"key":"chain","value":"<chain>","type":"text"},{"key":"namespace","value":"<namespace>","type":"text"}]` (substitute `<chain>` and `<namespace>`). retrieve from query results: `namespace`, `name`, and `abi`.
@@ -93,6 +93,29 @@ fallback sequence when `query_id` is required: create query with `createDuneQuer
9393
from base_trades where rn <= 3
9494
```
9595

96+
8. **commit, push, and open PR ready for review**
97+
- stage all integration files (sources, models, schema, seeds, `dex_trades` / `dex_token_volumes_daily` / `dex_info` updates as applicable).
98+
- commit with a Conventional Commit message, type prefix only (no scope), e.g. `feat: add <project> to dex.trades on <chain>`.
99+
- push the branch: `git push -u origin HEAD`.
100+
- create a PR ready for review with `gh pr create` (do **not** pass `--draft`):
101+
- title: `feat: add <project> to dex.trades on <chain>` (adjust for multi-project / new-chain wording).
102+
- body via HEREDOC, using the Spellbook PR template shape:
103+
```
104+
## Thank you for contributing to Spellbook 🪄
105+
106+
### Description:
107+
- Integrate **<project>** into `dex.trades` on **<chain>** (<issue_id>).
108+
- DEX type: <uniswap v2 fork | uniswap v3 fork | custom>.
109+
- Sources: `<namespace>_<chain>` event tables used by the platform model.
110+
- Includes platform base trades, chain-level models (if new chain), schema tests, and seed rows.
111+
112+
### Checklist
113+
- [x] `dbt compile` succeeds for `<project>_<chain>_base_trades`
114+
- [x] seed CSV populated with 2–3 recent trades
115+
- [ ] CI green
116+
```
117+
- return the PR URL when done. final expected state is **ready for review** (not draft).
118+
96119
## reference examples
97120
- custom DEX: `dbt_subprojects/dex/models/trades/<chain>/platforms/kuru_monad_base_trades.sql`
98121
- uniswap v2 fork: `dbt_subprojects/dex/models/trades/<chain>/platforms/uniswap_v2_monad_base_trades.sql`

dbt_subprojects/dex/models/trades/dex_token_volumes_daily.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
, 'tac'
4747
, 'taiko'
4848
, 'tempo'
49+
, 'tezos_evm'
4950
, 'unichain'
5051
, 'worldchain'
5152
, 'xlayer'

dbt_subprojects/dex/models/trades/dex_trades.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
, 'tac'
4747
, 'taiko'
4848
, 'tempo'
49+
, 'tezos_evm'
4950
, 'unichain'
5051
, 'worldchain'
5152
, 'xlayer'
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
version: 2
2+
3+
models:
4+
- name: dex_tezos_evm_trades
5+
data_tests:
6+
- check_columns_dex_trades
7+
- dbt_utils.unique_combination_of_columns:
8+
arguments:
9+
combination_of_columns:
10+
- blockchain
11+
- project
12+
- version
13+
- tx_hash
14+
- evt_index
15+
- dbt_utils.accepted_range:
16+
arguments:
17+
column_name: amount_usd
18+
max_value: 1000000000 # $1b is an arbitrary number, intended to flag outlier amounts early
19+
20+
- name: dex_tezos_evm_base_trades
21+
22+
- name: oku_tezos_evm_base_trades
23+
meta:
24+
blockchain: tezos_evm
25+
sector: dex
26+
project: oku
27+
contributors: tomfutago
28+
config:
29+
tags: ['tezos_evm', 'dex', 'trades', 'oku', 'v3']
30+
description: "Oku tezos_evm base trades"
31+
data_tests:
32+
- dbt_utils.unique_combination_of_columns:
33+
arguments:
34+
combination_of_columns:
35+
- tx_hash
36+
- evt_index
37+
- check_dex_base_trades_seed:
38+
arguments:
39+
seed_file: ref('oku_tezos_evm_base_trades_seed')
40+
41+
- name: dex_tezos_evm_token_volumes_daily
42+
data_tests:
43+
- dbt_utils.unique_combination_of_columns:
44+
arguments:
45+
combination_of_columns:
46+
- blockchain
47+
- token_address
48+
- block_date
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{{ config(
2+
schema = 'dex_tezos_evm'
3+
, alias = 'base_trades'
4+
, partition_by = ['block_month']
5+
, materialized = 'incremental'
6+
, file_format = 'delta'
7+
, incremental_strategy = 'merge'
8+
, unique_key = ['blockchain', 'project', 'version', 'tx_hash', 'evt_index']
9+
, incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')]
10+
)
11+
}}
12+
13+
{% set base_models = [
14+
ref('oku_tezos_evm_base_trades')
15+
] %}
16+
17+
{{ dex_base_trades_macro(
18+
blockchain = 'tezos_evm',
19+
base_models = base_models
20+
) }}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{{ config(
2+
schema = 'dex_tezos_evm'
3+
, alias = 'token_volumes_daily'
4+
, partition_by = ['block_month']
5+
, materialized = 'incremental'
6+
, file_format = 'delta'
7+
, incremental_strategy = 'merge'
8+
, unique_key = ['blockchain', 'token_address', 'block_date']
9+
, incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_date')]
10+
)
11+
}}
12+
13+
14+
WITH daily_token_volumes AS (
15+
{{
16+
dex_token_volumes_daily(
17+
blockchain = 'tezos_evm'
18+
, dev_dates = var('dev_dates', false)
19+
)
20+
}}
21+
)
22+
23+
SELECT *
24+
FROM daily_token_volumes
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{{ config(
2+
schema = 'dex_tezos_evm'
3+
, alias = 'trades'
4+
, partition_by = ['block_month']
5+
, materialized = 'incremental'
6+
, file_format = 'delta'
7+
, incremental_strategy = 'merge'
8+
, unique_key = ['blockchain', 'project', 'version', 'tx_hash', 'evt_index', 'block_month']
9+
, incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')]
10+
, merge_skip_unchanged = true
11+
)
12+
}}
13+
14+
WITH dexs AS (
15+
{{
16+
enrich_dex_trades(
17+
base_trades = ref('dex_tezos_evm_base_trades')
18+
, filter = "1=1"
19+
, tokens_erc20_model = source('tokens', 'erc20')
20+
, blockchain = 'tezos_evm'
21+
)
22+
}}
23+
)
24+
25+
SELECT
26+
blockchain
27+
, project
28+
, version
29+
, block_month
30+
, block_date
31+
, block_time
32+
, block_number
33+
, token_bought_symbol
34+
, token_sold_symbol
35+
, token_pair
36+
, token_bought_amount
37+
, token_sold_amount
38+
, token_bought_amount_raw
39+
, token_sold_amount_raw
40+
, amount_usd
41+
, token_bought_address
42+
, token_sold_address
43+
, taker
44+
, maker
45+
, project_contract_address
46+
, tx_hash
47+
, tx_from
48+
, tx_to
49+
, evt_index
50+
, current_timestamp AS _updated_at
51+
FROM
52+
dexs
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{{
2+
config(
3+
schema = 'oku_tezos_evm',
4+
alias = 'base_trades',
5+
materialized = 'incremental',
6+
file_format = 'delta',
7+
incremental_strategy = 'merge',
8+
unique_key = ['tx_hash', 'evt_index'],
9+
incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')]
10+
)
11+
}}
12+
13+
{{
14+
uniswap_compatible_v3_trades(
15+
blockchain = 'tezos_evm',
16+
project = 'oku',
17+
version = '3',
18+
Pair_evt_Swap = source('oku_tezos_evm', 'uniswapv3pool_evt_swap'),
19+
Factory_evt_PoolCreated = source('oku_tezos_evm', 'uniswapv3factory_evt_poolcreated')
20+
)
21+
}}

dbt_subprojects/dex/seeds/trades/_schema.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6205,3 +6205,18 @@ seeds:
62056205
token_bought_amount_raw: uint256
62066206
token_sold_amount_raw: uint256
62076207
block_date: timestamp
6208+
6209+
- name: oku_tezos_evm_base_trades_seed
6210+
config:
6211+
column_types:
6212+
blockchain: varchar
6213+
project: varchar
6214+
version: varchar
6215+
tx_hash: varbinary
6216+
evt_index: uint256
6217+
block_number: uint256
6218+
token_bought_address: varbinary
6219+
token_sold_address: varbinary
6220+
token_bought_amount_raw: uint256
6221+
token_sold_amount_raw: uint256
6222+
block_date: timestamp
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
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
2+
tezos_evm,oku,3,2026-07-09,0xdd26b9521132005abc1170695031274af5c9955442816befc27b6909c36a8129,2,0x2767fc1048cd0ae4fd952eef09853301c9dc7173,0xc9b53ab2679f573e480d01e0f49e2b5cfb7a3eab,47732694,5962053361449533093922,19333204305056504779
3+
tezos_evm,oku,3,2026-07-09,0x920f955159adca163be38659abb04f9d1d02c3968488443f2d1b6c74df9533a0,10,0xc9b53ab2679f573e480d01e0f49e2b5cfb7a3eab,0xfc24f770f94edbca6d6f885e12d4317320bcb401,47732671,57147673235188504185,7764706543986777
4+
tezos_evm,oku,3,2026-07-09,0xdcfb68d14a0a04dc4353891baf2640f9af869e8e3e22303716f67a3a409c5c04,16,0xc9b53ab2679f573e480d01e0f49e2b5cfb7a3eab,0xfc24f770f94edbca6d6f885e12d4317320bcb401,47732660,57157048595147885140,7762248107658608

0 commit comments

Comments
 (0)