Skip to content

Commit

Permalink
Add IceCreamSwap trades on Boba network (#7440)
Browse files Browse the repository at this point in the history
* feat: add IceCreamSwap trades on Boba network

- Add IceCreamSwap DEX trades implementation using uniswap_compatible_v2_trades macro
- Add Boba network to dex_trades and dex_base_trades
- Add source definition for IceCreamSwap events

* feat: add IceCreamSwap to dex_info and enable boba network

- Add IceCreamSwap to dex_info table
- Add boba network to expose_spells

* feat: add icecreamswap_boba_base_trades_seed

- Add seed data for IceCreamSwap on Boba network
- Add schema configuration for the new seed

* feat: add check_dex_base_trades_seed test for icecreamswap_boba_base_trades

* Add boba
  • Loading branch information
Hosuke authored Jan 9, 2025
1 parent 0df4adc commit 5b073ae
Show file tree
Hide file tree
Showing 10 changed files with 130 additions and 3 deletions.
3 changes: 2 additions & 1 deletion dbt_subprojects/dex/models/dex_info.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
tags = [ 'static'],
schema='dex',
alias = 'info',
post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "solana", "zksync"]\',
post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "solana", "zksync", "boba"]\',
"sector",
"dex",
\'["hildobby"]\') }}')
Expand Down Expand Up @@ -199,4 +199,5 @@ FROM (VALUES
, ('enosys', 'Enosys', 'Direct', 'enosys_global')
, ('gravity_finance', 'GravityFinance', 'Direct', 'Gravity_Finance')
, ('fluid', 'Fluid DEX', 'Direct', '0xfluid')
, ('icecreamswap', 'IceCreamSwap', 'Direct', 'icecream_swap')
) AS temp_table (project, name, marketplace_type, x_username)
2 changes: 1 addition & 1 deletion dbt_subprojects/dex/models/trades/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ models:
- name: dex_trades
meta:
docs_slug: /curated/trading/DEX/dex-trades
blockchain: arbitrum, avalanche_c, base, bnb, celo, ethereum, fantom, gnosis, kaia, optimism, polygon, scroll, zksync, linea, blast, sei, ronin, flare
blockchain: arbitrum, avalanche_c, base, bnb, celo, ethereum, fantom, gnosis, kaia, optimism, polygon, scroll, zksync, linea, blast, sei, ronin, flare, boba
sector: dex
short_description: The `dex.trades` table captures detailed data on trades executed via decentralized exchanges (DEXs). This table contains a detailed breakdown of trade execution containing one or many trades per transaction.
contributors: 0xRob, hosuke, jeff-dude, tomfutago, viniabussafi
Expand Down
25 changes: 25 additions & 0 deletions dbt_subprojects/dex/models/trades/boba/_schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: 2

models:
- name: dex_boba_base_trades
data_tests:
- check_dex_info_relationship

- name: icecreamswap_boba_base_trades
meta:
blockchain: boba
sector: dex
project: icecreamswap
contributors: hosuke
config:
tags: ["boba", "dex", "trades", "icecreamswap"]
description: "IceCreamSwap boba base trades"
data_tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- tx_hash
- evt_index
- check_dex_base_trades_seed:
seed_file: ref('icecreamswap_boba_base_trades_seed')
filter:
version: 1
48 changes: 48 additions & 0 deletions dbt_subprojects/dex/models/trades/boba/dex_boba_base_trades.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{{ config(
schema = 'dex_boba'
, alias = 'base_trades'
, materialized = 'view'
)
}}

{% set base_models = [
ref('icecreamswap_boba_base_trades')
] %}

WITH base_union AS (
SELECT *
FROM (
{% for base_model in base_models %}
SELECT
blockchain
, project
, version
, block_month
, block_date
, block_time
, block_number
, token_bought_amount_raw
, token_sold_amount_raw
, token_bought_address
, token_sold_address
, taker
, maker
, project_contract_address
, tx_hash
, evt_index
FROM
{{ base_model }}
{% if not loop.last %}
UNION ALL
{% endif %}
{% endfor %}
)
)

