Skip to content

Commit

Permalink
jojo on base (#7491)
Browse files Browse the repository at this point in the history
  • Loading branch information
PatelPrinci authored Jan 20, 2025
1 parent 33275ef commit 1704dd7
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 1 deletion.
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 @@ -199,5 +199,6 @@ FROM (VALUES
, ('enosys', 'Enosys', 'Direct', 'enosys_global')
, ('gravity_finance', 'GravityFinance', 'Direct', 'Gravity_Finance')
, ('fluid', 'Fluid DEX', 'Direct', '0xfluid')
, ('jojo', 'JOJO', 'Direct', 'jojo_exchange')
, ('beets', 'Beets DEX', 'Direct', 'beets_fi')
) AS temp_table (project, name, marketplace_type, x_username)
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: jojo_base_base_trades
meta:
blockchain: base
sector: dex
project: jojo
contributors: princi
config:
tags: [ 'base', 'dex', 'trades', 'jojo' ]
description: "jojo 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('jojo_base_base_trades_seed')
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
, ref('infusion_base_base_trades')
, ref('flashliquidity_base_base_trades')
, ref('akronswap_base_base_trades')
, ref('jojo_base_base_trades')
] %}

WITH base_union AS (
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{{ config(
schema = 'jojo_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,
payAmount AS token_sold_amount_raw,
receivedAmount AS token_bought_amount_raw,
fromToken AS token_sold_address,
toToken AS token_bought_address,
contract_address AS project_contract_address,
evt_tx_hash AS tx_hash,
evt_index AS evt_index
FROM
{{ source('jojo_base', 'FundingRateArbitrage_evt_Swap') }}
{% if is_incremental() %}
WHERE
{{ incremental_predicate('evt_block_time') }}
{% endif %}
)

SELECT
'base' AS blockchain,
'jojo' 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
17 changes: 16 additions & 1 deletion dbt_subprojects/dex/seeds/trades/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4649,7 +4649,22 @@ seeds:
token_bought_amount_raw: uint256
token_sold_amount_raw: uint256
block_date: timestamp


- name: jojo_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: beets_sonic_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,jojo,1,2024-05-01 00:00,2024-05-29 00:00,2024-05-29 02:08,15079594,30000000000,7308115452705510033,0x833589fcd6edb6e08f4c7c32d4f71b54bda02913,0x2ae3f1ec7f1f5012cfeab0185bfc7aa3cf0dec22,0xf7debaf84774b0e4da659ede243c8a84a2afcd14,0x8b7e1924ff57eec8ebd87254e4de6ff397f039d3,0x8b7e1924ff57eec8ebd87254e4de6ff397f039d3,0x2a68b8ffa1c93e692b8fb4584c856ddd4bfef9f5100d977d92d4b65a8be8ddf3,62
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 @@ -201,4 +201,7 @@ sources:
tables:
- name: UniswapV2Pair_evt_Swap
- name: UniswapV2Factory_evt_PairCreated
- name: jojo_base
tables:
- name: FundingRateArbitrage_evt_Swap

0 comments on commit 1704dd7

Please sign in to comment.