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

OTSea DEX on Base #7390

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions dbt_subprojects/dex/models/dex_info.sql
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ FROM (VALUES
, ('hyperjump', 'HyperJump', 'Direct', 'Hyperjump_fi')
, ('infusion', 'Infusion', 'Direct', 'infusionfinance')
, ('stablebase', 'StableBase', 'Direct', 'stablebasefi')
, ('otsea', 'OTSea', 'Direct', 'otseaERC20')
, ('flashliquidity', 'Flashliquidity', 'Direct', 'flashliquidity')
, ('akronswap', 'Akronswap', 'Direct', 'AkronFinance')
, ('saddle_finance', 'Saddle Finance', 'Direct', 'saddlefinance')
Expand Down
17 changes: 17 additions & 0 deletions dbt_subprojects/dex/models/trades/base/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1041,3 +1041,20 @@ models:
- evt_index
- check_dex_base_trades_seed:
seed_file: ref('akronswap_base_base_trades_seed')

- name: otsea_base_base_trades
meta:
blockchain: base
sector: dex
project: otsea
contributors: PatelPrinci
config:
tags: [ 'base', 'dex', 'trades', 'otsea' ]
description: "otsea base 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('otsea_base_base_trades_seed')
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
, ref('sushiswap_v1_base_base_trades')
, ref('sushiswap_v2_base_base_trades')
, ref('stablebase_base_base_trades')
, ref('otsea_base_base_trades')
, ref('aerodrome_base_base_trades')
, ref('pancakeswap_v2_base_base_trades')
, ref('pancakeswap_v3_base_base_trades')
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{{ config(
schema = 'otsea_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,
swapped AS token_sold_amount_raw,
received AS token_bought_amount_raw,
account AS token_sold_address,
PatelPrinci marked this conversation as resolved.
Show resolved Hide resolved
token AS token_bought_address,
contract_address AS project_contract_address,
evt_tx_hash AS tx_hash,
evt_index AS evt_index
FROM
{{ source('otsea_base', 'OTSeaV2_evt_SwappedTokensForETH') }}
PatelPrinci marked this conversation as resolved.
Show resolved Hide resolved
{% if is_incremental() %}
WHERE
{{ incremental_predicate('evt_block_time') }}
{% endif %}
)

SELECT
'base' AS blockchain,
'otsea' 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
15 changes: 15 additions & 0 deletions dbt_subprojects/dex/seeds/trades/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4500,6 +4500,21 @@ seeds:
token_sold_amount_raw: uint256
block_date: timestamp

- name: otsea_base_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: saddle_finance_optimism_base_trades_seed
config:
column_types:
Expand Down
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,otsea,1,2024-12-01 00:00,2024-12-06 00:00,2024-12-06 18:54,23360953,10000000000000000000,1000000000000,0x4778aa10fcac8b9534b8b2eeacf5255399280273,0x1a1f5b4d07e1c7fa9fe3a6a7c31544cecd06cb21,0x4778aa10fcac8b9534b8b2eeacf5255399280273,0xa836af59d35b3da3c9fb5cfd6f84d9e3bd8c5fd5,0xa836af59d35b3da3c9fb5cfd6f84d9e3bd8c5fd5,0x6cae4a05b04b7bedb80f8c40eeacd2917afe3ef57becb7914cac55ce60bddbd5,149
3 changes: 3 additions & 0 deletions sources/_sector/dex/trades/base/_sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@ sources:
- name: stablebase_base
tables:
- name: SwapFlashLoan_evt_TokenSwap
- name: otsea_base
tables:
- name: OTSeaV2_evt_SwappedTokensForETH
- name: basex_base
tables:
- name: UniswapV3Pool_evt_Swap
Expand Down
Loading