{{
add_tx_columns(
model_cte = 'base_union'
, blockchain = 'boba'
, columns = ['from', 'to', 'index']
)
}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{
config(
schema = 'icecreamswap_boba',
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 = 'boba',
project = 'icecreamswap',
version = '1',
Pair_evt_Swap = source('icecreamswap_boba', 'IceCreamSwapV2Pair_evt_Swap'),
Factory_evt_PairCreated = source('icecreamswap_boba', 'IceCreamSwapV2Factory_evt_PairCreated')
)
}}
1 change: 1 addition & 0 deletions dbt_subprojects/dex/models/trades/dex_base_trades.sql
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
, ref('dex_base_base_trades')
, ref('dex_blast_base_trades')
, ref('dex_bnb_base_trades')
, ref('dex_boba_base_trades')
, ref('dex_celo_base_trades')
, ref('dex_ethereum_base_trades')
, ref('dex_fantom_base_trades')
Expand Down
1 change: 1 addition & 0 deletions dbt_subprojects/dex/models/trades/dex_trades.sql
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
, "base"
, "blast"
, "bnb"
, "boba"
, "celo"
, "ethereum"
, "fantom"
Expand Down
22 changes: 21 additions & 1 deletion dbt_subprojects/dex/seeds/trades/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4573,7 +4573,7 @@ seeds:
token_sold_address: varbinary
token_bought_amount_raw: uint256
token_sold_amount_raw: uint256
block_date: timestamp
block_date: timestamp

- name: bridgers_optimism_base_trades_seed
config:
Expand Down Expand Up @@ -4664,3 +4664,23 @@ seeds:
token_bought_amount_raw: uint256
token_sold_amount_raw: uint256
block_date: timestamp

- name: icecreamswap_boba_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
taker: varbinary
maker: varbinary
project_contract_address: varbinary
block_month: timestamp
block_time: timestamp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
blockchain,project,version,block_month,block_date,block_time,block_number,token_bought_amount_raw,token_sold_amount_raw,token_bought_address,token_sold_address,taker,maker,project_contract_address,tx_hash,evt_index
boba,icecreamswap,1,2024-11-01 00:00,2024-11-24 00:00,2024-11-24 14:15,10726459,65183603501016643,300000000000000000,0x7d5a56742c082fcdfc240cd7d1775f00e059771f,0xa18bf3994c0cc6e3b63ac420308e5383f53120d7,0x85767bcbb2b5e95bddb3523406419d1aa7efdcf2,0x46d172bfdd9b03575229614bcf46da014d8ac8b1,0x46d172bfdd9b03575229614bcf46da014d8ac8b1,0x2a59b0f2abc8c29029c4dee209b0b82f2f1c89b825bca663a3d1c2b4deeb58b1,9
boba,icecreamswap,1,2024-07-01 00:00,2024-07-19 00:00,2024-07-19 16:57,5201714,661356424536501999965,169150000000000000000,0xa18bf3994c0cc6e3b63ac420308e5383f53120d7,0x7d5a56742c082fcdfc240cd7d1775f00e059771f,0x0604e652a188931e245717d45feb26f583b92908,0x46d172bfdd9b03575229614bcf46da014d8ac8b1,0x46d172bfdd9b03575229614bcf46da014d8ac8b1,0x01f3b8af8421fa428fca4cf2dc85498614d94b637bc5887c29e50abc7897c2b3,3
7 changes: 7 additions & 0 deletions sources/_sector/dex/trades/boba/_sources.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2

sources:
- name: icecreamswap_boba
tables:
- name: IceCreamSwapV2Pair_evt_Swap
- name: IceCreamSwapV2Factory_evt_PairCreated

0 comments on commit 5b073ae

Please sign in to comment.