From 4ce5dfcc91cdb8f2a4506b57d6d507139ac98bdf Mon Sep 17 00:00:00 2001 From: marcus-snx Date: Mon, 9 Dec 2024 23:47:07 +0200 Subject: [PATCH 01/21] Fix event schema --- indexers/utils/clickhouse_schema.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/indexers/utils/clickhouse_schema.py b/indexers/utils/clickhouse_schema.py index a0298600..50510d2b 100644 --- a/indexers/utils/clickhouse_schema.py +++ b/indexers/utils/clickhouse_schema.py @@ -52,11 +52,21 @@ def map_to_clickhouse_type(sol_type): def generate_clickhouse_schema(event_name, fields, network_name, protocol_name): query = [ - f"CREATE TABLE IF NOT EXISTS {network_name}.{protocol_name}_{event_name} (" + f"CREATE TABLE IF NOT EXISTS {network_name}.{protocol_name}_{event_name} (", + " `id` String,", + " `block_number` UInt64,", + " `block_timestamp` DateTime64(3, 'UTC'),", + " `transaction_hash` String,", + " `contract` String,", + " `event_name` String,", ] for field_name, field_type in fields: - clickhouse_type = map_to_clickhouse_type(field_type) - query.append(f" `{to_snake(field_name)}` {clickhouse_type},") + if field_name == "id": + clickhouse_type = "String" + query.append(f" `param_id` String,") + else: + clickhouse_type = map_to_clickhouse_type(field_type) + query.append(f" `{to_snake(field_name)}` {clickhouse_type},") query[-1] = query[-1][:-1] query.append(") ENGINE = MergeTree() ORDER BY tuple();") return "\n".join(query) @@ -84,7 +94,7 @@ def process_abi_schemas(client, abi, path, contract_name, network_name, protocol for event in events: event_name = to_snake(event["name"]) contract_name = to_snake(contract_name) - event_name = f"{contract_name}_{event_name}" + event_name = f"{contract_name}_event_{event_name}" input_names = get_abi_input_names(event) input_types = get_abi_input_types(event) @@ -96,6 +106,7 @@ def process_abi_schemas(client, abi, path, contract_name, network_name, protocol network_name=network_name, protocol_name=protocol_name, ) + print(schema) client.command(schema) save_clickhouse_schema(path=path, event_name=event_name, schema=schema) From 7231ae330abb747c8a3bd7d4f331940f8781fcc0 Mon Sep 17 00:00:00 2001 From: marcus-snx Date: Mon, 9 Dec 2024 23:47:18 +0200 Subject: [PATCH 02/21] Update requirements --- transformers/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transformers/requirements.txt b/transformers/requirements.txt index 9fda24fe..0475999f 100644 --- a/transformers/requirements.txt +++ b/transformers/requirements.txt @@ -1,6 +1,6 @@ pandas pyarrow psycopg2-binary -dbt-postgres +dbt-clickhouse sqlfluff synthetix==0.1.21 \ No newline at end of file From e1aa5e8d0c0c9c9b0576d65aeb3c5485707e2ec3 Mon Sep 17 00:00:00 2001 From: marcus-snx Date: Mon, 9 Dec 2024 23:47:27 +0200 Subject: [PATCH 03/21] Update listener --- indexers/scripts/listener.py | 44 +++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/indexers/scripts/listener.py b/indexers/scripts/listener.py index 362e7a63..105643e8 100644 --- a/indexers/scripts/listener.py +++ b/indexers/scripts/listener.py @@ -19,13 +19,35 @@ def convert_case(name): return snake_case +def create_table( + client: Client, + network: str, + protocol: str, + event: str, +): + table_name = f"{network}.{protocol}_{convert_case(event)}" + file_path = f"{CLICKHOUSE_INTERNAL_PATH}/{network}/{protocol}/{event}/*.parquet" + query = ( + f"create table if not exists {table_name} " + f"engine = MergeTree order by tuple() as " + f"select * from file('{file_path}', 'Parquet')" + ) + try: + client.command(query) + except Exception as e: + print(f"Error creating table {table_name}: {e}") + + def insert_data( client: Client, network: str, protocol: str, event: str, block_range: str ): table_name = f"{network}.{protocol}_{convert_case(event)}" file_path = f"{CLICKHOUSE_INTERNAL_PATH}/{network}/{protocol}/{event}/{event}_{block_range}.parquet" query = f"insert into {table_name} select * from file('{file_path}', 'Parquet')" - client.command(query) + try: + client.command(query) + except Exception as e: + print(f"Error inserting data into {table_name}: {e}") class FolderEventHandler(FileSystemEventHandler): @@ -58,6 +80,7 @@ def _clean_parquet(self, path: str): # Initialize counters empty_files = 0 written_files = 0 + tables_created = 0 data_insertions = 0 for parquet_file in path.glob("*.parquet"): @@ -70,18 +93,27 @@ def _clean_parquet(self, path: str): if df.empty: empty_files += 1 continue + df.columns = [convert_case(col) for col in df.columns] output_file.parent.mkdir(parents=True, exist_ok=True) df.to_parquet(output_file, index=False) written_files += 1 # import data into clickhouse - insert_data( - self.client, network_name, protocol_name, event_name, block_range - ) - data_insertions += 1 + if not self.client.command( + f"exists {network_name}.{protocol_name}_{event_name}" + ): + create_table(self.client, network_name, protocol_name, event_name) + tables_created += 1 + else: + insert_data( + self.client, network_name, protocol_name, event_name, block_range + ) + data_insertions += 1 print( - f"Processed {network_name}.{protocol_name}.{block_range}: empty files {empty_files}, written files {written_files}, data insertions {data_insertions}" + f"Processed {network_name}.{protocol_name}.{block_range}: " + f"empty files {empty_files}, written files {written_files}, " + f"tables created {tables_created}, data insertions {data_insertions}" ) From 730364fca64cf3f3e2f7a876281ef3d777c9c648 Mon Sep 17 00:00:00 2001 From: marcus-snx Date: Mon, 9 Dec 2024 23:47:55 +0200 Subject: [PATCH 04/21] Add dbt clickhouse profile --- transformers/synthetix/profiles/profiles.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/transformers/synthetix/profiles/profiles.yml b/transformers/synthetix/profiles/profiles.yml index 9e1fde39..8eae66dc 100644 --- a/transformers/synthetix/profiles/profiles.yml +++ b/transformers/synthetix/profiles/profiles.yml @@ -1,3 +1,17 @@ +clickhouse: + target: prod + outputs: + prod: + type: clickhouse + schema: prod + host: clickhouse + port: 8123 + user: default + password: "" + dbname: default + custom_settings: + allow_experimental_json_type: 1 + synthetix: target: prod outputs: From d30b949d8b22fd4f758fbf023beb0d528704ca82 Mon Sep 17 00:00:00 2001 From: marcus-snx Date: Mon, 9 Dec 2024 23:48:34 +0200 Subject: [PATCH 05/21] Update dbt macros --- transformers/synthetix/macros/convert_hex.sql | 8 ++------ .../synthetix/macros/get_event_data.sql | 19 +++++++++++++------ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/transformers/synthetix/macros/convert_hex.sql b/transformers/synthetix/macros/convert_hex.sql index 9f8c114a..90976820 100644 --- a/transformers/synthetix/macros/convert_hex.sql +++ b/transformers/synthetix/macros/convert_hex.sql @@ -4,13 +4,9 @@ ) %} LEFT( REGEXP_REPLACE( - encode( - DECODE(REPLACE({{ hex_column }}, '0x', ''), 'hex'), - 'escape' - ) :: text, + UNHEX(REPLACE({{ hex_column }}, '0x', '')), '\\000', - '', - 'g' + '' ), {{ max_length }} ) diff --git a/transformers/synthetix/macros/get_event_data.sql b/transformers/synthetix/macros/get_event_data.sql index 75a0ad0e..eed1df88 100644 --- a/transformers/synthetix/macros/get_event_data.sql +++ b/transformers/synthetix/macros/get_event_data.sql @@ -1,14 +1,21 @@ {% macro get_event_data( chain, network, + protocol_name, contract_name, event_name ) %} -SELECT - * -FROM - {{ source( + {%- set relation = source( 'raw_' ~ chain ~ '_' ~ network, - contract_name ~ '_event_' ~ event_name - ) }} + protocol_name ~ '_' ~ contract_name ~ '_event_' ~ event_name + ) -%} + {%- set columns = dbt_utils.get_filtered_columns_in_relation(relation) -%} + + + SELECT + {% for column in columns %} + {{ column }}{% if not loop.last %},{% endif %} + {% endfor %} + FROM + {{ relation }} {% endmacro %} From b4bdcf21dfc680ecda593478e48200fa8f4ed135 Mon Sep 17 00:00:00 2001 From: marcus-snx Date: Mon, 9 Dec 2024 23:48:58 +0200 Subject: [PATCH 06/21] Add ClickHouse arbitrum raw models --- ...core_account_activity_arbitrum_mainnet.sql | 42 - ...re_account_delegation_arbitrum_mainnet.sql | 60 - ..._active_stakers_daily_arbitrum_mainnet.sql | 52 - .../core/fct_core_apr_arbitrum_mainnet.sql | 238 ---- .../fct_core_apr_rewards_arbitrum_mainnet.sql | 115 -- ...t_core_market_updated_arbitrum_mainnet.sql | 30 - ..._core_pool_collateral_arbitrum_mainnet.sql | 39 - ..._core_pool_delegation_arbitrum_mainnet.sql | 45 - .../core/fct_core_pools_arbitrum_mainnet.sql | 13 - .../core/fct_pool_debt_arbitrum_mainnet.sql | 10 - .../fct_pool_issuance_arbitrum_mainnet.sql | 39 - ..._pool_issuance_hourly_arbitrum_mainnet.sql | 122 -- .../fct_pool_pnl_hourly_arbitrum_mainnet.sql | 217 --- ...ool_pnl_hourly_reward_arbitrum_mainnet.sql | 85 -- .../fct_pool_rewards_arbitrum_mainnet.sql | 37 - ...t_pool_rewards_hourly_arbitrum_mainnet.sql | 21 - ..._rewards_token_hourly_arbitrum_mainnet.sql | 190 --- .../marts/arbitrum/mainnet/core/schema.yml | 600 -------- ...perp_account_activity_arbitrum_mainnet.sql | 89 -- .../fct_perp_accounts_arbitrum_mainnet.sql | 14 - ...p_collateral_balances_arbitrum_mainnet.sql | 129 -- ...p_collateral_modified_arbitrum_mainnet.sql | 18 - ...perp_interest_charged_arbitrum_mainnet.sql | 11 - .../fct_perp_liq_account_arbitrum_mainnet.sql | 59 - ...fct_perp_liq_position_arbitrum_mainnet.sql | 38 - ...t_perp_market_history_arbitrum_mainnet.sql | 106 -- .../fct_perp_markets_arbitrum_mainnet.sql | 14 - .../perp/fct_perp_orders_arbitrum_mainnet.sql | 29 - .../perp/fct_perp_pnl_arbitrum_mainnet.sql | 18 - ...revious_order_expired_arbitrum_mainnet.sql | 15 - .../perp/fct_perp_trades_arbitrum_mainnet.sql | 39 - .../marts/arbitrum/mainnet/perp/schema.yml | 732 ---------- ...p_account_stats_daily_arbitrum_mainnet.sql | 45 - ..._account_stats_hourly_arbitrum_mainnet.sql | 119 -- ...rp_keeper_stats_daily_arbitrum_mainnet.sql | 44 - ...p_keeper_stats_hourly_arbitrum_mainnet.sql | 44 - ...rp_market_stats_daily_arbitrum_mainnet.sql | 25 - ...p_market_stats_hourly_arbitrum_mainnet.sql | 162 --- .../fct_perp_stats_daily_arbitrum_mainnet.sql | 23 - ...fct_perp_stats_hourly_arbitrum_mainnet.sql | 91 -- ..._tracking_stats_daily_arbitrum_mainnet.sql | 93 -- ...tracking_stats_hourly_arbitrum_mainnet.sql | 93 -- .../arbitrum/mainnet/perp_stats/schema.yml | 239 ---- .../prices/fct_prices_arbitrum_mainnet.sql | 44 - .../fct_prices_hourly_arbitrum_mainnet.sql | 72 - .../marts/arbitrum/mainnet/prices/schema.yml | 44 - .../fct_spot_atomics_arbitrum_mainnet.sql | 53 - .../fct_spot_markets_arbitrum_mainnet.sql | 13 - .../fct_spot_wrapper_arbitrum_mainnet.sql | 45 - .../fct_synth_supply_arbitrum_mainnet.sql | 72 - .../marts/arbitrum/mainnet/spot/schema.yml | 132 -- ...core_account_activity_arbitrum_sepolia.sql | 42 - ...re_account_delegation_arbitrum_sepolia.sql | 60 - ..._active_stakers_daily_arbitrum_sepolia.sql | 52 - .../core/fct_core_apr_arbitrum_sepolia.sql | 238 ---- .../fct_core_apr_rewards_arbitrum_sepolia.sql | 115 -- ...t_core_market_updated_arbitrum_sepolia.sql | 30 - ..._core_pool_collateral_arbitrum_sepolia.sql | 39 - ..._core_pool_delegation_arbitrum_sepolia.sql | 45 - .../core/fct_core_pools_arbitrum_sepolia.sql | 13 - .../core/fct_pool_debt_arbitrum_sepolia.sql | 10 - .../fct_pool_issuance_arbitrum_sepolia.sql | 39 - ..._pool_issuance_hourly_arbitrum_sepolia.sql | 122 -- .../fct_pool_pnl_hourly_arbitrum_sepolia.sql | 217 --- ...ool_pnl_hourly_reward_arbitrum_sepolia.sql | 85 -- .../fct_pool_rewards_arbitrum_sepolia.sql | 37 - ...t_pool_rewards_hourly_arbitrum_sepolia.sql | 21 - ..._rewards_token_hourly_arbitrum_sepolia.sql | 190 --- .../marts/arbitrum/sepolia/core/schema.yml | 600 -------- ...perp_account_activity_arbitrum_sepolia.sql | 89 -- .../fct_perp_accounts_arbitrum_sepolia.sql | 14 - ...p_collateral_balances_arbitrum_sepolia.sql | 129 -- ...p_collateral_modified_arbitrum_sepolia.sql | 18 - ...perp_interest_charged_arbitrum_sepolia.sql | 11 - .../fct_perp_liq_account_arbitrum_sepolia.sql | 59 - ...fct_perp_liq_position_arbitrum_sepolia.sql | 38 - ...t_perp_market_history_arbitrum_sepolia.sql | 106 -- .../fct_perp_markets_arbitrum_sepolia.sql | 14 - .../perp/fct_perp_orders_arbitrum_sepolia.sql | 29 - .../perp/fct_perp_pnl_arbitrum_sepolia.sql | 18 - ...revious_order_expired_arbitrum_sepolia.sql | 15 - .../perp/fct_perp_trades_arbitrum_sepolia.sql | 39 - .../marts/arbitrum/sepolia/perp/schema.yml | 732 ---------- ...p_account_stats_daily_arbitrum_sepolia.sql | 45 - ..._account_stats_hourly_arbitrum_sepolia.sql | 119 -- ...rp_keeper_stats_daily_arbitrum_sepolia.sql | 44 - ...p_keeper_stats_hourly_arbitrum_sepolia.sql | 44 - ...rp_market_stats_daily_arbitrum_sepolia.sql | 25 - ...p_market_stats_hourly_arbitrum_sepolia.sql | 162 --- .../fct_perp_stats_daily_arbitrum_sepolia.sql | 23 - ...fct_perp_stats_hourly_arbitrum_sepolia.sql | 91 -- ..._tracking_stats_daily_arbitrum_sepolia.sql | 93 -- ...tracking_stats_hourly_arbitrum_sepolia.sql | 93 -- .../arbitrum/sepolia/perp_stats/schema.yml | 239 ---- .../prices/fct_prices_arbitrum_sepolia.sql | 44 - .../fct_prices_hourly_arbitrum_sepolia.sql | 72 - .../marts/arbitrum/sepolia/prices/schema.yml | 44 - .../fct_spot_atomics_arbitrum_sepolia.sql | 53 - .../fct_spot_markets_arbitrum_sepolia.sql | 13 - .../fct_spot_wrapper_arbitrum_sepolia.sql | 45 - .../fct_synth_supply_arbitrum_sepolia.sql | 72 - .../marts/arbitrum/sepolia/spot/schema.yml | 132 -- .../buyback/fct_buyback_base_mainnet.sql | 9 - .../fct_buyback_daily_base_mainnet.sql | 31 - .../fct_buyback_hourly_base_mainnet.sql | 31 - .../marts/base/mainnet/buyback/schema.yml | 121 -- ...fct_core_account_activity_base_mainnet.sql | 42 - ...t_core_account_delegation_base_mainnet.sql | 60 - ...core_active_stakers_daily_base_mainnet.sql | 52 - .../core/fct_core_apr_base_mainnet.sql | 238 ---- .../fct_core_apr_rewards_base_mainnet.sql | 115 -- .../fct_core_market_updated_base_mainnet.sql | 30 - .../fct_core_pool_collateral_base_mainnet.sql | 39 - .../fct_core_pool_delegation_base_mainnet.sql | 45 - .../core/fct_core_pools_base_mainnet.sql | 13 - ...fct_core_vault_collateral_base_mainnet.sql | 10 - .../core/fct_pool_debt_base_mainnet.sql | 10 - .../core/fct_pool_issuance_base_mainnet.sql | 39 - .../fct_pool_issuance_hourly_base_mainnet.sql | 122 -- .../core/fct_pool_pnl_hourly_base_mainnet.sql | 217 --- ...ct_pool_pnl_hourly_reward_base_mainnet.sql | 85 -- .../core/fct_pool_rewards_base_mainnet.sql | 37 - .../fct_pool_rewards_hourly_base_mainnet.sql | 21 - ...pool_rewards_token_hourly_base_mainnet.sql | 190 --- .../models/marts/base/mainnet/core/schema.yml | 638 --------- ...fct_perp_account_activity_base_mainnet.sql | 89 -- .../perp/fct_perp_accounts_base_mainnet.sql | 14 - ..._perp_collateral_modified_base_mainnet.sql | 18 - ...fct_perp_interest_charged_base_mainnet.sql | 11 - .../fct_perp_liq_account_base_mainnet.sql | 59 - .../fct_perp_liq_position_base_mainnet.sql | 38 - .../fct_perp_market_history_base_mainnet.sql | 106 -- .../perp/fct_perp_markets_base_mainnet.sql | 14 - .../perp/fct_perp_orders_base_mainnet.sql | 29 - .../perp/fct_perp_pnl_base_mainnet.sql | 18 - ...rp_previous_order_expired_base_mainnet.sql | 15 - .../perp/fct_perp_trades_base_mainnet.sql | 39 - .../models/marts/base/mainnet/perp/schema.yml | 664 --------- ..._perp_account_stats_daily_base_mainnet.sql | 45 - ...perp_account_stats_hourly_base_mainnet.sql | 119 -- ...t_perp_keeper_stats_daily_base_mainnet.sql | 44 - ..._perp_keeper_stats_hourly_base_mainnet.sql | 44 - ...t_perp_market_stats_daily_base_mainnet.sql | 25 - ..._perp_market_stats_hourly_base_mainnet.sql | 162 --- .../fct_perp_stats_daily_base_mainnet.sql | 23 - .../fct_perp_stats_hourly_base_mainnet.sql | 91 -- ...perp_tracking_stats_daily_base_mainnet.sql | 93 -- ...erp_tracking_stats_hourly_base_mainnet.sql | 93 -- .../marts/base/mainnet/perp_stats/schema.yml | 239 ---- .../prices/fct_prices_base_mainnet.sql | 54 - .../prices/fct_prices_hourly_base_mainnet.sql | 72 - .../marts/base/mainnet/prices/schema.yml | 44 - .../spot/fct_spot_atomics_base_mainnet.sql | 53 - .../spot/fct_spot_markets_base_mainnet.sql | 13 - .../spot/fct_spot_wrapper_base_mainnet.sql | 45 - .../spot/fct_synth_supply_base_mainnet.sql | 72 - .../models/marts/base/mainnet/spot/schema.yml | 132 -- .../buyback/fct_buyback_base_sepolia.sql | 9 - .../fct_buyback_daily_base_sepolia.sql | 31 - .../fct_buyback_hourly_base_sepolia.sql | 31 - .../marts/base/sepolia/buyback/schema.yml | 121 -- ...fct_core_account_activity_base_sepolia.sql | 42 - ...t_core_account_delegation_base_sepolia.sql | 60 - ...core_active_stakers_daily_base_sepolia.sql | 52 - .../core/fct_core_apr_base_sepolia.sql | 238 ---- .../fct_core_apr_rewards_base_sepolia.sql | 115 -- .../fct_core_market_updated_base_sepolia.sql | 30 - .../fct_core_pool_collateral_base_sepolia.sql | 39 - .../fct_core_pool_delegation_base_sepolia.sql | 45 - .../core/fct_core_pools_base_sepolia.sql | 13 - .../core/fct_pool_debt_base_sepolia.sql | 10 - .../core/fct_pool_issuance_base_sepolia.sql | 39 - .../fct_pool_issuance_hourly_base_sepolia.sql | 122 -- .../core/fct_pool_pnl_hourly_base_sepolia.sql | 217 --- ...ct_pool_pnl_hourly_reward_base_sepolia.sql | 85 -- .../core/fct_pool_rewards_base_sepolia.sql | 37 - .../fct_pool_rewards_hourly_base_sepolia.sql | 21 - ...pool_rewards_token_hourly_base_sepolia.sql | 190 --- .../models/marts/base/sepolia/core/schema.yml | 592 -------- ...fct_perp_account_activity_base_sepolia.sql | 89 -- .../perp/fct_perp_accounts_base_sepolia.sql | 14 - ..._perp_collateral_modified_base_sepolia.sql | 18 - ...fct_perp_interest_charged_base_sepolia.sql | 11 - .../fct_perp_liq_account_base_sepolia.sql | 59 - .../fct_perp_liq_position_base_sepolia.sql | 38 - .../fct_perp_market_history_base_sepolia.sql | 106 -- .../perp/fct_perp_markets_base_sepolia.sql | 14 - .../perp/fct_perp_orders_base_sepolia.sql | 29 - .../perp/fct_perp_pnl_base_sepolia.sql | 18 - ...rp_previous_order_expired_base_sepolia.sql | 15 - .../perp/fct_perp_trades_base_sepolia.sql | 39 - .../models/marts/base/sepolia/perp/schema.yml | 664 --------- ..._perp_account_stats_daily_base_sepolia.sql | 45 - ...perp_account_stats_hourly_base_sepolia.sql | 119 -- ...t_perp_keeper_stats_daily_base_sepolia.sql | 44 - ..._perp_keeper_stats_hourly_base_sepolia.sql | 44 - ...t_perp_market_stats_daily_base_sepolia.sql | 25 - ..._perp_market_stats_hourly_base_sepolia.sql | 162 --- .../fct_perp_stats_daily_base_sepolia.sql | 23 - .../fct_perp_stats_hourly_base_sepolia.sql | 91 -- ...perp_tracking_stats_daily_base_sepolia.sql | 93 -- ...erp_tracking_stats_hourly_base_sepolia.sql | 93 -- .../marts/base/sepolia/perp_stats/schema.yml | 239 ---- .../prices/fct_prices_base_sepolia.sql | 54 - .../prices/fct_prices_hourly_base_sepolia.sql | 72 - .../marts/base/sepolia/prices/schema.yml | 44 - .../spot/fct_spot_atomics_base_sepolia.sql | 53 - .../spot/fct_spot_markets_base_sepolia.sql | 13 - .../spot/fct_spot_wrapper_base_sepolia.sql | 45 - .../spot/fct_synth_supply_base_sepolia.sql | 72 - .../models/marts/base/sepolia/spot/schema.yml | 132 -- .../fct_core_account_activity_eth_mainnet.sql | 42 - ...ct_core_account_delegation_eth_mainnet.sql | 60 - ..._core_active_stakers_daily_eth_mainnet.sql | 52 - .../mainnet/core/fct_core_apr_eth_mainnet.sql | 241 ---- .../core/fct_core_apr_rewards_eth_mainnet.sql | 115 -- .../fct_core_market_updated_eth_mainnet.sql | 30 - .../core/fct_core_migration_eth_mainnet.sql | 14 - .../fct_core_migration_hourly_eth_mainnet.sql | 63 - .../fct_core_pool_collateral_eth_mainnet.sql | 39 - .../fct_core_pool_delegation_eth_mainnet.sql | 45 - .../core/fct_core_pools_eth_mainnet.sql | 13 - .../core/fct_pool_debt_eth_mainnet.sql | 10 - .../core/fct_pool_issuance_eth_mainnet.sql | 39 - .../fct_pool_issuance_hourly_eth_mainnet.sql | 122 -- .../core/fct_pool_pnl_hourly_eth_mainnet.sql | 244 ---- ...fct_pool_pnl_hourly_reward_eth_mainnet.sql | 87 -- .../core/fct_pool_rewards_eth_mainnet.sql | 37 - .../fct_pool_rewards_hourly_eth_mainnet.sql | 21 - ..._pool_rewards_token_hourly_eth_mainnet.sql | 124 -- .../models/marts/eth/mainnet/core/schema.yml | 717 ---------- .../mainnet/prices/fct_prices_eth_mainnet.sql | 36 - .../prices/fct_prices_hourly_eth_mainnet.sql | 72 - .../marts/eth/mainnet/prices/schema.yml | 44 - .../fct_v2_actions_optimism_mainnet.sql | 34 - .../fct_v2_funding_optimism_mainnet.sql | 45 - .../fct_v2_liquidations_optimism_mainnet.sql | 98 -- .../fct_v2_market_stats_optimism_mainnet.sql | 174 --- .../fct_v2_open_interest_optimism_mainnet.sql | 149 -- ...fct_v2_trade_tracking_optimism_mainnet.sql | 71 - .../fct_v2_trades_optimism_mainnet.sql | 67 - .../fct_v2_transfers_optimism_mainnet.sql | 26 - .../models/marts/optimism/mainnet/schema.yml | 433 ------ ...t_v2_integrator_daily_optimism_mainnet.sql | 144 -- ..._v2_integrator_hourly_optimism_mainnet.sql | 144 -- .../fct_v2_market_daily_optimism_mainnet.sql | 232 ---- .../fct_v2_market_hourly_optimism_mainnet.sql | 232 ---- .../fct_v2_stats_daily_optimism_mainnet.sql | 69 - .../fct_v2_stats_hourly_optimism_mainnet.sql | 69 - .../mainnet/blocks_arbitrum_mainnet.sql | 29 +- .../core_account_created_arbitrum_mainnet.sql | 26 +- ...re_delegation_updated_arbitrum_mainnet.sql | 31 +- .../core/core_deposited_arbitrum_mainnet.sql | 28 +- .../core_liquidation_arbitrum_mainnet.sql | 30 +- ...ore_market_registered_arbitrum_mainnet.sql | 27 +- .../core_market_updated_arbitrum_mainnet.sql | 46 +- .../core_pool_created_arbitrum_mainnet.sql | 27 +- .../core_rewards_claimed_arbitrum_mainnet.sql | 29 +- ...e_rewards_distributed_arbitrum_mainnet.sql | 30 +- .../core/core_usd_burned_arbitrum_mainnet.sql | 29 +- .../core/core_usd_minted_arbitrum_mainnet.sql | 29 +- ...core_vault_collateral_arbitrum_mainnet.sql | 18 +- .../core/core_vault_debt_arbitrum_mainnet.sql | 16 +- ...ore_vault_liquidation_arbitrum_mainnet.sql | 28 +- .../core/core_withdrawn_arbitrum_mainnet.sql | 28 +- .../raw/arbitrum/mainnet/core/schema.yml | 137 +- .../perp_account_created_arbitrum_mainnet.sql | 26 +- ...t_liquidation_attempt_arbitrum_mainnet.sql | 27 +- ...p_collateral_modified_arbitrum_mainnet.sql | 28 +- ...perp_interest_charged_arbitrum_mainnet.sql | 26 +- ...interest_rate_updated_arbitrum_mainnet.sql | 26 +- .../perp_market_created_arbitrum_mainnet.sql | 27 +- .../perp_market_updated_arbitrum_mainnet.sql | 21 +- .../perp_order_committed_arbitrum_mainnet.sql | 25 +- .../perp_order_settled_arbitrum_mainnet.sql | 37 +- ...p_position_liquidated_arbitrum_mainnet.sql | 28 +- ...revious_order_expired_arbitrum_mainnet.sql | 30 +- .../raw/arbitrum/mainnet/perp/schema.yml | 96 +- .../raw/arbitrum/mainnet/spot/schema.yml | 18 +- .../spot_order_cancelled_arbitrum_mainnet.sql | 26 +- .../spot_order_committed_arbitrum_mainnet.sql | 30 +- .../spot_order_settled_arbitrum_mainnet.sql | 32 +- .../spot_synth_bought_arbitrum_mainnet.sql | 30 +- ...spot_synth_registered_arbitrum_mainnet.sql | 26 +- .../spot/spot_synth_sold_arbitrum_mainnet.sql | 30 +- .../spot_synth_unwrapped_arbitrum_mainnet.sql | 28 +- .../spot_synth_wrapped_arbitrum_mainnet.sql | 28 +- .../sepolia/blocks_arbitrum_sepolia.sql | 44 - .../core_account_created_arbitrum_sepolia.sql | 6 - ...re_delegation_updated_arbitrum_sepolia.sql | 6 - .../core/core_deposited_arbitrum_sepolia.sql | 6 - .../core_liquidation_arbitrum_sepolia.sql | 6 - ...ore_market_registered_arbitrum_sepolia.sql | 6 - .../core_market_updated_arbitrum_sepolia.sql | 103 -- .../core_pool_created_arbitrum_sepolia.sql | 6 - .../core_rewards_claimed_arbitrum_sepolia.sql | 6 - ...e_rewards_distributed_arbitrum_sepolia.sql | 6 - .../core/core_usd_burned_arbitrum_sepolia.sql | 6 - .../core/core_usd_minted_arbitrum_sepolia.sql | 6 - ...core_vault_collateral_arbitrum_sepolia.sql | 40 - .../core/core_vault_debt_arbitrum_sepolia.sql | 36 - ...ore_vault_liquidation_arbitrum_sepolia.sql | 6 - .../core/core_withdrawn_arbitrum_sepolia.sql | 6 - .../raw/arbitrum/sepolia/core/schema.yml | 942 ------------- .../perp_account_created_arbitrum_sepolia.sql | 6 - ...t_liquidation_attempt_arbitrum_sepolia.sql | 6 - ...p_collateral_modified_arbitrum_sepolia.sql | 6 - ...perp_interest_charged_arbitrum_sepolia.sql | 6 - ...interest_rate_updated_arbitrum_sepolia.sql | 6 - .../perp_market_created_arbitrum_sepolia.sql | 6 - .../perp_market_updated_arbitrum_sepolia.sql | 26 - .../perp_order_committed_arbitrum_sepolia.sql | 29 - .../perp_order_settled_arbitrum_sepolia.sql | 6 - ...p_position_liquidated_arbitrum_sepolia.sql | 6 - ...revious_order_expired_arbitrum_sepolia.sql | 6 - .../raw/arbitrum/sepolia/perp/schema.yml | 657 --------- .../models/raw/arbitrum/sepolia/schema.yml | 19 - .../raw/arbitrum/sepolia/spot/schema.yml | 525 ------- .../spot_order_cancelled_arbitrum_sepolia.sql | 6 - .../spot_order_committed_arbitrum_sepolia.sql | 6 - .../spot_order_settled_arbitrum_sepolia.sql | 6 - .../spot_synth_bought_arbitrum_sepolia.sql | 6 - ...spot_synth_registered_arbitrum_sepolia.sql | 6 - .../spot/spot_synth_sold_arbitrum_sepolia.sql | 6 - .../spot_synth_unwrapped_arbitrum_sepolia.sql | 6 - .../spot_synth_wrapped_arbitrum_sepolia.sql | 6 - .../raw/base/mainnet/blocks_base_mainnet.sql | 45 - .../buyback_processed_base_mainnet.sql | 43 - .../raw/base/mainnet/buyback/schema.yml | 57 - .../core_account_created_base_mainnet.sql | 6 - .../core_delegation_updated_base_mainnet.sql | 6 - .../core/core_deposited_base_mainnet.sql | 6 - .../core/core_liquidation_base_mainnet.sql | 6 - .../core_market_registered_base_mainnet.sql | 6 - .../core/core_market_updated_base_mainnet.sql | 151 -- .../core/core_pool_created_base_mainnet.sql | 6 - .../core_rewards_claimed_base_mainnet.sql | 6 - .../core_rewards_distributed_base_mainnet.sql | 6 - .../core/core_usd_burned_base_mainnet.sql | 6 - .../core/core_usd_minted_base_mainnet.sql | 6 - .../core_vault_collateral_base_mainnet.sql | 40 - .../core/core_vault_debt_base_mainnet.sql | 41 - .../core_vault_liquidation_base_mainnet.sql | 6 - .../core/core_withdrawn_base_mainnet.sql | 6 - .../models/raw/base/mainnet/core/schema.yml | 942 ------------- .../perp_account_created_base_mainnet.sql | 6 - ...count_liquidation_attempt_base_mainnet.sql | 6 - .../perp_collateral_modified_base_mainnet.sql | 6 - .../perp_interest_charged_base_mainnet.sql | 6 - ...erp_interest_rate_updated_base_mainnet.sql | 6 - .../perp/perp_market_created_base_mainnet.sql | 6 - .../perp/perp_market_updated_base_mainnet.sql | 53 - .../perp_order_committed_base_mainnet.sql | 61 - .../perp/perp_order_settled_base_mainnet.sql | 6 - .../perp_position_liquidated_base_mainnet.sql | 6 - ...rp_previous_order_expired_base_mainnet.sql | 6 - .../models/raw/base/mainnet/perp/schema.yml | 657 --------- .../models/raw/base/mainnet/schema.yml | 19 - .../models/raw/base/mainnet/spot/schema.yml | 525 ------- .../spot_order_cancelled_base_mainnet.sql | 6 - .../spot_order_committed_base_mainnet.sql | 6 - .../spot/spot_order_settled_base_mainnet.sql | 6 - .../spot/spot_synth_bought_base_mainnet.sql | 6 - .../spot_synth_registered_base_mainnet.sql | 6 - .../spot/spot_synth_sold_base_mainnet.sql | 6 - .../spot_synth_unwrapped_base_mainnet.sql | 6 - .../spot/spot_synth_wrapped_base_mainnet.sql | 6 - .../raw/base/sepolia/blocks_base_sepolia.sql | 45 - .../buyback_processed_base_sepolia.sql | 21 - .../raw/base/sepolia/buyback/schema.yml | 57 - .../core_account_created_base_sepolia.sql | 6 - .../core_delegation_updated_base_sepolia.sql | 6 - .../core/core_deposited_base_sepolia.sql | 6 - .../core/core_liquidation_base_sepolia.sql | 6 - .../core_market_registered_base_sepolia.sql | 6 - .../core/core_market_updated_base_sepolia.sql | 151 -- .../core/core_pool_created_base_sepolia.sql | 6 - .../core_rewards_claimed_base_sepolia.sql | 6 - .../core_rewards_distributed_base_sepolia.sql | 6 - .../core/core_usd_burned_base_sepolia.sql | 6 - .../core/core_usd_minted_base_sepolia.sql | 6 - .../core_vault_collateral_base_sepolia.sql | 40 - .../core/core_vault_debt_base_sepolia.sql | 36 - .../core_vault_liquidation_base_sepolia.sql | 6 - .../core/core_withdrawn_base_sepolia.sql | 6 - .../models/raw/base/sepolia/core/schema.yml | 942 ------------- .../perp_account_created_base_sepolia.sql | 6 - ...count_liquidation_attempt_base_sepolia.sql | 6 - .../perp_collateral_modified_base_sepolia.sql | 6 - .../perp_interest_charged_base_sepolia.sql | 6 - ...erp_interest_rate_updated_base_sepolia.sql | 6 - .../perp/perp_market_created_base_sepolia.sql | 6 - .../perp/perp_market_updated_base_sepolia.sql | 53 - .../perp_order_committed_base_sepolia.sql | 61 - .../perp/perp_order_settled_base_sepolia.sql | 6 - .../perp_position_liquidated_base_sepolia.sql | 6 - ...rp_previous_order_expired_base_sepolia.sql | 6 - .../models/raw/base/sepolia/perp/schema.yml | 657 --------- .../models/raw/base/sepolia/schema.yml | 19 - .../models/raw/base/sepolia/spot/schema.yml | 525 ------- .../spot_order_cancelled_base_sepolia.sql | 6 - .../spot_order_committed_base_sepolia.sql | 6 - .../spot/spot_order_settled_base_sepolia.sql | 6 - .../spot/spot_synth_bought_base_sepolia.sql | 6 - .../spot_synth_registered_base_sepolia.sql | 6 - .../spot/spot_synth_sold_base_sepolia.sql | 6 - .../spot_synth_unwrapped_base_sepolia.sql | 6 - .../spot/spot_synth_wrapped_base_sepolia.sql | 6 - .../raw/eth/mainnet/blocks_eth_mainnet.sql | 45 - .../core/core_account_created_eth_mainnet.sql | 6 - .../core_account_migrated_eth_mainnet.sql | 6 - .../core_delegation_updated_eth_mainnet.sql | 6 - .../core/core_deposited_eth_mainnet.sql | 6 - .../core/core_liquidation_eth_mainnet.sql | 6 - .../core_market_registered_eth_mainnet.sql | 6 - .../core/core_market_updated_eth_mainnet.sql | 103 -- .../core/core_pool_created_eth_mainnet.sql | 6 - .../core/core_rewards_claimed_eth_mainnet.sql | 6 - .../core_rewards_distributed_eth_mainnet.sql | 6 - .../core/core_usd_burned_eth_mainnet.sql | 6 - .../core/core_usd_minted_eth_mainnet.sql | 6 - .../core_vault_collateral_eth_mainnet.sql | 42 - .../core/core_vault_debt_eth_mainnet.sql | 38 - .../core_vault_liquidation_eth_mainnet.sql | 6 - .../core/core_withdrawn_eth_mainnet.sql | 6 - .../models/raw/eth/mainnet/core/schema.yml | 1005 -------------- .../models/raw/eth/mainnet/schema.yml | 19 - .../models/raw/optimism/mainnet/schema.yml | 141 -- ...layed_order_submitted_optimism_mainnet.sql | 40 - ...rp_funding_recomputed_optimism_mainnet.sql | 34 - ...rp_margin_transferred_optimism_mainnet.sql | 33 - ...p_position_liquidated_optimism_mainnet.sql | 71 - ...erp_position_modified_optimism_mainnet.sql | 65 - .../ambassador_vote_recorded_snax_mainnet.sql | 6 - ...ambassador_vote_withdrawn_snax_mainnet.sql | 6 - .../raw/snax/mainnet/blocks_snax_mainnet.sql | 10 - .../models/raw/snax/mainnet/schema.yml | 364 ----- .../spartan_vote_recorded_snax_mainnet.sql | 6 - .../spartan_vote_withdrawn_snax_mainnet.sql | 6 - .../treasury_vote_recorded_snax_mainnet.sql | 6 - .../treasury_vote_withdrawn_snax_mainnet.sql | 6 - .../raw/snax/testnet/blocks_snax_testnet.sql | 10 - .../gov_vote_recorded_snax_testnet.sql | 6 - .../gov_vote_withdrawn_snax_testnet.sql | 6 - .../models/raw/snax/testnet/schema.yml | 128 -- transformers/synthetix/models/raw/sources.yml | 1217 +---------------- 446 files changed, 890 insertions(+), 35198 deletions(-) delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_core_account_activity_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_core_account_delegation_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_core_active_stakers_daily_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_core_apr_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_core_apr_rewards_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_core_market_updated_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_core_pool_collateral_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_core_pool_delegation_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_core_pools_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_pool_debt_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_pool_issuance_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_pool_issuance_hourly_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_pool_pnl_hourly_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_pool_pnl_hourly_reward_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_pool_rewards_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_pool_rewards_hourly_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_pool_rewards_token_hourly_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/core/schema.yml delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_account_activity_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_accounts_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_collateral_balances_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_collateral_modified_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_interest_charged_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_liq_account_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_liq_position_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_market_history_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_markets_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_orders_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_pnl_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_previous_order_expired_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_trades_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/perp/schema.yml delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/fct_perp_account_stats_daily_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/fct_perp_account_stats_hourly_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/fct_perp_keeper_stats_daily_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/fct_perp_keeper_stats_hourly_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/fct_perp_market_stats_daily_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/fct_perp_market_stats_hourly_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/fct_perp_stats_daily_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/fct_perp_stats_hourly_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/fct_perp_tracking_stats_daily_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/fct_perp_tracking_stats_hourly_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/schema.yml delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/prices/fct_prices_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/prices/fct_prices_hourly_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/prices/schema.yml delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/spot/fct_spot_atomics_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/spot/fct_spot_markets_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/spot/fct_spot_wrapper_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/spot/fct_synth_supply_arbitrum_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/mainnet/spot/schema.yml delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_core_account_activity_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_core_account_delegation_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_core_active_stakers_daily_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_core_apr_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_core_apr_rewards_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_core_market_updated_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_core_pool_collateral_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_core_pool_delegation_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_core_pools_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_pool_debt_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_pool_issuance_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_pool_issuance_hourly_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_pool_pnl_hourly_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_pool_pnl_hourly_reward_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_pool_rewards_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_pool_rewards_hourly_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_pool_rewards_token_hourly_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/core/schema.yml delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_account_activity_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_accounts_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_collateral_balances_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_collateral_modified_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_interest_charged_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_liq_account_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_liq_position_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_market_history_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_markets_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_orders_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_pnl_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_previous_order_expired_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_trades_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/perp/schema.yml delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/fct_perp_account_stats_daily_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/fct_perp_account_stats_hourly_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/fct_perp_keeper_stats_daily_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/fct_perp_keeper_stats_hourly_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/fct_perp_market_stats_daily_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/fct_perp_market_stats_hourly_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/fct_perp_stats_daily_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/fct_perp_stats_hourly_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/fct_perp_tracking_stats_daily_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/fct_perp_tracking_stats_hourly_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/schema.yml delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/prices/fct_prices_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/prices/fct_prices_hourly_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/prices/schema.yml delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/spot/fct_spot_atomics_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/spot/fct_spot_markets_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/spot/fct_spot_wrapper_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/spot/fct_synth_supply_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/arbitrum/sepolia/spot/schema.yml delete mode 100644 transformers/synthetix/models/marts/base/mainnet/buyback/fct_buyback_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/buyback/fct_buyback_daily_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/buyback/fct_buyback_hourly_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/buyback/schema.yml delete mode 100644 transformers/synthetix/models/marts/base/mainnet/core/fct_core_account_activity_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/core/fct_core_account_delegation_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/core/fct_core_active_stakers_daily_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/core/fct_core_apr_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/core/fct_core_apr_rewards_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/core/fct_core_market_updated_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/core/fct_core_pool_collateral_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/core/fct_core_pool_delegation_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/core/fct_core_pools_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/core/fct_core_vault_collateral_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/core/fct_pool_debt_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/core/fct_pool_issuance_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/core/fct_pool_issuance_hourly_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/core/fct_pool_pnl_hourly_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/core/fct_pool_pnl_hourly_reward_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/core/fct_pool_rewards_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/core/fct_pool_rewards_hourly_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/core/fct_pool_rewards_token_hourly_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/core/schema.yml delete mode 100644 transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_account_activity_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_accounts_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_collateral_modified_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_interest_charged_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_liq_account_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_liq_position_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_market_history_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_markets_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_orders_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_pnl_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_previous_order_expired_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_trades_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/perp/schema.yml delete mode 100644 transformers/synthetix/models/marts/base/mainnet/perp_stats/fct_perp_account_stats_daily_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/perp_stats/fct_perp_account_stats_hourly_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/perp_stats/fct_perp_keeper_stats_daily_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/perp_stats/fct_perp_keeper_stats_hourly_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/perp_stats/fct_perp_market_stats_daily_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/perp_stats/fct_perp_market_stats_hourly_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/perp_stats/fct_perp_stats_daily_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/perp_stats/fct_perp_stats_hourly_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/perp_stats/fct_perp_tracking_stats_daily_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/perp_stats/fct_perp_tracking_stats_hourly_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/perp_stats/schema.yml delete mode 100644 transformers/synthetix/models/marts/base/mainnet/prices/fct_prices_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/prices/fct_prices_hourly_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/prices/schema.yml delete mode 100644 transformers/synthetix/models/marts/base/mainnet/spot/fct_spot_atomics_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/spot/fct_spot_markets_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/spot/fct_spot_wrapper_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/spot/fct_synth_supply_base_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/base/mainnet/spot/schema.yml delete mode 100644 transformers/synthetix/models/marts/base/sepolia/buyback/fct_buyback_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/buyback/fct_buyback_daily_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/buyback/fct_buyback_hourly_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/buyback/schema.yml delete mode 100644 transformers/synthetix/models/marts/base/sepolia/core/fct_core_account_activity_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/core/fct_core_account_delegation_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/core/fct_core_active_stakers_daily_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/core/fct_core_apr_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/core/fct_core_apr_rewards_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/core/fct_core_market_updated_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/core/fct_core_pool_collateral_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/core/fct_core_pool_delegation_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/core/fct_core_pools_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/core/fct_pool_debt_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/core/fct_pool_issuance_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/core/fct_pool_issuance_hourly_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/core/fct_pool_pnl_hourly_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/core/fct_pool_pnl_hourly_reward_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/core/fct_pool_rewards_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/core/fct_pool_rewards_hourly_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/core/fct_pool_rewards_token_hourly_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/core/schema.yml delete mode 100644 transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_account_activity_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_accounts_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_collateral_modified_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_interest_charged_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_liq_account_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_liq_position_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_market_history_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_markets_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_orders_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_pnl_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_previous_order_expired_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_trades_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/perp/schema.yml delete mode 100644 transformers/synthetix/models/marts/base/sepolia/perp_stats/fct_perp_account_stats_daily_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/perp_stats/fct_perp_account_stats_hourly_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/perp_stats/fct_perp_keeper_stats_daily_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/perp_stats/fct_perp_keeper_stats_hourly_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/perp_stats/fct_perp_market_stats_daily_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/perp_stats/fct_perp_market_stats_hourly_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/perp_stats/fct_perp_stats_daily_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/perp_stats/fct_perp_stats_hourly_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/perp_stats/fct_perp_tracking_stats_daily_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/perp_stats/fct_perp_tracking_stats_hourly_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/perp_stats/schema.yml delete mode 100644 transformers/synthetix/models/marts/base/sepolia/prices/fct_prices_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/prices/fct_prices_hourly_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/prices/schema.yml delete mode 100644 transformers/synthetix/models/marts/base/sepolia/spot/fct_spot_atomics_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/spot/fct_spot_markets_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/spot/fct_spot_wrapper_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/spot/fct_synth_supply_base_sepolia.sql delete mode 100644 transformers/synthetix/models/marts/base/sepolia/spot/schema.yml delete mode 100644 transformers/synthetix/models/marts/eth/mainnet/core/fct_core_account_activity_eth_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/eth/mainnet/core/fct_core_account_delegation_eth_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/eth/mainnet/core/fct_core_active_stakers_daily_eth_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/eth/mainnet/core/fct_core_apr_eth_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/eth/mainnet/core/fct_core_apr_rewards_eth_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/eth/mainnet/core/fct_core_market_updated_eth_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/eth/mainnet/core/fct_core_migration_eth_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/eth/mainnet/core/fct_core_migration_hourly_eth_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/eth/mainnet/core/fct_core_pool_collateral_eth_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/eth/mainnet/core/fct_core_pool_delegation_eth_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/eth/mainnet/core/fct_core_pools_eth_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/eth/mainnet/core/fct_pool_debt_eth_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/eth/mainnet/core/fct_pool_issuance_eth_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/eth/mainnet/core/fct_pool_issuance_hourly_eth_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/eth/mainnet/core/fct_pool_pnl_hourly_eth_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/eth/mainnet/core/fct_pool_pnl_hourly_reward_eth_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/eth/mainnet/core/fct_pool_rewards_eth_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/eth/mainnet/core/fct_pool_rewards_hourly_eth_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/eth/mainnet/core/fct_pool_rewards_token_hourly_eth_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/eth/mainnet/core/schema.yml delete mode 100644 transformers/synthetix/models/marts/eth/mainnet/prices/fct_prices_eth_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/eth/mainnet/prices/fct_prices_hourly_eth_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/eth/mainnet/prices/schema.yml delete mode 100644 transformers/synthetix/models/marts/optimism/mainnet/fct_v2_actions_optimism_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/optimism/mainnet/fct_v2_funding_optimism_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/optimism/mainnet/fct_v2_liquidations_optimism_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/optimism/mainnet/fct_v2_market_stats_optimism_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/optimism/mainnet/fct_v2_open_interest_optimism_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/optimism/mainnet/fct_v2_trade_tracking_optimism_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/optimism/mainnet/fct_v2_trades_optimism_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/optimism/mainnet/fct_v2_transfers_optimism_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/optimism/mainnet/schema.yml delete mode 100644 transformers/synthetix/models/marts/optimism/mainnet/stats/fct_v2_integrator_daily_optimism_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/optimism/mainnet/stats/fct_v2_integrator_hourly_optimism_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/optimism/mainnet/stats/fct_v2_market_daily_optimism_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/optimism/mainnet/stats/fct_v2_market_hourly_optimism_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/optimism/mainnet/stats/fct_v2_stats_daily_optimism_mainnet.sql delete mode 100644 transformers/synthetix/models/marts/optimism/mainnet/stats/fct_v2_stats_hourly_optimism_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/arbitrum/sepolia/blocks_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/arbitrum/sepolia/core/core_account_created_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/arbitrum/sepolia/core/core_delegation_updated_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/arbitrum/sepolia/core/core_deposited_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/arbitrum/sepolia/core/core_liquidation_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/arbitrum/sepolia/core/core_market_registered_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/arbitrum/sepolia/core/core_market_updated_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/arbitrum/sepolia/core/core_pool_created_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/arbitrum/sepolia/core/core_rewards_claimed_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/arbitrum/sepolia/core/core_rewards_distributed_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/arbitrum/sepolia/core/core_usd_burned_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/arbitrum/sepolia/core/core_usd_minted_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/arbitrum/sepolia/core/core_vault_collateral_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/arbitrum/sepolia/core/core_vault_debt_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/arbitrum/sepolia/core/core_vault_liquidation_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/arbitrum/sepolia/core/core_withdrawn_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/arbitrum/sepolia/core/schema.yml delete mode 100644 transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_account_created_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_account_liquidation_attempt_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_collateral_modified_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_interest_charged_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_interest_rate_updated_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_market_created_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_market_updated_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_order_committed_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_order_settled_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_position_liquidated_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_previous_order_expired_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/arbitrum/sepolia/perp/schema.yml delete mode 100644 transformers/synthetix/models/raw/arbitrum/sepolia/schema.yml delete mode 100644 transformers/synthetix/models/raw/arbitrum/sepolia/spot/schema.yml delete mode 100644 transformers/synthetix/models/raw/arbitrum/sepolia/spot/spot_order_cancelled_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/arbitrum/sepolia/spot/spot_order_committed_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/arbitrum/sepolia/spot/spot_order_settled_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/arbitrum/sepolia/spot/spot_synth_bought_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/arbitrum/sepolia/spot/spot_synth_registered_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/arbitrum/sepolia/spot/spot_synth_sold_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/arbitrum/sepolia/spot/spot_synth_unwrapped_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/arbitrum/sepolia/spot/spot_synth_wrapped_arbitrum_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/base/mainnet/blocks_base_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/base/mainnet/buyback/buyback_processed_base_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/base/mainnet/buyback/schema.yml delete mode 100644 transformers/synthetix/models/raw/base/mainnet/core/core_account_created_base_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/base/mainnet/core/core_delegation_updated_base_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/base/mainnet/core/core_deposited_base_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/base/mainnet/core/core_liquidation_base_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/base/mainnet/core/core_market_registered_base_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/base/mainnet/core/core_market_updated_base_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/base/mainnet/core/core_pool_created_base_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/base/mainnet/core/core_rewards_claimed_base_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/base/mainnet/core/core_rewards_distributed_base_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/base/mainnet/core/core_usd_burned_base_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/base/mainnet/core/core_usd_minted_base_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/base/mainnet/core/core_vault_collateral_base_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/base/mainnet/core/core_vault_debt_base_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/base/mainnet/core/core_vault_liquidation_base_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/base/mainnet/core/core_withdrawn_base_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/base/mainnet/core/schema.yml delete mode 100644 transformers/synthetix/models/raw/base/mainnet/perp/perp_account_created_base_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/base/mainnet/perp/perp_account_liquidation_attempt_base_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/base/mainnet/perp/perp_collateral_modified_base_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/base/mainnet/perp/perp_interest_charged_base_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/base/mainnet/perp/perp_interest_rate_updated_base_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/base/mainnet/perp/perp_market_created_base_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/base/mainnet/perp/perp_market_updated_base_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/base/mainnet/perp/perp_order_committed_base_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/base/mainnet/perp/perp_order_settled_base_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/base/mainnet/perp/perp_position_liquidated_base_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/base/mainnet/perp/perp_previous_order_expired_base_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/base/mainnet/perp/schema.yml delete mode 100644 transformers/synthetix/models/raw/base/mainnet/schema.yml delete mode 100644 transformers/synthetix/models/raw/base/mainnet/spot/schema.yml delete mode 100644 transformers/synthetix/models/raw/base/mainnet/spot/spot_order_cancelled_base_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/base/mainnet/spot/spot_order_committed_base_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/base/mainnet/spot/spot_order_settled_base_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/base/mainnet/spot/spot_synth_bought_base_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/base/mainnet/spot/spot_synth_registered_base_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/base/mainnet/spot/spot_synth_sold_base_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/base/mainnet/spot/spot_synth_unwrapped_base_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/base/mainnet/spot/spot_synth_wrapped_base_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/base/sepolia/blocks_base_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/base/sepolia/buyback/buyback_processed_base_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/base/sepolia/buyback/schema.yml delete mode 100644 transformers/synthetix/models/raw/base/sepolia/core/core_account_created_base_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/base/sepolia/core/core_delegation_updated_base_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/base/sepolia/core/core_deposited_base_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/base/sepolia/core/core_liquidation_base_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/base/sepolia/core/core_market_registered_base_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/base/sepolia/core/core_market_updated_base_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/base/sepolia/core/core_pool_created_base_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/base/sepolia/core/core_rewards_claimed_base_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/base/sepolia/core/core_rewards_distributed_base_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/base/sepolia/core/core_usd_burned_base_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/base/sepolia/core/core_usd_minted_base_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/base/sepolia/core/core_vault_collateral_base_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/base/sepolia/core/core_vault_debt_base_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/base/sepolia/core/core_vault_liquidation_base_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/base/sepolia/core/core_withdrawn_base_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/base/sepolia/core/schema.yml delete mode 100644 transformers/synthetix/models/raw/base/sepolia/perp/perp_account_created_base_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/base/sepolia/perp/perp_account_liquidation_attempt_base_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/base/sepolia/perp/perp_collateral_modified_base_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/base/sepolia/perp/perp_interest_charged_base_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/base/sepolia/perp/perp_interest_rate_updated_base_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/base/sepolia/perp/perp_market_created_base_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/base/sepolia/perp/perp_market_updated_base_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/base/sepolia/perp/perp_order_committed_base_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/base/sepolia/perp/perp_order_settled_base_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/base/sepolia/perp/perp_position_liquidated_base_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/base/sepolia/perp/perp_previous_order_expired_base_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/base/sepolia/perp/schema.yml delete mode 100644 transformers/synthetix/models/raw/base/sepolia/schema.yml delete mode 100644 transformers/synthetix/models/raw/base/sepolia/spot/schema.yml delete mode 100644 transformers/synthetix/models/raw/base/sepolia/spot/spot_order_cancelled_base_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/base/sepolia/spot/spot_order_committed_base_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/base/sepolia/spot/spot_order_settled_base_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/base/sepolia/spot/spot_synth_bought_base_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/base/sepolia/spot/spot_synth_registered_base_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/base/sepolia/spot/spot_synth_sold_base_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/base/sepolia/spot/spot_synth_unwrapped_base_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/base/sepolia/spot/spot_synth_wrapped_base_sepolia.sql delete mode 100644 transformers/synthetix/models/raw/eth/mainnet/blocks_eth_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/eth/mainnet/core/core_account_created_eth_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/eth/mainnet/core/core_account_migrated_eth_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/eth/mainnet/core/core_delegation_updated_eth_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/eth/mainnet/core/core_deposited_eth_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/eth/mainnet/core/core_liquidation_eth_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/eth/mainnet/core/core_market_registered_eth_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/eth/mainnet/core/core_market_updated_eth_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/eth/mainnet/core/core_pool_created_eth_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/eth/mainnet/core/core_rewards_claimed_eth_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/eth/mainnet/core/core_rewards_distributed_eth_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/eth/mainnet/core/core_usd_burned_eth_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/eth/mainnet/core/core_usd_minted_eth_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/eth/mainnet/core/core_vault_collateral_eth_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/eth/mainnet/core/core_vault_debt_eth_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/eth/mainnet/core/core_vault_liquidation_eth_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/eth/mainnet/core/core_withdrawn_eth_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/eth/mainnet/core/schema.yml delete mode 100644 transformers/synthetix/models/raw/eth/mainnet/schema.yml delete mode 100644 transformers/synthetix/models/raw/optimism/mainnet/schema.yml delete mode 100644 transformers/synthetix/models/raw/optimism/mainnet/v2_perp_delayed_order_submitted_optimism_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/optimism/mainnet/v2_perp_funding_recomputed_optimism_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/optimism/mainnet/v2_perp_margin_transferred_optimism_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/optimism/mainnet/v2_perp_position_liquidated_optimism_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/optimism/mainnet/v2_perp_position_modified_optimism_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/snax/mainnet/ambassador_vote_recorded_snax_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/snax/mainnet/ambassador_vote_withdrawn_snax_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/snax/mainnet/blocks_snax_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/snax/mainnet/schema.yml delete mode 100644 transformers/synthetix/models/raw/snax/mainnet/spartan_vote_recorded_snax_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/snax/mainnet/spartan_vote_withdrawn_snax_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/snax/mainnet/treasury_vote_recorded_snax_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/snax/mainnet/treasury_vote_withdrawn_snax_mainnet.sql delete mode 100644 transformers/synthetix/models/raw/snax/testnet/blocks_snax_testnet.sql delete mode 100644 transformers/synthetix/models/raw/snax/testnet/gov_vote_recorded_snax_testnet.sql delete mode 100644 transformers/synthetix/models/raw/snax/testnet/gov_vote_withdrawn_snax_testnet.sql delete mode 100644 transformers/synthetix/models/raw/snax/testnet/schema.yml diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_core_account_activity_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_core_account_activity_arbitrum_mainnet.sql deleted file mode 100644 index 7e7b383b..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_core_account_activity_arbitrum_mainnet.sql +++ /dev/null @@ -1,42 +0,0 @@ -{{ config( - materialized = "view", - tags = ["core", "account_activity", "daily", "arbitrum", "mainnet"] -) }} - -with delegated as ( - select distinct - block_timestamp, - account_id, - 'Delegated' as account_action - from {{ ref('core_delegation_updated_arbitrum_mainnet') }} -), - -withdrawn as ( - select - block_timestamp, - account_id, - 'Withdrawn' as account_action - from {{ ref('core_withdrawn_arbitrum_mainnet') }} -), - -claimed as ( - select - block_timestamp, - account_id, - 'Claimed' as account_action - from {{ ref('core_rewards_claimed_arbitrum_mainnet') }} -), - -combined as ( - select * from delegated - union all - select * from withdrawn - union all - select * from claimed -) - -select - block_timestamp, - account_action, - account_id -from combined diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_core_account_delegation_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_core_account_delegation_arbitrum_mainnet.sql deleted file mode 100644 index d92d8773..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_core_account_delegation_arbitrum_mainnet.sql +++ /dev/null @@ -1,60 +0,0 @@ -with delegation_changes as ( - select - block_timestamp, - account_id, - pool_id, - collateral_type, - {{ convert_wei('amount') }} - - LAG({{ convert_wei('amount') }}, 1, 0) over ( - partition by - account_id, - pool_id, - collateral_type - order by - block_timestamp - ) as change_in_amount - from - {{ ref('core_delegation_updated_arbitrum_mainnet') }} -), - -cumulative_delegation as ( - select - block_timestamp, - account_id, - pool_id, - collateral_type, - SUM(change_in_amount) over ( - partition by - pool_id, - account_id, - collateral_type - order by - block_timestamp - ) as cumulative_amount_delegated, - ROW_NUMBER() over ( - partition by - pool_id, - account_id, - collateral_type - order by - block_timestamp desc - ) as rn - from - delegation_changes -) - -select - block_timestamp as ts, - pool_id, - collateral_type, - cumulative_amount_delegated as amount_delegated, - CAST( - account_id as text - ) as account_id -from - cumulative_delegation -where - rn = 1 -order by - block_timestamp, - collateral_type diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_core_active_stakers_daily_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_core_active_stakers_daily_arbitrum_mainnet.sql deleted file mode 100644 index 109c22ab..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_core_active_stakers_daily_arbitrum_mainnet.sql +++ /dev/null @@ -1,52 +0,0 @@ -{{ config( - materialized = "view", - tags = ["core", "active_stakers", "daily", "arbitrum", "mainnet"] -) }} - -with delegation_updated as ( - select - block_timestamp, - account_id, - amount - from {{ ref('core_delegation_updated_arbitrum_mainnet') }} -), - -dim as ( - select - d.block_date, - accounts_unique.account_id - from ( - select - generate_series( - date_trunc('day', date('2023-12-15')), - date_trunc('day', current_date), '1 day'::interval - ) as block_date - ) as d - cross join ( - select distinct account_id from delegation_updated - ) as accounts_unique -), - -stakers as ( - select - dim.block_date, - dim.account_id, - case - when coalesce(last(delegation_updated.amount) over ( - partition by dim.account_id - order by dim.block_date - rows between unbounded preceding and current row - ), 0) = 0 then 0 - else 1 - end as is_staking - from dim - left join delegation_updated on - dim.block_date = date(delegation_updated.block_timestamp) - and dim.account_id = delegation_updated.account_id -) - -select - block_date, - sum(is_staking) as nof_stakers_daily -from stakers -group by block_date diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_core_apr_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_core_apr_arbitrum_mainnet.sql deleted file mode 100644 index b442bdcd..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_core_apr_arbitrum_mainnet.sql +++ /dev/null @@ -1,238 +0,0 @@ -{{ - config( - materialized = 'table', - ) -}} - -with pnl_hourly as ( - select - ts, - pool_id, - collateral_type, - collateral_value, - debt, - hourly_pnl, - hourly_issuance, - rewards_usd, - hourly_pnl_pct, - hourly_rewards_pct, - hourly_total_pct, - SUM( - COALESCE( - hourly_issuance, - 0 - ) - ) over ( - partition by - pool_id, - collateral_type - order by - ts - ) as cumulative_issuance, - SUM( - hourly_pnl - ) over ( - partition by - pool_id, - collateral_type - order by - ts - ) as cumulative_pnl - from - {{ ref('fct_pool_pnl_hourly_arbitrum_mainnet') }} -), - -avg_returns as ( - select - ts, - pool_id, - collateral_type, - AVG( - hourly_pnl_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '24 HOURS' preceding - and current row - ) as avg_24h_pnl_pct, - AVG( - hourly_pnl_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '7 DAYS' preceding - and current row - ) as avg_7d_pnl_pct, - AVG( - hourly_pnl_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '28 DAYS' preceding - and current row - ) as avg_28d_pnl_pct, - AVG( - hourly_rewards_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '24 HOURS' preceding - and current row - ) as avg_24h_rewards_pct, - AVG( - hourly_rewards_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '7 DAYS' preceding - and current row - ) as avg_7d_rewards_pct, - AVG( - hourly_rewards_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '28 DAYS' preceding - and current row - ) as avg_28d_rewards_pct, - AVG( - hourly_total_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '24 HOURS' preceding - and current row - ) as avg_24h_total_pct, - AVG( - hourly_total_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '7 DAYS' preceding - and current row - ) as avg_7d_total_pct, - AVG( - hourly_total_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '28 DAYS' preceding - and current row - ) as avg_28d_total_pct - from - pnl_hourly -), - -apr_calculations as ( - select - pnl_hourly.ts, - pnl_hourly.pool_id, - pnl_hourly.collateral_type, - pnl_hourly.collateral_value, - pnl_hourly.debt, - pnl_hourly.hourly_pnl, - pnl_hourly.cumulative_pnl, - pnl_hourly.hourly_issuance, - pnl_hourly.cumulative_issuance, - pnl_hourly.rewards_usd, - pnl_hourly.hourly_pnl_pct, - pnl_hourly.hourly_rewards_pct, - -- total pnls - avg_returns.avg_24h_total_pct * 24 * 365 as apr_24h, - avg_returns.avg_7d_total_pct * 24 * 365 as apr_7d, - avg_returns.avg_28d_total_pct * 24 * 365 as apr_28d, - -- pool pnls - avg_returns.avg_24h_pnl_pct * 24 * 365 as apr_24h_pnl, - avg_returns.avg_7d_pnl_pct * 24 * 365 as apr_7d_pnl, - avg_returns.avg_28d_pnl_pct * 24 * 365 as apr_28d_pnl, - -- rewards pnls - avg_returns.avg_24h_rewards_pct * 24 * 365 as apr_24h_rewards, - avg_returns.avg_7d_rewards_pct * 24 * 365 as apr_7d_rewards, - avg_returns.avg_28d_rewards_pct * 24 * 365 as apr_28d_rewards - from - pnl_hourly - inner join avg_returns - on - pnl_hourly.ts = avg_returns.ts - and pnl_hourly.pool_id = avg_returns.pool_id - and pnl_hourly.collateral_type = avg_returns.collateral_type -), - -apy_calculations as ( - select - *, - (POWER(1 + apr_24h / 8760, 8760) - 1) as apy_24h, - (POWER(1 + apr_7d / 8760, 8760) - 1) as apy_7d, - (POWER(1 + apr_28d / 8760, 8760) - 1) as apy_28d, - (POWER(1 + apr_24h_pnl / 8760, 8760) - 1) as apy_24h_pnl, - (POWER(1 + apr_7d_pnl / 8760, 8760) - 1) as apy_7d_pnl, - (POWER(1 + apr_28d_pnl / 8760, 8760) - 1) as apy_28d_pnl, - (POWER(1 + apr_24h_rewards / 8760, 8760) - 1) as apy_24h_rewards, - (POWER(1 + apr_7d_rewards / 8760, 8760) - 1) as apy_7d_rewards, - (POWER(1 + apr_28d_rewards / 8760, 8760) - 1) as apy_28d_rewards - from - apr_calculations -) - -select - ts, - pool_id, - collateral_type, - collateral_value, - debt, - hourly_issuance, - hourly_pnl, - cumulative_pnl, - cumulative_issuance, - rewards_usd, - hourly_pnl_pct, - hourly_rewards_pct, - apr_24h, - apy_24h, - apr_7d, - apy_7d, - apr_28d, - apy_28d, - apr_24h_pnl, - apy_24h_pnl, - apr_7d_pnl, - apy_7d_pnl, - apr_28d_pnl, - apy_28d_pnl, - apr_24h_rewards, - apy_24h_rewards, - apr_7d_rewards, - apy_7d_rewards, - apr_28d_rewards, - apy_28d_rewards -from - apy_calculations -order by - ts diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_core_apr_rewards_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_core_apr_rewards_arbitrum_mainnet.sql deleted file mode 100644 index bbb72fc5..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_core_apr_rewards_arbitrum_mainnet.sql +++ /dev/null @@ -1,115 +0,0 @@ -{{ - config( - materialized = 'table', - ) -}} - -with pnl_hourly as ( - select - ts, - pool_id, - collateral_type, - reward_token, - collateral_value, - rewards_usd, - hourly_rewards_pct - from - {{ ref('fct_pool_pnl_hourly_reward_arbitrum_mainnet') }} -), - -avg_returns as ( - select - ts, - pool_id, - collateral_type, - reward_token, - AVG( - hourly_rewards_pct - ) over ( - partition by - pool_id, - collateral_type, - reward_token - order by - ts - range between interval '24 HOURS' preceding - and current row - ) as avg_24h_rewards_pct, - AVG( - hourly_rewards_pct - ) over ( - partition by - pool_id, - collateral_type, - reward_token - order by - ts - range between interval '7 DAYS' preceding - and current row - ) as avg_7d_rewards_pct, - AVG( - hourly_rewards_pct - ) over ( - partition by - pool_id, - collateral_type, - reward_token - order by - ts - range between interval '28 DAYS' preceding - and current row - ) as avg_28d_rewards_pct - from - pnl_hourly -), - -apr_calculations as ( - select - pnl_hourly.ts, - pnl_hourly.pool_id, - pnl_hourly.collateral_type, - pnl_hourly.reward_token, - pnl_hourly.collateral_value, - pnl_hourly.rewards_usd, - pnl_hourly.hourly_rewards_pct, - avg_returns.avg_24h_rewards_pct * 24 * 365 as apr_24h_rewards, - avg_returns.avg_7d_rewards_pct * 24 * 365 as apr_7d_rewards, - avg_returns.avg_28d_rewards_pct * 24 * 365 as apr_28d_rewards - from - pnl_hourly - inner join avg_returns - on - pnl_hourly.ts = avg_returns.ts - and pnl_hourly.pool_id = avg_returns.pool_id - and pnl_hourly.collateral_type = avg_returns.collateral_type - and pnl_hourly.reward_token = avg_returns.reward_token -), - -apy_calculations as ( - select - *, - (POWER(1 + apr_24h_rewards / 8760, 8760) - 1) as apy_24h_rewards, - (POWER(1 + apr_7d_rewards / 8760, 8760) - 1) as apy_7d_rewards, - (POWER(1 + apr_28d_rewards / 8760, 8760) - 1) as apy_28d_rewards - from - apr_calculations -) - -select - ts, - pool_id, - collateral_type, - reward_token, - collateral_value, - rewards_usd, - hourly_rewards_pct, - apr_24h_rewards, - apy_24h_rewards, - apr_7d_rewards, - apy_7d_rewards, - apr_28d_rewards, - apy_28d_rewards -from - apy_calculations -order by - ts diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_core_market_updated_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_core_market_updated_arbitrum_mainnet.sql deleted file mode 100644 index b3bca73e..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_core_market_updated_arbitrum_mainnet.sql +++ /dev/null @@ -1,30 +0,0 @@ -with market_updated as ( - select - id, - block_timestamp, - block_number, - transaction_hash, - contract, - event_name, - market_id, - net_issuance, - sender, - collateral_type, - credit_capacity, - token_amount - from - {{ ref('core_market_updated_arbitrum_mainnet') }} -) - -select - id, - block_timestamp as ts, - transaction_hash, - event_name, - market_id, - collateral_type, - {{ convert_wei("credit_capacity") }} as credit_capacity, - {{ convert_wei("net_issuance") }} as net_issuance, - {{ convert_wei("token_amount") }} as token_amount -from - market_updated diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_core_pool_collateral_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_core_pool_collateral_arbitrum_mainnet.sql deleted file mode 100644 index 1ce4576a..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_core_pool_collateral_arbitrum_mainnet.sql +++ /dev/null @@ -1,39 +0,0 @@ -with events as ( - select - block_timestamp, - {{ convert_wei('token_amount') }} as token_amount, - collateral_type - from - {{ ref('core_deposited_arbitrum_mainnet') }} - union all - select - block_timestamp, - -{{ convert_wei('token_amount') }} as token_amount, - collateral_type - from - {{ ref('core_withdrawn_arbitrum_mainnet') }} -), - -ranked_events as ( - select - *, - SUM(token_amount) over ( - partition by collateral_type - order by - block_timestamp - rows between unbounded preceding - and current row - ) as amount_deposited - from - events -) - -select - block_timestamp as ts, - collateral_type, - amount_deposited -from - ranked_events -order by - block_timestamp, - collateral_type diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_core_pool_delegation_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_core_pool_delegation_arbitrum_mainnet.sql deleted file mode 100644 index e2385a41..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_core_pool_delegation_arbitrum_mainnet.sql +++ /dev/null @@ -1,45 +0,0 @@ -with delegation_changes as ( - select - block_timestamp, - account_id, - pool_id, - collateral_type, - {{ convert_wei('amount') }} - - LAG({{ convert_wei('amount') }}, 1, 0) over ( - partition by - account_id, - pool_id, - collateral_type - order by - block_timestamp - ) as change_in_amount - from - {{ ref('core_delegation_updated_arbitrum_mainnet') }} -), - -cumulative_delegation as ( - select - block_timestamp, - pool_id, - collateral_type, - SUM(change_in_amount) over ( - partition by - pool_id, - collateral_type - order by - block_timestamp - ) as cumulative_amount_delegated - from - delegation_changes -) - -select - block_timestamp as ts, - pool_id, - collateral_type, - cumulative_amount_delegated as amount_delegated -from - cumulative_delegation -order by - block_timestamp, - collateral_type diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_core_pools_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_core_pools_arbitrum_mainnet.sql deleted file mode 100644 index be6c7070..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_core_pools_arbitrum_mainnet.sql +++ /dev/null @@ -1,13 +0,0 @@ -with base as ( - select - pool_id as id, - block_timestamp as created_ts, - block_number, - owner - from - {{ ref('core_pool_created_arbitrum_mainnet') }} -) - -select * -from - base diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_pool_debt_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_pool_debt_arbitrum_mainnet.sql deleted file mode 100644 index e480c58d..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_pool_debt_arbitrum_mainnet.sql +++ /dev/null @@ -1,10 +0,0 @@ -select - ts, - block_number, - pool_id, - collateral_type, - debt -from - {{ ref('core_vault_debt_arbitrum_mainnet') }} -order by - ts diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_pool_issuance_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_pool_issuance_arbitrum_mainnet.sql deleted file mode 100644 index c41ca72e..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_pool_issuance_arbitrum_mainnet.sql +++ /dev/null @@ -1,39 +0,0 @@ -with burns as ( - select - block_timestamp as ts, - block_number, - transaction_hash, - pool_id, - collateral_type, - account_id, - -1 * {{ convert_wei('amount') }} as amount - from - {{ ref('core_usd_burned_arbitrum_mainnet') }} - order by - block_timestamp desc -), - -mints as ( - select - block_timestamp as ts, - block_number, - transaction_hash, - pool_id, - collateral_type, - account_id, - {{ convert_wei('amount') }} as amount - from - {{ ref('core_usd_minted_arbitrum_mainnet') }} - order by - block_timestamp desc -) - -select * -from - burns -union all -select * -from - mints -order by - ts desc diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_pool_issuance_hourly_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_pool_issuance_hourly_arbitrum_mainnet.sql deleted file mode 100644 index 2c2fce8a..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_pool_issuance_hourly_arbitrum_mainnet.sql +++ /dev/null @@ -1,122 +0,0 @@ -with dim as ( - select - m.pool_id, - m.collateral_type, - generate_series( - date_trunc('hour', min(t.ts)), - date_trunc('hour', max(t.ts)), - '1 hour'::interval - ) as ts - from - ( - select ts - from - {{ ref('fct_pool_issuance_arbitrum_mainnet') }} - ) as t - cross join ( - select distinct - pool_id, - collateral_type - from - {{ ref('fct_pool_issuance_arbitrum_mainnet') }} - ) as m - group by - m.pool_id, - m.collateral_type -), - -max_debt_block as ( - select - pool_id, - collateral_type, - date_trunc( - 'hour', - ts - ) as "hour", - max(block_number) as max_block_number - from - {{ ref('fct_pool_debt_arbitrum_mainnet') }} - group by - date_trunc( - 'hour', - ts - ), - pool_id, - collateral_type -), - -filt_issuance as ( - select - i.pool_id, - i.collateral_type, - i.amount, - case - when - i.block_number <= d.max_block_number - or d.max_block_number is null then i.ts - else i.ts + interval '1 hour' - end as ts - from - {{ ref('fct_pool_issuance_arbitrum_mainnet') }} - as i - left join max_debt_block as d - on date_trunc( - 'hour', - i.ts - ) = d.hour - and i.pool_id = d.pool_id - and lower( - i.collateral_type - ) = lower( - d.collateral_type - ) - where - i.block_number <= ( - select - max( - max_block_number - ) as b - from - max_debt_block - ) -), - -issuance as ( - select - date_trunc( - 'hour', - ts - ) as ts, - pool_id, - collateral_type, - sum(amount) as hourly_issuance - from - filt_issuance - group by - date_trunc( - 'hour', - ts - ), - pool_id, - collateral_type -) - -select - dim.ts, - dim.pool_id, - dim.collateral_type, - coalesce( - i.hourly_issuance, - 0 - ) as hourly_issuance -from - dim -left join issuance as i - on - dim.pool_id = i.pool_id - and lower( - dim.collateral_type - ) = lower( - i.collateral_type - ) - and dim.ts = i.ts diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_pool_pnl_hourly_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_pool_pnl_hourly_arbitrum_mainnet.sql deleted file mode 100644 index fea50f88..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_pool_pnl_hourly_arbitrum_mainnet.sql +++ /dev/null @@ -1,217 +0,0 @@ -{{ config( - materialized = 'table', - unique_key = ['ts', 'pool_id', 'collateral_type'], -) }} - -with dim as ( - select - p.pool_id, - p.collateral_type, - generate_series( - date_trunc('hour', min(t.ts)), - date_trunc('hour', max(t.ts)), - '1 hour'::INTERVAL - ) as ts - from - ( - select ts - from - {{ ref('fct_pool_debt_arbitrum_mainnet') }} - ) as t - cross join ( - select distinct - pool_id, - collateral_type - from - {{ ref('fct_pool_debt_arbitrum_mainnet') }} - ) as p - group by - p.pool_id, - p.collateral_type -), - -issuance as ( - select - ts, - pool_id, - collateral_type, - hourly_issuance - from - {{ ref('fct_pool_issuance_hourly_arbitrum_mainnet') }} -), - -debt as ( - select distinct - pool_id, - collateral_type, - date_trunc( - 'hour', - ts - ) as ts, - last_value(debt) over ( - partition by date_trunc('hour', ts), pool_id, collateral_type - order by - ts - rows between unbounded preceding - and unbounded following - ) as debt - from - {{ ref('fct_pool_debt_arbitrum_mainnet') }} -), - -collateral as ( - select distinct - pool_id, - collateral_type, - date_trunc( - 'hour', - ts - ) as ts, - last_value(collateral_value) over ( - partition by date_trunc('hour', ts), pool_id, collateral_type - order by - ts - rows between unbounded preceding - and unbounded following - ) as collateral_value - from - {{ ref('core_vault_collateral_arbitrum_mainnet') }} - where - pool_id = 1 -), - -ffill as ( - select - dim.ts, - dim.pool_id, - dim.collateral_type, - coalesce( - last(debt) over ( - partition by dim.collateral_type, dim.pool_id - order by dim.ts - rows between unbounded preceding and current row - ), - 0 - ) as debt, - coalesce( - last(collateral_value) over ( - partition by dim.collateral_type, dim.pool_id - order by dim.ts - rows between unbounded preceding and current row - ), - 0 - ) as collateral_value - from - dim - left join debt - on - dim.ts = debt.ts - and dim.pool_id = debt.pool_id - and dim.collateral_type = debt.collateral_type - left join collateral - on - dim.ts = collateral.ts - and dim.pool_id = collateral.pool_id - and dim.collateral_type = collateral.collateral_type -), - -hourly_pnl as ( - select - ts, - pool_id, - collateral_type, - collateral_value, - debt, - coalesce(lag(debt) over ( - partition by pool_id, collateral_type - order by - ts - ) - debt, 0) as hourly_pnl - from - ffill -), - -hourly_rewards as ( - select - ts, - pool_id, - collateral_type, - rewards_usd - from - {{ ref('fct_pool_rewards_hourly_arbitrum_mainnet') }} -), - -hourly_returns as ( - select - pnl.ts, - pnl.pool_id, - pnl.collateral_type, - pnl.collateral_value, - pnl.debt, - coalesce( - iss.hourly_issuance, - 0 - ) as hourly_issuance, - pnl.hourly_pnl + coalesce( - iss.hourly_issuance, - 0 - ) as hourly_pnl, - coalesce( - rewards.rewards_usd, - 0 - ) as rewards_usd, - case - when pnl.collateral_value = 0 then 0 - else coalesce( - rewards.rewards_usd, - 0 - ) / pnl.collateral_value - end as hourly_rewards_pct, - case - when pnl.collateral_value = 0 then 0 - else - (coalesce(iss.hourly_issuance, 0) + pnl.hourly_pnl) - / pnl.collateral_value - end as hourly_pnl_pct, - case - when pnl.collateral_value = 0 then 0 - else - ( - coalesce(rewards.rewards_usd, 0) - + pnl.hourly_pnl - + coalesce(iss.hourly_issuance, 0) - ) - / pnl.collateral_value - end as hourly_total_pct - from - hourly_pnl as pnl - left join hourly_rewards as rewards - on - pnl.ts = rewards.ts - and pnl.pool_id = rewards.pool_id - and lower(pnl.collateral_type) = lower(rewards.collateral_type) - left join issuance as iss - on - pnl.ts = iss.ts - and pnl.pool_id = iss.pool_id - and lower( - pnl.collateral_type - ) = lower( - iss.collateral_type - ) -) - -select - ts, - pool_id, - collateral_type, - collateral_value, - debt, - hourly_issuance, - hourly_pnl, - rewards_usd, - hourly_pnl_pct, - hourly_rewards_pct, - hourly_total_pct -from - hourly_returns diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_pool_pnl_hourly_reward_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_pool_pnl_hourly_reward_arbitrum_mainnet.sql deleted file mode 100644 index c698b73f..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_pool_pnl_hourly_reward_arbitrum_mainnet.sql +++ /dev/null @@ -1,85 +0,0 @@ -{{ config( - materialized = 'table', - unique_key = ['ts', 'pool_id', 'collateral_type', 'reward_token'], -) }} - -with dim as ( - - select - t.ts, - t.pool_id, - t.collateral_type, - t.collateral_value, - p.token_symbol as reward_token - from - ( - select - ts, - collateral_type, - pool_id, - collateral_value - from - {{ ref('fct_pool_pnl_hourly_arbitrum_mainnet') }} - group by - ts, - collateral_type, - pool_id, - collateral_value - ) as t - cross join ( - select distinct token_symbol - from - {{ ref('fct_pool_rewards_token_hourly_arbitrum_mainnet') }} - ) as p - group by - t.ts, - t.pool_id, - t.collateral_type, - t.collateral_value, - p.token_symbol -), - -reward_hourly_token as ( - select - ts, - pool_id, - collateral_type, - token_symbol as reward_token, - SUM( - rewards_usd - ) as rewards_usd - from - {{ ref('fct_pool_rewards_token_hourly_arbitrum_mainnet') }} - group by - ts, - pool_id, - collateral_type, - token_symbol -) - -select - dim.ts, - dim.pool_id, - dim.collateral_type, - dim.collateral_value, - dim.reward_token, - COALESCE( - reward_hourly_token.rewards_usd, - 0 - ) as rewards_usd, - case - when dim.collateral_value = 0 then 0 - else COALESCE( - reward_hourly_token.rewards_usd, - 0 - ) / dim.collateral_value - end as hourly_rewards_pct -from - dim -left join reward_hourly_token - on - dim.ts = reward_hourly_token.ts - and dim.pool_id = reward_hourly_token.pool_id - and LOWER(dim.collateral_type) - = LOWER(reward_hourly_token.collateral_type) - and dim.reward_token = reward_hourly_token.reward_token diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_pool_rewards_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_pool_rewards_arbitrum_mainnet.sql deleted file mode 100644 index 02a0278d..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_pool_rewards_arbitrum_mainnet.sql +++ /dev/null @@ -1,37 +0,0 @@ -with rewards_distributed as ( - select - block_timestamp as ts, - CAST( - pool_id as INTEGER - ) as pool_id, - collateral_type, - distributor, - {{ convert_wei('amount') }} as amount, - TO_TIMESTAMP("start") as ts_start, - "duration" - from - {{ ref('core_rewards_distributed_arbitrum_mainnet') }} -), - -distributors as ( - select - CAST(distributor_address as TEXT) as distributor_address, - CAST(token_symbol as TEXT) as token_symbol - from - {{ ref('arbitrum_mainnet_reward_distributors') }} -) - -select - rd.ts, - rd.pool_id, - rd.collateral_type, - rd.distributor, - distributors.token_symbol, - rd.amount, - rd.ts_start, - rd.duration -from - rewards_distributed as rd -inner join distributors on rd.distributor = distributors.distributor_address -order by - rd.ts diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_pool_rewards_hourly_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_pool_rewards_hourly_arbitrum_mainnet.sql deleted file mode 100644 index bbf7ede7..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_pool_rewards_hourly_arbitrum_mainnet.sql +++ /dev/null @@ -1,21 +0,0 @@ -with token_hourly as ( - select - ts, - pool_id, - collateral_type, - rewards_usd - from - {{ ref('fct_pool_rewards_token_hourly_arbitrum_mainnet') }} -) - -select - ts, - pool_id, - collateral_type, - SUM(rewards_usd) as rewards_usd -from - token_hourly -group by - ts, - pool_id, - collateral_type diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_pool_rewards_token_hourly_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_pool_rewards_token_hourly_arbitrum_mainnet.sql deleted file mode 100644 index 380eaee3..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/core/fct_pool_rewards_token_hourly_arbitrum_mainnet.sql +++ /dev/null @@ -1,190 +0,0 @@ -with dim as ( - select - m.pool_id, - m.collateral_type, - generate_series( - date_trunc('hour', min(t.min_ts)), - date_trunc('hour', max(t.max_ts)), - '1 hour'::INTERVAL - ) as ts - from - ( - select - min(ts_start) as min_ts, - max( - ts_start + "duration" * '1 second'::INTERVAL - ) as max_ts - from - {{ ref('fct_pool_rewards_arbitrum_mainnet') }} - ) as t - cross join ( - select distinct - pool_id, - collateral_type - from - {{ ref('fct_pool_debt_arbitrum_mainnet') }} - ) as m - group by - m.pool_id, - m.collateral_type -), - -rewards_distributed as ( - select - ts, - pool_id, - collateral_type, - distributor, - token_symbol, - amount, - ts_start, - "duration" - from - {{ ref('fct_pool_rewards_arbitrum_mainnet') }} -), - -hourly_distributions as ( - select - dim.ts, - dim.pool_id, - dim.collateral_type, - r.distributor, - r.token_symbol, - r.amount, - r.ts_start, - r."duration", - row_number() over ( - partition by - dim.ts, - dim.pool_id, - dim.collateral_type, - r.distributor - order by - r.ts_start desc - ) as distributor_index - from - dim - left join rewards_distributed as r - on - dim.pool_id = r.pool_id - and lower( - dim.collateral_type - ) = lower( - r.collateral_type - ) - and dim.ts + '1 hour'::INTERVAL >= r.ts_start - and dim.ts < r.ts_start + r."duration" * '1 second'::INTERVAL - where - r."duration" > 0 -), - -streamed_rewards as ( - select - d.ts, - d.pool_id, - d.collateral_type, - d.distributor, - d.token_symbol, - -- get the amount of time distributed this hour - -- use the smaller of those two intervals - -- convert the interval to a number of hours - -- multiply the result by the hourly amount to get the amount distributed this hour - ( - extract( - epoch - from - least( - d."duration" / 3600 * '1 hour'::INTERVAL, - least( - d.ts + '1 hour'::INTERVAL - greatest( - d.ts, - d.ts_start - ), - least( - d.ts_start + d."duration" * '1 second'::INTERVAL, - d.ts + '1 hour'::INTERVAL - ) - d.ts - ) - ) - ) / 3600 - ) * d.amount / ( - d."duration" / 3600 - ) as amount - from - hourly_distributions as d - where - d.distributor_index = 1 -), - -instant_rewards as ( - select - date_trunc( - 'hour', - ts - ) as ts, - pool_id, - collateral_type, - distributor, - token_symbol, - amount - from - rewards_distributed - where - "duration" = 0 -), - -combined as ( - select - combo.ts, - combo.pool_id, - combo.collateral_type, - combo.distributor, - combo.token_symbol, - combo.amount, - p.price - from - ( - select - ts, - pool_id, - collateral_type, - distributor, - token_symbol, - amount - from - streamed_rewards - union all - select - ts, - pool_id, - collateral_type, - distributor, - token_symbol, - amount - from - instant_rewards - ) as combo - left join {{ ref('fct_prices_hourly_arbitrum_mainnet') }} as p - on - combo.token_symbol = p.market_symbol - and combo.ts = p.ts -) - -select - ts, - pool_id, - collateral_type, - distributor, - token_symbol, - sum(amount) as amount, - sum( - amount * price - ) as rewards_usd -from - combined -group by - ts, - pool_id, - collateral_type, - distributor, - token_symbol diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/core/schema.yml b/transformers/synthetix/models/marts/arbitrum/mainnet/core/schema.yml deleted file mode 100644 index 0d1c3a8a..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/core/schema.yml +++ /dev/null @@ -1,600 +0,0 @@ -version: 2 -models: - - name: fct_core_account_activity_arbitrum_mainnet - description: "Daily number of accounts by action (Delegated, Withdrawn, Claimed)" - columns: - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: account_action - description: "Type of LP action" - data_type: text - tests: - - not_null - - accepted_values: - values: ["Delegated", "Withdrawn", "Claimed"] - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - name: fct_core_active_stakers_daily_arbitrum_mainnet - description: "Daily number of active stakers" - columns: - - name: block_date - description: "Date" - data_type: date - tests: - - not_null - - name: nof_stakers_daily - description: "Number of active stakers daily" - - name: fct_pool_rewards_arbitrum_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: distributor - description: "Address of the distributor" - data_type: text - tests: - - not_null - - name: token_symbol - description: "Token symbol" - data_type: text - tests: - - not_null - - name: amount - description: "Reward amount" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: ts_start - data_type: timestamp with time zone - - name: duration - data_type: numeric - - name: fct_core_account_delegation_arbitrum_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: amount_delegated - description: "Amount of delegated collateral" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fct_core_apr_arbitrum_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: collateral_value - description: "Collateral value (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: debt - description: "Debt value (USD)" - data_type: numeric - tests: - - not_null - - name: hourly_issuance - description: "Hourly issuance" - data_type: numeric - tests: - - not_null - - name: hourly_pnl - description: "Hourly PnL" - data_type: numeric - tests: - - not_null - - name: cumulative_pnl - description: "Cumulative PnL" - data_type: numeric - tests: - - not_null - - name: cumulative_issuance - description: "Cumulative Issuance" - data_type: numeric - tests: - - not_null - - name: rewards_usd - description: "Rewards value (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: hourly_pnl_pct - description: "Hourly PnL (%)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: -1 - max_value: 1 - inclusive: true - - name: hourly_rewards_pct - description: "Hourly Rewards (%)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - max_value: 1 - inclusive: true - - name: apr_24h - description: "APR (24h)" - data_type: numeric - tests: - - not_null - - name: apy_24h - description: "APY (24h)" - data_type: numeric - tests: - - not_null - - name: apr_7d - description: "APR (7d)" - data_type: numeric - tests: - - not_null - - name: apy_7d - description: "APY (7d)" - data_type: numeric - tests: - - not_null - - name: apr_28d - description: "APR (28d)" - data_type: numeric - tests: - - not_null - - name: apy_28d - description: "APY (28d)" - data_type: numeric - tests: - - not_null - - name: apr_24h_pnl - data_type: numeric - - name: apy_24h_pnl - data_type: numeric - - name: apr_7d_pnl - data_type: numeric - - name: apy_7d_pnl - data_type: numeric - - name: apr_28d_pnl - data_type: numeric - - name: apy_28d_pnl - data_type: numeric - - name: apr_24h_rewards - data_type: numeric - - name: apy_24h_rewards - data_type: numeric - - name: apr_7d_rewards - data_type: numeric - - name: apy_7d_rewards - data_type: numeric - - name: apr_28d_rewards - data_type: numeric - - name: apy_28d_rewards - data_type: numeric - - name: fct_core_market_updated_arbitrum_mainnet - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["MarketCollateralWithdrawn", "MarketCollateralDeposited", "MarketUsdWithdrawn", "MarketUsdDeposited"] - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: credit_capacity - description: "Credit capacity" - data_type: numeric - tests: - - not_null - - name: net_issuance - description: "Net issuance" - data_type: numeric - tests: - - not_null - - name: token_amount - description: "Token amount" - data_type: numeric - tests: - - not_null - - name: fct_core_pool_collateral_arbitrum_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: amount_deposited - description: "Amount deposited" - data_type: numeric - tests: - - not_null - - name: fct_core_pool_delegation_arbitrum_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: amount_delegated - data_type: numeric - - name: fct_core_pools_arbitrum_mainnet - columns: - - name: id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: created_ts - description: "Pool creation timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: owner - description: "Address of the pool owner" - data_type: text - tests: - - not_null - - name: fct_pool_debt_arbitrum_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: debt - description: "Debt value (USD)" - data_type: numeric - tests: - - not_null - - name: fct_pool_issuance_hourly_arbitrum_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: hourly_issuance - description: "Hourly issuance" - data_type: numeric - tests: - - not_null - - name: fct_pool_issuance_arbitrum_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - name: amount - description: "Amount issued" - data_type: numeric - tests: - - not_null - - name: fct_pool_pnl_hourly_arbitrum_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: collateral_value - description: "Collateral value (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: debt - description: "Debt value (USD)" - data_type: numeric - tests: - - not_null - - name: hourly_issuance - description: "Hourly issuance" - data_type: numeric - tests: - - not_null - - name: hourly_pnl - description: "Hourly PnL" - data_type: numeric - tests: - - not_null - - name: rewards_usd - description: "Rewards value (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: hourly_pnl_pct - description: "Hourly PnL (%)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: -1 - max_value: 1 - inclusive: true - - name: hourly_rewards_pct - description: "Hourly Rewards (%)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - max_value: 1 - inclusive: true - - name: hourly_total_pct - description: "Hourly Total (%)" - data_type: numeric - tests: - - not_null - - name: fct_pool_rewards_hourly_arbitrum_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: rewards_usd - description: "Rewards value (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fct_pool_rewards_token_hourly_arbitrum_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: distributor - description: "Address of the distributor" - data_type: text - tests: - - not_null - - name: token_symbol - description: "Token symbol" - data_type: text - tests: - - not_null - - name: amount - description: "Distributed rewards amount" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: rewards_usd - description: "Rewards value (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_account_activity_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_account_activity_arbitrum_mainnet.sql deleted file mode 100644 index 1663321c..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_account_activity_arbitrum_mainnet.sql +++ /dev/null @@ -1,89 +0,0 @@ -{{ config( - materialized = "view", - tags = ["perp", "account_activity", "arbitrum", "mainnet"] -) }} - -with active_accounts as ( - select distinct - date_trunc('day', ts) as activity_date, - account_id - from {{ ref('fct_perp_trades_arbitrum_mainnet') }} -), - -date_range as ( - select - generate_series( - date(min(activity_date)), - date(max(activity_date)), - interval '1 day' - )::date as activity_date - from active_accounts -), - -active_accounts_daily as ( - select - date_range.activity_date, - count(distinct active_accounts.account_id) as active_accounts - from date_range - left join active_accounts - on date_range.activity_date = active_accounts.activity_date - group by date_range.activity_date -), - -active_accounts_monthly as ( - select - date_range.activity_date, - count(distinct active_accounts.account_id) as active_accounts - from date_range - left join active_accounts - on - date_range.activity_date - interval '27 days' - <= active_accounts.activity_date - and date_range.activity_date >= active_accounts.activity_date - group by date_range.activity_date -), - -new_accounts as ( - select - min(activity_date) as start_date, - account_id - from active_accounts - group by account_id -), - -new_accounts_daily as ( - select - date_range.activity_date, - count(new_accounts.account_id) as new_accounts - from date_range - left join new_accounts - on date_range.activity_date = new_accounts.start_date - group by date_range.activity_date, new_accounts.start_date -), - -new_accounts_monthly as ( - select distinct - activity_date, - sum(new_accounts) over ( - order by activity_date - range between interval '27 days' preceding and current row - ) as new_accounts - from new_accounts_daily -) - -select - dr.activity_date as ts, - dau.active_accounts as dau, - mau.active_accounts as mau, - new_accounts_daily.new_accounts as new_accounts_daily, - new_accounts_monthly.new_accounts as new_accounts_monthly -from date_range as dr -left join active_accounts_daily as dau - on dr.activity_date = dau.activity_date -left join active_accounts_monthly as mau - on dr.activity_date = mau.activity_date -left join new_accounts_daily - on dr.activity_date = new_accounts_daily.activity_date -left join new_accounts_monthly - on dr.activity_date = new_accounts_monthly.activity_date -order by ts desc diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_accounts_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_accounts_arbitrum_mainnet.sql deleted file mode 100644 index 53b5dc8a..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_accounts_arbitrum_mainnet.sql +++ /dev/null @@ -1,14 +0,0 @@ -with arbitrum as ( - select - block_timestamp as created_ts, - "owner", - CAST( - account_id as VARCHAR - ) as id - from - {{ ref('perp_account_created_arbitrum_mainnet') }} -) - -select * -from - arbitrum diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_collateral_balances_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_collateral_balances_arbitrum_mainnet.sql deleted file mode 100644 index 3386949c..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_collateral_balances_arbitrum_mainnet.sql +++ /dev/null @@ -1,129 +0,0 @@ -with synths as ( - select - synth_market_id as collateral_id, - synth_token_address - from - {{ ref('spot_synth_registered_arbitrum_mainnet') }} -), - -transfers as ( - select - cm.block_number, - cm.block_timestamp as ts, - cm.transaction_hash, - cm.collateral_id, - synths.synth_token_address, - CAST(cm.account_id as text) as account_id, - {{ convert_wei('cm.amount_delta') }} as amount_delta - from - {{ ref('perp_collateral_modified_arbitrum_mainnet') }} as cm - inner join synths - on cm.collateral_id = synths.collateral_id -), - -liq_tx as ( - select distinct - transaction_hash, - CAST(account_id as text) as account_id - from - {{ ref('perp_account_liquidation_attempt_arbitrum_mainnet') }} -), - -distributors as ( - select - CAST(rd.distributor_address as text) as distributor_address, - CAST(rd.token_symbol as text) as token_symbol, - rd.synth_token_address, - synths.collateral_id - from - {{ ref('arbitrum_mainnet_reward_distributors') }} as rd - inner join synths - on rd.synth_token_address = synths.synth_token_address -), - -liquidations as ( - select - rd.block_number, - rd.block_timestamp as ts, - -rd.amount / 1e18 as amount_delta, - liq_tx.transaction_hash, - rd.collateral_type, - distributors.token_symbol, - distributors.synth_token_address, - CAST(liq_tx.account_id as text) as account_id, - distributors.collateral_id - from - {{ ref('core_rewards_distributed_arbitrum_mainnet') }} as rd - inner join liq_tx - on rd.transaction_hash = liq_tx.transaction_hash - inner join distributors - on rd.distributor = distributors.distributor_address -), - -net_transfers as ( - select - events.ts, - events.transaction_hash, - events.event_type, - events.collateral_id, - events.synth_token_address, - synths.synth_symbol, - events.account_id, - prices.price, - events.amount_delta, - SUM(events.amount_delta) over ( - partition by events.account_id, events.collateral_id - order by events.ts - ) as account_balance, - SUM(events.amount_delta) over ( - partition by events.collateral_id - order by events.ts - ) as total_balance - from ( - select - transfers.ts, - transfers.transaction_hash, - transfers.collateral_id, - transfers.synth_token_address, - transfers.account_id, - transfers.amount_delta, - 'transfer' as event_type - from - transfers - union all - select - liquidations.ts, - liquidations.transaction_hash, - liquidations.collateral_id, - liquidations.synth_token_address, - liquidations.account_id, - liquidations.amount_delta, - 'liquidation' as event_type - from - liquidations - ) as events - inner join {{ ref('arbitrum_mainnet_synths') }} as synths - on events.collateral_id = synths.synth_market_id - left join {{ ref('fct_prices_hourly_arbitrum_mainnet') }} as prices - on - synths.token_symbol = prices.market_symbol - and DATE_TRUNC('hour', events.ts) = prices.ts -) - -select - net_transfers.ts, - net_transfers.transaction_hash, - net_transfers.event_type, - net_transfers.collateral_id, - net_transfers.synth_token_address, - net_transfers.synth_symbol, - net_transfers.account_id, - net_transfers.price, - net_transfers.amount_delta, - net_transfers.amount_delta * net_transfers.price as amount_delta_usd, - net_transfers.account_balance, - net_transfers.account_balance * net_transfers.price as account_balance_usd, - net_transfers.total_balance, - net_transfers.total_balance * net_transfers.price as total_balance_usd -from - net_transfers diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_collateral_modified_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_collateral_modified_arbitrum_mainnet.sql deleted file mode 100644 index 686154ca..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_collateral_modified_arbitrum_mainnet.sql +++ /dev/null @@ -1,18 +0,0 @@ -select - cm.id, - cm.block_timestamp, - cm.account_id, - cm.block_number, - cm.transaction_hash, - cm.contract, - cm.event_name, - synths.synth_symbol, - cm.collateral_id as synth_market_id, - synths.synth_token_address, - cm.sender, - {{ convert_wei("cm.amount_delta") }} as amount_delta -from - {{ ref("perp_collateral_modified_arbitrum_mainnet") }} - as cm -inner join {{ ref('arbitrum_mainnet_synths') }} as synths - on cm.collateral_id = synths.synth_market_id diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_interest_charged_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_interest_charged_arbitrum_mainnet.sql deleted file mode 100644 index 39652400..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_interest_charged_arbitrum_mainnet.sql +++ /dev/null @@ -1,11 +0,0 @@ -select - id, - block_timestamp, - block_number, - transaction_hash, - contract, - event_name, - account_id, - {{ convert_wei("interest") }} as interest -from - {{ ref("perp_interest_charged_arbitrum_mainnet") }} diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_liq_account_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_liq_account_arbitrum_mainnet.sql deleted file mode 100644 index 35835faf..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_liq_account_arbitrum_mainnet.sql +++ /dev/null @@ -1,59 +0,0 @@ -with liquidation_events as ( - select - account_id, - reward, - block_timestamp, - full_liquidation, - SUM( - case - when full_liquidation then 1 - else 0 - end - ) over ( - partition by account_id - order by - block_timestamp - rows between unbounded preceding - and current row - ) as liquidation_id - from - {{ ref('perp_account_liquidation_attempt_arbitrum_mainnet') }} -), - -cumulative_rewards as ( - select - block_timestamp, - reward, - full_liquidation, - liquidation_id, - CAST( - account_id as text - ) as account_id, - SUM({{ convert_wei('reward') }}) over ( - partition by - account_id, - liquidation_id - order by - block_timestamp - ) as cumulative_reward, - ROW_NUMBER() over ( - partition by - account_id, - liquidation_id - order by - block_timestamp desc - ) as rn - from - liquidation_events - order by - block_timestamp -) - -select - account_id, - block_timestamp as ts, - cumulative_reward as total_reward -from - cumulative_rewards -where - rn = 1 diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_liq_position_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_liq_position_arbitrum_mainnet.sql deleted file mode 100644 index d1f186d9..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_liq_position_arbitrum_mainnet.sql +++ /dev/null @@ -1,38 +0,0 @@ -with liquidations as ( - select - id, - block_timestamp as ts, - block_number, - transaction_hash, - account_id, - market_id, - {{ convert_wei('amount_liquidated') }} as amount_liquidated, - {{ convert_wei('current_position_size') }} as position_size - from - {{ ref('perp_position_liquidated_arbitrum_mainnet') }} -), - -markets as ( - select - id, - market_symbol - from - {{ ref('fct_perp_markets_arbitrum_mainnet') }} -) - -select - l.id, - l.ts, - l.block_number, - l.transaction_hash, - l.market_id, - m.market_symbol, - l.amount_liquidated, - l.position_size, - CAST( - l.account_id as text - ) as account_id -from - liquidations as l -left join markets as m - on l.market_id = m.id diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_market_history_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_market_history_arbitrum_mainnet.sql deleted file mode 100644 index ccdfe3c7..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_market_history_arbitrum_mainnet.sql +++ /dev/null @@ -1,106 +0,0 @@ -with base as ( - select - mu.id, - mu.block_timestamp as ts, - mu.block_number, - mu.transaction_hash, - m.id as market_id, - m.market_symbol, - {{ convert_wei('price') }} as price, - {{ convert_wei('skew') }} as skew, - {{ convert_wei('size') }} as size, - {{ convert_wei('size_delta') }} as size_delta, - {{ convert_wei('current_funding_rate') }} as funding_rate, - {{ convert_wei('current_funding_velocity') }} as funding_velocity, - {{ convert_wei('interest_rate') }} as interest_rate, - {{ convert_wei('current_funding_rate') }} * 365.25 as funding_rate_apr, - {{ convert_wei('current_funding_rate') }} * 365.25 - + {{ convert_wei('interest_rate') }} as long_rate_apr, - {{ convert_wei('current_funding_rate') }} * -1 * 365.25 - + {{ convert_wei('interest_rate') }} as short_rate_apr, - LAG({{ convert_wei('size') }}, 1, 0) over ( - partition by m.market_symbol - order by - mu.block_timestamp - ) as prev_size - from - {{ ref('perp_market_updated_arbitrum_mainnet') }} as mu - left join {{ ref('fct_perp_markets_arbitrum_mainnet') }} as m - on mu.market_id = m.id -), - -oi as ( - select - id, - ts, - size * price as market_oi_usd, - LAG( - size * price, - 1, - 0 - ) over ( - partition by market_symbol - order by - ts asc - ) as prev_market_oi_usd, - ( - size + skew - ) * price / 2 as long_oi, - ( - size - skew - ) * price / 2 as short_oi, - case - when size * price = 0 then null - else ((size + skew) * price / 2) / ( - size * price - ) - end as long_oi_pct, - case - when size * price = 0 then null - else ((size - skew) * price / 2) / ( - size * price - ) - end as short_oi_pct - from - base -), - -total_oi as ( - select - id, - SUM( - market_oi_usd - prev_market_oi_usd - ) over ( - order by - ts asc - ) as total_oi_usd - from - oi -) - -select - base.*, - ROUND( - oi.market_oi_usd, - 2 - ) as market_oi_usd, - ROUND( - total_oi.total_oi_usd, - 2 - ) as total_oi_usd, - ROUND( - oi.long_oi, - 2 - ) as long_oi, - ROUND( - oi.short_oi, - 2 - ) as short_oi, - oi.long_oi_pct, - oi.short_oi_pct -from - base -inner join oi - on base.id = oi.id -inner join total_oi - on base.id = total_oi.id diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_markets_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_markets_arbitrum_mainnet.sql deleted file mode 100644 index f8d2d5e1..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_markets_arbitrum_mainnet.sql +++ /dev/null @@ -1,14 +0,0 @@ -with arbitrum as ( - select - perps_market_id as id, - block_timestamp as created_ts, - block_number, - market_symbol, - market_name - from - {{ ref('perp_market_created_arbitrum_mainnet') }} -) - -select * -from - arbitrum diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_orders_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_orders_arbitrum_mainnet.sql deleted file mode 100644 index ed72cf7f..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_orders_arbitrum_mainnet.sql +++ /dev/null @@ -1,29 +0,0 @@ -with arbitrum as ( - select - oc.id, - oc.block_timestamp as ts, - oc.block_number, - oc.transaction_hash, - oc.contract, - oc.market_id, - markets.market_symbol, - CAST( - oc.account_id as text - ) as account_id, - oc.order_type, - {{ convert_wei('oc.size_delta') }} as size, - {{ convert_wei('oc.acceptable_price') }} as acceptable_price, - oc.settlement_time, - oc.expiration_time, - {{ convert_hex('oc.tracking_code') }} as tracking_code, - oc.sender - from - {{ ref('perp_order_committed_arbitrum_mainnet') }} - as oc - left join {{ ref('fct_perp_markets_arbitrum_mainnet') }} as markets - on oc.market_id = markets.id -) - -select * -from - arbitrum diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_pnl_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_pnl_arbitrum_mainnet.sql deleted file mode 100644 index 47b44d25..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_pnl_arbitrum_mainnet.sql +++ /dev/null @@ -1,18 +0,0 @@ -{# DEPRECATED: deprecate this table in dashboards and remove #} -with debt as ( - select - ts, - 2 as market_id, - debt * -1 as market_pnl - from - {{ ref('core_vault_debt_arbitrum_mainnet') }} -) - -select - ts, - market_id, - market_pnl -from - debt -order by - ts diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_previous_order_expired_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_previous_order_expired_arbitrum_mainnet.sql deleted file mode 100644 index 577d036d..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_previous_order_expired_arbitrum_mainnet.sql +++ /dev/null @@ -1,15 +0,0 @@ -select - id, - block_timestamp, - block_number, - transaction_hash, - contract, - event_name, - market_id, - account_id, - commitment_time, - tracking_code, - {{ convert_wei("acceptable_price") }} as acceptable_price, - {{ convert_wei("size_delta") }} as size_delta -from - {{ ref("perp_previous_order_expired_arbitrum_mainnet") }} diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_trades_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_trades_arbitrum_mainnet.sql deleted file mode 100644 index 6b5745f6..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_trades_arbitrum_mainnet.sql +++ /dev/null @@ -1,39 +0,0 @@ -with arbitrum as ( - select - pos.id, - pos.block_timestamp as ts, - pos.block_number, - pos.transaction_hash, - pos.contract, - pos.market_id, - markets.market_symbol, - CAST( - pos.account_id as text - ) as account_id, - {{ convert_wei('fill_price') }} as fill_price, - {{ convert_wei('pnl') }} as pnl, - {{ convert_wei('accrued_funding') }} as accrued_funding, - {{ convert_wei('size_delta') }} as trade_size, - {{ convert_wei('new_size') }} as position_size, - {{ convert_wei('total_fees') }} as total_fees, - {{ convert_wei('referral_fees') }} as referral_fees, - {{ convert_wei('collected_fees') }} as collected_fees, - {{ convert_wei('settlement_reward') }} as settlement_reward, - {{ convert_hex('tracking_code') }} as tracking_code, - pos.settler - from - {{ ref('perp_order_settled_arbitrum_mainnet') }} as pos - left join {{ ref('fct_perp_markets_arbitrum_mainnet') }} as markets - on pos.market_id = markets.id -) - -select - *, - ABS( - fill_price * trade_size - ) as notional_trade_size, - fill_price * position_size as notional_position_size, - total_fees - referral_fees - collected_fees - settlement_reward as lp_fees, - total_fees - settlement_reward as exchange_fees -from - arbitrum diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/perp/schema.yml b/transformers/synthetix/models/marts/arbitrum/mainnet/perp/schema.yml deleted file mode 100644 index da65de85..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/perp/schema.yml +++ /dev/null @@ -1,732 +0,0 @@ -models: - - name: fct_perp_account_activity_arbitrum_mainnet - columns: - - name: ts - description: "Activity date" - data_type: date - tests: - - not_null - - name: dau - description: "Daily active users" - data_type: integer - tests: - - not_null - - name: mau - description: "Monthly active users" - data_type: integer - tests: - - not_null - - name: new_accounts_daily - description: "Daily new accounts" - data_type: integer - tests: - - not_null - - name: new_accounts_monthly - description: "Monthly new accounts" - data_type: integer - tests: - - not_null - - name: fct_perp_interest_charged_arbitrum_mainnet - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["InterestCharged"] - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: interest - description: "Interest amount" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fct_perp_collateral_modified_arbitrum_mainnet - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["CollateralModified"] - - name: synth_market_id - description: "Synth market ID" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: sender - data_type: text - tests: - - not_null - - name: amount_delta - data_type: numeric - - name: fct_perp_previous_order_expired_arbitrum_mainnet - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["PreviousOrderExpired"] - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: commitment_time - data_type: numeric - - name: tracking_code - data_type: text - - name: acceptable_price - data_type: numeric - - name: size_delta - data_type: numeric - - name: fct_perp_trades_arbitrum_mainnet - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: market_symbol - description: "Market symbol" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: text - tests: - - not_null - - name: fill_price - description: "Fill price (ETH)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: pnl - description: "PnL (ETH)" - data_type: numeric - tests: - - not_null - - name: accrued_funding - description: "Accrued funding (ETH)" - data_type: numeric - tests: - - not_null - - name: trade_size - description: "Trade size (ETH)" - data_type: numeric - tests: - - not_null - - name: position_size - description: "Position size" - data_type: numeric - tests: - - not_null - - name: total_fees - description: "Total fees (ETH)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: referral_fees - description: "Referral fees (ETH)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collected_fees - description: "Collected fees (ETH)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: settlement_reward - description: "Settlement reward (ETH)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: tracking_code - description: "Account tracking code" - data_type: text - tests: - - not_null - - name: settler - description: "Address of the settler" - data_type: text - tests: - - not_null - - name: notional_trade_size - description: "Notional trade size (ETH)" - data_type: numeric - tests: - - not_null - - name: notional_position_size - description: "Notional position size (ETH)" - data_type: numeric - tests: - - not_null - - name: lp_fees - description: "LP fees (ETH)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - severity: warn - min_value: 0 - inclusive: true - - name: exchange_fees - description: "Exchange fees (ETH)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fct_perp_pnl_arbitrum_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: market_pnl - data_type: numeric - - name: fct_perp_orders_arbitrum_mainnet - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: market_symbol - description: "Market symbol" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: text - tests: - - not_null - - name: order_type - data_type: integer - - name: size - data_type: numeric - - name: acceptable_price - data_type: numeric - - name: settlement_time - data_type: numeric - - name: expiration_time - data_type: numeric - - name: tracking_code - data_type: text - - name: sender - data_type: text - - name: fct_perp_markets_arbitrum_mainnet - columns: - - name: id - description: "Market ID" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: created_ts - description: "Market creation timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: market_symbol - description: "Market symbol" - data_type: text - tests: - - not_null - - name: market_name - description: "Market name" - data_type: text - tests: - - not_null - - name: fct_perp_market_history_arbitrum_mainnet - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: market_symbol - description: "Market symbol" - data_type: text - tests: - - not_null - - name: price - description: "Price (USD)" - data_type: numeric - tests: - - not_null - - name: skew - description: "Skew (ETH)" - data_type: numeric - tests: - - not_null - - name: size - description: "Size (ETH)" - data_type: numeric - tests: - - not_null - - name: size_delta - description: "Size delta (ETH)" - data_type: numeric - tests: - - not_null - - name: funding_rate - description: "Funding rate (%)" - data_type: numeric - tests: - - not_null - - name: funding_velocity - description: "Funding velocity" - data_type: numeric - tests: - - not_null - - name: interest_rate - description: "Interest rate (%)" - data_type: numeric - tests: - - not_null - - name: funding_rate_apr - description: "Funding rate APR (%)" - data_type: numeric - tests: - - not_null - - name: long_rate_apr - description: "Long rate APR (%)" - data_type: numeric - tests: - - not_null - - name: short_rate_apr - description: "Short rate APR (%)" - data_type: numeric - tests: - - not_null - - name: prev_size - description: "Previous size (ETH)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: market_oi_usd - description: "Market open interest (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: total_oi_usd - description: "Total open interest (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: long_oi - description: "Long open interest (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: short_oi - description: "Short open interest (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: long_oi_pct - description: "Long open interest (%)" - data_type: numeric - - name: short_oi_pct - description: "Short open interest (%)" - data_type: numeric - - name: fct_perp_liq_position_arbitrum_mainnet - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: text - tests: - - not_null - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: market_symbol - description: "Market symbol" - data_type: text - tests: - - not_null - - name: amount_liquidated - description: "Amount liquidated" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: position_size - description: "Liquidated position size" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fct_perp_liq_account_arbitrum_mainnet - columns: - - name: account_id - description: "ID of the account" - data_type: text - tests: - - not_null - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: total_reward - description: "Total reward" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fct_perp_accounts_arbitrum_mainnet - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: created_ts - description: "Account creation timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: owner - description: "Address of the account owner" - data_type: text - tests: - - not_null - - name: fct_perp_collateral_balances_arbitrum_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: collateral_id - description: "Market ID of the collateral, from the spot market" - data_type: integer - tests: - - not_null - - name: synth_token_address - description: "Address of the synth token" - data_type: text - tests: - - not_null - - name: synth_symbol - description: "Symbol of the synth token" - data_type: text - tests: - - not_null - - name: event_type - description: "Description of the event, e.g. 'transfer' or 'liquidation'" - data_type: text - tests: - - not_null - - name: amount_delta - description: "Amount of the collateral token that was transferred" - data_type: numeric - tests: - - not_null - - name: account_balance - description: "Balance of the collateral token in the account after the transfer" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: total_balance - description: "Total balance of the collateral token in the perps system after the transfer" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: amount_delta_usd - description: "USD value of the collateral token that was transferred" - data_type: numeric - tests: - - not_null - - name: account_balance_usd - description: "USD value of the collateral token in the account after the transfer" - data_type: numeric - tests: - - not_null - - name: total_balance_usd - description: "Total USD value of the collateral token in the perps system after the transfer" - data_type: numeric - tests: - - not_null diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/fct_perp_account_stats_daily_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/fct_perp_account_stats_daily_arbitrum_mainnet.sql deleted file mode 100644 index 6ec24eb6..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/fct_perp_account_stats_daily_arbitrum_mainnet.sql +++ /dev/null @@ -1,45 +0,0 @@ -with daily as ( - select - DATE_TRUNC( - 'day', - ts - ) as ts, - account_id, - SUM(fees) as fees, - SUM(volume) as volume, - SUM(amount_liquidated) as amount_liquidated, - SUM(liquidations) as liquidations - from - {{ ref('fct_perp_account_stats_hourly_arbitrum_mainnet') }} - group by - DATE_TRUNC( - 'day', - ts - ), - account_id -), - -stats as ( - select - *, - SUM(fees) over ( - partition by account_id - order by - ts - range between unbounded preceding - and current row - ) as cumulative_fees, - SUM(volume) over ( - partition by account_id - order by - ts - range between unbounded preceding - and current row - ) as cumulative_volume - from - daily -) - -select * -from - stats diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/fct_perp_account_stats_hourly_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/fct_perp_account_stats_hourly_arbitrum_mainnet.sql deleted file mode 100644 index 06dd40b1..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/fct_perp_account_stats_hourly_arbitrum_mainnet.sql +++ /dev/null @@ -1,119 +0,0 @@ -with trades as ( - select - ts, - account_id, - total_fees, - notional_trade_size, - 1 as trades, - SUM( - total_fees - ) over ( - partition by account_id - order by - ts - ) as cumulative_fees, - SUM( - notional_trade_size - ) over ( - partition by account_id - order by - ts - ) as cumulative_volume - from - {{ ref('fct_perp_trades_arbitrum_mainnet') }} -), - -liq as ( - select - ts, - account_id, - amount_liquidated, - 1 as liquidations - from - {{ ref('fct_perp_liq_position_arbitrum_mainnet') }} -), - -inc_trades as ( - select - DATE_TRUNC( - 'hour', - ts - ) as ts, - account_id, - SUM(trades) as trades, - SUM(total_fees) as fees, - SUM(notional_trade_size) as volume, - MAX(cumulative_fees) as cumulative_fees, - MAX(cumulative_volume) as cumulative_volume - from - trades - group by - DATE_TRUNC( - 'hour', - ts - ), - account_id -), - -inc_liq as ( - select - DATE_TRUNC( - 'hour', - ts - ) as ts, - account_id, - SUM(amount_liquidated) as amount_liquidated, - SUM(liquidations) as liquidations - from - liq - group by - DATE_TRUNC( - 'hour', - ts - ), - account_id -), - -inc as ( - select - h.ts, - h.account_id, - COALESCE( - h.trades, - 0 - ) as trades, - COALESCE( - h.fees, - 0 - ) as fees, - COALESCE( - h.volume, - 0 - ) as volume, - COALESCE( - l.amount_liquidated, - 0 - ) as amount_liquidated, - COALESCE( - l.liquidations, - 0 - ) as liquidations, - COALESCE( - h.cumulative_fees, - 0 - ) as cumulative_fees, - COALESCE( - h.cumulative_volume, - 0 - ) as cumulative_volume - from - inc_trades as h - left join inc_liq as l - on - h.ts = l.ts - and h.account_id = l.account_id -) - -select * -from - inc diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/fct_perp_keeper_stats_daily_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/fct_perp_keeper_stats_daily_arbitrum_mainnet.sql deleted file mode 100644 index d2614bab..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/fct_perp_keeper_stats_daily_arbitrum_mainnet.sql +++ /dev/null @@ -1,44 +0,0 @@ -with hourly as ( - select - keeper, - settlement_rewards, - amount_settled, - trades, - DATE_TRUNC( - 'day', - ts - ) as ts - from - {{ ref('fct_perp_keeper_stats_hourly_arbitrum_mainnet') }} -), - -total as ( - select - ts, - SUM(trades) as trades_total, - SUM(settlement_rewards) as settlement_reward_total, - SUM(amount_settled) as amount_settled_total - from - hourly - group by - ts -) - -select - hourly.ts, - hourly.keeper, - SUM(hourly.trades) as trades, - SUM(hourly.settlement_rewards) as settlement_rewards, - SUM(hourly.amount_settled) as amount_settled, - SUM(hourly.trades) / MAX(total.trades_total) as trades_pct, - SUM(hourly.settlement_rewards) - / MAX(total.settlement_reward_total) as settlement_rewards_pct, - SUM(hourly.amount_settled) - / MAX(total.amount_settled_total) as amount_settled_pct -from - hourly -inner join total - on hourly.ts = total.ts -group by - hourly.ts, - hourly.keeper diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/fct_perp_keeper_stats_hourly_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/fct_perp_keeper_stats_hourly_arbitrum_mainnet.sql deleted file mode 100644 index f165f4df..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/fct_perp_keeper_stats_hourly_arbitrum_mainnet.sql +++ /dev/null @@ -1,44 +0,0 @@ -with trades as ( - select - settler, - settlement_reward, - notional_trade_size, - 1 as trades, - DATE_TRUNC( - 'hour', - ts - ) as ts - from - {{ ref('fct_perp_trades_arbitrum_mainnet') }} -), - -total as ( - select - ts, - SUM(trades) as trades_total, - SUM(settlement_reward) as settlement_reward_total, - SUM(notional_trade_size) as notional_trade_size_total - from - trades - group by - ts -) - -select - trades.ts, - trades.settler as keeper, - SUM(trades.trades) as trades, - SUM(trades.settlement_reward) as settlement_rewards, - SUM(trades.notional_trade_size) as amount_settled, - SUM(trades.trades) / MAX(total.trades_total) as trades_pct, - SUM(trades.settlement_reward) - / MAX(total.settlement_reward_total) as settlement_rewards_pct, - SUM(trades.notional_trade_size) - / MAX(total.notional_trade_size_total) as amount_settled_pct -from - trades -inner join total - on trades.ts = total.ts -group by - trades.ts, - trades.settler diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/fct_perp_market_stats_daily_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/fct_perp_market_stats_daily_arbitrum_mainnet.sql deleted file mode 100644 index 77b55789..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/fct_perp_market_stats_daily_arbitrum_mainnet.sql +++ /dev/null @@ -1,25 +0,0 @@ -select - DATE_TRUNC( - 'day', - ts - ) as ts, - market_symbol, - SUM(trades) as trades, - SUM(exchange_fees) as exchange_fees, - SUM(referral_fees) as referral_fees, - SUM(collected_fees) as collected_fees, - SUM(volume) as volume, - SUM(amount_liquidated) as amount_liquidated, - SUM(liquidations) as liquidations, - MAX(cumulative_exchange_fees) as cumulative_exchange_fees, - MAX(cumulative_referral_fees) as cumulative_referral_fees, - MAX(cumulative_collected_fees) as cumulative_collected_fees, - MAX(cumulative_volume) as cumulative_volume -from - {{ ref('fct_perp_market_stats_hourly_arbitrum_mainnet') }} -group by - DATE_TRUNC( - 'day', - ts - ), - market_symbol diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/fct_perp_market_stats_hourly_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/fct_perp_market_stats_hourly_arbitrum_mainnet.sql deleted file mode 100644 index fe5fb9e6..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/fct_perp_market_stats_hourly_arbitrum_mainnet.sql +++ /dev/null @@ -1,162 +0,0 @@ -with trades as ( - select - ts, - market_symbol, - exchange_fees, - referral_fees, - collected_fees, - notional_trade_size, - 1 as trades - from - {{ ref('fct_perp_trades_arbitrum_mainnet') }} -), - -liq as ( - select - ts, - market_symbol, - amount_liquidated, - 1 as liquidations - from - {{ ref('fct_perp_liq_position_arbitrum_mainnet') }} -), - -inc_trades as ( - select - DATE_TRUNC( - 'hour', - ts - ) as ts, - market_symbol, - SUM(trades) as trades, - SUM(exchange_fees) as exchange_fees, - SUM(referral_fees) as referral_fees, - SUM(collected_fees) as collected_fees, - SUM(notional_trade_size) as volume - from - trades - group by - DATE_TRUNC( - 'hour', - ts - ), - market_symbol -), - -inc_liq as ( - select - DATE_TRUNC( - 'hour', - ts - ) as ts, - market_symbol, - SUM(amount_liquidated) as amount_liquidated, - SUM(liquidations) as liquidations - from - liq - group by - DATE_TRUNC( - 'hour', - ts - ), - market_symbol -), - -dim as ( - select - m.market_symbol, - GENERATE_SERIES( - DATE_TRUNC('hour', MIN(t.ts)), - DATE_TRUNC('hour', MAX(t.ts)), - '1 hour'::INTERVAL - ) as ts - from - ( - select ts - from - trades - ) as t - cross join ( - select distinct market_symbol - from - trades - ) as m - group by - m.market_symbol -), - -inc as ( - select - dim.ts, - dim.market_symbol, - COALESCE( - h.trades, - 0 - ) as trades, - COALESCE( - h.exchange_fees, - 0 - ) as exchange_fees, - COALESCE( - h.referral_fees, - 0 - ) as referral_fees, - COALESCE( - h.collected_fees, - 0 - ) as collected_fees, - COALESCE( - h.volume, - 0 - ) as volume, - COALESCE( - l.amount_liquidated, - 0 - ) as amount_liquidated, - COALESCE( - l.liquidations, - 0 - ) as liquidations, - SUM( - h.exchange_fees - ) over ( - partition by dim.market_symbol - order by - dim.ts - ) as cumulative_exchange_fees, - SUM( - h.referral_fees - ) over ( - partition by dim.market_symbol - order by - dim.ts - ) as cumulative_referral_fees, - SUM( - h.collected_fees - ) over ( - partition by dim.market_symbol - order by - dim.ts - ) as cumulative_collected_fees, - SUM( - h.volume - ) over ( - partition by dim.market_symbol - order by - dim.ts - ) as cumulative_volume - from - dim - left join inc_trades as h - on - dim.ts = h.ts - and dim.market_symbol = h.market_symbol - left join inc_liq as l - on - dim.ts = l.ts - and dim.market_symbol = l.market_symbol -) - -select * -from - inc diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/fct_perp_stats_daily_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/fct_perp_stats_daily_arbitrum_mainnet.sql deleted file mode 100644 index e419be66..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/fct_perp_stats_daily_arbitrum_mainnet.sql +++ /dev/null @@ -1,23 +0,0 @@ -select - DATE_TRUNC( - 'day', - ts - ) as ts, - SUM(trades) as trades, - SUM(exchange_fees) as exchange_fees, - SUM(referral_fees) as referral_fees, - SUM(collected_fees) as collected_fees, - SUM(volume) as volume, - SUM(liquidation_rewards) as liquidation_rewards, - SUM(liquidated_accounts) as liquidated_accounts, - MAX(cumulative_exchange_fees) as cumulative_exchange_fees, - MAX(cumulative_referral_fees) as cumulative_referral_fees, - MAX(cumulative_collected_fees) as cumulative_collected_fees, - MAX(cumulative_volume) as cumulative_volume -from - {{ ref('fct_perp_stats_hourly_arbitrum_mainnet') }} -group by - DATE_TRUNC( - 'day', - ts - ) diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/fct_perp_stats_hourly_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/fct_perp_stats_hourly_arbitrum_mainnet.sql deleted file mode 100644 index d49e1876..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/fct_perp_stats_hourly_arbitrum_mainnet.sql +++ /dev/null @@ -1,91 +0,0 @@ -with inc_market as ( - select - ts, - market_symbol, - trades, - exchange_fees, - referral_fees, - collected_fees, - volume, - liquidations, - cumulative_exchange_fees, - cumulative_referral_fees, - cumulative_collected_fees, - cumulative_volume - from - {{ ref('fct_perp_market_stats_hourly_arbitrum_mainnet') }} -), - -liq as ( - select - ts, - total_reward, - 1 as liquidated_accounts - from - {{ ref('fct_perp_liq_account_arbitrum_mainnet') }} -), - -inc_liq as ( - select - DATE_TRUNC( - 'hour', - ts - ) as ts, - SUM(total_reward) as liquidation_rewards, - SUM(liquidated_accounts) as liquidated_accounts - from - liq - group by - DATE_TRUNC( - 'hour', - ts - ) -), - -inc_trade as ( - select - ts, - SUM(trades) as trades, - SUM(exchange_fees) as exchange_fees, - SUM(referral_fees) as referral_fees, - SUM(collected_fees) as collected_fees, - SUM(volume) as volume, - SUM(cumulative_exchange_fees) as cumulative_exchange_fees, - SUM(cumulative_referral_fees) as cumulative_referral_fees, - SUM(cumulative_collected_fees) as cumulative_collected_fees, - SUM(cumulative_volume) as cumulative_volume - from - inc_market - group by - ts -), - -inc as ( - select - h.ts, - h.trades, - h.exchange_fees, - h.referral_fees, - h.collected_fees, - h.volume, - h.cumulative_exchange_fees, - h.cumulative_referral_fees, - h.cumulative_collected_fees, - h.cumulative_volume, - COALESCE( - l.liquidation_rewards, - 0 - ) as liquidation_rewards, - COALESCE( - l.liquidated_accounts, - 0 - ) as liquidated_accounts - from - inc_trade as h - left join inc_liq as l - on h.ts = l.ts -) - -select * -from - inc diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/fct_perp_tracking_stats_daily_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/fct_perp_tracking_stats_daily_arbitrum_mainnet.sql deleted file mode 100644 index b3ec49d4..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/fct_perp_tracking_stats_daily_arbitrum_mainnet.sql +++ /dev/null @@ -1,93 +0,0 @@ -with trades as ( - select - DATE_TRUNC( - 'day', - ts - ) as ts, - tracking_code, - SUM(exchange_fees) as exchange_fees, - SUM(referral_fees) as referral_fees, - SUM(collected_fees) as collected_fees, - SUM(volume) as volume, - SUM(trades) as trades - from - {{ ref('fct_perp_tracking_stats_hourly_arbitrum_mainnet') }} - group by - DATE_TRUNC( - 'day', - ts - ), - tracking_code -), - -accounts as ( - select - DATE_TRUNC( - 'day', - ts - ) as ts, - tracking_code, - COUNT( - distinct account_id - ) as "accounts" - from - {{ ref('fct_perp_trades_arbitrum_mainnet') }} - group by - DATE_TRUNC( - 'day', - ts - ), - tracking_code -), - -total as ( - select - ts, - SUM(exchange_fees) as exchange_fees_total, - SUM(referral_fees) as referral_fees_total, - SUM(collected_fees) as collected_fees_total, - SUM(volume) as volume_total, - SUM(trades) as trades_total - from - trades - group by - ts -) - -select - trades.ts, - trades.tracking_code, - trades.exchange_fees, - trades.referral_fees, - trades.collected_fees, - trades.volume, - trades.trades, - accounts.accounts, - case - when total.exchange_fees_total = 0 then 0 - else trades.exchange_fees / total.exchange_fees_total - end as exchange_fees_share, - case - when total.referral_fees_total = 0 then 0 - else trades.referral_fees / total.referral_fees_total - end as referral_fees_share, - case - when total.collected_fees_total = 0 then 0 - else trades.collected_fees / total.collected_fees_total - end as collected_fees_share, - case - when total.volume_total = 0 then 0 - else trades.volume / total.volume_total - end as volume_share, - case - when total.trades_total = 0 then 0 - else trades.trades / total.trades_total - end as trades_share -from - trades -inner join accounts - on - trades.ts = accounts.ts - and trades.tracking_code = accounts.tracking_code -inner join total - on trades.ts = total.ts diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/fct_perp_tracking_stats_hourly_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/fct_perp_tracking_stats_hourly_arbitrum_mainnet.sql deleted file mode 100644 index 98d0399f..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/fct_perp_tracking_stats_hourly_arbitrum_mainnet.sql +++ /dev/null @@ -1,93 +0,0 @@ -with trades as ( - select - DATE_TRUNC( - 'hour', - ts - ) as ts, - tracking_code, - SUM(exchange_fees) as exchange_fees, - SUM(referral_fees) as referral_fees, - SUM(collected_fees) as collected_fees, - SUM(notional_trade_size) as volume, - SUM(1) as trades - from - {{ ref('fct_perp_trades_arbitrum_mainnet') }} - group by - DATE_TRUNC( - 'hour', - ts - ), - tracking_code -), - -accounts as ( - select - DATE_TRUNC( - 'hour', - ts - ) as ts, - tracking_code, - COUNT( - distinct account_id - ) as "accounts" - from - {{ ref('fct_perp_trades_arbitrum_mainnet') }} - group by - DATE_TRUNC( - 'hour', - ts - ), - tracking_code -), - -total as ( - select - ts, - SUM(trades) as trades_total, - SUM(exchange_fees) as exchange_fees_total, - SUM(referral_fees) as referral_fees_total, - SUM(collected_fees) as collected_fees_total, - SUM(volume) as volume_total - from - trades - group by - ts -) - -select - trades.ts, - trades.tracking_code, - trades.exchange_fees, - trades.referral_fees, - trades.collected_fees, - trades.volume, - trades.trades, - accounts.accounts, - case - when total.exchange_fees_total = 0 then 0 - else trades.exchange_fees / total.exchange_fees_total - end as exchange_fees_share, - case - when total.referral_fees_total = 0 then 0 - else trades.referral_fees / total.referral_fees_total - end as referral_fees_share, - case - when total.collected_fees_total = 0 then 0 - else trades.collected_fees / total.collected_fees_total - end as collected_fees_share, - case - when total.volume_total = 0 then 0 - else trades.volume / total.volume_total - end as volume_share, - case - when total.trades_total = 0 then 0 - else trades.trades / total.trades_total - end as trades_share -from - trades -inner join accounts - on - trades.ts = accounts.ts - and trades.tracking_code = accounts.tracking_code -inner join total - on trades.ts = total.ts diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/schema.yml b/transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/schema.yml deleted file mode 100644 index 749a5c3b..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/perp_stats/schema.yml +++ /dev/null @@ -1,239 +0,0 @@ -models: - - name: fct_perp_tracking_stats_hourly_arbitrum_mainnet - columns: - - name: ts - data_type: timestamp with time zone - - name: tracking_code - data_type: text - - name: exchange_fees - data_type: numeric - - name: referral_fees - data_type: numeric - - name: collected_fees - data_type: numeric - - name: volume - data_type: numeric - - name: trades - data_type: bigint - - name: accounts - data_type: bigint - - name: exchange_fees_share - data_type: numeric - - name: referral_fees_share - data_type: numeric - - name: collected_fees_share - data_type: numeric - - name: volume_share - data_type: numeric - - name: trades_share - data_type: numeric - - name: fct_perp_tracking_stats_daily_arbitrum_mainnet - columns: - - name: ts - data_type: timestamp with time zone - - name: tracking_code - data_type: text - - name: exchange_fees - data_type: numeric - - name: referral_fees - data_type: numeric - - name: collected_fees - data_type: numeric - - name: volume - data_type: numeric - - name: trades - data_type: numeric - - name: accounts - data_type: bigint - - name: exchange_fees_share - data_type: numeric - - name: referral_fees_share - data_type: numeric - - name: collected_fees_share - data_type: numeric - - name: volume_share - data_type: numeric - - name: trades_share - data_type: numeric - - name: fct_perp_stats_hourly_arbitrum_mainnet - columns: - - name: ts - data_type: timestamp with time zone - - name: trades - data_type: numeric - - name: exchange_fees - data_type: numeric - - name: referral_fees - data_type: numeric - - name: collected_fees - data_type: numeric - - name: volume - data_type: numeric - - name: liquidation_rewards - data_type: numeric - - name: liquidated_accounts - data_type: bigint - - name: cumulative_exchange_fees - data_type: numeric - - name: cumulative_referral_fees - data_type: numeric - - name: cumulative_collected_fees - data_type: numeric - - name: cumulative_volume - data_type: numeric - - name: fct_perp_stats_daily_arbitrum_mainnet - columns: - - name: ts - data_type: timestamp with time zone - - name: trades - data_type: numeric - - name: exchange_fees - data_type: numeric - - name: referral_fees - data_type: numeric - - name: collected_fees - data_type: numeric - - name: volume - data_type: numeric - - name: liquidation_rewards - data_type: numeric - - name: liquidated_accounts - data_type: numeric - - name: cumulative_exchange_fees - data_type: numeric - - name: cumulative_referral_fees - data_type: numeric - - name: cumulative_collected_fees - data_type: numeric - - name: cumulative_volume - data_type: numeric - - name: fct_perp_market_stats_hourly_arbitrum_mainnet - columns: - - name: ts - data_type: timestamp with time zone - - name: market_symbol - data_type: text - - name: trades - data_type: bigint - - name: exchange_fees - data_type: numeric - - name: referral_fees - data_type: numeric - - name: collected_fees - data_type: numeric - - name: volume - data_type: numeric - - name: amount_liquidated - data_type: numeric - - name: liquidations - data_type: bigint - - name: cumulative_exchange_fees - data_type: numeric - - name: cumulative_referral_fees - data_type: numeric - - name: cumulative_collected_fees - data_type: numeric - - name: cumulative_volume - data_type: numeric - - name: fct_perp_market_stats_daily_arbitrum_mainnet - columns: - - name: ts - data_type: timestamp with time zone - - name: market_symbol - data_type: text - - name: trades - data_type: numeric - - name: exchange_fees - data_type: numeric - - name: referral_fees - data_type: numeric - - name: collected_fees - data_type: numeric - - name: volume - data_type: numeric - - name: amount_liquidated - data_type: numeric - - name: liquidations - data_type: numeric - - name: cumulative_exchange_fees - data_type: numeric - - name: cumulative_referral_fees - data_type: numeric - - name: cumulative_collected_fees - data_type: numeric - - name: cumulative_volume - data_type: numeric - - name: fct_perp_keeper_stats_hourly_arbitrum_mainnet - columns: - - name: ts - data_type: timestamp with time zone - - name: keeper - data_type: text - - name: trades - data_type: bigint - - name: settlement_rewards - data_type: numeric - - name: amount_settled - data_type: numeric - - name: trades_pct - data_type: bigint - - name: settlement_rewards_pct - data_type: numeric - - name: amount_settled_pct - data_type: numeric - - name: fct_perp_keeper_stats_daily_arbitrum_mainnet - columns: - - name: ts - data_type: timestamp with time zone - - name: keeper - data_type: text - - name: trades - data_type: numeric - - name: settlement_rewards - data_type: numeric - - name: amount_settled - data_type: numeric - - name: trades_pct - data_type: numeric - - name: settlement_rewards_pct - data_type: numeric - - name: amount_settled_pct - data_type: numeric - - name: fct_perp_account_stats_hourly_arbitrum_mainnet - columns: - - name: ts - data_type: timestamp with time zone - - name: account_id - data_type: text - - name: trades - data_type: bigint - - name: fees - data_type: numeric - - name: volume - data_type: numeric - - name: amount_liquidated - data_type: numeric - - name: liquidations - data_type: bigint - - name: cumulative_fees - data_type: numeric - - name: cumulative_volume - data_type: numeric - - name: fct_perp_account_stats_daily_arbitrum_mainnet - columns: - - name: ts - data_type: timestamp with time zone - - name: account_id - data_type: text - - name: fees - data_type: numeric - - name: volume - data_type: numeric - - name: amount_liquidated - data_type: numeric - - name: liquidations - data_type: numeric - - name: cumulative_fees - data_type: numeric - - name: cumulative_volume - data_type: numeric diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/prices/fct_prices_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/prices/fct_prices_arbitrum_mainnet.sql deleted file mode 100644 index d9f44db7..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/prices/fct_prices_arbitrum_mainnet.sql +++ /dev/null @@ -1,44 +0,0 @@ -with all_prices as ( - select - ts, - null as market_address, - market_symbol, - price - from - {{ ref('fct_perp_market_history_arbitrum_mainnet') }} - union all - select - ts, - collateral_type as market_address, - null as market_symbol, - collateral_value / amount as price - from - {{ ref('core_vault_collateral_arbitrum_mainnet') }} - where - collateral_value > 0 -), - -tokens as ( - select - token_address, - token_symbol - from - {{ ref('arbitrum_mainnet_tokens') }} -) - -select - p.ts, - p.market_address, - p.price, - COALESCE( - t.token_symbol, - p.market_symbol - ) as market_symbol -from - all_prices as p -left join tokens as t - on LOWER( - p.market_address - ) = LOWER( - t.token_address - ) diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/prices/fct_prices_hourly_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/prices/fct_prices_hourly_arbitrum_mainnet.sql deleted file mode 100644 index 2f1c338a..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/prices/fct_prices_hourly_arbitrum_mainnet.sql +++ /dev/null @@ -1,72 +0,0 @@ -with prices as ( - select distinct - market_symbol, - DATE_TRUNC( - 'hour', - ts - ) as ts, - LAST_VALUE(price) over ( - partition by DATE_TRUNC('hour', ts), market_symbol - order by - ts - rows between unbounded preceding - and unbounded following - ) as price - from - {{ ref('fct_prices_arbitrum_mainnet') }} -), - -dim as ( - select - m.market_symbol, - GENERATE_SERIES( - DATE_TRUNC('hour', MIN(t.ts)), - DATE_TRUNC('hour', MAX(t.ts)), - '1 hour'::INTERVAL - ) as ts - from - ( - select ts - from - prices - ) as t - cross join ( - select distinct market_symbol - from - prices - ) as m - group by - m.market_symbol -), - -ffill as ( - select - dim.ts, - dim.market_symbol, - LAST(prices.price) over ( - partition by dim.market_symbol - order by dim.ts - rows between unbounded preceding and current row - ) as price - from - dim - left join prices - on - dim.ts = prices.ts - and dim.market_symbol = prices.market_symbol -), - -hourly_prices as ( - select - ts, - market_symbol, - price - from - ffill -) - -select * -from - hourly_prices -where - price is not null diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/prices/schema.yml b/transformers/synthetix/models/marts/arbitrum/mainnet/prices/schema.yml deleted file mode 100644 index 069c4754..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/prices/schema.yml +++ /dev/null @@ -1,44 +0,0 @@ -models: - - name: fct_prices_arbitrum_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: market_address - description: "Market address" - data_type: text - - name: market_symbol - description: "Market symbol" - data_type: text - tests: - - not_null - - name: price - description: "Price" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fct_prices_hourly_arbitrum_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: market_symbol - description: "Market symbol" - data_type: text - tests: - - not_null - - name: price - description: "Price" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/spot/fct_spot_atomics_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/spot/fct_spot_atomics_arbitrum_mainnet.sql deleted file mode 100644 index eac22565..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/spot/fct_spot_atomics_arbitrum_mainnet.sql +++ /dev/null @@ -1,53 +0,0 @@ -with bought as ( - select - id, - block_timestamp as ts, - block_number, - transaction_hash as tx_hash, - synth_market_id, - {{ convert_wei('price') }} as price, - {{ convert_wei('synth_returned') }} as amount, - referrer - from - {{ ref('spot_synth_bought_arbitrum_mainnet') }} -), - -sold as ( - select - id, - block_timestamp as ts, - block_number, - transaction_hash as tx_hash, - synth_market_id, - {{ convert_wei('price') }} as price, - -1 * {{ convert_wei('amount_returned') }} as amount, - referrer - from - {{ ref('spot_synth_sold_arbitrum_mainnet') }} -) - -select - id, - ts, - block_number, - tx_hash, - synth_market_id, - price, - amount, - referrer -from - bought -union all -select - id, - ts, - block_number, - tx_hash, - synth_market_id, - price, - amount, - referrer -from - sold -order by - ts diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/spot/fct_spot_markets_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/spot/fct_spot_markets_arbitrum_mainnet.sql deleted file mode 100644 index e87c8b57..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/spot/fct_spot_markets_arbitrum_mainnet.sql +++ /dev/null @@ -1,13 +0,0 @@ -with base as ( - select - synth_market_id as id, - block_timestamp as created_ts, - block_number, - synth_token_address as token_address - from - {{ ref('spot_synth_registered_arbitrum_mainnet') }} -) - -select * -from - base diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/spot/fct_spot_wrapper_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/spot/fct_spot_wrapper_arbitrum_mainnet.sql deleted file mode 100644 index 84942d33..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/spot/fct_spot_wrapper_arbitrum_mainnet.sql +++ /dev/null @@ -1,45 +0,0 @@ -with wraps as ( - select - id, - block_timestamp as ts, - block_number, - transaction_hash as tx_hash, - synth_market_id, - {{ convert_wei('amount_wrapped') }} as amount_wrapped - from - {{ ref('spot_synth_wrapped_arbitrum_mainnet') }} -), - -unwraps as ( - select - id, - block_timestamp as ts, - block_number, - transaction_hash as tx_hash, - synth_market_id, - -1 * {{ convert_wei('amount_unwrapped') }} as amount_wrapped - from - {{ ref('spot_synth_unwrapped_arbitrum_mainnet') }} -) - -select - id, - ts, - block_number, - tx_hash, - synth_market_id, - amount_wrapped -from - wraps -union all -select - id, - ts, - block_number, - tx_hash, - synth_market_id, - amount_wrapped -from - unwraps -order by - ts diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/spot/fct_synth_supply_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/spot/fct_synth_supply_arbitrum_mainnet.sql deleted file mode 100644 index 9608558b..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/spot/fct_synth_supply_arbitrum_mainnet.sql +++ /dev/null @@ -1,72 +0,0 @@ -with wrapper as ( - select - ts, - block_number, - synth_market_id, - amount_wrapped as change_amount - from - {{ ref('fct_spot_wrapper_arbitrum_mainnet') }} -), - -atomics as ( - select - ts, - block_number, - synth_market_id, - amount as change_amount - from - {{ ref('fct_spot_atomics_arbitrum_mainnet') }} - union all - select - ts, - block_number, - 0 as synth_market_id, - amount * price * -1 as change_amount - from - {{ ref('fct_spot_atomics_arbitrum_mainnet') }} -), - -usd_changes as ( - select - block_timestamp as ts, - block_number, - 0 as synth_market_id, - {{ convert_wei("amount") }} as change_amount - from - {{ ref('core_usd_minted_arbitrum_mainnet') }} - union all - select - block_timestamp as ts, - block_number, - 0 as synth_market_id, - -1 * {{ convert_wei("amount") }} as change_amount - from - {{ ref('core_usd_burned_arbitrum_mainnet') }} -), - -all_changes as ( - select * - from - wrapper - union all - select * - from - atomics - union all - select * - from - usd_changes -) - -select - ts, - block_number, - synth_market_id, - SUM(change_amount) over ( - partition by synth_market_id - order by - ts, - block_number - ) as supply -from - all_changes diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/spot/schema.yml b/transformers/synthetix/models/marts/arbitrum/mainnet/spot/schema.yml deleted file mode 100644 index 5d5e6d8c..00000000 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/spot/schema.yml +++ /dev/null @@ -1,132 +0,0 @@ -models: - - name: fct_synth_supply_arbitrum_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: synth_market_id - description: "Synth market ID" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: supply - description: "Supply" - data_type: numeric - tests: - - not_null - - name: fct_spot_atomics_arbitrum_mainnet - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: tx_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: synth_market_id - description: "Synth market ID" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: price - description: "Price" - data_type: numeric - tests: - - not_null - - name: amount - description: "Amount" - data_type: numeric - tests: - - not_null - - name: referrer - description: "Address of the referrer" - data_type: text - tests: - - not_null - - name: fct_spot_markets_arbitrum_mainnet - columns: - - name: id - description: "Synth market ID" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: created_ts - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: token_address - description: "Token address" - data_type: text - tests: - - not_null - - name: fct_spot_wrapper_arbitrum_mainnet - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: tx_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: synth_market_id - description: "Synth market ID" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: amount_wrapped - description: "Amount wrapped" - data_type: numeric - tests: - - not_null diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_core_account_activity_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_core_account_activity_arbitrum_sepolia.sql deleted file mode 100644 index 22b47978..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_core_account_activity_arbitrum_sepolia.sql +++ /dev/null @@ -1,42 +0,0 @@ -{{ config( - materialized = "view", - tags = ["core", "account_activity", "daily", "arbitrum", "sepolia"] -) }} - -with delegated as ( - select distinct - block_timestamp, - account_id, - 'Delegated' as account_action - from {{ ref('core_delegation_updated_arbitrum_sepolia') }} -), - -withdrawn as ( - select - block_timestamp, - account_id, - 'Withdrawn' as account_action - from {{ ref('core_withdrawn_arbitrum_sepolia') }} -), - -claimed as ( - select - block_timestamp, - account_id, - 'Claimed' as account_action - from {{ ref('core_rewards_claimed_arbitrum_sepolia') }} -), - -combined as ( - select * from delegated - union all - select * from withdrawn - union all - select * from claimed -) - -select - block_timestamp, - account_action, - account_id -from combined diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_core_account_delegation_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_core_account_delegation_arbitrum_sepolia.sql deleted file mode 100644 index 450aa3c0..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_core_account_delegation_arbitrum_sepolia.sql +++ /dev/null @@ -1,60 +0,0 @@ -with delegation_changes as ( - select - block_timestamp, - account_id, - pool_id, - collateral_type, - {{ convert_wei('amount') }} - - LAG({{ convert_wei('amount') }}, 1, 0) over ( - partition by - account_id, - pool_id, - collateral_type - order by - block_timestamp - ) as change_in_amount - from - {{ ref('core_delegation_updated_arbitrum_sepolia') }} -), - -cumulative_delegation as ( - select - block_timestamp, - account_id, - pool_id, - collateral_type, - SUM(change_in_amount) over ( - partition by - pool_id, - account_id, - collateral_type - order by - block_timestamp - ) as cumulative_amount_delegated, - ROW_NUMBER() over ( - partition by - pool_id, - account_id, - collateral_type - order by - block_timestamp desc - ) as rn - from - delegation_changes -) - -select - block_timestamp as ts, - pool_id, - collateral_type, - cumulative_amount_delegated as amount_delegated, - CAST( - account_id as text - ) as account_id -from - cumulative_delegation -where - rn = 1 -order by - block_timestamp, - collateral_type diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_core_active_stakers_daily_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_core_active_stakers_daily_arbitrum_sepolia.sql deleted file mode 100644 index fab88560..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_core_active_stakers_daily_arbitrum_sepolia.sql +++ /dev/null @@ -1,52 +0,0 @@ -{{ config( - materialized = "view", - tags = ["core", "active_stakers", "daily", "arbitrum", "sepolia"] -) }} - -with delegation_updated as ( - select - block_timestamp, - account_id, - amount - from {{ ref('core_delegation_updated_arbitrum_sepolia') }} -), - -dim as ( - select - d.block_date, - accounts_unique.account_id - from ( - select - generate_series( - date_trunc('day', date('2023-12-15')), - date_trunc('day', current_date), '1 day'::interval - ) as block_date - ) as d - cross join ( - select distinct account_id from delegation_updated - ) as accounts_unique -), - -stakers as ( - select - dim.block_date, - dim.account_id, - case - when coalesce(last(delegation_updated.amount) over ( - partition by dim.account_id - order by dim.block_date - rows between unbounded preceding and current row - ), 0) = 0 then 0 - else 1 - end as is_staking - from dim - left join delegation_updated on - dim.block_date = date(delegation_updated.block_timestamp) - and dim.account_id = delegation_updated.account_id -) - -select - block_date, - sum(is_staking) as nof_stakers_daily -from stakers -group by block_date diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_core_apr_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_core_apr_arbitrum_sepolia.sql deleted file mode 100644 index 4b8c42a1..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_core_apr_arbitrum_sepolia.sql +++ /dev/null @@ -1,238 +0,0 @@ -{{ - config( - materialized = 'table', - ) -}} - -with pnl_hourly as ( - select - ts, - pool_id, - collateral_type, - collateral_value, - debt, - hourly_pnl, - hourly_issuance, - rewards_usd, - hourly_pnl_pct, - hourly_rewards_pct, - hourly_total_pct, - SUM( - COALESCE( - hourly_issuance, - 0 - ) - ) over ( - partition by - pool_id, - collateral_type - order by - ts - ) as cumulative_issuance, - SUM( - hourly_pnl - ) over ( - partition by - pool_id, - collateral_type - order by - ts - ) as cumulative_pnl - from - {{ ref('fct_pool_pnl_hourly_arbitrum_sepolia') }} -), - -avg_returns as ( - select - ts, - pool_id, - collateral_type, - AVG( - hourly_pnl_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '24 HOURS' preceding - and current row - ) as avg_24h_pnl_pct, - AVG( - hourly_pnl_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '7 DAYS' preceding - and current row - ) as avg_7d_pnl_pct, - AVG( - hourly_pnl_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '28 DAYS' preceding - and current row - ) as avg_28d_pnl_pct, - AVG( - hourly_rewards_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '24 HOURS' preceding - and current row - ) as avg_24h_rewards_pct, - AVG( - hourly_rewards_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '7 DAYS' preceding - and current row - ) as avg_7d_rewards_pct, - AVG( - hourly_rewards_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '28 DAYS' preceding - and current row - ) as avg_28d_rewards_pct, - AVG( - hourly_total_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '24 HOURS' preceding - and current row - ) as avg_24h_total_pct, - AVG( - hourly_total_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '7 DAYS' preceding - and current row - ) as avg_7d_total_pct, - AVG( - hourly_total_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '28 DAYS' preceding - and current row - ) as avg_28d_total_pct - from - pnl_hourly -), - -apr_calculations as ( - select - pnl_hourly.ts, - pnl_hourly.pool_id, - pnl_hourly.collateral_type, - pnl_hourly.collateral_value, - pnl_hourly.debt, - pnl_hourly.hourly_pnl, - pnl_hourly.cumulative_pnl, - pnl_hourly.hourly_issuance, - pnl_hourly.cumulative_issuance, - pnl_hourly.rewards_usd, - pnl_hourly.hourly_pnl_pct, - pnl_hourly.hourly_rewards_pct, - -- total pnls - avg_returns.avg_24h_total_pct * 24 * 365 as apr_24h, - avg_returns.avg_7d_total_pct * 24 * 365 as apr_7d, - avg_returns.avg_28d_total_pct * 24 * 365 as apr_28d, - -- pool pnls - avg_returns.avg_24h_pnl_pct * 24 * 365 as apr_24h_pnl, - avg_returns.avg_7d_pnl_pct * 24 * 365 as apr_7d_pnl, - avg_returns.avg_28d_pnl_pct * 24 * 365 as apr_28d_pnl, - -- rewards pnls - avg_returns.avg_24h_rewards_pct * 24 * 365 as apr_24h_rewards, - avg_returns.avg_7d_rewards_pct * 24 * 365 as apr_7d_rewards, - avg_returns.avg_28d_rewards_pct * 24 * 365 as apr_28d_rewards - from - pnl_hourly - inner join avg_returns - on - pnl_hourly.ts = avg_returns.ts - and pnl_hourly.pool_id = avg_returns.pool_id - and pnl_hourly.collateral_type = avg_returns.collateral_type -), - -apy_calculations as ( - select - *, - (POWER(1 + apr_24h / 8760, 8760) - 1) as apy_24h, - (POWER(1 + apr_7d / 8760, 8760) - 1) as apy_7d, - (POWER(1 + apr_28d / 8760, 8760) - 1) as apy_28d, - (POWER(1 + apr_24h_pnl / 8760, 8760) - 1) as apy_24h_pnl, - (POWER(1 + apr_7d_pnl / 8760, 8760) - 1) as apy_7d_pnl, - (POWER(1 + apr_28d_pnl / 8760, 8760) - 1) as apy_28d_pnl, - (POWER(1 + apr_24h_rewards / 8760, 8760) - 1) as apy_24h_rewards, - (POWER(1 + apr_7d_rewards / 8760, 8760) - 1) as apy_7d_rewards, - (POWER(1 + apr_28d_rewards / 8760, 8760) - 1) as apy_28d_rewards - from - apr_calculations -) - -select - ts, - pool_id, - collateral_type, - collateral_value, - debt, - hourly_issuance, - hourly_pnl, - cumulative_pnl, - cumulative_issuance, - rewards_usd, - hourly_pnl_pct, - hourly_rewards_pct, - apr_24h, - apy_24h, - apr_7d, - apy_7d, - apr_28d, - apy_28d, - apr_24h_pnl, - apy_24h_pnl, - apr_7d_pnl, - apy_7d_pnl, - apr_28d_pnl, - apy_28d_pnl, - apr_24h_rewards, - apy_24h_rewards, - apr_7d_rewards, - apy_7d_rewards, - apr_28d_rewards, - apy_28d_rewards -from - apy_calculations -order by - ts diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_core_apr_rewards_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_core_apr_rewards_arbitrum_sepolia.sql deleted file mode 100644 index 4ba9c72d..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_core_apr_rewards_arbitrum_sepolia.sql +++ /dev/null @@ -1,115 +0,0 @@ -{{ - config( - materialized = 'table', - ) -}} - -with pnl_hourly as ( - select - ts, - pool_id, - collateral_type, - reward_token, - collateral_value, - rewards_usd, - hourly_rewards_pct - from - {{ ref('fct_pool_pnl_hourly_reward_arbitrum_sepolia') }} -), - -avg_returns as ( - select - ts, - pool_id, - collateral_type, - reward_token, - AVG( - hourly_rewards_pct - ) over ( - partition by - pool_id, - collateral_type, - reward_token - order by - ts - range between interval '24 HOURS' preceding - and current row - ) as avg_24h_rewards_pct, - AVG( - hourly_rewards_pct - ) over ( - partition by - pool_id, - collateral_type, - reward_token - order by - ts - range between interval '7 DAYS' preceding - and current row - ) as avg_7d_rewards_pct, - AVG( - hourly_rewards_pct - ) over ( - partition by - pool_id, - collateral_type, - reward_token - order by - ts - range between interval '28 DAYS' preceding - and current row - ) as avg_28d_rewards_pct - from - pnl_hourly -), - -apr_calculations as ( - select - pnl_hourly.ts, - pnl_hourly.pool_id, - pnl_hourly.collateral_type, - pnl_hourly.reward_token, - pnl_hourly.collateral_value, - pnl_hourly.rewards_usd, - pnl_hourly.hourly_rewards_pct, - avg_returns.avg_24h_rewards_pct * 24 * 365 as apr_24h_rewards, - avg_returns.avg_7d_rewards_pct * 24 * 365 as apr_7d_rewards, - avg_returns.avg_28d_rewards_pct * 24 * 365 as apr_28d_rewards - from - pnl_hourly - inner join avg_returns - on - pnl_hourly.ts = avg_returns.ts - and pnl_hourly.pool_id = avg_returns.pool_id - and pnl_hourly.collateral_type = avg_returns.collateral_type - and pnl_hourly.reward_token = avg_returns.reward_token -), - -apy_calculations as ( - select - *, - (POWER(1 + apr_24h_rewards / 8760, 8760) - 1) as apy_24h_rewards, - (POWER(1 + apr_7d_rewards / 8760, 8760) - 1) as apy_7d_rewards, - (POWER(1 + apr_28d_rewards / 8760, 8760) - 1) as apy_28d_rewards - from - apr_calculations -) - -select - ts, - pool_id, - collateral_type, - reward_token, - collateral_value, - rewards_usd, - hourly_rewards_pct, - apr_24h_rewards, - apy_24h_rewards, - apr_7d_rewards, - apy_7d_rewards, - apr_28d_rewards, - apy_28d_rewards -from - apy_calculations -order by - ts diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_core_market_updated_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_core_market_updated_arbitrum_sepolia.sql deleted file mode 100644 index c8adac6f..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_core_market_updated_arbitrum_sepolia.sql +++ /dev/null @@ -1,30 +0,0 @@ -with market_updated as ( - select - id, - block_timestamp, - block_number, - transaction_hash, - contract, - event_name, - market_id, - net_issuance, - sender, - collateral_type, - credit_capacity, - token_amount - from - {{ ref('core_market_updated_arbitrum_sepolia') }} -) - -select - id, - block_timestamp as ts, - transaction_hash, - event_name, - market_id, - collateral_type, - {{ convert_wei("credit_capacity") }} as credit_capacity, - {{ convert_wei("net_issuance") }} as net_issuance, - {{ convert_wei("token_amount") }} as token_amount -from - market_updated diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_core_pool_collateral_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_core_pool_collateral_arbitrum_sepolia.sql deleted file mode 100644 index 7b379477..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_core_pool_collateral_arbitrum_sepolia.sql +++ /dev/null @@ -1,39 +0,0 @@ -with events as ( - select - block_timestamp, - {{ convert_wei('token_amount') }} as token_amount, - collateral_type - from - {{ ref('core_deposited_arbitrum_sepolia') }} - union all - select - block_timestamp, - -{{ convert_wei('token_amount') }} as token_amount, - collateral_type - from - {{ ref('core_withdrawn_arbitrum_sepolia') }} -), - -ranked_events as ( - select - *, - SUM(token_amount) over ( - partition by collateral_type - order by - block_timestamp - rows between unbounded preceding - and current row - ) as amount_deposited - from - events -) - -select - block_timestamp as ts, - collateral_type, - amount_deposited -from - ranked_events -order by - block_timestamp, - collateral_type diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_core_pool_delegation_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_core_pool_delegation_arbitrum_sepolia.sql deleted file mode 100644 index f1ad401f..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_core_pool_delegation_arbitrum_sepolia.sql +++ /dev/null @@ -1,45 +0,0 @@ -with delegation_changes as ( - select - block_timestamp, - account_id, - pool_id, - collateral_type, - {{ convert_wei('amount') }} - - LAG({{ convert_wei('amount') }}, 1, 0) over ( - partition by - account_id, - pool_id, - collateral_type - order by - block_timestamp - ) as change_in_amount - from - {{ ref('core_delegation_updated_arbitrum_sepolia') }} -), - -cumulative_delegation as ( - select - block_timestamp, - pool_id, - collateral_type, - SUM(change_in_amount) over ( - partition by - pool_id, - collateral_type - order by - block_timestamp - ) as cumulative_amount_delegated - from - delegation_changes -) - -select - block_timestamp as ts, - pool_id, - collateral_type, - cumulative_amount_delegated as amount_delegated -from - cumulative_delegation -order by - block_timestamp, - collateral_type diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_core_pools_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_core_pools_arbitrum_sepolia.sql deleted file mode 100644 index 26012eef..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_core_pools_arbitrum_sepolia.sql +++ /dev/null @@ -1,13 +0,0 @@ -with base as ( - select - pool_id as id, - block_timestamp as created_ts, - block_number, - owner - from - {{ ref('core_pool_created_arbitrum_sepolia') }} -) - -select * -from - base diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_pool_debt_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_pool_debt_arbitrum_sepolia.sql deleted file mode 100644 index 5443db99..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_pool_debt_arbitrum_sepolia.sql +++ /dev/null @@ -1,10 +0,0 @@ -select - ts, - block_number, - pool_id, - collateral_type, - debt -from - {{ ref('core_vault_debt_arbitrum_sepolia') }} -order by - ts diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_pool_issuance_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_pool_issuance_arbitrum_sepolia.sql deleted file mode 100644 index 069a93d0..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_pool_issuance_arbitrum_sepolia.sql +++ /dev/null @@ -1,39 +0,0 @@ -with burns as ( - select - block_timestamp as ts, - block_number, - transaction_hash, - pool_id, - collateral_type, - account_id, - -1 * {{ convert_wei('amount') }} as amount - from - {{ ref('core_usd_burned_arbitrum_sepolia') }} - order by - block_timestamp desc -), - -mints as ( - select - block_timestamp as ts, - block_number, - transaction_hash, - pool_id, - collateral_type, - account_id, - {{ convert_wei('amount') }} as amount - from - {{ ref('core_usd_minted_arbitrum_sepolia') }} - order by - block_timestamp desc -) - -select * -from - burns -union all -select * -from - mints -order by - ts desc diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_pool_issuance_hourly_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_pool_issuance_hourly_arbitrum_sepolia.sql deleted file mode 100644 index ccf1bb55..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_pool_issuance_hourly_arbitrum_sepolia.sql +++ /dev/null @@ -1,122 +0,0 @@ -with dim as ( - select - m.pool_id, - m.collateral_type, - generate_series( - date_trunc('hour', min(t.ts)), - date_trunc('hour', max(t.ts)), - '1 hour'::interval - ) as ts - from - ( - select ts - from - {{ ref('fct_pool_issuance_arbitrum_sepolia') }} - ) as t - cross join ( - select distinct - pool_id, - collateral_type - from - {{ ref('fct_pool_issuance_arbitrum_sepolia') }} - ) as m - group by - m.pool_id, - m.collateral_type -), - -max_debt_block as ( - select - pool_id, - collateral_type, - date_trunc( - 'hour', - ts - ) as "hour", - max(block_number) as max_block_number - from - {{ ref('fct_pool_debt_arbitrum_sepolia') }} - group by - date_trunc( - 'hour', - ts - ), - pool_id, - collateral_type -), - -filt_issuance as ( - select - i.pool_id, - i.collateral_type, - i.amount, - case - when - i.block_number <= d.max_block_number - or d.max_block_number is null then i.ts - else i.ts + interval '1 hour' - end as ts - from - {{ ref('fct_pool_issuance_arbitrum_sepolia') }} - as i - left join max_debt_block as d - on date_trunc( - 'hour', - i.ts - ) = d.hour - and i.pool_id = d.pool_id - and lower( - i.collateral_type - ) = lower( - d.collateral_type - ) - where - i.block_number <= ( - select - max( - max_block_number - ) as b - from - max_debt_block - ) -), - -issuance as ( - select - date_trunc( - 'hour', - ts - ) as ts, - pool_id, - collateral_type, - sum(amount) as hourly_issuance - from - filt_issuance - group by - date_trunc( - 'hour', - ts - ), - pool_id, - collateral_type -) - -select - dim.ts, - dim.pool_id, - dim.collateral_type, - coalesce( - i.hourly_issuance, - 0 - ) as hourly_issuance -from - dim -left join issuance as i - on - dim.pool_id = i.pool_id - and lower( - dim.collateral_type - ) = lower( - i.collateral_type - ) - and dim.ts = i.ts diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_pool_pnl_hourly_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_pool_pnl_hourly_arbitrum_sepolia.sql deleted file mode 100644 index 4bc4b6e7..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_pool_pnl_hourly_arbitrum_sepolia.sql +++ /dev/null @@ -1,217 +0,0 @@ -{{ config( - materialized = 'table', - unique_key = ['ts', 'pool_id', 'collateral_type'], -) }} - -with dim as ( - select - p.pool_id, - p.collateral_type, - generate_series( - date_trunc('hour', min(t.ts)), - date_trunc('hour', max(t.ts)), - '1 hour'::INTERVAL - ) as ts - from - ( - select ts - from - {{ ref('fct_pool_debt_arbitrum_sepolia') }} - ) as t - cross join ( - select distinct - pool_id, - collateral_type - from - {{ ref('fct_pool_debt_arbitrum_sepolia') }} - ) as p - group by - p.pool_id, - p.collateral_type -), - -issuance as ( - select - ts, - pool_id, - collateral_type, - hourly_issuance - from - {{ ref('fct_pool_issuance_hourly_arbitrum_sepolia') }} -), - -debt as ( - select distinct - pool_id, - collateral_type, - date_trunc( - 'hour', - ts - ) as ts, - last_value(debt) over ( - partition by date_trunc('hour', ts), pool_id, collateral_type - order by - ts - rows between unbounded preceding - and unbounded following - ) as debt - from - {{ ref('fct_pool_debt_arbitrum_sepolia') }} -), - -collateral as ( - select distinct - pool_id, - collateral_type, - date_trunc( - 'hour', - ts - ) as ts, - last_value(collateral_value) over ( - partition by date_trunc('hour', ts), pool_id, collateral_type - order by - ts - rows between unbounded preceding - and unbounded following - ) as collateral_value - from - {{ ref('core_vault_collateral_arbitrum_sepolia') }} - where - pool_id = 1 -), - -ffill as ( - select - dim.ts, - dim.pool_id, - dim.collateral_type, - coalesce( - last(debt) over ( - partition by dim.collateral_type, dim.pool_id - order by dim.ts - rows between unbounded preceding and current row - ), - 0 - ) as debt, - coalesce( - last(collateral_value) over ( - partition by dim.collateral_type, dim.pool_id - order by dim.ts - rows between unbounded preceding and current row - ), - 0 - ) as collateral_value - from - dim - left join debt - on - dim.ts = debt.ts - and dim.pool_id = debt.pool_id - and dim.collateral_type = debt.collateral_type - left join collateral - on - dim.ts = collateral.ts - and dim.pool_id = collateral.pool_id - and dim.collateral_type = collateral.collateral_type -), - -hourly_pnl as ( - select - ts, - pool_id, - collateral_type, - collateral_value, - debt, - coalesce(lag(debt) over ( - partition by pool_id, collateral_type - order by - ts - ) - debt, 0) as hourly_pnl - from - ffill -), - -hourly_rewards as ( - select - ts, - pool_id, - collateral_type, - rewards_usd - from - {{ ref('fct_pool_rewards_hourly_arbitrum_sepolia') }} -), - -hourly_returns as ( - select - pnl.ts, - pnl.pool_id, - pnl.collateral_type, - pnl.collateral_value, - pnl.debt, - coalesce( - iss.hourly_issuance, - 0 - ) as hourly_issuance, - pnl.hourly_pnl + coalesce( - iss.hourly_issuance, - 0 - ) as hourly_pnl, - coalesce( - rewards.rewards_usd, - 0 - ) as rewards_usd, - case - when pnl.collateral_value = 0 then 0 - else coalesce( - rewards.rewards_usd, - 0 - ) / pnl.collateral_value - end as hourly_rewards_pct, - case - when pnl.collateral_value = 0 then 0 - else - (coalesce(iss.hourly_issuance, 0) + pnl.hourly_pnl) - / pnl.collateral_value - end as hourly_pnl_pct, - case - when pnl.collateral_value = 0 then 0 - else - ( - coalesce(rewards.rewards_usd, 0) - + pnl.hourly_pnl - + coalesce(iss.hourly_issuance, 0) - ) - / pnl.collateral_value - end as hourly_total_pct - from - hourly_pnl as pnl - left join hourly_rewards as rewards - on - pnl.ts = rewards.ts - and pnl.pool_id = rewards.pool_id - and lower(pnl.collateral_type) = lower(rewards.collateral_type) - left join issuance as iss - on - pnl.ts = iss.ts - and pnl.pool_id = iss.pool_id - and lower( - pnl.collateral_type - ) = lower( - iss.collateral_type - ) -) - -select - ts, - pool_id, - collateral_type, - collateral_value, - debt, - hourly_issuance, - hourly_pnl, - rewards_usd, - hourly_pnl_pct, - hourly_rewards_pct, - hourly_total_pct -from - hourly_returns diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_pool_pnl_hourly_reward_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_pool_pnl_hourly_reward_arbitrum_sepolia.sql deleted file mode 100644 index 64203443..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_pool_pnl_hourly_reward_arbitrum_sepolia.sql +++ /dev/null @@ -1,85 +0,0 @@ -{{ config( - materialized = 'table', - unique_key = ['ts', 'pool_id', 'collateral_type', 'reward_token'], -) }} - -with dim as ( - - select - t.ts, - t.pool_id, - t.collateral_type, - t.collateral_value, - p.token_symbol as reward_token - from - ( - select - ts, - collateral_type, - pool_id, - collateral_value - from - {{ ref('fct_pool_pnl_hourly_arbitrum_sepolia') }} - group by - ts, - collateral_type, - pool_id, - collateral_value - ) as t - cross join ( - select distinct token_symbol - from - {{ ref('fct_pool_rewards_token_hourly_arbitrum_sepolia') }} - ) as p - group by - t.ts, - t.pool_id, - t.collateral_type, - t.collateral_value, - p.token_symbol -), - -reward_hourly_token as ( - select - ts, - pool_id, - collateral_type, - token_symbol as reward_token, - SUM( - rewards_usd - ) as rewards_usd - from - {{ ref('fct_pool_rewards_token_hourly_arbitrum_sepolia') }} - group by - ts, - pool_id, - collateral_type, - token_symbol -) - -select - dim.ts, - dim.pool_id, - dim.collateral_type, - dim.collateral_value, - dim.reward_token, - COALESCE( - reward_hourly_token.rewards_usd, - 0 - ) as rewards_usd, - case - when dim.collateral_value = 0 then 0 - else COALESCE( - reward_hourly_token.rewards_usd, - 0 - ) / dim.collateral_value - end as hourly_rewards_pct -from - dim -left join reward_hourly_token - on - dim.ts = reward_hourly_token.ts - and dim.pool_id = reward_hourly_token.pool_id - and LOWER(dim.collateral_type) - = LOWER(reward_hourly_token.collateral_type) - and dim.reward_token = reward_hourly_token.reward_token diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_pool_rewards_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_pool_rewards_arbitrum_sepolia.sql deleted file mode 100644 index 64df6fe3..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_pool_rewards_arbitrum_sepolia.sql +++ /dev/null @@ -1,37 +0,0 @@ -with rewards_distributed as ( - select - block_timestamp as ts, - CAST( - pool_id as INTEGER - ) as pool_id, - collateral_type, - distributor, - {{ convert_wei('amount') }} as amount, - TO_TIMESTAMP("start") as ts_start, - "duration" - from - {{ ref('core_rewards_distributed_arbitrum_sepolia') }} -), - -distributors as ( - select - CAST(distributor_address as TEXT) as distributor_address, - CAST(token_symbol as TEXT) as token_symbol - from - {{ ref('arbitrum_sepolia_reward_distributors') }} -) - -select - rd.ts, - rd.pool_id, - rd.collateral_type, - rd.distributor, - distributors.token_symbol, - rd.amount, - rd.ts_start, - rd.duration -from - rewards_distributed as rd -inner join distributors on rd.distributor = distributors.distributor_address -order by - ts diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_pool_rewards_hourly_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_pool_rewards_hourly_arbitrum_sepolia.sql deleted file mode 100644 index 5fb900f3..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_pool_rewards_hourly_arbitrum_sepolia.sql +++ /dev/null @@ -1,21 +0,0 @@ -with token_hourly as ( - select - ts, - pool_id, - collateral_type, - rewards_usd - from - {{ ref('fct_pool_rewards_token_hourly_arbitrum_sepolia') }} -) - -select - ts, - pool_id, - collateral_type, - SUM(rewards_usd) as rewards_usd -from - token_hourly -group by - ts, - pool_id, - collateral_type diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_pool_rewards_token_hourly_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_pool_rewards_token_hourly_arbitrum_sepolia.sql deleted file mode 100644 index 3cd4079f..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/core/fct_pool_rewards_token_hourly_arbitrum_sepolia.sql +++ /dev/null @@ -1,190 +0,0 @@ -with dim as ( - select - m.pool_id, - m.collateral_type, - generate_series( - date_trunc('hour', min(t.min_ts)), - date_trunc('hour', max(t.max_ts)), - '1 hour'::INTERVAL - ) as ts - from - ( - select - min(ts_start) as min_ts, - max( - ts_start + "duration" * '1 second'::INTERVAL - ) as max_ts - from - {{ ref('fct_pool_rewards_arbitrum_sepolia') }} - ) as t - cross join ( - select distinct - pool_id, - collateral_type - from - {{ ref('fct_pool_debt_arbitrum_sepolia') }} - ) as m - group by - m.pool_id, - m.collateral_type -), - -rewards_distributed as ( - select - ts, - pool_id, - collateral_type, - distributor, - token_symbol, - amount, - ts_start, - "duration" - from - {{ ref('fct_pool_rewards_arbitrum_sepolia') }} -), - -hourly_distributions as ( - select - dim.ts, - dim.pool_id, - dim.collateral_type, - r.distributor, - r.token_symbol, - r.amount, - r.ts_start, - r."duration", - row_number() over ( - partition by - dim.ts, - dim.pool_id, - dim.collateral_type, - r.distributor - order by - r.ts_start desc - ) as distributor_index - from - dim - left join rewards_distributed as r - on - dim.pool_id = r.pool_id - and lower( - dim.collateral_type - ) = lower( - r.collateral_type - ) - and dim.ts + '1 hour'::INTERVAL >= r.ts_start - and dim.ts < r.ts_start + r."duration" * '1 second'::INTERVAL - where - r."duration" > 0 -), - -streamed_rewards as ( - select - d.ts, - d.pool_id, - d.collateral_type, - d.distributor, - d.token_symbol, - -- get the amount of time distributed this hour - -- use the smaller of those two intervals - -- convert the interval to a number of hours - -- multiply the result by the hourly amount to get the amount distributed this hour - ( - extract( - epoch - from - least( - d."duration" / 3600 * '1 hour'::INTERVAL, - least( - d.ts + '1 hour'::INTERVAL - greatest( - d.ts, - d.ts_start - ), - least( - d.ts_start + d."duration" * '1 second'::INTERVAL, - d.ts + '1 hour'::INTERVAL - ) - d.ts - ) - ) - ) / 3600 - ) * d.amount / ( - d."duration" / 3600 - ) as amount - from - hourly_distributions as d - where - d.distributor_index = 1 -), - -instant_rewards as ( - select - date_trunc( - 'hour', - ts - ) as ts, - pool_id, - collateral_type, - distributor, - token_symbol, - amount - from - rewards_distributed - where - "duration" = 0 -), - -combined as ( - select - combo.ts, - combo.pool_id, - combo.collateral_type, - combo.distributor, - combo.token_symbol, - combo.amount, - p.price - from - ( - select - ts, - pool_id, - collateral_type, - distributor, - token_symbol, - amount - from - streamed_rewards - union all - select - ts, - pool_id, - collateral_type, - distributor, - token_symbol, - amount - from - instant_rewards - ) as combo - left join {{ ref('fct_prices_hourly_arbitrum_sepolia') }} as p - on - combo.token_symbol = p.market_symbol - and combo.ts = p.ts -) - -select - ts, - pool_id, - collateral_type, - distributor, - token_symbol, - sum(amount) as amount, - sum( - amount * price - ) as rewards_usd -from - combined -group by - ts, - pool_id, - collateral_type, - distributor, - token_symbol diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/core/schema.yml b/transformers/synthetix/models/marts/arbitrum/sepolia/core/schema.yml deleted file mode 100644 index 04193656..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/core/schema.yml +++ /dev/null @@ -1,600 +0,0 @@ -version: 2 -models: - - name: fct_core_account_activity_arbitrum_sepolia - description: "Daily number of accounts by action (Delegated, Withdrawn, Claimed)" - columns: - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: account_action - description: "Type of LP action" - data_type: text - tests: - - not_null - - accepted_values: - values: ["Delegated", "Withdrawn", "Claimed"] - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - name: fct_core_active_stakers_daily_arbitrum_sepolia - description: "Daily number of active stakers" - columns: - - name: block_date - description: "Date" - data_type: date - tests: - - not_null - - name: nof_stakers_daily - description: "Number of active stakers daily" - - name: fct_pool_rewards_arbitrum_sepolia - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: distributor - description: "Address of the distributor" - data_type: text - tests: - - not_null - - name: token_symbol - description: "Token symbol" - data_type: text - tests: - - not_null - - name: amount - description: "Reward amount" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: ts_start - data_type: timestamp with time zone - - name: duration - data_type: numeric - - name: fct_core_account_delegation_arbitrum_sepolia - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: amount_delegated - description: "Amount of delegated collateral" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fct_core_apr_arbitrum_sepolia - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: collateral_value - description: "Collateral value (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: debt - description: "Debt value (USD)" - data_type: numeric - tests: - - not_null - - name: hourly_issuance - description: "Hourly issuance" - data_type: numeric - tests: - - not_null - - name: hourly_pnl - description: "Hourly PnL" - data_type: numeric - tests: - - not_null - - name: cumulative_pnl - description: "Cumulative PnL" - data_type: numeric - tests: - - not_null - - name: cumulative_issuance - description: "Cumulative Issuance" - data_type: numeric - tests: - - not_null - - name: rewards_usd - description: "Rewards value (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: hourly_pnl_pct - description: "Hourly PnL (%)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: -1 - max_value: 1 - inclusive: true - - name: hourly_rewards_pct - description: "Hourly Rewards (%)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - max_value: 1 - inclusive: true - - name: apr_24h - description: "APR (24h)" - data_type: numeric - tests: - - not_null - - name: apy_24h - description: "APY (24h)" - data_type: numeric - tests: - - not_null - - name: apr_7d - description: "APR (7d)" - data_type: numeric - tests: - - not_null - - name: apy_7d - description: "APY (7d)" - data_type: numeric - tests: - - not_null - - name: apr_28d - description: "APR (28d)" - data_type: numeric - tests: - - not_null - - name: apy_28d - description: "APY (28d)" - data_type: numeric - tests: - - not_null - - name: apr_24h_pnl - data_type: numeric - - name: apy_24h_pnl - data_type: numeric - - name: apr_7d_pnl - data_type: numeric - - name: apy_7d_pnl - data_type: numeric - - name: apr_28d_pnl - data_type: numeric - - name: apy_28d_pnl - data_type: numeric - - name: apr_24h_rewards - data_type: numeric - - name: apy_24h_rewards - data_type: numeric - - name: apr_7d_rewards - data_type: numeric - - name: apy_7d_rewards - data_type: numeric - - name: apr_28d_rewards - data_type: numeric - - name: apy_28d_rewards - data_type: numeric - - name: fct_core_market_updated_arbitrum_sepolia - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["MarketCollateralWithdrawn", "MarketCollateralDeposited", "MarketUsdWithdrawn", "MarketUsdDeposited"] - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: credit_capacity - description: "Credit capacity" - data_type: numeric - tests: - - not_null - - name: net_issuance - description: "Net issuance" - data_type: numeric - tests: - - not_null - - name: token_amount - description: "Token amount" - data_type: numeric - tests: - - not_null - - name: fct_core_pool_collateral_arbitrum_sepolia - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: amount_deposited - description: "Amount deposited" - data_type: numeric - tests: - - not_null - - name: fct_core_pool_delegation_arbitrum_sepolia - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: amount_delegated - data_type: numeric - - name: fct_core_pools_arbitrum_sepolia - columns: - - name: id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: created_ts - description: "Pool creation timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: owner - description: "Address of the pool owner" - data_type: text - tests: - - not_null - - name: fct_pool_debt_arbitrum_sepolia - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: debt - description: "Debt value (USD)" - data_type: numeric - tests: - - not_null - - name: fct_pool_issuance_hourly_arbitrum_sepolia - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: hourly_issuance - description: "Hourly issuance" - data_type: numeric - tests: - - not_null - - name: fct_pool_issuance_arbitrum_sepolia - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - name: amount - description: "Amount issued" - data_type: numeric - tests: - - not_null - - name: fct_pool_pnl_hourly_arbitrum_sepolia - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: collateral_value - description: "Collateral value (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: debt - description: "Debt value (USD)" - data_type: numeric - tests: - - not_null - - name: hourly_issuance - description: "Hourly issuance" - data_type: numeric - tests: - - not_null - - name: hourly_pnl - description: "Hourly PnL" - data_type: numeric - tests: - - not_null - - name: rewards_usd - description: "Rewards value (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: hourly_pnl_pct - description: "Hourly PnL (%)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: -1 - max_value: 1 - inclusive: true - - name: hourly_rewards_pct - description: "Hourly Rewards (%)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - max_value: 1 - inclusive: true - - name: hourly_total_pct - description: "Hourly Total (%)" - data_type: numeric - tests: - - not_null - - name: fct_pool_rewards_hourly_arbitrum_sepolia - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: rewards_usd - description: "Rewards value (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fct_pool_rewards_token_hourly_arbitrum_sepolia - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: distributor - description: "Address of the distributor" - data_type: text - tests: - - not_null - - name: token_symbol - description: "Token symbol" - data_type: text - tests: - - not_null - - name: amount - description: "Distributed rewards amount" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: rewards_usd - description: "Rewards value (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_account_activity_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_account_activity_arbitrum_sepolia.sql deleted file mode 100644 index 024ead34..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_account_activity_arbitrum_sepolia.sql +++ /dev/null @@ -1,89 +0,0 @@ -{{ config( - materialized = "view", - tags = ["perp", "account_activity", "arbitrum", "sepolia"] -) }} - -with active_accounts as ( - select distinct - date_trunc('day', ts) as activity_date, - account_id - from {{ ref('fct_perp_trades_arbitrum_sepolia') }} -), - -date_range as ( - select - generate_series( - date(min(activity_date)), - date(max(activity_date)), - interval '1 day' - )::date as activity_date - from active_accounts -), - -active_accounts_daily as ( - select - date_range.activity_date, - count(distinct active_accounts.account_id) as active_accounts - from date_range - left join active_accounts - on date_range.activity_date = active_accounts.activity_date - group by date_range.activity_date -), - -active_accounts_monthly as ( - select - date_range.activity_date, - count(distinct active_accounts.account_id) as active_accounts - from date_range - left join active_accounts - on - date_range.activity_date - interval '27 days' - <= active_accounts.activity_date - and date_range.activity_date >= active_accounts.activity_date - group by date_range.activity_date -), - -new_accounts as ( - select - min(activity_date) as start_date, - account_id - from active_accounts - group by account_id -), - -new_accounts_daily as ( - select - date_range.activity_date, - count(new_accounts.account_id) as new_accounts - from date_range - left join new_accounts - on date_range.activity_date = new_accounts.start_date - group by date_range.activity_date, new_accounts.start_date -), - -new_accounts_monthly as ( - select distinct - activity_date, - sum(new_accounts) over ( - order by activity_date - range between interval '27 days' preceding and current row - ) as new_accounts - from new_accounts_daily -) - -select - dr.activity_date as ts, - dau.active_accounts as dau, - mau.active_accounts as mau, - new_accounts_daily.new_accounts as new_accounts_daily, - new_accounts_monthly.new_accounts as new_accounts_monthly -from date_range as dr -left join active_accounts_daily as dau - on dr.activity_date = dau.activity_date -left join active_accounts_monthly as mau - on dr.activity_date = mau.activity_date -left join new_accounts_daily - on dr.activity_date = new_accounts_daily.activity_date -left join new_accounts_monthly - on dr.activity_date = new_accounts_monthly.activity_date -order by ts desc diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_accounts_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_accounts_arbitrum_sepolia.sql deleted file mode 100644 index 06656ca5..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_accounts_arbitrum_sepolia.sql +++ /dev/null @@ -1,14 +0,0 @@ -with arbitrum as ( - select - block_timestamp as created_ts, - "owner", - CAST( - account_id as VARCHAR - ) as id - from - {{ ref('perp_account_created_arbitrum_sepolia') }} -) - -select * -from - arbitrum diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_collateral_balances_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_collateral_balances_arbitrum_sepolia.sql deleted file mode 100644 index 2cfca30c..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_collateral_balances_arbitrum_sepolia.sql +++ /dev/null @@ -1,129 +0,0 @@ -with synths as ( - select - synth_market_id as collateral_id, - synth_token_address - from - {{ ref('spot_synth_registered_arbitrum_sepolia') }} -), - -transfers as ( - select - cm.block_number, - cm.block_timestamp as ts, - cm.transaction_hash, - cm.collateral_id, - synths.synth_token_address, - CAST(cm.account_id as text) as account_id, - {{ convert_wei('cm.amount_delta') }} as amount_delta - from - {{ ref('perp_collateral_modified_arbitrum_sepolia') }} as cm - inner join synths - on cm.collateral_id = synths.collateral_id -), - -liq_tx as ( - select distinct - transaction_hash, - CAST(account_id as text) as account_id - from - {{ ref('perp_account_liquidation_attempt_arbitrum_sepolia') }} -), - -distributors as ( - select - CAST(rd.distributor_address as text) as distributor_address, - CAST(rd.token_symbol as text) as token_symbol, - rd.synth_token_address, - synths.collateral_id - from - {{ ref('arbitrum_sepolia_reward_distributors') }} as rd - inner join synths - on rd.synth_token_address = synths.synth_token_address -), - -liquidations as ( - select - rd.block_number, - rd.block_timestamp as ts, - -rd.amount / 1e18 as amount_delta, - liq_tx.transaction_hash, - rd.collateral_type, - distributors.token_symbol, - distributors.synth_token_address, - CAST(liq_tx.account_id as text) as account_id, - distributors.collateral_id - from - {{ ref('core_rewards_distributed_arbitrum_sepolia') }} as rd - inner join liq_tx - on rd.transaction_hash = liq_tx.transaction_hash - inner join distributors - on rd.distributor = distributors.distributor_address -), - -net_transfers as ( - select - events.ts, - events.transaction_hash, - events.event_type, - events.collateral_id, - events.synth_token_address, - synths.synth_symbol, - events.account_id, - prices.price, - events.amount_delta, - SUM(events.amount_delta) over ( - partition by events.account_id, events.collateral_id - order by events.ts - ) as account_balance, - SUM(events.amount_delta) over ( - partition by events.collateral_id - order by events.ts - ) as total_balance - from ( - select - transfers.ts, - transfers.transaction_hash, - transfers.collateral_id, - transfers.synth_token_address, - transfers.account_id, - transfers.amount_delta, - 'transfer' as event_type - from - transfers - union all - select - liquidations.ts, - liquidations.transaction_hash, - liquidations.collateral_id, - liquidations.synth_token_address, - liquidations.account_id, - liquidations.amount_delta, - 'liquidation' as event_type - from - liquidations - ) as events - inner join {{ ref('arbitrum_sepolia_synths') }} as synths - on events.collateral_id = synths.synth_market_id - left join {{ ref('fct_prices_hourly_arbitrum_sepolia') }} as prices - on - synths.token_symbol = prices.market_symbol - and DATE_TRUNC('hour', events.ts) = prices.ts -) - -select - net_transfers.ts, - net_transfers.transaction_hash, - net_transfers.event_type, - net_transfers.collateral_id, - net_transfers.synth_token_address, - net_transfers.synth_symbol, - net_transfers.account_id, - net_transfers.price, - net_transfers.amount_delta, - net_transfers.amount_delta * net_transfers.price as amount_delta_usd, - net_transfers.account_balance, - net_transfers.account_balance * net_transfers.price as account_balance_usd, - net_transfers.total_balance, - net_transfers.total_balance * net_transfers.price as total_balance_usd -from - net_transfers diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_collateral_modified_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_collateral_modified_arbitrum_sepolia.sql deleted file mode 100644 index 997db7a0..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_collateral_modified_arbitrum_sepolia.sql +++ /dev/null @@ -1,18 +0,0 @@ -select - cm.id, - cm.block_timestamp, - cm.account_id, - cm.block_number, - cm.transaction_hash, - cm.contract, - cm.event_name, - synths.synth_symbol, - cm.collateral_id as synth_market_id, - synths.synth_token_address, - cm.sender, - {{ convert_wei("cm.amount_delta") }} as amount_delta -from - {{ ref("perp_collateral_modified_arbitrum_sepolia") }} - as cm -inner join {{ ref('arbitrum_sepolia_synths') }} as synths - on cm.collateral_id = synths.synth_market_id diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_interest_charged_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_interest_charged_arbitrum_sepolia.sql deleted file mode 100644 index 31817a08..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_interest_charged_arbitrum_sepolia.sql +++ /dev/null @@ -1,11 +0,0 @@ -select - id, - block_timestamp, - block_number, - transaction_hash, - contract, - event_name, - account_id, - {{ convert_wei("interest") }} as interest -from - {{ ref("perp_interest_charged_arbitrum_sepolia") }} diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_liq_account_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_liq_account_arbitrum_sepolia.sql deleted file mode 100644 index 4f6561be..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_liq_account_arbitrum_sepolia.sql +++ /dev/null @@ -1,59 +0,0 @@ -with liquidation_events as ( - select - account_id, - reward, - block_timestamp, - full_liquidation, - SUM( - case - when full_liquidation then 1 - else 0 - end - ) over ( - partition by account_id - order by - block_timestamp - rows between unbounded preceding - and current row - ) as liquidation_id - from - {{ ref('perp_account_liquidation_attempt_arbitrum_sepolia') }} -), - -cumulative_rewards as ( - select - block_timestamp, - reward, - full_liquidation, - liquidation_id, - CAST( - account_id as text - ) as account_id, - SUM({{ convert_wei('reward') }}) over ( - partition by - account_id, - liquidation_id - order by - block_timestamp - ) as cumulative_reward, - ROW_NUMBER() over ( - partition by - account_id, - liquidation_id - order by - block_timestamp desc - ) as rn - from - liquidation_events - order by - block_timestamp -) - -select - account_id, - block_timestamp as ts, - cumulative_reward as total_reward -from - cumulative_rewards -where - rn = 1 diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_liq_position_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_liq_position_arbitrum_sepolia.sql deleted file mode 100644 index 25eb0152..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_liq_position_arbitrum_sepolia.sql +++ /dev/null @@ -1,38 +0,0 @@ -with liquidations as ( - select - id, - block_timestamp as ts, - block_number, - transaction_hash, - account_id, - market_id, - {{ convert_wei('amount_liquidated') }} as amount_liquidated, - {{ convert_wei('current_position_size') }} as position_size - from - {{ ref('perp_position_liquidated_arbitrum_sepolia') }} -), - -markets as ( - select - id, - market_symbol - from - {{ ref('fct_perp_markets_arbitrum_sepolia') }} -) - -select - l.id, - l.ts, - l.block_number, - l.transaction_hash, - l.market_id, - m.market_symbol, - l.amount_liquidated, - l.position_size, - CAST( - l.account_id as text - ) as account_id -from - liquidations as l -left join markets as m - on l.market_id = m.id diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_market_history_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_market_history_arbitrum_sepolia.sql deleted file mode 100644 index d87db8d5..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_market_history_arbitrum_sepolia.sql +++ /dev/null @@ -1,106 +0,0 @@ -with base as ( - select - mu.id, - mu.block_timestamp as ts, - mu.block_number, - mu.transaction_hash, - m.id as market_id, - m.market_symbol, - {{ convert_wei('price') }} as price, - {{ convert_wei('skew') }} as skew, - {{ convert_wei('size') }} as size, - {{ convert_wei('size_delta') }} as size_delta, - {{ convert_wei('current_funding_rate') }} as funding_rate, - {{ convert_wei('current_funding_velocity') }} as funding_velocity, - {{ convert_wei('interest_rate') }} as interest_rate, - {{ convert_wei('current_funding_rate') }} * 365.25 as funding_rate_apr, - {{ convert_wei('current_funding_rate') }} * 365.25 - + {{ convert_wei('interest_rate') }} as long_rate_apr, - {{ convert_wei('current_funding_rate') }} * -1 * 365.25 - + {{ convert_wei('interest_rate') }} as short_rate_apr, - LAG({{ convert_wei('size') }}, 1, 0) over ( - partition by m.market_symbol - order by - mu.block_timestamp - ) as prev_size - from - {{ ref('perp_market_updated_arbitrum_sepolia') }} as mu - left join {{ ref('fct_perp_markets_arbitrum_sepolia') }} as m - on mu.market_id = m.id -), - -oi as ( - select - id, - ts, - size * price as market_oi_usd, - LAG( - size * price, - 1, - 0 - ) over ( - partition by market_symbol - order by - ts asc - ) as prev_market_oi_usd, - ( - size + skew - ) * price / 2 as long_oi, - ( - size - skew - ) * price / 2 as short_oi, - case - when size * price = 0 then null - else ((size + skew) * price / 2) / ( - size * price - ) - end as long_oi_pct, - case - when size * price = 0 then null - else ((size - skew) * price / 2) / ( - size * price - ) - end as short_oi_pct - from - base -), - -total_oi as ( - select - id, - SUM( - market_oi_usd - prev_market_oi_usd - ) over ( - order by - ts asc - ) as total_oi_usd - from - oi -) - -select - base.*, - ROUND( - oi.market_oi_usd, - 2 - ) as market_oi_usd, - ROUND( - total_oi.total_oi_usd, - 2 - ) as total_oi_usd, - ROUND( - oi.long_oi, - 2 - ) as long_oi, - ROUND( - oi.short_oi, - 2 - ) as short_oi, - oi.long_oi_pct, - oi.short_oi_pct -from - base -inner join oi - on base.id = oi.id -inner join total_oi - on base.id = total_oi.id diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_markets_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_markets_arbitrum_sepolia.sql deleted file mode 100644 index 1a300cd7..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_markets_arbitrum_sepolia.sql +++ /dev/null @@ -1,14 +0,0 @@ -with arbitrum as ( - select - perps_market_id as id, - block_timestamp as created_ts, - block_number, - market_symbol, - market_name - from - {{ ref('perp_market_created_arbitrum_sepolia') }} -) - -select * -from - arbitrum diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_orders_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_orders_arbitrum_sepolia.sql deleted file mode 100644 index 5c56742e..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_orders_arbitrum_sepolia.sql +++ /dev/null @@ -1,29 +0,0 @@ -with arbitrum as ( - select - oc.id, - oc.block_timestamp as ts, - oc.block_number, - oc.transaction_hash, - oc.contract, - oc.market_id, - markets.market_symbol, - CAST( - oc.account_id as text - ) as account_id, - oc.order_type, - {{ convert_wei('oc.size_delta') }} as size, - {{ convert_wei('oc.acceptable_price') }} as acceptable_price, - oc.settlement_time, - oc.expiration_time, - {{ convert_hex('oc.tracking_code') }} as tracking_code, - oc.sender - from - {{ ref('perp_order_committed_arbitrum_sepolia') }} - as oc - left join {{ ref('fct_perp_markets_arbitrum_sepolia') }} as markets - on oc.market_id = markets.id -) - -select * -from - arbitrum diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_pnl_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_pnl_arbitrum_sepolia.sql deleted file mode 100644 index 8f876a83..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_pnl_arbitrum_sepolia.sql +++ /dev/null @@ -1,18 +0,0 @@ -{# DEPRECATED: deprecate this table in dashboards and remove #} -with debt as ( - select - ts, - 2 as market_id, - debt * -1 as market_pnl - from - {{ ref('core_vault_debt_arbitrum_sepolia') }} -) - -select - ts, - market_id, - market_pnl -from - debt -order by - ts diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_previous_order_expired_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_previous_order_expired_arbitrum_sepolia.sql deleted file mode 100644 index e374536e..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_previous_order_expired_arbitrum_sepolia.sql +++ /dev/null @@ -1,15 +0,0 @@ -select - id, - block_timestamp, - block_number, - transaction_hash, - contract, - event_name, - market_id, - account_id, - commitment_time, - tracking_code, - {{ convert_wei("acceptable_price") }} as acceptable_price, - {{ convert_wei("size_delta") }} as size_delta -from - {{ ref("perp_previous_order_expired_arbitrum_sepolia") }} diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_trades_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_trades_arbitrum_sepolia.sql deleted file mode 100644 index 46d35b5e..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_trades_arbitrum_sepolia.sql +++ /dev/null @@ -1,39 +0,0 @@ -with arbitrum as ( - select - pos.id, - pos.block_timestamp as ts, - pos.block_number, - pos.transaction_hash, - pos.contract, - pos.market_id, - markets.market_symbol, - CAST( - pos.account_id as text - ) as account_id, - {{ convert_wei('fill_price') }} as fill_price, - {{ convert_wei('pnl') }} as pnl, - {{ convert_wei('accrued_funding') }} as accrued_funding, - {{ convert_wei('size_delta') }} as trade_size, - {{ convert_wei('new_size') }} as position_size, - {{ convert_wei('total_fees') }} as total_fees, - {{ convert_wei('referral_fees') }} as referral_fees, - {{ convert_wei('collected_fees') }} as collected_fees, - {{ convert_wei('settlement_reward') }} as settlement_reward, - {{ convert_hex('tracking_code') }} as tracking_code, - pos.settler - from - {{ ref('perp_order_settled_arbitrum_sepolia') }} as pos - left join {{ ref('fct_perp_markets_arbitrum_sepolia') }} as markets - on pos.market_id = markets.id -) - -select - *, - ABS( - fill_price * trade_size - ) as notional_trade_size, - fill_price * position_size as notional_position_size, - total_fees - referral_fees - collected_fees - settlement_reward as lp_fees, - total_fees - settlement_reward as exchange_fees -from - arbitrum diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/perp/schema.yml b/transformers/synthetix/models/marts/arbitrum/sepolia/perp/schema.yml deleted file mode 100644 index 3b2e83ee..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/perp/schema.yml +++ /dev/null @@ -1,732 +0,0 @@ -models: - - name: fct_perp_account_activity_arbitrum_sepolia - columns: - - name: ts - description: "Activity date" - data_type: date - tests: - - not_null - - name: dau - description: "Daily active users" - data_type: integer - tests: - - not_null - - name: mau - description: "Monthly active users" - data_type: integer - tests: - - not_null - - name: new_accounts_daily - description: "Daily new accounts" - data_type: integer - tests: - - not_null - - name: new_accounts_monthly - description: "Monthly new accounts" - data_type: integer - tests: - - not_null - - name: fct_perp_interest_charged_arbitrum_sepolia - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["InterestCharged"] - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: interest - description: "Interest amount" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fct_perp_collateral_modified_arbitrum_sepolia - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["CollateralModified"] - - name: synth_market_id - description: "Synth market ID" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: sender - data_type: text - tests: - - not_null - - name: amount_delta - data_type: numeric - - name: fct_perp_previous_order_expired_arbitrum_sepolia - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["PreviousOrderExpired"] - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: commitment_time - data_type: numeric - - name: tracking_code - data_type: text - - name: acceptable_price - data_type: numeric - - name: size_delta - data_type: numeric - - name: fct_perp_trades_arbitrum_sepolia - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: market_symbol - description: "Market symbol" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: text - tests: - - not_null - - name: fill_price - description: "Fill price (ETH)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: pnl - description: "PnL (ETH)" - data_type: numeric - tests: - - not_null - - name: accrued_funding - description: "Accrued funding (ETH)" - data_type: numeric - tests: - - not_null - - name: trade_size - description: "Trade size (ETH)" - data_type: numeric - tests: - - not_null - - name: position_size - description: "Position size" - data_type: numeric - tests: - - not_null - - name: total_fees - description: "Total fees (ETH)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: referral_fees - description: "Referral fees (ETH)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collected_fees - description: "Collected fees (ETH)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: settlement_reward - description: "Settlement reward (ETH)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: tracking_code - description: "Account tracking code" - data_type: text - tests: - - not_null - - name: settler - description: "Address of the settler" - data_type: text - tests: - - not_null - - name: notional_trade_size - description: "Notional trade size (ETH)" - data_type: numeric - tests: - - not_null - - name: notional_position_size - description: "Notional position size (ETH)" - data_type: numeric - tests: - - not_null - - name: lp_fees - description: "LP fees (ETH)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - severity: warn - min_value: 0 - inclusive: true - - name: exchange_fees - description: "Exchange fees (ETH)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fct_perp_pnl_arbitrum_sepolia - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: market_pnl - data_type: numeric - - name: fct_perp_orders_arbitrum_sepolia - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: market_symbol - description: "Market symbol" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: text - tests: - - not_null - - name: order_type - data_type: integer - - name: size - data_type: numeric - - name: acceptable_price - data_type: numeric - - name: settlement_time - data_type: numeric - - name: expiration_time - data_type: numeric - - name: tracking_code - data_type: text - - name: sender - data_type: text - - name: fct_perp_markets_arbitrum_sepolia - columns: - - name: id - description: "Market ID" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: created_ts - description: "Market creation timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: market_symbol - description: "Market symbol" - data_type: text - tests: - - not_null - - name: market_name - description: "Market name" - data_type: text - tests: - - not_null - - name: fct_perp_market_history_arbitrum_sepolia - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: market_symbol - description: "Market symbol" - data_type: text - tests: - - not_null - - name: price - description: "Price (USD)" - data_type: numeric - tests: - - not_null - - name: skew - description: "Skew (ETH)" - data_type: numeric - tests: - - not_null - - name: size - description: "Size (ETH)" - data_type: numeric - tests: - - not_null - - name: size_delta - description: "Size delta (ETH)" - data_type: numeric - tests: - - not_null - - name: funding_rate - description: "Funding rate (%)" - data_type: numeric - tests: - - not_null - - name: funding_velocity - description: "Funding velocity" - data_type: numeric - tests: - - not_null - - name: interest_rate - description: "Interest rate (%)" - data_type: numeric - tests: - - not_null - - name: funding_rate_apr - description: "Funding rate APR (%)" - data_type: numeric - tests: - - not_null - - name: long_rate_apr - description: "Long rate APR (%)" - data_type: numeric - tests: - - not_null - - name: short_rate_apr - description: "Short rate APR (%)" - data_type: numeric - tests: - - not_null - - name: prev_size - description: "Previous size (ETH)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: market_oi_usd - description: "Market open interest (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: total_oi_usd - description: "Total open interest (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: long_oi - description: "Long open interest (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: short_oi - description: "Short open interest (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: long_oi_pct - description: "Long open interest (%)" - data_type: numeric - - name: short_oi_pct - description: "Short open interest (%)" - data_type: numeric - - name: fct_perp_liq_position_arbitrum_sepolia - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: text - tests: - - not_null - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: market_symbol - description: "Market symbol" - data_type: text - tests: - - not_null - - name: amount_liquidated - description: "Amount liquidated" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: position_size - description: "Liquidated position size" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fct_perp_liq_account_arbitrum_sepolia - columns: - - name: account_id - description: "ID of the account" - data_type: text - tests: - - not_null - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: total_reward - description: "Total reward" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fct_perp_accounts_arbitrum_sepolia - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: created_ts - description: "Account creation timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: owner - description: "Address of the account owner" - data_type: text - tests: - - not_null - - name: fct_perp_collateral_balances_arbitrum_sepolia - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: collateral_id - description: "Market ID of the collateral, from the spot market" - data_type: integer - tests: - - not_null - - name: synth_token_address - description: "Address of the synth token" - data_type: text - tests: - - not_null - - name: synth_symbol - description: "Symbol of the synth token" - data_type: text - tests: - - not_null - - name: event_type - description: "Description of the event, e.g. 'transfer' or 'liquidation'" - data_type: text - tests: - - not_null - - name: amount_delta - description: "Amount of the collateral token that was transferred" - data_type: numeric - tests: - - not_null - - name: account_balance - description: "Balance of the collateral token in the account after the transfer" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: total_balance - description: "Total balance of the collateral token in the perps system after the transfer" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: amount_delta_usd - description: "USD value of the collateral token that was transferred" - data_type: numeric - tests: - - not_null - - name: account_balance_usd - description: "USD value of the collateral token in the account after the transfer" - data_type: numeric - tests: - - not_null - - name: total_balance_usd - description: "Total USD value of the collateral token in the perps system after the transfer" - data_type: numeric - tests: - - not_null diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/fct_perp_account_stats_daily_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/fct_perp_account_stats_daily_arbitrum_sepolia.sql deleted file mode 100644 index db42b19d..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/fct_perp_account_stats_daily_arbitrum_sepolia.sql +++ /dev/null @@ -1,45 +0,0 @@ -with daily as ( - select - DATE_TRUNC( - 'day', - ts - ) as ts, - account_id, - SUM(fees) as fees, - SUM(volume) as volume, - SUM(amount_liquidated) as amount_liquidated, - SUM(liquidations) as liquidations - from - {{ ref('fct_perp_account_stats_hourly_arbitrum_sepolia') }} - group by - DATE_TRUNC( - 'day', - ts - ), - account_id -), - -stats as ( - select - *, - SUM(fees) over ( - partition by account_id - order by - ts - range between unbounded preceding - and current row - ) as cumulative_fees, - SUM(volume) over ( - partition by account_id - order by - ts - range between unbounded preceding - and current row - ) as cumulative_volume - from - daily -) - -select * -from - stats diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/fct_perp_account_stats_hourly_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/fct_perp_account_stats_hourly_arbitrum_sepolia.sql deleted file mode 100644 index 8d80af43..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/fct_perp_account_stats_hourly_arbitrum_sepolia.sql +++ /dev/null @@ -1,119 +0,0 @@ -with trades as ( - select - ts, - account_id, - total_fees, - notional_trade_size, - 1 as trades, - SUM( - total_fees - ) over ( - partition by account_id - order by - ts - ) as cumulative_fees, - SUM( - notional_trade_size - ) over ( - partition by account_id - order by - ts - ) as cumulative_volume - from - {{ ref('fct_perp_trades_arbitrum_sepolia') }} -), - -liq as ( - select - ts, - account_id, - amount_liquidated, - 1 as liquidations - from - {{ ref('fct_perp_liq_position_arbitrum_sepolia') }} -), - -inc_trades as ( - select - DATE_TRUNC( - 'hour', - ts - ) as ts, - account_id, - SUM(trades) as trades, - SUM(total_fees) as fees, - SUM(notional_trade_size) as volume, - MAX(cumulative_fees) as cumulative_fees, - MAX(cumulative_volume) as cumulative_volume - from - trades - group by - DATE_TRUNC( - 'hour', - ts - ), - account_id -), - -inc_liq as ( - select - DATE_TRUNC( - 'hour', - ts - ) as ts, - account_id, - SUM(amount_liquidated) as amount_liquidated, - SUM(liquidations) as liquidations - from - liq - group by - DATE_TRUNC( - 'hour', - ts - ), - account_id -), - -inc as ( - select - h.ts, - h.account_id, - COALESCE( - h.trades, - 0 - ) as trades, - COALESCE( - h.fees, - 0 - ) as fees, - COALESCE( - h.volume, - 0 - ) as volume, - COALESCE( - l.amount_liquidated, - 0 - ) as amount_liquidated, - COALESCE( - l.liquidations, - 0 - ) as liquidations, - COALESCE( - h.cumulative_fees, - 0 - ) as cumulative_fees, - COALESCE( - h.cumulative_volume, - 0 - ) as cumulative_volume - from - inc_trades as h - left join inc_liq as l - on - h.ts = l.ts - and h.account_id = l.account_id -) - -select * -from - inc diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/fct_perp_keeper_stats_daily_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/fct_perp_keeper_stats_daily_arbitrum_sepolia.sql deleted file mode 100644 index ec1a4a22..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/fct_perp_keeper_stats_daily_arbitrum_sepolia.sql +++ /dev/null @@ -1,44 +0,0 @@ -with hourly as ( - select - keeper, - settlement_rewards, - amount_settled, - trades, - DATE_TRUNC( - 'day', - ts - ) as ts - from - {{ ref('fct_perp_keeper_stats_hourly_arbitrum_sepolia') }} -), - -total as ( - select - ts, - SUM(trades) as trades_total, - SUM(settlement_rewards) as settlement_reward_total, - SUM(amount_settled) as amount_settled_total - from - hourly - group by - ts -) - -select - hourly.ts, - hourly.keeper, - SUM(hourly.trades) as trades, - SUM(hourly.settlement_rewards) as settlement_rewards, - SUM(hourly.amount_settled) as amount_settled, - SUM(hourly.trades) / MAX(total.trades_total) as trades_pct, - SUM(hourly.settlement_rewards) - / MAX(total.settlement_reward_total) as settlement_rewards_pct, - SUM(hourly.amount_settled) - / MAX(total.amount_settled_total) as amount_settled_pct -from - hourly -inner join total - on hourly.ts = total.ts -group by - hourly.ts, - hourly.keeper diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/fct_perp_keeper_stats_hourly_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/fct_perp_keeper_stats_hourly_arbitrum_sepolia.sql deleted file mode 100644 index 940d0dd7..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/fct_perp_keeper_stats_hourly_arbitrum_sepolia.sql +++ /dev/null @@ -1,44 +0,0 @@ -with trades as ( - select - settler, - settlement_reward, - notional_trade_size, - 1 as trades, - DATE_TRUNC( - 'hour', - ts - ) as ts - from - {{ ref('fct_perp_trades_arbitrum_sepolia') }} -), - -total as ( - select - ts, - SUM(trades) as trades_total, - SUM(settlement_reward) as settlement_reward_total, - SUM(notional_trade_size) as notional_trade_size_total - from - trades - group by - ts -) - -select - trades.ts, - trades.settler as keeper, - SUM(trades.trades) as trades, - SUM(trades.settlement_reward) as settlement_rewards, - SUM(trades.notional_trade_size) as amount_settled, - SUM(trades.trades) / MAX(total.trades_total) as trades_pct, - SUM(trades.settlement_reward) - / MAX(total.settlement_reward_total) as settlement_rewards_pct, - SUM(trades.notional_trade_size) - / MAX(total.notional_trade_size_total) as amount_settled_pct -from - trades -inner join total - on trades.ts = total.ts -group by - trades.ts, - trades.settler diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/fct_perp_market_stats_daily_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/fct_perp_market_stats_daily_arbitrum_sepolia.sql deleted file mode 100644 index 190a3e0f..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/fct_perp_market_stats_daily_arbitrum_sepolia.sql +++ /dev/null @@ -1,25 +0,0 @@ -select - DATE_TRUNC( - 'day', - ts - ) as ts, - market_symbol, - SUM(trades) as trades, - SUM(exchange_fees) as exchange_fees, - SUM(referral_fees) as referral_fees, - SUM(collected_fees) as collected_fees, - SUM(volume) as volume, - SUM(amount_liquidated) as amount_liquidated, - SUM(liquidations) as liquidations, - MAX(cumulative_exchange_fees) as cumulative_exchange_fees, - MAX(cumulative_referral_fees) as cumulative_referral_fees, - MAX(cumulative_collected_fees) as cumulative_collected_fees, - MAX(cumulative_volume) as cumulative_volume -from - {{ ref('fct_perp_market_stats_hourly_arbitrum_sepolia') }} -group by - DATE_TRUNC( - 'day', - ts - ), - market_symbol diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/fct_perp_market_stats_hourly_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/fct_perp_market_stats_hourly_arbitrum_sepolia.sql deleted file mode 100644 index 472b7f80..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/fct_perp_market_stats_hourly_arbitrum_sepolia.sql +++ /dev/null @@ -1,162 +0,0 @@ -with trades as ( - select - ts, - market_symbol, - exchange_fees, - referral_fees, - collected_fees, - notional_trade_size, - 1 as trades - from - {{ ref('fct_perp_trades_arbitrum_sepolia') }} -), - -liq as ( - select - ts, - market_symbol, - amount_liquidated, - 1 as liquidations - from - {{ ref('fct_perp_liq_position_arbitrum_sepolia') }} -), - -inc_trades as ( - select - DATE_TRUNC( - 'hour', - ts - ) as ts, - market_symbol, - SUM(trades) as trades, - SUM(exchange_fees) as exchange_fees, - SUM(referral_fees) as referral_fees, - SUM(collected_fees) as collected_fees, - SUM(notional_trade_size) as volume - from - trades - group by - DATE_TRUNC( - 'hour', - ts - ), - market_symbol -), - -inc_liq as ( - select - DATE_TRUNC( - 'hour', - ts - ) as ts, - market_symbol, - SUM(amount_liquidated) as amount_liquidated, - SUM(liquidations) as liquidations - from - liq - group by - DATE_TRUNC( - 'hour', - ts - ), - market_symbol -), - -dim as ( - select - m.market_symbol, - GENERATE_SERIES( - DATE_TRUNC('hour', MIN(t.ts)), - DATE_TRUNC('hour', MAX(t.ts)), - '1 hour'::INTERVAL - ) as ts - from - ( - select ts - from - trades - ) as t - cross join ( - select distinct market_symbol - from - trades - ) as m - group by - m.market_symbol -), - -inc as ( - select - dim.ts, - dim.market_symbol, - COALESCE( - h.trades, - 0 - ) as trades, - COALESCE( - h.exchange_fees, - 0 - ) as exchange_fees, - COALESCE( - h.referral_fees, - 0 - ) as referral_fees, - COALESCE( - h.collected_fees, - 0 - ) as collected_fees, - COALESCE( - h.volume, - 0 - ) as volume, - COALESCE( - l.amount_liquidated, - 0 - ) as amount_liquidated, - COALESCE( - l.liquidations, - 0 - ) as liquidations, - SUM( - h.exchange_fees - ) over ( - partition by dim.market_symbol - order by - dim.ts - ) as cumulative_exchange_fees, - SUM( - h.referral_fees - ) over ( - partition by dim.market_symbol - order by - dim.ts - ) as cumulative_referral_fees, - SUM( - h.collected_fees - ) over ( - partition by dim.market_symbol - order by - dim.ts - ) as cumulative_collected_fees, - SUM( - h.volume - ) over ( - partition by dim.market_symbol - order by - dim.ts - ) as cumulative_volume - from - dim - left join inc_trades as h - on - dim.ts = h.ts - and dim.market_symbol = h.market_symbol - left join inc_liq as l - on - dim.ts = l.ts - and dim.market_symbol = l.market_symbol -) - -select * -from - inc diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/fct_perp_stats_daily_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/fct_perp_stats_daily_arbitrum_sepolia.sql deleted file mode 100644 index b5556781..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/fct_perp_stats_daily_arbitrum_sepolia.sql +++ /dev/null @@ -1,23 +0,0 @@ -select - DATE_TRUNC( - 'day', - ts - ) as ts, - SUM(trades) as trades, - SUM(exchange_fees) as exchange_fees, - SUM(referral_fees) as referral_fees, - SUM(collected_fees) as collected_fees, - SUM(volume) as volume, - SUM(liquidation_rewards) as liquidation_rewards, - SUM(liquidated_accounts) as liquidated_accounts, - MAX(cumulative_exchange_fees) as cumulative_exchange_fees, - MAX(cumulative_referral_fees) as cumulative_referral_fees, - MAX(cumulative_collected_fees) as cumulative_collected_fees, - MAX(cumulative_volume) as cumulative_volume -from - {{ ref('fct_perp_stats_hourly_arbitrum_sepolia') }} -group by - DATE_TRUNC( - 'day', - ts - ) diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/fct_perp_stats_hourly_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/fct_perp_stats_hourly_arbitrum_sepolia.sql deleted file mode 100644 index 035db288..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/fct_perp_stats_hourly_arbitrum_sepolia.sql +++ /dev/null @@ -1,91 +0,0 @@ -with inc_market as ( - select - ts, - market_symbol, - trades, - exchange_fees, - referral_fees, - collected_fees, - volume, - liquidations, - cumulative_exchange_fees, - cumulative_referral_fees, - cumulative_collected_fees, - cumulative_volume - from - {{ ref('fct_perp_market_stats_hourly_arbitrum_sepolia') }} -), - -liq as ( - select - ts, - total_reward, - 1 as liquidated_accounts - from - {{ ref('fct_perp_liq_account_arbitrum_sepolia') }} -), - -inc_liq as ( - select - DATE_TRUNC( - 'hour', - ts - ) as ts, - SUM(total_reward) as liquidation_rewards, - SUM(liquidated_accounts) as liquidated_accounts - from - liq - group by - DATE_TRUNC( - 'hour', - ts - ) -), - -inc_trade as ( - select - ts, - SUM(trades) as trades, - SUM(exchange_fees) as exchange_fees, - SUM(referral_fees) as referral_fees, - SUM(collected_fees) as collected_fees, - SUM(volume) as volume, - SUM(cumulative_exchange_fees) as cumulative_exchange_fees, - SUM(cumulative_referral_fees) as cumulative_referral_fees, - SUM(cumulative_collected_fees) as cumulative_collected_fees, - SUM(cumulative_volume) as cumulative_volume - from - inc_market - group by - ts -), - -inc as ( - select - h.ts, - h.trades, - h.exchange_fees, - h.referral_fees, - h.collected_fees, - h.volume, - h.cumulative_exchange_fees, - h.cumulative_referral_fees, - h.cumulative_collected_fees, - h.cumulative_volume, - COALESCE( - l.liquidation_rewards, - 0 - ) as liquidation_rewards, - COALESCE( - l.liquidated_accounts, - 0 - ) as liquidated_accounts - from - inc_trade as h - left join inc_liq as l - on h.ts = l.ts -) - -select * -from - inc diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/fct_perp_tracking_stats_daily_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/fct_perp_tracking_stats_daily_arbitrum_sepolia.sql deleted file mode 100644 index 242cbcc9..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/fct_perp_tracking_stats_daily_arbitrum_sepolia.sql +++ /dev/null @@ -1,93 +0,0 @@ -with trades as ( - select - DATE_TRUNC( - 'day', - ts - ) as ts, - tracking_code, - SUM(exchange_fees) as exchange_fees, - SUM(referral_fees) as referral_fees, - SUM(collected_fees) as collected_fees, - SUM(volume) as volume, - SUM(trades) as trades - from - {{ ref('fct_perp_tracking_stats_hourly_arbitrum_sepolia') }} - group by - DATE_TRUNC( - 'day', - ts - ), - tracking_code -), - -accounts as ( - select - DATE_TRUNC( - 'day', - ts - ) as ts, - tracking_code, - COUNT( - distinct account_id - ) as "accounts" - from - {{ ref('fct_perp_trades_arbitrum_sepolia') }} - group by - DATE_TRUNC( - 'day', - ts - ), - tracking_code -), - -total as ( - select - ts, - SUM(exchange_fees) as exchange_fees_total, - SUM(referral_fees) as referral_fees_total, - SUM(collected_fees) as collected_fees_total, - SUM(volume) as volume_total, - SUM(trades) as trades_total - from - trades - group by - ts -) - -select - trades.ts, - trades.tracking_code, - trades.exchange_fees, - trades.referral_fees, - trades.collected_fees, - trades.volume, - trades.trades, - accounts.accounts, - case - when total.exchange_fees_total = 0 then 0 - else trades.exchange_fees / total.exchange_fees_total - end as exchange_fees_share, - case - when total.referral_fees_total = 0 then 0 - else trades.referral_fees / total.referral_fees_total - end as referral_fees_share, - case - when total.collected_fees_total = 0 then 0 - else trades.collected_fees / total.collected_fees_total - end as collected_fees_share, - case - when total.volume_total = 0 then 0 - else trades.volume / total.volume_total - end as volume_share, - case - when total.trades_total = 0 then 0 - else trades.trades / total.trades_total - end as trades_share -from - trades -inner join accounts - on - trades.ts = accounts.ts - and trades.tracking_code = accounts.tracking_code -inner join total - on trades.ts = total.ts diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/fct_perp_tracking_stats_hourly_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/fct_perp_tracking_stats_hourly_arbitrum_sepolia.sql deleted file mode 100644 index 81c623ac..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/fct_perp_tracking_stats_hourly_arbitrum_sepolia.sql +++ /dev/null @@ -1,93 +0,0 @@ -with trades as ( - select - DATE_TRUNC( - 'hour', - ts - ) as ts, - tracking_code, - SUM(exchange_fees) as exchange_fees, - SUM(referral_fees) as referral_fees, - SUM(collected_fees) as collected_fees, - SUM(notional_trade_size) as volume, - SUM(1) as trades - from - {{ ref('fct_perp_trades_arbitrum_sepolia') }} - group by - DATE_TRUNC( - 'hour', - ts - ), - tracking_code -), - -accounts as ( - select - DATE_TRUNC( - 'hour', - ts - ) as ts, - tracking_code, - COUNT( - distinct account_id - ) as "accounts" - from - {{ ref('fct_perp_trades_arbitrum_sepolia') }} - group by - DATE_TRUNC( - 'hour', - ts - ), - tracking_code -), - -total as ( - select - ts, - SUM(trades) as trades_total, - SUM(exchange_fees) as exchange_fees_total, - SUM(referral_fees) as referral_fees_total, - SUM(collected_fees) as collected_fees_total, - SUM(volume) as volume_total - from - trades - group by - ts -) - -select - trades.ts, - trades.tracking_code, - trades.exchange_fees, - trades.referral_fees, - trades.collected_fees, - trades.volume, - trades.trades, - accounts.accounts, - case - when total.exchange_fees_total = 0 then 0 - else trades.exchange_fees / total.exchange_fees_total - end as exchange_fees_share, - case - when total.referral_fees_total = 0 then 0 - else trades.referral_fees / total.referral_fees_total - end as referral_fees_share, - case - when total.collected_fees_total = 0 then 0 - else trades.collected_fees / total.collected_fees_total - end as collected_fees_share, - case - when total.volume_total = 0 then 0 - else trades.volume / total.volume_total - end as volume_share, - case - when total.trades_total = 0 then 0 - else trades.trades / total.trades_total - end as trades_share -from - trades -inner join accounts - on - trades.ts = accounts.ts - and trades.tracking_code = accounts.tracking_code -inner join total - on trades.ts = total.ts diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/schema.yml b/transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/schema.yml deleted file mode 100644 index 1fd483bd..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/perp_stats/schema.yml +++ /dev/null @@ -1,239 +0,0 @@ -models: - - name: fct_perp_tracking_stats_hourly_arbitrum_sepolia - columns: - - name: ts - data_type: timestamp with time zone - - name: tracking_code - data_type: text - - name: exchange_fees - data_type: numeric - - name: referral_fees - data_type: numeric - - name: collected_fees - data_type: numeric - - name: volume - data_type: numeric - - name: trades - data_type: bigint - - name: accounts - data_type: bigint - - name: exchange_fees_share - data_type: numeric - - name: referral_fees_share - data_type: numeric - - name: collected_fees_share - data_type: numeric - - name: volume_share - data_type: numeric - - name: trades_share - data_type: numeric - - name: fct_perp_tracking_stats_daily_arbitrum_sepolia - columns: - - name: ts - data_type: timestamp with time zone - - name: tracking_code - data_type: text - - name: exchange_fees - data_type: numeric - - name: referral_fees - data_type: numeric - - name: collected_fees - data_type: numeric - - name: volume - data_type: numeric - - name: trades - data_type: numeric - - name: accounts - data_type: bigint - - name: exchange_fees_share - data_type: numeric - - name: referral_fees_share - data_type: numeric - - name: collected_fees_share - data_type: numeric - - name: volume_share - data_type: numeric - - name: trades_share - data_type: numeric - - name: fct_perp_stats_hourly_arbitrum_sepolia - columns: - - name: ts - data_type: timestamp with time zone - - name: trades - data_type: numeric - - name: exchange_fees - data_type: numeric - - name: referral_fees - data_type: numeric - - name: collected_fees - data_type: numeric - - name: volume - data_type: numeric - - name: liquidation_rewards - data_type: numeric - - name: liquidated_accounts - data_type: bigint - - name: cumulative_exchange_fees - data_type: numeric - - name: cumulative_referral_fees - data_type: numeric - - name: cumulative_collected_fees - data_type: numeric - - name: cumulative_volume - data_type: numeric - - name: fct_perp_stats_daily_arbitrum_sepolia - columns: - - name: ts - data_type: timestamp with time zone - - name: trades - data_type: numeric - - name: exchange_fees - data_type: numeric - - name: referral_fees - data_type: numeric - - name: collected_fees - data_type: numeric - - name: volume - data_type: numeric - - name: liquidation_rewards - data_type: numeric - - name: liquidated_accounts - data_type: numeric - - name: cumulative_exchange_fees - data_type: numeric - - name: cumulative_referral_fees - data_type: numeric - - name: cumulative_collected_fees - data_type: numeric - - name: cumulative_volume - data_type: numeric - - name: fct_perp_market_stats_hourly_arbitrum_sepolia - columns: - - name: ts - data_type: timestamp with time zone - - name: market_symbol - data_type: text - - name: trades - data_type: bigint - - name: exchange_fees - data_type: numeric - - name: referral_fees - data_type: numeric - - name: collected_fees - data_type: numeric - - name: volume - data_type: numeric - - name: amount_liquidated - data_type: numeric - - name: liquidations - data_type: bigint - - name: cumulative_exchange_fees - data_type: numeric - - name: cumulative_referral_fees - data_type: numeric - - name: cumulative_collected_fees - data_type: numeric - - name: cumulative_volume - data_type: numeric - - name: fct_perp_market_stats_daily_arbitrum_sepolia - columns: - - name: ts - data_type: timestamp with time zone - - name: market_symbol - data_type: text - - name: trades - data_type: numeric - - name: exchange_fees - data_type: numeric - - name: referral_fees - data_type: numeric - - name: collected_fees - data_type: numeric - - name: volume - data_type: numeric - - name: amount_liquidated - data_type: numeric - - name: liquidations - data_type: numeric - - name: cumulative_exchange_fees - data_type: numeric - - name: cumulative_referral_fees - data_type: numeric - - name: cumulative_collected_fees - data_type: numeric - - name: cumulative_volume - data_type: numeric - - name: fct_perp_keeper_stats_hourly_arbitrum_sepolia - columns: - - name: ts - data_type: timestamp with time zone - - name: keeper - data_type: text - - name: trades - data_type: bigint - - name: settlement_rewards - data_type: numeric - - name: amount_settled - data_type: numeric - - name: trades_pct - data_type: bigint - - name: settlement_rewards_pct - data_type: numeric - - name: amount_settled_pct - data_type: numeric - - name: fct_perp_keeper_stats_daily_arbitrum_sepolia - columns: - - name: ts - data_type: timestamp with time zone - - name: keeper - data_type: text - - name: trades - data_type: numeric - - name: settlement_rewards - data_type: numeric - - name: amount_settled - data_type: numeric - - name: trades_pct - data_type: numeric - - name: settlement_rewards_pct - data_type: numeric - - name: amount_settled_pct - data_type: numeric - - name: fct_perp_account_stats_hourly_arbitrum_sepolia - columns: - - name: ts - data_type: timestamp with time zone - - name: account_id - data_type: text - - name: trades - data_type: bigint - - name: fees - data_type: numeric - - name: volume - data_type: numeric - - name: amount_liquidated - data_type: numeric - - name: liquidations - data_type: bigint - - name: cumulative_fees - data_type: numeric - - name: cumulative_volume - data_type: numeric - - name: fct_perp_account_stats_daily_arbitrum_sepolia - columns: - - name: ts - data_type: timestamp with time zone - - name: account_id - data_type: text - - name: fees - data_type: numeric - - name: volume - data_type: numeric - - name: amount_liquidated - data_type: numeric - - name: liquidations - data_type: numeric - - name: cumulative_fees - data_type: numeric - - name: cumulative_volume - data_type: numeric diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/prices/fct_prices_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/prices/fct_prices_arbitrum_sepolia.sql deleted file mode 100644 index 9e72b68a..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/prices/fct_prices_arbitrum_sepolia.sql +++ /dev/null @@ -1,44 +0,0 @@ -with all_prices as ( - select - ts, - null as market_address, - market_symbol, - price - from - {{ ref('fct_perp_market_history_arbitrum_sepolia') }} - union all - select - ts, - collateral_type as market_address, - null as market_symbol, - collateral_value / amount as price - from - {{ ref('core_vault_collateral_arbitrum_sepolia') }} - where - collateral_value > 0 -), - -tokens as ( - select - token_address, - token_symbol - from - {{ ref('arbitrum_sepolia_tokens') }} -) - -select - p.ts, - p.market_address, - p.price, - COALESCE( - t.token_symbol, - p.market_symbol - ) as market_symbol -from - all_prices as p -left join tokens as t - on LOWER( - p.market_address - ) = LOWER( - t.token_address - ) diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/prices/fct_prices_hourly_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/prices/fct_prices_hourly_arbitrum_sepolia.sql deleted file mode 100644 index c7e7404f..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/prices/fct_prices_hourly_arbitrum_sepolia.sql +++ /dev/null @@ -1,72 +0,0 @@ -with prices as ( - select distinct - market_symbol, - DATE_TRUNC( - 'hour', - ts - ) as ts, - LAST_VALUE(price) over ( - partition by DATE_TRUNC('hour', ts), market_symbol - order by - ts - rows between unbounded preceding - and unbounded following - ) as price - from - {{ ref('fct_prices_arbitrum_sepolia') }} -), - -dim as ( - select - m.market_symbol, - GENERATE_SERIES( - DATE_TRUNC('hour', MIN(t.ts)), - DATE_TRUNC('hour', MAX(t.ts)), - '1 hour'::INTERVAL - ) as ts - from - ( - select ts - from - prices - ) as t - cross join ( - select distinct market_symbol - from - prices - ) as m - group by - m.market_symbol -), - -ffill as ( - select - dim.ts, - dim.market_symbol, - LAST(prices.price) over ( - partition by dim.market_symbol - order by dim.ts - rows between unbounded preceding and current row - ) as price - from - dim - left join prices - on - dim.ts = prices.ts - and dim.market_symbol = prices.market_symbol -), - -hourly_prices as ( - select - ts, - market_symbol, - price - from - ffill -) - -select * -from - hourly_prices -where - price is not null diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/prices/schema.yml b/transformers/synthetix/models/marts/arbitrum/sepolia/prices/schema.yml deleted file mode 100644 index c50ff4f6..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/prices/schema.yml +++ /dev/null @@ -1,44 +0,0 @@ -models: - - name: fct_prices_arbitrum_sepolia - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: market_address - description: "Market address" - data_type: text - - name: market_symbol - description: "Market symbol" - data_type: text - tests: - - not_null - - name: price - description: "Price" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fct_prices_hourly_arbitrum_sepolia - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: market_symbol - description: "Market symbol" - data_type: text - tests: - - not_null - - name: price - description: "Price" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/spot/fct_spot_atomics_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/spot/fct_spot_atomics_arbitrum_sepolia.sql deleted file mode 100644 index 38702f78..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/spot/fct_spot_atomics_arbitrum_sepolia.sql +++ /dev/null @@ -1,53 +0,0 @@ -with bought as ( - select - id, - block_timestamp as ts, - block_number, - transaction_hash as tx_hash, - synth_market_id, - {{ convert_wei('price') }} as price, - {{ convert_wei('synth_returned') }} as amount, - referrer - from - {{ ref('spot_synth_bought_arbitrum_sepolia') }} -), - -sold as ( - select - id, - block_timestamp as ts, - block_number, - transaction_hash as tx_hash, - synth_market_id, - {{ convert_wei('price') }} as price, - -1 * {{ convert_wei('amount_returned') }} as amount, - referrer - from - {{ ref('spot_synth_sold_arbitrum_sepolia') }} -) - -select - id, - ts, - block_number, - tx_hash, - synth_market_id, - price, - amount, - referrer -from - bought -union all -select - id, - ts, - block_number, - tx_hash, - synth_market_id, - price, - amount, - referrer -from - sold -order by - ts diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/spot/fct_spot_markets_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/spot/fct_spot_markets_arbitrum_sepolia.sql deleted file mode 100644 index c69a6afe..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/spot/fct_spot_markets_arbitrum_sepolia.sql +++ /dev/null @@ -1,13 +0,0 @@ -with base as ( - select - synth_market_id as id, - block_timestamp as created_ts, - block_number, - synth_token_address as token_address - from - {{ ref('spot_synth_registered_arbitrum_sepolia') }} -) - -select * -from - base diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/spot/fct_spot_wrapper_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/spot/fct_spot_wrapper_arbitrum_sepolia.sql deleted file mode 100644 index b5612350..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/spot/fct_spot_wrapper_arbitrum_sepolia.sql +++ /dev/null @@ -1,45 +0,0 @@ -with wraps as ( - select - id, - block_timestamp as ts, - block_number, - transaction_hash as tx_hash, - synth_market_id, - {{ convert_wei('amount_wrapped') }} as amount_wrapped - from - {{ ref('spot_synth_wrapped_arbitrum_sepolia') }} -), - -unwraps as ( - select - id, - block_timestamp as ts, - block_number, - transaction_hash as tx_hash, - synth_market_id, - -1 * {{ convert_wei('amount_unwrapped') }} as amount_wrapped - from - {{ ref('spot_synth_unwrapped_arbitrum_sepolia') }} -) - -select - id, - ts, - block_number, - tx_hash, - synth_market_id, - amount_wrapped -from - wraps -union all -select - id, - ts, - block_number, - tx_hash, - synth_market_id, - amount_wrapped -from - unwraps -order by - ts diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/spot/fct_synth_supply_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/spot/fct_synth_supply_arbitrum_sepolia.sql deleted file mode 100644 index 7c0d89d5..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/spot/fct_synth_supply_arbitrum_sepolia.sql +++ /dev/null @@ -1,72 +0,0 @@ -with wrapper as ( - select - ts, - block_number, - synth_market_id, - amount_wrapped as change_amount - from - {{ ref('fct_spot_wrapper_arbitrum_sepolia') }} -), - -atomics as ( - select - ts, - block_number, - synth_market_id, - amount as change_amount - from - {{ ref('fct_spot_atomics_arbitrum_sepolia') }} - union all - select - ts, - block_number, - 0 as synth_market_id, - amount * price * -1 as change_amount - from - {{ ref('fct_spot_atomics_arbitrum_sepolia') }} -), - -usd_changes as ( - select - block_timestamp as ts, - block_number, - 0 as synth_market_id, - {{ convert_wei("amount") }} as change_amount - from - {{ ref('core_usd_minted_arbitrum_sepolia') }} - union all - select - block_timestamp as ts, - block_number, - 0 as synth_market_id, - -1 * {{ convert_wei("amount") }} as change_amount - from - {{ ref('core_usd_burned_arbitrum_sepolia') }} -), - -all_changes as ( - select * - from - wrapper - union all - select * - from - atomics - union all - select * - from - usd_changes -) - -select - ts, - block_number, - synth_market_id, - SUM(change_amount) over ( - partition by synth_market_id - order by - ts, - block_number - ) as supply -from - all_changes diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/spot/schema.yml b/transformers/synthetix/models/marts/arbitrum/sepolia/spot/schema.yml deleted file mode 100644 index 73fe1c98..00000000 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/spot/schema.yml +++ /dev/null @@ -1,132 +0,0 @@ -models: - - name: fct_synth_supply_arbitrum_sepolia - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: synth_market_id - description: "Synth market ID" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: supply - description: "Supply" - data_type: numeric - tests: - - not_null - - name: fct_spot_atomics_arbitrum_sepolia - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: tx_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: synth_market_id - description: "Synth market ID" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: price - description: "Price" - data_type: numeric - tests: - - not_null - - name: amount - description: "Amount" - data_type: numeric - tests: - - not_null - - name: referrer - description: "Address of the referrer" - data_type: text - tests: - - not_null - - name: fct_spot_markets_arbitrum_sepolia - columns: - - name: id - description: "Synth market ID" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: created_ts - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: token_address - description: "Token address" - data_type: text - tests: - - not_null - - name: fct_spot_wrapper_arbitrum_sepolia - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: tx_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: synth_market_id - description: "Synth market ID" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: amount_wrapped - description: "Amount wrapped" - data_type: numeric - tests: - - not_null diff --git a/transformers/synthetix/models/marts/base/mainnet/buyback/fct_buyback_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/buyback/fct_buyback_base_mainnet.sql deleted file mode 100644 index f7b1faba..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/buyback/fct_buyback_base_mainnet.sql +++ /dev/null @@ -1,9 +0,0 @@ -select - id, - block_timestamp as ts, - buyer, - {{ convert_wei('snx') }} as snx, - {{ convert_wei('usd') }} as usd, - ({{ convert_wei('usd') }}) / ({{ convert_wei('snx') }}) as snx_price -from - {{ ref('buyback_processed_base_mainnet') }} diff --git a/transformers/synthetix/models/marts/base/mainnet/buyback/fct_buyback_daily_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/buyback/fct_buyback_daily_base_mainnet.sql deleted file mode 100644 index ea8d20fd..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/buyback/fct_buyback_daily_base_mainnet.sql +++ /dev/null @@ -1,31 +0,0 @@ -with agg as ( - select - date_trunc( - 'day', - ts - ) as ts, - sum(snx) as snx_amount, - sum(usd) as usd_amount - from - {{ ref('fct_buyback_base_mainnet') }} - group by - date_trunc( - 'day', - ts - ) -) -- add cumulative amounts - -select - ts, - snx_amount, - usd_amount, - sum(snx_amount) over ( - order by - ts - ) as cumulative_snx_amount, - sum(usd_amount) over ( - order by - ts - ) as cumulative_usd_amount -from - agg diff --git a/transformers/synthetix/models/marts/base/mainnet/buyback/fct_buyback_hourly_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/buyback/fct_buyback_hourly_base_mainnet.sql deleted file mode 100644 index 9a3b0912..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/buyback/fct_buyback_hourly_base_mainnet.sql +++ /dev/null @@ -1,31 +0,0 @@ -with agg as ( - select - date_trunc( - 'hour', - ts - ) as ts, - sum(snx) as snx_amount, - sum(usd) as usd_amount - from - {{ ref('fct_buyback_base_mainnet') }} - group by - date_trunc( - 'hour', - ts - ) -) -- add cumulative amounts - -select - ts, - snx_amount, - usd_amount, - sum(snx_amount) over ( - order by - ts - ) as cumulative_snx_amount, - sum(usd_amount) over ( - order by - ts - ) as cumulative_usd_amount -from - agg diff --git a/transformers/synthetix/models/marts/base/mainnet/buyback/schema.yml b/transformers/synthetix/models/marts/base/mainnet/buyback/schema.yml deleted file mode 100644 index d92a4482..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/buyback/schema.yml +++ /dev/null @@ -1,121 +0,0 @@ -models: - - name: fct_buyback_daily_base_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: snx_amount - description: "Amount in SNX" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: usd_amount - description: "Amount in USD" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: cumulative_snx_amount - description: "Cumulative amount in SNX" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: cumulative_usd_amount - description: "Cumulative amount in USD" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fct_buyback_hourly_base_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: snx_amount - description: "Amount in SNX" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: usd_amount - description: "Amount in USD" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: cumulative_snx_amount - description: "Cumulative amount in SNX" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: cumulative_usd_amount - description: "Cumulative amount in USD" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fct_buyback_base_mainnet - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: buyer - description: "Address of buyer" - data_type: text - tests: - - not_null - - name: snx - description: "Amount in SNX" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: usd - description: "Amount in USD" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: snx_price - description: "SNX Price" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true diff --git a/transformers/synthetix/models/marts/base/mainnet/core/fct_core_account_activity_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/core/fct_core_account_activity_base_mainnet.sql deleted file mode 100644 index 1885898d..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/core/fct_core_account_activity_base_mainnet.sql +++ /dev/null @@ -1,42 +0,0 @@ -{{ config( - materialized = "view", - tags = ["core", "account_activity", "daily", "base", "mainnet"] -) }} - -with delegated as ( - select distinct - block_timestamp, - account_id, - 'Delegated' as account_action - from {{ ref('core_delegation_updated_base_mainnet') }} -), - -withdrawn as ( - select - block_timestamp, - account_id, - 'Withdrawn' as account_action - from {{ ref('core_withdrawn_base_mainnet') }} -), - -claimed as ( - select - block_timestamp, - account_id, - 'Claimed' as account_action - from {{ ref('core_rewards_claimed_base_mainnet') }} -), - -combined as ( - select * from delegated - union all - select * from withdrawn - union all - select * from claimed -) - -select - block_timestamp, - account_action, - account_id -from combined diff --git a/transformers/synthetix/models/marts/base/mainnet/core/fct_core_account_delegation_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/core/fct_core_account_delegation_base_mainnet.sql deleted file mode 100644 index 5f70a172..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/core/fct_core_account_delegation_base_mainnet.sql +++ /dev/null @@ -1,60 +0,0 @@ -with delegation_changes as ( - select - block_timestamp, - account_id, - pool_id, - collateral_type, - {{ convert_wei('amount') }} - - LAG({{ convert_wei('amount') }}, 1, 0) over ( - partition by - account_id, - pool_id, - collateral_type - order by - block_timestamp - ) as change_in_amount - from - {{ ref('core_delegation_updated_base_mainnet') }} -), - -cumulative_delegation as ( - select - block_timestamp, - account_id, - pool_id, - collateral_type, - SUM(change_in_amount) over ( - partition by - pool_id, - account_id, - collateral_type - order by - block_timestamp - ) as cumulative_amount_delegated, - ROW_NUMBER() over ( - partition by - pool_id, - account_id, - collateral_type - order by - block_timestamp desc - ) as rn - from - delegation_changes -) - -select - block_timestamp as ts, - pool_id, - collateral_type, - cumulative_amount_delegated as amount_delegated, - CAST( - account_id as text - ) as account_id -from - cumulative_delegation -where - rn = 1 -order by - block_timestamp, - collateral_type diff --git a/transformers/synthetix/models/marts/base/mainnet/core/fct_core_active_stakers_daily_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/core/fct_core_active_stakers_daily_base_mainnet.sql deleted file mode 100644 index a2b5a7ad..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/core/fct_core_active_stakers_daily_base_mainnet.sql +++ /dev/null @@ -1,52 +0,0 @@ -{{ config( - materialized = "view", - tags = ["core", "active_stakers", "daily", "base", "mainnet"] -) }} - -with delegation_updated as ( - select - block_timestamp, - account_id, - amount - from {{ ref('core_delegation_updated_base_mainnet') }} -), - -dim as ( - select - d.block_date, - accounts_unique.account_id - from ( - select - generate_series( - date_trunc('day', date('2023-12-15')), - date_trunc('day', current_date), '1 day'::interval - ) as block_date - ) as d - cross join ( - select distinct account_id from delegation_updated - ) as accounts_unique -), - -stakers as ( - select - dim.block_date, - dim.account_id, - case - when coalesce(last(delegation_updated.amount) over ( - partition by dim.account_id - order by dim.block_date - rows between unbounded preceding and current row - ), 0) = 0 then 0 - else 1 - end as is_staking - from dim - left join delegation_updated on - dim.block_date = date(delegation_updated.block_timestamp) - and dim.account_id = delegation_updated.account_id -) - -select - block_date, - sum(is_staking) as nof_stakers_daily -from stakers -group by block_date diff --git a/transformers/synthetix/models/marts/base/mainnet/core/fct_core_apr_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/core/fct_core_apr_base_mainnet.sql deleted file mode 100644 index 9c29b6dd..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/core/fct_core_apr_base_mainnet.sql +++ /dev/null @@ -1,238 +0,0 @@ -{{ - config( - materialized = 'table', - ) -}} - -with pnl_hourly as ( - select - ts, - pool_id, - collateral_type, - collateral_value, - debt, - hourly_pnl, - hourly_issuance, - rewards_usd, - hourly_pnl_pct, - hourly_rewards_pct, - hourly_total_pct, - SUM( - COALESCE( - hourly_issuance, - 0 - ) - ) over ( - partition by - pool_id, - collateral_type - order by - ts - ) as cumulative_issuance, - SUM( - hourly_pnl - ) over ( - partition by - pool_id, - collateral_type - order by - ts - ) as cumulative_pnl - from - {{ ref('fct_pool_pnl_hourly_base_mainnet') }} -), - -avg_returns as ( - select - ts, - pool_id, - collateral_type, - AVG( - hourly_pnl_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '24 HOURS' preceding - and current row - ) as avg_24h_pnl_pct, - AVG( - hourly_pnl_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '7 DAYS' preceding - and current row - ) as avg_7d_pnl_pct, - AVG( - hourly_pnl_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '28 DAYS' preceding - and current row - ) as avg_28d_pnl_pct, - AVG( - hourly_rewards_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '24 HOURS' preceding - and current row - ) as avg_24h_rewards_pct, - AVG( - hourly_rewards_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '7 DAYS' preceding - and current row - ) as avg_7d_rewards_pct, - AVG( - hourly_rewards_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '28 DAYS' preceding - and current row - ) as avg_28d_rewards_pct, - AVG( - hourly_total_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '24 HOURS' preceding - and current row - ) as avg_24h_total_pct, - AVG( - hourly_total_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '7 DAYS' preceding - and current row - ) as avg_7d_total_pct, - AVG( - hourly_total_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '28 DAYS' preceding - and current row - ) as avg_28d_total_pct - from - pnl_hourly -), - -apr_calculations as ( - select - pnl_hourly.ts, - pnl_hourly.pool_id, - pnl_hourly.collateral_type, - pnl_hourly.collateral_value, - pnl_hourly.debt, - pnl_hourly.hourly_pnl, - pnl_hourly.cumulative_pnl, - pnl_hourly.hourly_issuance, - pnl_hourly.cumulative_issuance, - pnl_hourly.rewards_usd, - pnl_hourly.hourly_pnl_pct, - pnl_hourly.hourly_rewards_pct, - -- total pnls - avg_returns.avg_24h_total_pct * 24 * 365 as apr_24h, - avg_returns.avg_7d_total_pct * 24 * 365 as apr_7d, - avg_returns.avg_28d_total_pct * 24 * 365 as apr_28d, - -- pool pnls - avg_returns.avg_24h_pnl_pct * 24 * 365 as apr_24h_pnl, - avg_returns.avg_7d_pnl_pct * 24 * 365 as apr_7d_pnl, - avg_returns.avg_28d_pnl_pct * 24 * 365 as apr_28d_pnl, - -- rewards pnls - avg_returns.avg_24h_rewards_pct * 24 * 365 as apr_24h_rewards, - avg_returns.avg_7d_rewards_pct * 24 * 365 as apr_7d_rewards, - avg_returns.avg_28d_rewards_pct * 24 * 365 as apr_28d_rewards - from - pnl_hourly - inner join avg_returns - on - pnl_hourly.ts = avg_returns.ts - and pnl_hourly.pool_id = avg_returns.pool_id - and pnl_hourly.collateral_type = avg_returns.collateral_type -), - -apy_calculations as ( - select - *, - (POWER(1 + apr_24h / 8760, 8760) - 1) as apy_24h, - (POWER(1 + apr_7d / 8760, 8760) - 1) as apy_7d, - (POWER(1 + apr_28d / 8760, 8760) - 1) as apy_28d, - (POWER(1 + apr_24h_pnl / 8760, 8760) - 1) as apy_24h_pnl, - (POWER(1 + apr_7d_pnl / 8760, 8760) - 1) as apy_7d_pnl, - (POWER(1 + apr_28d_pnl / 8760, 8760) - 1) as apy_28d_pnl, - (POWER(1 + apr_24h_rewards / 8760, 8760) - 1) as apy_24h_rewards, - (POWER(1 + apr_7d_rewards / 8760, 8760) - 1) as apy_7d_rewards, - (POWER(1 + apr_28d_rewards / 8760, 8760) - 1) as apy_28d_rewards - from - apr_calculations -) - -select - ts, - pool_id, - collateral_type, - collateral_value, - debt, - hourly_issuance, - hourly_pnl, - cumulative_pnl, - cumulative_issuance, - rewards_usd, - hourly_pnl_pct, - hourly_rewards_pct, - apr_24h, - apy_24h, - apr_7d, - apy_7d, - apr_28d, - apy_28d, - apr_24h_pnl, - apy_24h_pnl, - apr_7d_pnl, - apy_7d_pnl, - apr_28d_pnl, - apy_28d_pnl, - apr_24h_rewards, - apy_24h_rewards, - apr_7d_rewards, - apy_7d_rewards, - apr_28d_rewards, - apy_28d_rewards -from - apy_calculations -order by - ts diff --git a/transformers/synthetix/models/marts/base/mainnet/core/fct_core_apr_rewards_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/core/fct_core_apr_rewards_base_mainnet.sql deleted file mode 100644 index c6f75d61..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/core/fct_core_apr_rewards_base_mainnet.sql +++ /dev/null @@ -1,115 +0,0 @@ -{{ - config( - materialized = 'table', - ) -}} - -with pnl_hourly as ( - select - ts, - pool_id, - collateral_type, - reward_token, - collateral_value, - rewards_usd, - hourly_rewards_pct - from - {{ ref('fct_pool_pnl_hourly_reward_base_mainnet') }} -), - -avg_returns as ( - select - ts, - pool_id, - collateral_type, - reward_token, - AVG( - hourly_rewards_pct - ) over ( - partition by - pool_id, - collateral_type, - reward_token - order by - ts - range between interval '24 HOURS' preceding - and current row - ) as avg_24h_rewards_pct, - AVG( - hourly_rewards_pct - ) over ( - partition by - pool_id, - collateral_type, - reward_token - order by - ts - range between interval '7 DAYS' preceding - and current row - ) as avg_7d_rewards_pct, - AVG( - hourly_rewards_pct - ) over ( - partition by - pool_id, - collateral_type, - reward_token - order by - ts - range between interval '28 DAYS' preceding - and current row - ) as avg_28d_rewards_pct - from - pnl_hourly -), - -apr_calculations as ( - select - pnl_hourly.ts, - pnl_hourly.pool_id, - pnl_hourly.collateral_type, - pnl_hourly.reward_token, - pnl_hourly.collateral_value, - pnl_hourly.rewards_usd, - pnl_hourly.hourly_rewards_pct, - avg_returns.avg_24h_rewards_pct * 24 * 365 as apr_24h_rewards, - avg_returns.avg_7d_rewards_pct * 24 * 365 as apr_7d_rewards, - avg_returns.avg_28d_rewards_pct * 24 * 365 as apr_28d_rewards - from - pnl_hourly - inner join avg_returns - on - pnl_hourly.ts = avg_returns.ts - and pnl_hourly.pool_id = avg_returns.pool_id - and pnl_hourly.collateral_type = avg_returns.collateral_type - and pnl_hourly.reward_token = avg_returns.reward_token -), - -apy_calculations as ( - select - *, - (POWER(1 + apr_24h_rewards / 8760, 8760) - 1) as apy_24h_rewards, - (POWER(1 + apr_7d_rewards / 8760, 8760) - 1) as apy_7d_rewards, - (POWER(1 + apr_28d_rewards / 8760, 8760) - 1) as apy_28d_rewards - from - apr_calculations -) - -select - ts, - pool_id, - collateral_type, - reward_token, - collateral_value, - rewards_usd, - hourly_rewards_pct, - apr_24h_rewards, - apy_24h_rewards, - apr_7d_rewards, - apy_7d_rewards, - apr_28d_rewards, - apy_28d_rewards -from - apy_calculations -order by - ts diff --git a/transformers/synthetix/models/marts/base/mainnet/core/fct_core_market_updated_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/core/fct_core_market_updated_base_mainnet.sql deleted file mode 100644 index 427f654a..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/core/fct_core_market_updated_base_mainnet.sql +++ /dev/null @@ -1,30 +0,0 @@ -with market_updated as ( - select - id, - block_timestamp, - block_number, - transaction_hash, - contract, - event_name, - market_id, - net_issuance, - sender, - collateral_type, - credit_capacity, - token_amount - from - {{ ref('core_market_updated_base_mainnet') }} -) - -select - id, - block_timestamp as ts, - transaction_hash, - event_name, - market_id, - collateral_type, - {{ convert_wei("credit_capacity") }} as credit_capacity, - {{ convert_wei("net_issuance") }} as net_issuance, - {{ convert_wei("token_amount") }} as token_amount -from - market_updated diff --git a/transformers/synthetix/models/marts/base/mainnet/core/fct_core_pool_collateral_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/core/fct_core_pool_collateral_base_mainnet.sql deleted file mode 100644 index d5c8969e..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/core/fct_core_pool_collateral_base_mainnet.sql +++ /dev/null @@ -1,39 +0,0 @@ -with events as ( - select - block_timestamp, - {{ convert_wei('token_amount') }} as token_amount, - collateral_type - from - {{ ref('core_deposited_base_mainnet') }} - union all - select - block_timestamp, - -{{ convert_wei('token_amount') }} as token_amount, - collateral_type - from - {{ ref('core_withdrawn_base_mainnet') }} -), - -ranked_events as ( - select - *, - SUM(token_amount) over ( - partition by collateral_type - order by - block_timestamp - rows between unbounded preceding - and current row - ) as amount_deposited - from - events -) - -select - block_timestamp as ts, - collateral_type, - amount_deposited -from - ranked_events -order by - block_timestamp, - collateral_type diff --git a/transformers/synthetix/models/marts/base/mainnet/core/fct_core_pool_delegation_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/core/fct_core_pool_delegation_base_mainnet.sql deleted file mode 100644 index cfdb81d8..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/core/fct_core_pool_delegation_base_mainnet.sql +++ /dev/null @@ -1,45 +0,0 @@ -with delegation_changes as ( - select - block_timestamp, - account_id, - pool_id, - collateral_type, - {{ convert_wei('amount') }} - - LAG({{ convert_wei('amount') }}, 1, 0) over ( - partition by - account_id, - pool_id, - collateral_type - order by - block_timestamp - ) as change_in_amount - from - {{ ref('core_delegation_updated_base_mainnet') }} -), - -cumulative_delegation as ( - select - block_timestamp, - pool_id, - collateral_type, - SUM(change_in_amount) over ( - partition by - pool_id, - collateral_type - order by - block_timestamp - ) as cumulative_amount_delegated - from - delegation_changes -) - -select - block_timestamp as ts, - pool_id, - collateral_type, - cumulative_amount_delegated as amount_delegated -from - cumulative_delegation -order by - block_timestamp, - collateral_type diff --git a/transformers/synthetix/models/marts/base/mainnet/core/fct_core_pools_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/core/fct_core_pools_base_mainnet.sql deleted file mode 100644 index 2fd9e5ec..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/core/fct_core_pools_base_mainnet.sql +++ /dev/null @@ -1,13 +0,0 @@ -with base as ( - select - pool_id as id, - block_timestamp as created_ts, - block_number, - owner - from - {{ ref('core_pool_created_base_mainnet') }} -) - -select * -from - base diff --git a/transformers/synthetix/models/marts/base/mainnet/core/fct_core_vault_collateral_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/core/fct_core_vault_collateral_base_mainnet.sql deleted file mode 100644 index f7b3efd4..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/core/fct_core_vault_collateral_base_mainnet.sql +++ /dev/null @@ -1,10 +0,0 @@ -select - ts, - block_number, - contract_address, - pool_id, - collateral_type, - amount, - collateral_value -from - {{ ref("core_vault_collateral_base_mainnet") }} diff --git a/transformers/synthetix/models/marts/base/mainnet/core/fct_pool_debt_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/core/fct_pool_debt_base_mainnet.sql deleted file mode 100644 index c65a22fb..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/core/fct_pool_debt_base_mainnet.sql +++ /dev/null @@ -1,10 +0,0 @@ -select - ts, - block_number, - pool_id, - collateral_type, - debt -from - {{ ref('core_vault_debt_base_mainnet') }} -order by - ts diff --git a/transformers/synthetix/models/marts/base/mainnet/core/fct_pool_issuance_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/core/fct_pool_issuance_base_mainnet.sql deleted file mode 100644 index c0ca3ed0..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/core/fct_pool_issuance_base_mainnet.sql +++ /dev/null @@ -1,39 +0,0 @@ -with burns as ( - select - block_timestamp as ts, - block_number, - transaction_hash, - pool_id, - collateral_type, - account_id, - -1 * {{ convert_wei('amount') }} as amount - from - {{ ref('core_usd_burned_base_mainnet') }} - order by - block_timestamp desc -), - -mints as ( - select - block_timestamp as ts, - block_number, - transaction_hash, - pool_id, - collateral_type, - account_id, - {{ convert_wei('amount') }} as amount - from - {{ ref('core_usd_minted_base_mainnet') }} - order by - block_timestamp desc -) - -select * -from - burns -union all -select * -from - mints -order by - ts desc diff --git a/transformers/synthetix/models/marts/base/mainnet/core/fct_pool_issuance_hourly_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/core/fct_pool_issuance_hourly_base_mainnet.sql deleted file mode 100644 index b1d5765f..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/core/fct_pool_issuance_hourly_base_mainnet.sql +++ /dev/null @@ -1,122 +0,0 @@ -with dim as ( - select - m.pool_id, - m.collateral_type, - generate_series( - date_trunc('hour', min(t.ts)), - date_trunc('hour', max(t.ts)), - '1 hour'::interval - ) as ts - from - ( - select ts - from - {{ ref('fct_pool_issuance_base_mainnet') }} - ) as t - cross join ( - select distinct - pool_id, - collateral_type - from - {{ ref('fct_pool_issuance_base_mainnet') }} - ) as m - group by - m.pool_id, - m.collateral_type -), - -max_debt_block as ( - select - pool_id, - collateral_type, - date_trunc( - 'hour', - ts - ) as "hour", - max(block_number) as max_block_number - from - {{ ref('fct_pool_debt_base_mainnet') }} - group by - date_trunc( - 'hour', - ts - ), - pool_id, - collateral_type -), - -filt_issuance as ( - select - i.pool_id, - i.collateral_type, - i.amount, - case - when - i.block_number <= d.max_block_number - or d.max_block_number is null then i.ts - else i.ts + interval '1 hour' - end as ts - from - {{ ref('fct_pool_issuance_base_mainnet') }} - as i - left join max_debt_block as d - on date_trunc( - 'hour', - i.ts - ) = d.hour - and i.pool_id = d.pool_id - and lower( - i.collateral_type - ) = lower( - d.collateral_type - ) - where - i.block_number <= ( - select - max( - max_block_number - ) as b - from - max_debt_block - ) -), - -issuance as ( - select - date_trunc( - 'hour', - ts - ) as ts, - pool_id, - collateral_type, - sum(amount) as hourly_issuance - from - filt_issuance - group by - date_trunc( - 'hour', - ts - ), - pool_id, - collateral_type -) - -select - dim.ts, - dim.pool_id, - dim.collateral_type, - coalesce( - i.hourly_issuance, - 0 - ) as hourly_issuance -from - dim -left join issuance as i - on - dim.pool_id = i.pool_id - and lower( - dim.collateral_type - ) = lower( - i.collateral_type - ) - and dim.ts = i.ts diff --git a/transformers/synthetix/models/marts/base/mainnet/core/fct_pool_pnl_hourly_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/core/fct_pool_pnl_hourly_base_mainnet.sql deleted file mode 100644 index 732f0c8a..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/core/fct_pool_pnl_hourly_base_mainnet.sql +++ /dev/null @@ -1,217 +0,0 @@ -{{ config( - materialized = 'table', - unique_key = ['ts', 'pool_id', 'collateral_type'], -) }} - -with dim as ( - select - p.pool_id, - p.collateral_type, - generate_series( - date_trunc('hour', min(t.ts)), - date_trunc('hour', max(t.ts)), - '1 hour'::INTERVAL - ) as ts - from - ( - select ts - from - {{ ref('fct_pool_debt_base_mainnet') }} - ) as t - cross join ( - select distinct - pool_id, - collateral_type - from - {{ ref('fct_pool_debt_base_mainnet') }} - ) as p - group by - p.pool_id, - p.collateral_type -), - -issuance as ( - select - ts, - pool_id, - collateral_type, - hourly_issuance - from - {{ ref('fct_pool_issuance_hourly_base_mainnet') }} -), - -debt as ( - select distinct - pool_id, - collateral_type, - date_trunc( - 'hour', - ts - ) as ts, - last_value(debt) over ( - partition by date_trunc('hour', ts), pool_id, collateral_type - order by - ts - rows between unbounded preceding - and unbounded following - ) as debt - from - {{ ref('fct_pool_debt_base_mainnet') }} -), - -collateral as ( - select distinct - pool_id, - collateral_type, - date_trunc( - 'hour', - ts - ) as ts, - last_value(collateral_value) over ( - partition by date_trunc('hour', ts), pool_id, collateral_type - order by - ts - rows between unbounded preceding - and unbounded following - ) as collateral_value - from - {{ ref('core_vault_collateral_base_mainnet') }} - where - pool_id = 1 -), - -ffill as ( - select - dim.ts, - dim.pool_id, - dim.collateral_type, - coalesce( - last(debt) over ( - partition by dim.collateral_type, dim.pool_id - order by dim.ts - rows between unbounded preceding and current row - ), - 0 - ) as debt, - coalesce( - last(collateral_value) over ( - partition by dim.collateral_type, dim.pool_id - order by dim.ts - rows between unbounded preceding and current row - ), - 0 - ) as collateral_value - from - dim - left join debt - on - dim.ts = debt.ts - and dim.pool_id = debt.pool_id - and dim.collateral_type = debt.collateral_type - left join collateral - on - dim.ts = collateral.ts - and dim.pool_id = collateral.pool_id - and dim.collateral_type = collateral.collateral_type -), - -hourly_pnl as ( - select - ts, - pool_id, - collateral_type, - collateral_value, - debt, - coalesce(lag(debt) over ( - partition by pool_id, collateral_type - order by - ts - ) - debt, 0) as hourly_pnl - from - ffill -), - -hourly_rewards as ( - select - ts, - pool_id, - collateral_type, - rewards_usd - from - {{ ref('fct_pool_rewards_hourly_base_mainnet') }} -), - -hourly_returns as ( - select - pnl.ts, - pnl.pool_id, - pnl.collateral_type, - pnl.collateral_value, - pnl.debt, - coalesce( - iss.hourly_issuance, - 0 - ) as hourly_issuance, - pnl.hourly_pnl + coalesce( - iss.hourly_issuance, - 0 - ) as hourly_pnl, - coalesce( - rewards.rewards_usd, - 0 - ) as rewards_usd, - case - when pnl.collateral_value = 0 then 0 - else coalesce( - rewards.rewards_usd, - 0 - ) / pnl.collateral_value - end as hourly_rewards_pct, - case - when pnl.collateral_value = 0 then 0 - else - (coalesce(iss.hourly_issuance, 0) + pnl.hourly_pnl) - / pnl.collateral_value - end as hourly_pnl_pct, - case - when pnl.collateral_value = 0 then 0 - else - ( - coalesce(rewards.rewards_usd, 0) - + pnl.hourly_pnl - + coalesce(iss.hourly_issuance, 0) - ) - / pnl.collateral_value - end as hourly_total_pct - from - hourly_pnl as pnl - left join hourly_rewards as rewards - on - pnl.ts = rewards.ts - and pnl.pool_id = rewards.pool_id - and lower(pnl.collateral_type) = lower(rewards.collateral_type) - left join issuance as iss - on - pnl.ts = iss.ts - and pnl.pool_id = iss.pool_id - and lower( - pnl.collateral_type - ) = lower( - iss.collateral_type - ) -) - -select - ts, - pool_id, - collateral_type, - collateral_value, - debt, - hourly_issuance, - hourly_pnl, - rewards_usd, - hourly_pnl_pct, - hourly_rewards_pct, - hourly_total_pct -from - hourly_returns diff --git a/transformers/synthetix/models/marts/base/mainnet/core/fct_pool_pnl_hourly_reward_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/core/fct_pool_pnl_hourly_reward_base_mainnet.sql deleted file mode 100644 index 82d21fc6..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/core/fct_pool_pnl_hourly_reward_base_mainnet.sql +++ /dev/null @@ -1,85 +0,0 @@ -{{ config( - materialized = 'table', - unique_key = ['ts', 'pool_id', 'collateral_type', 'reward_token'], -) }} - -with dim as ( - - select - t.ts, - t.pool_id, - t.collateral_type, - t.collateral_value, - p.token_symbol as reward_token - from - ( - select - ts, - collateral_type, - pool_id, - collateral_value - from - {{ ref('fct_pool_pnl_hourly_base_mainnet') }} - group by - ts, - collateral_type, - pool_id, - collateral_value - ) as t - cross join ( - select distinct token_symbol - from - {{ ref('fct_pool_rewards_token_hourly_base_mainnet') }} - ) as p - group by - t.ts, - t.pool_id, - t.collateral_type, - t.collateral_value, - p.token_symbol -), - -reward_hourly_token as ( - select - ts, - pool_id, - collateral_type, - token_symbol as reward_token, - SUM( - rewards_usd - ) as rewards_usd - from - {{ ref('fct_pool_rewards_token_hourly_base_mainnet') }} - group by - ts, - pool_id, - collateral_type, - token_symbol -) - -select - dim.ts, - dim.pool_id, - dim.collateral_type, - dim.collateral_value, - dim.reward_token, - COALESCE( - reward_hourly_token.rewards_usd, - 0 - ) as rewards_usd, - case - when dim.collateral_value = 0 then 0 - else COALESCE( - reward_hourly_token.rewards_usd, - 0 - ) / dim.collateral_value - end as hourly_rewards_pct -from - dim -left join reward_hourly_token - on - dim.ts = reward_hourly_token.ts - and dim.pool_id = reward_hourly_token.pool_id - and LOWER(dim.collateral_type) - = LOWER(reward_hourly_token.collateral_type) - and dim.reward_token = reward_hourly_token.reward_token diff --git a/transformers/synthetix/models/marts/base/mainnet/core/fct_pool_rewards_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/core/fct_pool_rewards_base_mainnet.sql deleted file mode 100644 index c69a1b13..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/core/fct_pool_rewards_base_mainnet.sql +++ /dev/null @@ -1,37 +0,0 @@ -with rewards_distributed as ( - select - block_timestamp as ts, - CAST( - pool_id as INTEGER - ) as pool_id, - collateral_type, - distributor, - {{ convert_wei('amount') }} as amount, - TO_TIMESTAMP("start") as ts_start, - "duration" - from - {{ ref('core_rewards_distributed_base_mainnet') }} -), - -distributors as ( - select - CAST(distributor_address as TEXT) as distributor_address, - CAST(token_symbol as TEXT) as token_symbol - from - {{ ref('base_mainnet_reward_distributors') }} -) - -select - rd.ts, - rd.pool_id, - rd.collateral_type, - rd.distributor, - distributors.token_symbol, - rd.amount, - rd.ts_start, - rd.duration -from - rewards_distributed as rd -inner join distributors on rd.distributor = distributors.distributor_address -order by - ts diff --git a/transformers/synthetix/models/marts/base/mainnet/core/fct_pool_rewards_hourly_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/core/fct_pool_rewards_hourly_base_mainnet.sql deleted file mode 100644 index c3f43e5a..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/core/fct_pool_rewards_hourly_base_mainnet.sql +++ /dev/null @@ -1,21 +0,0 @@ -with token_hourly as ( - select - ts, - pool_id, - collateral_type, - rewards_usd - from - {{ ref('fct_pool_rewards_token_hourly_base_mainnet') }} -) - -select - ts, - pool_id, - collateral_type, - SUM(rewards_usd) as rewards_usd -from - token_hourly -group by - ts, - pool_id, - collateral_type diff --git a/transformers/synthetix/models/marts/base/mainnet/core/fct_pool_rewards_token_hourly_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/core/fct_pool_rewards_token_hourly_base_mainnet.sql deleted file mode 100644 index 171eaaaa..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/core/fct_pool_rewards_token_hourly_base_mainnet.sql +++ /dev/null @@ -1,190 +0,0 @@ -with dim as ( - select - m.pool_id, - m.collateral_type, - generate_series( - date_trunc('hour', min(t.min_ts)), - date_trunc('hour', max(t.max_ts)), - '1 hour'::INTERVAL - ) as ts - from - ( - select - min(ts_start) as min_ts, - max( - ts_start + "duration" * '1 second'::INTERVAL - ) as max_ts - from - {{ ref('fct_pool_rewards_base_mainnet') }} - ) as t - cross join ( - select distinct - pool_id, - collateral_type - from - {{ ref('fct_pool_debt_base_mainnet') }} - ) as m - group by - m.pool_id, - m.collateral_type -), - -rewards_distributed as ( - select - ts, - pool_id, - collateral_type, - distributor, - token_symbol, - amount, - ts_start, - "duration" - from - {{ ref('fct_pool_rewards_base_mainnet') }} -), - -hourly_distributions as ( - select - dim.ts, - dim.pool_id, - dim.collateral_type, - r.distributor, - r.token_symbol, - r.amount, - r.ts_start, - r."duration", - row_number() over ( - partition by - dim.ts, - dim.pool_id, - dim.collateral_type, - r.distributor - order by - r.ts_start desc - ) as distributor_index - from - dim - left join rewards_distributed as r - on - dim.pool_id = r.pool_id - and lower( - dim.collateral_type - ) = lower( - r.collateral_type - ) - and dim.ts + '1 hour'::INTERVAL >= r.ts_start - and dim.ts < r.ts_start + r."duration" * '1 second'::INTERVAL - where - r."duration" > 0 -), - -streamed_rewards as ( - select - d.ts, - d.pool_id, - d.collateral_type, - d.distributor, - d.token_symbol, - -- get the amount of time distributed this hour - -- use the smaller of those two intervals - -- convert the interval to a number of hours - -- multiply the result by the hourly amount to get the amount distributed this hour - ( - extract( - epoch - from - least( - d."duration" / 3600 * '1 hour'::INTERVAL, - least( - d.ts + '1 hour'::INTERVAL - greatest( - d.ts, - d.ts_start - ), - least( - d.ts_start + d."duration" * '1 second'::INTERVAL, - d.ts + '1 hour'::INTERVAL - ) - d.ts - ) - ) - ) / 3600 - ) * d.amount / ( - d."duration" / 3600 - ) as amount - from - hourly_distributions as d - where - d.distributor_index = 1 -), - -instant_rewards as ( - select - date_trunc( - 'hour', - ts - ) as ts, - pool_id, - collateral_type, - distributor, - token_symbol, - amount - from - rewards_distributed - where - "duration" = 0 -), - -combined as ( - select - combo.ts, - combo.pool_id, - combo.collateral_type, - combo.distributor, - combo.token_symbol, - combo.amount, - p.price - from - ( - select - ts, - pool_id, - collateral_type, - distributor, - token_symbol, - amount - from - streamed_rewards - union all - select - ts, - pool_id, - collateral_type, - distributor, - token_symbol, - amount - from - instant_rewards - ) as combo - left join {{ ref('fct_prices_hourly_base_mainnet') }} as p - on - combo.token_symbol = p.market_symbol - and combo.ts = p.ts -) - -select - ts, - pool_id, - collateral_type, - distributor, - token_symbol, - sum(amount) as amount, - sum( - amount * price - ) as rewards_usd -from - combined -group by - ts, - pool_id, - collateral_type, - distributor, - token_symbol diff --git a/transformers/synthetix/models/marts/base/mainnet/core/schema.yml b/transformers/synthetix/models/marts/base/mainnet/core/schema.yml deleted file mode 100644 index 57ad6b38..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/core/schema.yml +++ /dev/null @@ -1,638 +0,0 @@ -version: 2 -models: - - name: fct_core_account_activity_base_mainnet - description: "Daily number of accounts by action (Delegated, Withdrawn, Claimed)" - columns: - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: account_action - description: "Type of LP action" - data_type: text - tests: - - not_null - - accepted_values: - values: ["Delegated", "Withdrawn", "Claimed"] - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - name: fct_core_active_stakers_daily_base_mainnet - description: "Daily number of active stakers" - columns: - - name: block_date - description: "Date" - data_type: date - tests: - - not_null - - name: nof_stakers_daily - description: "Number of active stakers daily" - - name: fct_core_vault_collateral_base_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: contract_address - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: integer - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: character varying - tests: - - not_null - - name: amount - description: "Collateral amount" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_value - description: "Vault collateral value" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fct_pool_rewards_base_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: distributor - description: "Address of the distributor" - data_type: text - tests: - - not_null - - name: token_symbol - description: "Token symbol" - data_type: text - tests: - - not_null - - name: amount - description: "Reward amount" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: ts_start - data_type: timestamp with time zone - - name: duration - data_type: numeric - - name: fct_core_account_delegation_base_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: amount_delegated - description: "Amount of delegated collateral" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fct_core_apr_base_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: collateral_value - description: "Collateral value (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: debt - description: "Debt value (USD)" - data_type: numeric - tests: - - not_null - - name: hourly_issuance - description: "Hourly issuance" - data_type: numeric - tests: - - not_null - - name: hourly_pnl - description: "Hourly PnL" - data_type: numeric - tests: - - not_null - - name: cumulative_pnl - description: "Cumulative PnL" - data_type: numeric - tests: - - not_null - - name: cumulative_issuance - description: "Cumulative Issuance" - data_type: numeric - tests: - - not_null - - name: rewards_usd - description: "Rewards value (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: hourly_pnl_pct - description: "Hourly PnL (%)" - data_type: numeric - tests: - - not_null - - name: hourly_rewards_pct - description: "Hourly Rewards (%)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - max_value: 1 - inclusive: true - - name: apr_24h - description: "APR (24h)" - data_type: numeric - tests: - - not_null - - name: apy_24h - description: "APY (24h)" - data_type: numeric - tests: - - not_null - - name: apr_7d - description: "APR (7d)" - data_type: numeric - tests: - - not_null - - name: apy_7d - description: "APY (7d)" - data_type: numeric - tests: - - not_null - - name: apr_28d - description: "APR (28d)" - data_type: numeric - tests: - - not_null - - name: apy_28d - description: "APY (28d)" - data_type: numeric - tests: - - not_null - - name: apr_24h_pnl - data_type: numeric - - name: apy_24h_pnl - data_type: numeric - - name: apr_7d_pnl - data_type: numeric - - name: apy_7d_pnl - data_type: numeric - - name: apr_28d_pnl - data_type: numeric - - name: apy_28d_pnl - data_type: numeric - - name: apr_24h_rewards - data_type: numeric - - name: apy_24h_rewards - data_type: numeric - - name: apr_7d_rewards - data_type: numeric - - name: apy_7d_rewards - data_type: numeric - - name: apr_28d_rewards - data_type: numeric - - name: apy_28d_rewards - data_type: numeric - - name: fct_core_market_updated_base_mainnet - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["MarketCollateralWithdrawn", "MarketCollateralDeposited", "MarketUsdWithdrawn", "MarketUsdDeposited"] - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: credit_capacity - description: "Credit capacity" - data_type: numeric - tests: - - not_null - - name: net_issuance - description: "Net issuance" - data_type: numeric - tests: - - not_null - - name: token_amount - description: "Token amount" - data_type: numeric - tests: - - not_null - - name: fct_core_pool_collateral_base_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: amount_deposited - description: "Amount deposited" - data_type: numeric - tests: - - not_null - - name: fct_core_pool_delegation_base_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: amount_delegated - data_type: numeric - - name: fct_core_pools_base_mainnet - columns: - - name: id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: created_ts - description: "Pool creation timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: owner - description: "Address of the pool owner" - data_type: text - tests: - - not_null - - name: fct_pool_debt_base_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: debt - description: "Debt value (USD)" - data_type: numeric - tests: - - not_null - - name: fct_pool_issuance_hourly_base_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: hourly_issuance - description: "Hourly issuance" - data_type: numeric - tests: - - not_null - - name: fct_pool_issuance_base_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - name: amount - description: "Amount issued" - data_type: numeric - tests: - - not_null - - name: fct_pool_pnl_hourly_base_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: collateral_value - description: "Collateral value (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: debt - description: "Debt value (USD)" - data_type: numeric - tests: - - not_null - - name: hourly_issuance - description: "Hourly issuance" - data_type: numeric - tests: - - not_null - - name: hourly_pnl - description: "Hourly PnL" - data_type: numeric - tests: - - not_null - - name: rewards_usd - description: "Rewards value (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: hourly_pnl_pct - description: "Hourly PnL (%)" - data_type: numeric - tests: - - not_null - - name: hourly_rewards_pct - description: "Hourly Rewards (%)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - max_value: 1 - inclusive: true - - name: hourly_total_pct - description: "Hourly Total (%)" - data_type: numeric - tests: - - not_null - - name: fct_pool_rewards_hourly_base_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: rewards_usd - description: "Rewards value (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fct_pool_rewards_token_hourly_base_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: distributor - description: "Address of the distributor" - data_type: text - tests: - - not_null - - name: token_symbol - description: "Token symbol" - data_type: text - tests: - - not_null - - name: amount - description: "Distributed rewards amount" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: rewards_usd - description: "Rewards value (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true diff --git a/transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_account_activity_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_account_activity_base_mainnet.sql deleted file mode 100644 index f54a9258..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_account_activity_base_mainnet.sql +++ /dev/null @@ -1,89 +0,0 @@ -{{ config( - materialized = "view", - tags = ["perp", "account_activity", "base", "mainnet"] -) }} - -with active_accounts as ( - select distinct - date_trunc('day', ts) as activity_date, - account_id - from {{ ref('fct_perp_trades_base_mainnet') }} -), - -date_range as ( - select - generate_series( - date(min(activity_date)), - date(max(activity_date)), - interval '1 day' - )::date as activity_date - from active_accounts -), - -active_accounts_daily as ( - select - date_range.activity_date, - count(distinct active_accounts.account_id) as active_accounts - from date_range - left join active_accounts - on date_range.activity_date = active_accounts.activity_date - group by date_range.activity_date -), - -active_accounts_monthly as ( - select - date_range.activity_date, - count(distinct active_accounts.account_id) as active_accounts - from date_range - left join active_accounts - on - date_range.activity_date - interval '27 days' - <= active_accounts.activity_date - and date_range.activity_date >= active_accounts.activity_date - group by date_range.activity_date -), - -new_accounts as ( - select - min(activity_date) as start_date, - account_id - from active_accounts - group by account_id -), - -new_accounts_daily as ( - select - date_range.activity_date, - count(new_accounts.account_id) as new_accounts - from date_range - left join new_accounts - on date_range.activity_date = new_accounts.start_date - group by date_range.activity_date, new_accounts.start_date -), - -new_accounts_monthly as ( - select distinct - activity_date, - sum(new_accounts) over ( - order by activity_date - range between interval '27 days' preceding and current row - ) as new_accounts - from new_accounts_daily -) - -select - dr.activity_date as ts, - dau.active_accounts as dau, - mau.active_accounts as mau, - new_accounts_daily.new_accounts as new_accounts_daily, - new_accounts_monthly.new_accounts as new_accounts_monthly -from date_range as dr -left join active_accounts_daily as dau - on dr.activity_date = dau.activity_date -left join active_accounts_monthly as mau - on dr.activity_date = mau.activity_date -left join new_accounts_daily - on dr.activity_date = new_accounts_daily.activity_date -left join new_accounts_monthly - on dr.activity_date = new_accounts_monthly.activity_date -order by ts desc diff --git a/transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_accounts_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_accounts_base_mainnet.sql deleted file mode 100644 index 7352fc30..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_accounts_base_mainnet.sql +++ /dev/null @@ -1,14 +0,0 @@ -with base as ( - select - block_timestamp as created_ts, - "owner", - CAST( - account_id as VARCHAR - ) as id - from - {{ ref('perp_account_created_base_mainnet') }} -) - -select * -from - base diff --git a/transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_collateral_modified_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_collateral_modified_base_mainnet.sql deleted file mode 100644 index cde91fef..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_collateral_modified_base_mainnet.sql +++ /dev/null @@ -1,18 +0,0 @@ -select - cm.id, - cm.block_timestamp, - cm.account_id, - cm.block_number, - cm.transaction_hash, - cm.contract, - cm.event_name, - synths.synth_symbol, - cm.synth_market_id, - synths.synth_token_address, - cm.sender, - {{ convert_wei("cm.amount_delta") }} as amount_delta -from - {{ ref("perp_collateral_modified_base_mainnet") }} - as cm -inner join {{ ref('base_mainnet_synths') }} as synths - on cm.synth_market_id = synths.synth_market_id diff --git a/transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_interest_charged_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_interest_charged_base_mainnet.sql deleted file mode 100644 index bd657a06..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_interest_charged_base_mainnet.sql +++ /dev/null @@ -1,11 +0,0 @@ -select - id, - block_timestamp, - block_number, - transaction_hash, - contract, - event_name, - account_id, - {{ convert_wei("interest") }} as interest -from - {{ ref("perp_interest_charged_base_mainnet") }} diff --git a/transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_liq_account_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_liq_account_base_mainnet.sql deleted file mode 100644 index ab1fc4ec..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_liq_account_base_mainnet.sql +++ /dev/null @@ -1,59 +0,0 @@ -with liquidation_events as ( - select - account_id, - reward, - block_timestamp, - full_liquidation, - SUM( - case - when full_liquidation then 1 - else 0 - end - ) over ( - partition by account_id - order by - block_timestamp - rows between unbounded preceding - and current row - ) as liquidation_id - from - {{ ref('perp_account_liquidation_attempt_base_mainnet') }} -), - -cumulative_rewards as ( - select - block_timestamp, - reward, - full_liquidation, - liquidation_id, - CAST( - account_id as text - ) as account_id, - SUM({{ convert_wei('reward') }}) over ( - partition by - account_id, - liquidation_id - order by - block_timestamp - ) as cumulative_reward, - ROW_NUMBER() over ( - partition by - account_id, - liquidation_id - order by - block_timestamp desc - ) as rn - from - liquidation_events - order by - block_timestamp -) - -select - account_id, - block_timestamp as ts, - cumulative_reward as total_reward -from - cumulative_rewards -where - rn = 1 diff --git a/transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_liq_position_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_liq_position_base_mainnet.sql deleted file mode 100644 index 8c52ca42..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_liq_position_base_mainnet.sql +++ /dev/null @@ -1,38 +0,0 @@ -with liquidations as ( - select - id, - block_timestamp as ts, - block_number, - transaction_hash, - account_id, - market_id, - {{ convert_wei('amount_liquidated') }} as amount_liquidated, - {{ convert_wei('current_position_size') }} as position_size - from - {{ ref('perp_position_liquidated_base_mainnet') }} -), - -markets as ( - select - id, - market_symbol - from - {{ ref('fct_perp_markets_base_mainnet') }} -) - -select - l.id, - l.ts, - l.block_number, - l.transaction_hash, - l.market_id, - m.market_symbol, - l.amount_liquidated, - l.position_size, - CAST( - l.account_id as text - ) as account_id -from - liquidations as l -left join markets as m - on l.market_id = m.id diff --git a/transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_market_history_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_market_history_base_mainnet.sql deleted file mode 100644 index ff995a29..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_market_history_base_mainnet.sql +++ /dev/null @@ -1,106 +0,0 @@ -with base as ( - select - mu.id, - mu.block_timestamp as ts, - mu.block_number, - mu.transaction_hash, - m.id as market_id, - m.market_symbol, - {{ convert_wei('price') }} as price, - {{ convert_wei('skew') }} as skew, - {{ convert_wei('size') }} as size, - {{ convert_wei('size_delta') }} as size_delta, - {{ convert_wei('current_funding_rate') }} as funding_rate, - {{ convert_wei('current_funding_velocity') }} as funding_velocity, - {{ convert_wei('interest_rate') }} as interest_rate, - {{ convert_wei('current_funding_rate') }} * 365.25 as funding_rate_apr, - {{ convert_wei('current_funding_rate') }} * 365.25 - + {{ convert_wei('interest_rate') }} as long_rate_apr, - {{ convert_wei('current_funding_rate') }} * -1 * 365.25 - + {{ convert_wei('interest_rate') }} as short_rate_apr, - LAG({{ convert_wei('size') }}, 1, 0) over ( - partition by m.market_symbol - order by - mu.block_timestamp - ) as prev_size - from - {{ ref('perp_market_updated_base_mainnet') }} as mu - left join {{ ref('fct_perp_markets_base_mainnet') }} as m - on mu.market_id = m.id -), - -oi as ( - select - id, - ts, - size * price as market_oi_usd, - LAG( - size * price, - 1, - 0 - ) over ( - partition by market_symbol - order by - ts asc - ) as prev_market_oi_usd, - ( - size + skew - ) * price / 2 as long_oi, - ( - size - skew - ) * price / 2 as short_oi, - case - when size * price = 0 then null - else ((size + skew) * price / 2) / ( - size * price - ) - end as long_oi_pct, - case - when size * price = 0 then null - else ((size - skew) * price / 2) / ( - size * price - ) - end as short_oi_pct - from - base -), - -total_oi as ( - select - id, - SUM( - market_oi_usd - prev_market_oi_usd - ) over ( - order by - ts asc - ) as total_oi_usd - from - oi -) - -select - base.*, - ROUND( - oi.market_oi_usd, - 2 - ) as market_oi_usd, - ROUND( - total_oi.total_oi_usd, - 2 - ) as total_oi_usd, - ROUND( - oi.long_oi, - 2 - ) as long_oi, - ROUND( - oi.short_oi, - 2 - ) as short_oi, - oi.long_oi_pct, - oi.short_oi_pct -from - base -inner join oi - on base.id = oi.id -inner join total_oi - on base.id = total_oi.id diff --git a/transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_markets_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_markets_base_mainnet.sql deleted file mode 100644 index 6f4a2ac2..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_markets_base_mainnet.sql +++ /dev/null @@ -1,14 +0,0 @@ -with base as ( - select - perps_market_id as id, - block_timestamp as created_ts, - block_number, - market_symbol, - market_name - from - {{ ref('perp_market_created_base_mainnet') }} -) - -select * -from - base diff --git a/transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_orders_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_orders_base_mainnet.sql deleted file mode 100644 index 2296dfe2..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_orders_base_mainnet.sql +++ /dev/null @@ -1,29 +0,0 @@ -with base as ( - select - oc.id, - oc.block_timestamp as ts, - oc.block_number, - oc.transaction_hash, - oc.contract, - oc.market_id, - markets.market_symbol, - CAST( - oc.account_id as text - ) as account_id, - oc.order_type, - {{ convert_wei('oc.size_delta') }} as size, - {{ convert_wei('oc.acceptable_price') }} as acceptable_price, - oc.settlement_time, - oc.expiration_time, - {{ convert_hex('oc.tracking_code') }} as tracking_code, - oc.sender - from - {{ ref('perp_order_committed_base_mainnet') }} - as oc - left join {{ ref('fct_perp_markets_base_mainnet') }} as markets - on oc.market_id = markets.id -) - -select * -from - base diff --git a/transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_pnl_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_pnl_base_mainnet.sql deleted file mode 100644 index 5dfd81ac..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_pnl_base_mainnet.sql +++ /dev/null @@ -1,18 +0,0 @@ -{# DEPRECATED: deprecate this table in dashboards and remove #} -with debt as ( - select - ts, - 2 as market_id, - debt * -1 as market_pnl - from - {{ ref('core_vault_debt_base_mainnet') }} -) - -select - ts, - market_id, - market_pnl -from - debt -order by - ts diff --git a/transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_previous_order_expired_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_previous_order_expired_base_mainnet.sql deleted file mode 100644 index fd48910d..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_previous_order_expired_base_mainnet.sql +++ /dev/null @@ -1,15 +0,0 @@ -select - id, - block_timestamp, - block_number, - transaction_hash, - contract, - event_name, - market_id, - account_id, - commitment_time, - tracking_code, - {{ convert_wei("acceptable_price") }} as acceptable_price, - {{ convert_wei("size_delta") }} as size_delta -from - {{ ref("perp_previous_order_expired_base_mainnet") }} diff --git a/transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_trades_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_trades_base_mainnet.sql deleted file mode 100644 index d80ff112..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_trades_base_mainnet.sql +++ /dev/null @@ -1,39 +0,0 @@ -with base as ( - select - pos.id, - pos.block_timestamp as ts, - pos.block_number, - pos.transaction_hash, - pos.contract, - pos.market_id, - markets.market_symbol, - CAST( - pos.account_id as text - ) as account_id, - {{ convert_wei('fill_price') }} as fill_price, - {{ convert_wei('pnl') }} as pnl, - {{ convert_wei('accrued_funding') }} as accrued_funding, - {{ convert_wei('size_delta') }} as trade_size, - {{ convert_wei('new_size') }} as position_size, - {{ convert_wei('total_fees') }} as total_fees, - {{ convert_wei('referral_fees') }} as referral_fees, - {{ convert_wei('collected_fees') }} as collected_fees, - {{ convert_wei('settlement_reward') }} as settlement_reward, - {{ convert_hex('tracking_code') }} as tracking_code, - pos.settler - from - {{ ref('perp_order_settled_base_mainnet') }} as pos - left join {{ ref('fct_perp_markets_base_mainnet') }} as markets - on pos.market_id = markets.id -) - -select - *, - ABS( - fill_price * trade_size - ) as notional_trade_size, - fill_price * position_size as notional_position_size, - total_fees - referral_fees - collected_fees - settlement_reward as lp_fees, - total_fees - settlement_reward as exchange_fees -from - base diff --git a/transformers/synthetix/models/marts/base/mainnet/perp/schema.yml b/transformers/synthetix/models/marts/base/mainnet/perp/schema.yml deleted file mode 100644 index 0a5f24bc..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/perp/schema.yml +++ /dev/null @@ -1,664 +0,0 @@ -models: - - name: fct_perp_account_activity_base_mainnet - columns: - - name: ts - description: "Activity date" - data_type: date - tests: - - not_null - - name: dau - description: "Daily active users" - data_type: integer - tests: - - not_null - - name: mau - description: "Monthly active users" - data_type: integer - tests: - - not_null - - name: new_accounts_daily - description: "Daily new accounts" - data_type: integer - tests: - - not_null - - name: new_accounts_monthly - description: "Monthly new accounts" - data_type: integer - tests: - - not_null - - name: fct_perp_interest_charged_base_mainnet - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["InterestCharged"] - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: interest - description: "Interest amount" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fct_perp_collateral_modified_base_mainnet - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["CollateralModified"] - - name: synth_market_id - description: "Synth market ID" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: sender - data_type: text - tests: - - not_null - - name: amount_delta - data_type: numeric - - name: fct_perp_previous_order_expired_base_mainnet - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["PreviousOrderExpired"] - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: commitment_time - data_type: numeric - - name: tracking_code - data_type: text - - name: acceptable_price - data_type: numeric - - name: size_delta - data_type: numeric - - name: fct_perp_trades_base_mainnet - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: market_symbol - description: "Market symbol" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: text - tests: - - not_null - - name: fill_price - description: "Fill price (ETH)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: pnl - description: "PnL (ETH)" - data_type: numeric - tests: - - not_null - - name: accrued_funding - description: "Accrued funding (ETH)" - data_type: numeric - tests: - - not_null - - name: trade_size - description: "Trade size (ETH)" - data_type: numeric - tests: - - not_null - - name: position_size - description: "Position size" - data_type: numeric - tests: - - not_null - - name: total_fees - description: "Total fees (ETH)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: referral_fees - description: "Referral fees (ETH)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collected_fees - description: "Collected fees (ETH)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: settlement_reward - description: "Settlement reward (ETH)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: tracking_code - description: "Account tracking code" - data_type: text - tests: - - not_null - - name: settler - description: "Address of the settler" - data_type: text - tests: - - not_null - - name: notional_trade_size - description: "Notional trade size (ETH)" - data_type: numeric - tests: - - not_null - - name: notional_position_size - description: "Notional position size (ETH)" - data_type: numeric - tests: - - not_null - - name: lp_fees - description: "LP fees (ETH)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - severity: warn - min_value: 0 - inclusive: true - - name: exchange_fees - description: "Exchange fees (ETH)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fct_perp_pnl_base_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: market_pnl - data_type: numeric - - name: fct_perp_orders_base_mainnet - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: market_symbol - description: "Market symbol" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: text - tests: - - not_null - - name: order_type - data_type: integer - - name: size - data_type: numeric - - name: acceptable_price - data_type: numeric - - name: settlement_time - data_type: numeric - - name: expiration_time - data_type: numeric - - name: tracking_code - data_type: text - - name: sender - data_type: text - - name: fct_perp_markets_base_mainnet - columns: - - name: id - description: "Market ID" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: created_ts - description: "Market creation timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: market_symbol - description: "Market symbol" - data_type: text - tests: - - not_null - - name: market_name - description: "Market name" - data_type: text - tests: - - not_null - - name: fct_perp_market_history_base_mainnet - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: market_symbol - description: "Market symbol" - data_type: text - tests: - - not_null - - name: price - description: "Price (USD)" - data_type: numeric - tests: - - not_null - - name: skew - description: "Skew (ETH)" - data_type: numeric - tests: - - not_null - - name: size - description: "Size (ETH)" - data_type: numeric - tests: - - not_null - - name: size_delta - description: "Size delta (ETH)" - data_type: numeric - tests: - - not_null - - name: funding_rate - description: "Funding rate (%)" - data_type: numeric - tests: - - not_null - - name: funding_velocity - description: "Funding velocity" - data_type: numeric - tests: - - not_null - - name: interest_rate - description: "Interest rate (%)" - data_type: numeric - tests: - - not_null - - name: funding_rate_apr - description: "Funding rate APR (%)" - data_type: numeric - tests: - - not_null - - name: long_rate_apr - description: "Long rate APR (%)" - data_type: numeric - tests: - - not_null - - name: short_rate_apr - description: "Short rate APR (%)" - data_type: numeric - tests: - - not_null - - name: prev_size - description: "Previous size (ETH)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: market_oi_usd - description: "Market open interest (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: total_oi_usd - description: "Total open interest (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: long_oi - description: "Long open interest (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: short_oi - description: "Short open interest (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: long_oi_pct - description: "Long open interest (%)" - data_type: numeric - - name: short_oi_pct - description: "Short open interest (%)" - data_type: numeric - - name: fct_perp_liq_position_base_mainnet - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: text - tests: - - not_null - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: market_symbol - description: "Market symbol" - data_type: text - tests: - - not_null - - name: amount_liquidated - description: "Amount liquidated" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: position_size - description: "Liquidated position size" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fct_perp_liq_account_base_mainnet - columns: - - name: account_id - description: "ID of the account" - data_type: text - tests: - - not_null - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: total_reward - description: "Total reward" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fct_perp_accounts_base_mainnet - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: created_ts - description: "Account creation timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: owner - description: "Address of the account owner" - data_type: text - tests: - - not_null diff --git a/transformers/synthetix/models/marts/base/mainnet/perp_stats/fct_perp_account_stats_daily_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/perp_stats/fct_perp_account_stats_daily_base_mainnet.sql deleted file mode 100644 index 45635d3a..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/perp_stats/fct_perp_account_stats_daily_base_mainnet.sql +++ /dev/null @@ -1,45 +0,0 @@ -with daily as ( - select - DATE_TRUNC( - 'day', - ts - ) as ts, - account_id, - SUM(fees) as fees, - SUM(volume) as volume, - SUM(amount_liquidated) as amount_liquidated, - SUM(liquidations) as liquidations - from - {{ ref('fct_perp_account_stats_hourly_base_mainnet') }} - group by - DATE_TRUNC( - 'day', - ts - ), - account_id -), - -stats as ( - select - *, - SUM(fees) over ( - partition by account_id - order by - ts - range between unbounded preceding - and current row - ) as cumulative_fees, - SUM(volume) over ( - partition by account_id - order by - ts - range between unbounded preceding - and current row - ) as cumulative_volume - from - daily -) - -select * -from - stats diff --git a/transformers/synthetix/models/marts/base/mainnet/perp_stats/fct_perp_account_stats_hourly_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/perp_stats/fct_perp_account_stats_hourly_base_mainnet.sql deleted file mode 100644 index 13283a10..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/perp_stats/fct_perp_account_stats_hourly_base_mainnet.sql +++ /dev/null @@ -1,119 +0,0 @@ -with trades as ( - select - ts, - account_id, - total_fees, - notional_trade_size, - 1 as trades, - SUM( - total_fees - ) over ( - partition by account_id - order by - ts - ) as cumulative_fees, - SUM( - notional_trade_size - ) over ( - partition by account_id - order by - ts - ) as cumulative_volume - from - {{ ref('fct_perp_trades_base_mainnet') }} -), - -liq as ( - select - ts, - account_id, - amount_liquidated, - 1 as liquidations - from - {{ ref('fct_perp_liq_position_base_mainnet') }} -), - -inc_trades as ( - select - DATE_TRUNC( - 'hour', - ts - ) as ts, - account_id, - SUM(trades) as trades, - SUM(total_fees) as fees, - SUM(notional_trade_size) as volume, - MAX(cumulative_fees) as cumulative_fees, - MAX(cumulative_volume) as cumulative_volume - from - trades - group by - DATE_TRUNC( - 'hour', - ts - ), - account_id -), - -inc_liq as ( - select - DATE_TRUNC( - 'hour', - ts - ) as ts, - account_id, - SUM(amount_liquidated) as amount_liquidated, - SUM(liquidations) as liquidations - from - liq - group by - DATE_TRUNC( - 'hour', - ts - ), - account_id -), - -inc as ( - select - h.ts, - h.account_id, - COALESCE( - h.trades, - 0 - ) as trades, - COALESCE( - h.fees, - 0 - ) as fees, - COALESCE( - h.volume, - 0 - ) as volume, - COALESCE( - l.amount_liquidated, - 0 - ) as amount_liquidated, - COALESCE( - l.liquidations, - 0 - ) as liquidations, - COALESCE( - h.cumulative_fees, - 0 - ) as cumulative_fees, - COALESCE( - h.cumulative_volume, - 0 - ) as cumulative_volume - from - inc_trades as h - left join inc_liq as l - on - h.ts = l.ts - and h.account_id = l.account_id -) - -select * -from - inc diff --git a/transformers/synthetix/models/marts/base/mainnet/perp_stats/fct_perp_keeper_stats_daily_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/perp_stats/fct_perp_keeper_stats_daily_base_mainnet.sql deleted file mode 100644 index 9dc6faad..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/perp_stats/fct_perp_keeper_stats_daily_base_mainnet.sql +++ /dev/null @@ -1,44 +0,0 @@ -with hourly as ( - select - keeper, - settlement_rewards, - amount_settled, - trades, - DATE_TRUNC( - 'day', - ts - ) as ts - from - {{ ref('fct_perp_keeper_stats_hourly_base_mainnet') }} -), - -total as ( - select - ts, - SUM(trades) as trades_total, - SUM(settlement_rewards) as settlement_reward_total, - SUM(amount_settled) as amount_settled_total - from - hourly - group by - ts -) - -select - hourly.ts, - hourly.keeper, - SUM(hourly.trades) as trades, - SUM(hourly.settlement_rewards) as settlement_rewards, - SUM(hourly.amount_settled) as amount_settled, - SUM(hourly.trades) / MAX(total.trades_total) as trades_pct, - SUM(hourly.settlement_rewards) - / MAX(total.settlement_reward_total) as settlement_rewards_pct, - SUM(hourly.amount_settled) - / MAX(total.amount_settled_total) as amount_settled_pct -from - hourly -inner join total - on hourly.ts = total.ts -group by - hourly.ts, - hourly.keeper diff --git a/transformers/synthetix/models/marts/base/mainnet/perp_stats/fct_perp_keeper_stats_hourly_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/perp_stats/fct_perp_keeper_stats_hourly_base_mainnet.sql deleted file mode 100644 index df614ddf..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/perp_stats/fct_perp_keeper_stats_hourly_base_mainnet.sql +++ /dev/null @@ -1,44 +0,0 @@ -with trades as ( - select - settler, - settlement_reward, - notional_trade_size, - 1 as trades, - DATE_TRUNC( - 'hour', - ts - ) as ts - from - {{ ref('fct_perp_trades_base_mainnet') }} -), - -total as ( - select - ts, - SUM(trades) as trades_total, - SUM(settlement_reward) as settlement_reward_total, - SUM(notional_trade_size) as notional_trade_size_total - from - trades - group by - ts -) - -select - trades.ts, - trades.settler as keeper, - SUM(trades.trades) as trades, - SUM(trades.settlement_reward) as settlement_rewards, - SUM(trades.notional_trade_size) as amount_settled, - SUM(trades.trades) / MAX(total.trades_total) as trades_pct, - SUM(trades.settlement_reward) - / MAX(total.settlement_reward_total) as settlement_rewards_pct, - SUM(trades.notional_trade_size) - / MAX(total.notional_trade_size_total) as amount_settled_pct -from - trades -inner join total - on trades.ts = total.ts -group by - trades.ts, - trades.settler diff --git a/transformers/synthetix/models/marts/base/mainnet/perp_stats/fct_perp_market_stats_daily_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/perp_stats/fct_perp_market_stats_daily_base_mainnet.sql deleted file mode 100644 index 022c587a..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/perp_stats/fct_perp_market_stats_daily_base_mainnet.sql +++ /dev/null @@ -1,25 +0,0 @@ -select - DATE_TRUNC( - 'day', - ts - ) as ts, - market_symbol, - SUM(trades) as trades, - SUM(exchange_fees) as exchange_fees, - SUM(referral_fees) as referral_fees, - SUM(collected_fees) as collected_fees, - SUM(volume) as volume, - SUM(amount_liquidated) as amount_liquidated, - SUM(liquidations) as liquidations, - MAX(cumulative_exchange_fees) as cumulative_exchange_fees, - MAX(cumulative_referral_fees) as cumulative_referral_fees, - MAX(cumulative_collected_fees) as cumulative_collected_fees, - MAX(cumulative_volume) as cumulative_volume -from - {{ ref('fct_perp_market_stats_hourly_base_mainnet') }} -group by - DATE_TRUNC( - 'day', - ts - ), - market_symbol diff --git a/transformers/synthetix/models/marts/base/mainnet/perp_stats/fct_perp_market_stats_hourly_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/perp_stats/fct_perp_market_stats_hourly_base_mainnet.sql deleted file mode 100644 index 90a9aae6..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/perp_stats/fct_perp_market_stats_hourly_base_mainnet.sql +++ /dev/null @@ -1,162 +0,0 @@ -with trades as ( - select - ts, - market_symbol, - exchange_fees, - referral_fees, - collected_fees, - notional_trade_size, - 1 as trades - from - {{ ref('fct_perp_trades_base_mainnet') }} -), - -liq as ( - select - ts, - market_symbol, - amount_liquidated, - 1 as liquidations - from - {{ ref('fct_perp_liq_position_base_mainnet') }} -), - -inc_trades as ( - select - DATE_TRUNC( - 'hour', - ts - ) as ts, - market_symbol, - SUM(trades) as trades, - SUM(exchange_fees) as exchange_fees, - SUM(referral_fees) as referral_fees, - SUM(collected_fees) as collected_fees, - SUM(notional_trade_size) as volume - from - trades - group by - DATE_TRUNC( - 'hour', - ts - ), - market_symbol -), - -inc_liq as ( - select - DATE_TRUNC( - 'hour', - ts - ) as ts, - market_symbol, - SUM(amount_liquidated) as amount_liquidated, - SUM(liquidations) as liquidations - from - liq - group by - DATE_TRUNC( - 'hour', - ts - ), - market_symbol -), - -dim as ( - select - m.market_symbol, - GENERATE_SERIES( - DATE_TRUNC('hour', MIN(t.ts)), - DATE_TRUNC('hour', MAX(t.ts)), - '1 hour'::INTERVAL - ) as ts - from - ( - select ts - from - trades - ) as t - cross join ( - select distinct market_symbol - from - trades - ) as m - group by - m.market_symbol -), - -inc as ( - select - dim.ts, - dim.market_symbol, - COALESCE( - h.trades, - 0 - ) as trades, - COALESCE( - h.exchange_fees, - 0 - ) as exchange_fees, - COALESCE( - h.referral_fees, - 0 - ) as referral_fees, - COALESCE( - h.collected_fees, - 0 - ) as collected_fees, - COALESCE( - h.volume, - 0 - ) as volume, - COALESCE( - l.amount_liquidated, - 0 - ) as amount_liquidated, - COALESCE( - l.liquidations, - 0 - ) as liquidations, - SUM( - h.exchange_fees - ) over ( - partition by dim.market_symbol - order by - dim.ts - ) as cumulative_exchange_fees, - SUM( - h.referral_fees - ) over ( - partition by dim.market_symbol - order by - dim.ts - ) as cumulative_referral_fees, - SUM( - h.collected_fees - ) over ( - partition by dim.market_symbol - order by - dim.ts - ) as cumulative_collected_fees, - SUM( - h.volume - ) over ( - partition by dim.market_symbol - order by - dim.ts - ) as cumulative_volume - from - dim - left join inc_trades as h - on - dim.ts = h.ts - and dim.market_symbol = h.market_symbol - left join inc_liq as l - on - dim.ts = l.ts - and dim.market_symbol = l.market_symbol -) - -select * -from - inc diff --git a/transformers/synthetix/models/marts/base/mainnet/perp_stats/fct_perp_stats_daily_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/perp_stats/fct_perp_stats_daily_base_mainnet.sql deleted file mode 100644 index 5274ad8b..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/perp_stats/fct_perp_stats_daily_base_mainnet.sql +++ /dev/null @@ -1,23 +0,0 @@ -select - DATE_TRUNC( - 'day', - ts - ) as ts, - SUM(trades) as trades, - SUM(exchange_fees) as exchange_fees, - SUM(referral_fees) as referral_fees, - SUM(collected_fees) as collected_fees, - SUM(volume) as volume, - SUM(liquidation_rewards) as liquidation_rewards, - SUM(liquidated_accounts) as liquidated_accounts, - MAX(cumulative_exchange_fees) as cumulative_exchange_fees, - MAX(cumulative_referral_fees) as cumulative_referral_fees, - MAX(cumulative_collected_fees) as cumulative_collected_fees, - MAX(cumulative_volume) as cumulative_volume -from - {{ ref('fct_perp_stats_hourly_base_mainnet') }} -group by - DATE_TRUNC( - 'day', - ts - ) diff --git a/transformers/synthetix/models/marts/base/mainnet/perp_stats/fct_perp_stats_hourly_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/perp_stats/fct_perp_stats_hourly_base_mainnet.sql deleted file mode 100644 index 260b0b82..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/perp_stats/fct_perp_stats_hourly_base_mainnet.sql +++ /dev/null @@ -1,91 +0,0 @@ -with inc_market as ( - select - ts, - market_symbol, - trades, - exchange_fees, - referral_fees, - collected_fees, - volume, - liquidations, - cumulative_exchange_fees, - cumulative_referral_fees, - cumulative_collected_fees, - cumulative_volume - from - {{ ref('fct_perp_market_stats_hourly_base_mainnet') }} -), - -liq as ( - select - ts, - total_reward, - 1 as liquidated_accounts - from - {{ ref('fct_perp_liq_account_base_mainnet') }} -), - -inc_liq as ( - select - DATE_TRUNC( - 'hour', - ts - ) as ts, - SUM(total_reward) as liquidation_rewards, - SUM(liquidated_accounts) as liquidated_accounts - from - liq - group by - DATE_TRUNC( - 'hour', - ts - ) -), - -inc_trade as ( - select - ts, - SUM(trades) as trades, - SUM(exchange_fees) as exchange_fees, - SUM(referral_fees) as referral_fees, - SUM(collected_fees) as collected_fees, - SUM(volume) as volume, - SUM(cumulative_exchange_fees) as cumulative_exchange_fees, - SUM(cumulative_referral_fees) as cumulative_referral_fees, - SUM(cumulative_collected_fees) as cumulative_collected_fees, - SUM(cumulative_volume) as cumulative_volume - from - inc_market - group by - ts -), - -inc as ( - select - h.ts, - h.trades, - h.exchange_fees, - h.referral_fees, - h.collected_fees, - h.volume, - h.cumulative_exchange_fees, - h.cumulative_referral_fees, - h.cumulative_collected_fees, - h.cumulative_volume, - COALESCE( - l.liquidation_rewards, - 0 - ) as liquidation_rewards, - COALESCE( - l.liquidated_accounts, - 0 - ) as liquidated_accounts - from - inc_trade as h - left join inc_liq as l - on h.ts = l.ts -) - -select * -from - inc diff --git a/transformers/synthetix/models/marts/base/mainnet/perp_stats/fct_perp_tracking_stats_daily_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/perp_stats/fct_perp_tracking_stats_daily_base_mainnet.sql deleted file mode 100644 index 44552c4b..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/perp_stats/fct_perp_tracking_stats_daily_base_mainnet.sql +++ /dev/null @@ -1,93 +0,0 @@ -with trades as ( - select - DATE_TRUNC( - 'day', - ts - ) as ts, - tracking_code, - SUM(exchange_fees) as exchange_fees, - SUM(referral_fees) as referral_fees, - SUM(collected_fees) as collected_fees, - SUM(volume) as volume, - SUM(trades) as trades - from - {{ ref('fct_perp_tracking_stats_hourly_base_mainnet') }} - group by - DATE_TRUNC( - 'day', - ts - ), - tracking_code -), - -accounts as ( - select - DATE_TRUNC( - 'day', - ts - ) as ts, - tracking_code, - COUNT( - distinct account_id - ) as "accounts" - from - {{ ref('fct_perp_trades_base_mainnet') }} - group by - DATE_TRUNC( - 'day', - ts - ), - tracking_code -), - -total as ( - select - ts, - SUM(exchange_fees) as exchange_fees_total, - SUM(referral_fees) as referral_fees_total, - SUM(collected_fees) as collected_fees_total, - SUM(volume) as volume_total, - SUM(trades) as trades_total - from - trades - group by - ts -) - -select - trades.ts, - trades.tracking_code, - trades.exchange_fees, - trades.referral_fees, - trades.collected_fees, - trades.volume, - trades.trades, - accounts.accounts, - case - when total.exchange_fees_total = 0 then 0 - else trades.exchange_fees / total.exchange_fees_total - end as exchange_fees_share, - case - when total.referral_fees_total = 0 then 0 - else trades.referral_fees / total.referral_fees_total - end as referral_fees_share, - case - when total.collected_fees_total = 0 then 0 - else trades.collected_fees / total.collected_fees_total - end as collected_fees_share, - case - when total.volume_total = 0 then 0 - else trades.volume / total.volume_total - end as volume_share, - case - when total.trades_total = 0 then 0 - else trades.trades / total.trades_total - end as trades_share -from - trades -inner join accounts - on - trades.ts = accounts.ts - and trades.tracking_code = accounts.tracking_code -inner join total - on trades.ts = total.ts diff --git a/transformers/synthetix/models/marts/base/mainnet/perp_stats/fct_perp_tracking_stats_hourly_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/perp_stats/fct_perp_tracking_stats_hourly_base_mainnet.sql deleted file mode 100644 index 1c81d86a..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/perp_stats/fct_perp_tracking_stats_hourly_base_mainnet.sql +++ /dev/null @@ -1,93 +0,0 @@ -with trades as ( - select - DATE_TRUNC( - 'hour', - ts - ) as ts, - tracking_code, - SUM(exchange_fees) as exchange_fees, - SUM(referral_fees) as referral_fees, - SUM(collected_fees) as collected_fees, - SUM(notional_trade_size) as volume, - SUM(1) as trades - from - {{ ref('fct_perp_trades_base_mainnet') }} - group by - DATE_TRUNC( - 'hour', - ts - ), - tracking_code -), - -accounts as ( - select - DATE_TRUNC( - 'hour', - ts - ) as ts, - tracking_code, - COUNT( - distinct account_id - ) as "accounts" - from - {{ ref('fct_perp_trades_base_mainnet') }} - group by - DATE_TRUNC( - 'hour', - ts - ), - tracking_code -), - -total as ( - select - ts, - SUM(trades) as trades_total, - SUM(exchange_fees) as exchange_fees_total, - SUM(referral_fees) as referral_fees_total, - SUM(collected_fees) as collected_fees_total, - SUM(volume) as volume_total - from - trades - group by - ts -) - -select - trades.ts, - trades.tracking_code, - trades.exchange_fees, - trades.referral_fees, - trades.collected_fees, - trades.volume, - trades.trades, - accounts.accounts, - case - when total.exchange_fees_total = 0 then 0 - else trades.exchange_fees / total.exchange_fees_total - end as exchange_fees_share, - case - when total.referral_fees_total = 0 then 0 - else trades.referral_fees / total.referral_fees_total - end as referral_fees_share, - case - when total.collected_fees_total = 0 then 0 - else trades.collected_fees / total.collected_fees_total - end as collected_fees_share, - case - when total.volume_total = 0 then 0 - else trades.volume / total.volume_total - end as volume_share, - case - when total.trades_total = 0 then 0 - else trades.trades / total.trades_total - end as trades_share -from - trades -inner join accounts - on - trades.ts = accounts.ts - and trades.tracking_code = accounts.tracking_code -inner join total - on trades.ts = total.ts diff --git a/transformers/synthetix/models/marts/base/mainnet/perp_stats/schema.yml b/transformers/synthetix/models/marts/base/mainnet/perp_stats/schema.yml deleted file mode 100644 index 8ea728b5..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/perp_stats/schema.yml +++ /dev/null @@ -1,239 +0,0 @@ -models: - - name: fct_perp_tracking_stats_hourly_base_mainnet - columns: - - name: ts - data_type: timestamp with time zone - - name: tracking_code - data_type: text - - name: exchange_fees - data_type: numeric - - name: referral_fees - data_type: numeric - - name: collected_fees - data_type: numeric - - name: volume - data_type: numeric - - name: trades - data_type: bigint - - name: accounts - data_type: bigint - - name: exchange_fees_share - data_type: numeric - - name: referral_fees_share - data_type: numeric - - name: collected_fees_share - data_type: numeric - - name: volume_share - data_type: numeric - - name: trades_share - data_type: numeric - - name: fct_perp_tracking_stats_daily_base_mainnet - columns: - - name: ts - data_type: timestamp with time zone - - name: tracking_code - data_type: text - - name: exchange_fees - data_type: numeric - - name: referral_fees - data_type: numeric - - name: collected_fees - data_type: numeric - - name: volume - data_type: numeric - - name: trades - data_type: numeric - - name: accounts - data_type: bigint - - name: exchange_fees_share - data_type: numeric - - name: referral_fees_share - data_type: numeric - - name: collected_fees_share - data_type: numeric - - name: volume_share - data_type: numeric - - name: trades_share - data_type: numeric - - name: fct_perp_stats_hourly_base_mainnet - columns: - - name: ts - data_type: timestamp with time zone - - name: trades - data_type: numeric - - name: exchange_fees - data_type: numeric - - name: referral_fees - data_type: numeric - - name: collected_fees - data_type: numeric - - name: volume - data_type: numeric - - name: liquidation_rewards - data_type: numeric - - name: liquidated_accounts - data_type: bigint - - name: cumulative_exchange_fees - data_type: numeric - - name: cumulative_referral_fees - data_type: numeric - - name: cumulative_collected_fees - data_type: numeric - - name: cumulative_volume - data_type: numeric - - name: fct_perp_stats_daily_base_mainnet - columns: - - name: ts - data_type: timestamp with time zone - - name: trades - data_type: numeric - - name: exchange_fees - data_type: numeric - - name: referral_fees - data_type: numeric - - name: collected_fees - data_type: numeric - - name: volume - data_type: numeric - - name: liquidation_rewards - data_type: numeric - - name: liquidated_accounts - data_type: numeric - - name: cumulative_exchange_fees - data_type: numeric - - name: cumulative_referral_fees - data_type: numeric - - name: cumulative_collected_fees - data_type: numeric - - name: cumulative_volume - data_type: numeric - - name: fct_perp_market_stats_hourly_base_mainnet - columns: - - name: ts - data_type: timestamp with time zone - - name: market_symbol - data_type: text - - name: trades - data_type: bigint - - name: exchange_fees - data_type: numeric - - name: referral_fees - data_type: numeric - - name: collected_fees - data_type: numeric - - name: volume - data_type: numeric - - name: amount_liquidated - data_type: numeric - - name: liquidations - data_type: bigint - - name: cumulative_exchange_fees - data_type: numeric - - name: cumulative_referral_fees - data_type: numeric - - name: cumulative_collected_fees - data_type: numeric - - name: cumulative_volume - data_type: numeric - - name: fct_perp_market_stats_daily_base_mainnet - columns: - - name: ts - data_type: timestamp with time zone - - name: market_symbol - data_type: text - - name: trades - data_type: numeric - - name: exchange_fees - data_type: numeric - - name: referral_fees - data_type: numeric - - name: collected_fees - data_type: numeric - - name: volume - data_type: numeric - - name: amount_liquidated - data_type: numeric - - name: liquidations - data_type: numeric - - name: cumulative_exchange_fees - data_type: numeric - - name: cumulative_referral_fees - data_type: numeric - - name: cumulative_collected_fees - data_type: numeric - - name: cumulative_volume - data_type: numeric - - name: fct_perp_keeper_stats_hourly_base_mainnet - columns: - - name: ts - data_type: timestamp with time zone - - name: keeper - data_type: text - - name: trades - data_type: bigint - - name: settlement_rewards - data_type: numeric - - name: amount_settled - data_type: numeric - - name: trades_pct - data_type: bigint - - name: settlement_rewards_pct - data_type: numeric - - name: amount_settled_pct - data_type: numeric - - name: fct_perp_keeper_stats_daily_base_mainnet - columns: - - name: ts - data_type: timestamp with time zone - - name: keeper - data_type: text - - name: trades - data_type: numeric - - name: settlement_rewards - data_type: numeric - - name: amount_settled - data_type: numeric - - name: trades_pct - data_type: numeric - - name: settlement_rewards_pct - data_type: numeric - - name: amount_settled_pct - data_type: numeric - - name: fct_perp_account_stats_hourly_base_mainnet - columns: - - name: ts - data_type: timestamp with time zone - - name: account_id - data_type: text - - name: trades - data_type: bigint - - name: fees - data_type: numeric - - name: volume - data_type: numeric - - name: amount_liquidated - data_type: numeric - - name: liquidations - data_type: bigint - - name: cumulative_fees - data_type: numeric - - name: cumulative_volume - data_type: numeric - - name: fct_perp_account_stats_daily_base_mainnet - columns: - - name: ts - data_type: timestamp with time zone - - name: account_id - data_type: text - - name: fees - data_type: numeric - - name: volume - data_type: numeric - - name: amount_liquidated - data_type: numeric - - name: liquidations - data_type: numeric - - name: cumulative_fees - data_type: numeric - - name: cumulative_volume - data_type: numeric diff --git a/transformers/synthetix/models/marts/base/mainnet/prices/fct_prices_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/prices/fct_prices_base_mainnet.sql deleted file mode 100644 index fad396ad..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/prices/fct_prices_base_mainnet.sql +++ /dev/null @@ -1,54 +0,0 @@ -with all_prices as ( - select - ts, - null as market_address, - market_symbol, - price - from - {{ ref('fct_perp_market_history_base_mainnet') }} - union all - select - ts, - null as market_address, - 'SNX' as market_symbol, - snx_price as price - from - {{ ref('fct_buyback_base_mainnet') }} - where - snx_price > 0 - union all - select - ts, - collateral_type as market_address, - null as market_symbol, - collateral_value / amount as price - from - {{ ref('core_vault_collateral_base_mainnet') }} - where - collateral_value > 0 -), - -tokens as ( - select - token_address, - token_symbol - from - {{ ref('base_mainnet_tokens') }} -) - -select - p.ts, - p.market_address, - p.price, - COALESCE( - t.token_symbol, - p.market_symbol - ) as market_symbol -from - all_prices as p -left join tokens as t - on LOWER( - p.market_address - ) = LOWER( - t.token_address - ) diff --git a/transformers/synthetix/models/marts/base/mainnet/prices/fct_prices_hourly_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/prices/fct_prices_hourly_base_mainnet.sql deleted file mode 100644 index 65829fe0..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/prices/fct_prices_hourly_base_mainnet.sql +++ /dev/null @@ -1,72 +0,0 @@ -with prices as ( - select distinct - market_symbol, - DATE_TRUNC( - 'hour', - ts - ) as ts, - LAST_VALUE(price) over ( - partition by DATE_TRUNC('hour', ts), market_symbol - order by - ts - rows between unbounded preceding - and unbounded following - ) as price - from - {{ ref('fct_prices_base_mainnet') }} -), - -dim as ( - select - m.market_symbol, - GENERATE_SERIES( - DATE_TRUNC('hour', MIN(t.ts)), - DATE_TRUNC('hour', MAX(t.ts)), - '1 hour'::INTERVAL - ) as ts - from - ( - select ts - from - prices - ) as t - cross join ( - select distinct market_symbol - from - prices - ) as m - group by - m.market_symbol -), - -ffill as ( - select - dim.ts, - dim.market_symbol, - LAST(prices.price) over ( - partition by dim.market_symbol - order by dim.ts - rows between unbounded preceding and current row - ) as price - from - dim - left join prices - on - dim.ts = prices.ts - and dim.market_symbol = prices.market_symbol -), - -hourly_prices as ( - select - ts, - market_symbol, - price - from - ffill -) - -select * -from - hourly_prices -where - price is not null diff --git a/transformers/synthetix/models/marts/base/mainnet/prices/schema.yml b/transformers/synthetix/models/marts/base/mainnet/prices/schema.yml deleted file mode 100644 index 8715b6e4..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/prices/schema.yml +++ /dev/null @@ -1,44 +0,0 @@ -models: - - name: fct_prices_base_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: market_address - description: "Market address" - data_type: text - - name: market_symbol - description: "Market symbol" - data_type: text - tests: - - not_null - - name: price - description: "Price" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fct_prices_hourly_base_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: market_symbol - description: "Market symbol" - data_type: text - tests: - - not_null - - name: price - description: "Price" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true diff --git a/transformers/synthetix/models/marts/base/mainnet/spot/fct_spot_atomics_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/spot/fct_spot_atomics_base_mainnet.sql deleted file mode 100644 index de4095e1..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/spot/fct_spot_atomics_base_mainnet.sql +++ /dev/null @@ -1,53 +0,0 @@ -with bought as ( - select - id, - block_timestamp as ts, - block_number, - transaction_hash as tx_hash, - synth_market_id, - {{ convert_wei('price') }} as price, - {{ convert_wei('synth_returned') }} as amount, - referrer - from - {{ ref('spot_synth_bought_base_mainnet') }} -), - -sold as ( - select - id, - block_timestamp as ts, - block_number, - transaction_hash as tx_hash, - synth_market_id, - {{ convert_wei('price') }} as price, - -1 * {{ convert_wei('amount_returned') }} as amount, - referrer - from - {{ ref('spot_synth_sold_base_mainnet') }} -) - -select - id, - ts, - block_number, - tx_hash, - synth_market_id, - price, - amount, - referrer -from - bought -union all -select - id, - ts, - block_number, - tx_hash, - synth_market_id, - price, - amount, - referrer -from - sold -order by - ts diff --git a/transformers/synthetix/models/marts/base/mainnet/spot/fct_spot_markets_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/spot/fct_spot_markets_base_mainnet.sql deleted file mode 100644 index 39fef3ab..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/spot/fct_spot_markets_base_mainnet.sql +++ /dev/null @@ -1,13 +0,0 @@ -with base as ( - select - synth_market_id as id, - block_timestamp as created_ts, - block_number, - synth_token_address as token_address - from - {{ ref('spot_synth_registered_base_mainnet') }} -) - -select * -from - base diff --git a/transformers/synthetix/models/marts/base/mainnet/spot/fct_spot_wrapper_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/spot/fct_spot_wrapper_base_mainnet.sql deleted file mode 100644 index 74ac5e97..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/spot/fct_spot_wrapper_base_mainnet.sql +++ /dev/null @@ -1,45 +0,0 @@ -with wraps as ( - select - id, - block_timestamp as ts, - block_number, - transaction_hash as tx_hash, - synth_market_id, - {{ convert_wei('amount_wrapped') }} as amount_wrapped - from - {{ ref('spot_synth_wrapped_base_mainnet') }} -), - -unwraps as ( - select - id, - block_timestamp as ts, - block_number, - transaction_hash as tx_hash, - synth_market_id, - -1 * {{ convert_wei('amount_unwrapped') }} as amount_wrapped - from - {{ ref('spot_synth_unwrapped_base_mainnet') }} -) - -select - id, - ts, - block_number, - tx_hash, - synth_market_id, - amount_wrapped -from - wraps -union all -select - id, - ts, - block_number, - tx_hash, - synth_market_id, - amount_wrapped -from - unwraps -order by - ts diff --git a/transformers/synthetix/models/marts/base/mainnet/spot/fct_synth_supply_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/spot/fct_synth_supply_base_mainnet.sql deleted file mode 100644 index 4ef4e8f9..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/spot/fct_synth_supply_base_mainnet.sql +++ /dev/null @@ -1,72 +0,0 @@ -with wrapper as ( - select - ts, - block_number, - synth_market_id, - amount_wrapped as change_amount - from - {{ ref('fct_spot_wrapper_base_mainnet') }} -), - -atomics as ( - select - ts, - block_number, - synth_market_id, - amount as change_amount - from - {{ ref('fct_spot_atomics_base_mainnet') }} - union all - select - ts, - block_number, - 0 as synth_market_id, - amount * price * -1 as change_amount - from - {{ ref('fct_spot_atomics_base_mainnet') }} -), - -usd_changes as ( - select - block_timestamp as ts, - block_number, - 0 as synth_market_id, - {{ convert_wei("amount") }} as change_amount - from - {{ ref('core_usd_minted_base_mainnet') }} - union all - select - block_timestamp as ts, - block_number, - 0 as synth_market_id, - -1 * {{ convert_wei("amount") }} as change_amount - from - {{ ref('core_usd_burned_base_mainnet') }} -), - -all_changes as ( - select * - from - wrapper - union all - select * - from - atomics - union all - select * - from - usd_changes -) - -select - ts, - block_number, - synth_market_id, - SUM(change_amount) over ( - partition by synth_market_id - order by - ts, - block_number - ) as supply -from - all_changes diff --git a/transformers/synthetix/models/marts/base/mainnet/spot/schema.yml b/transformers/synthetix/models/marts/base/mainnet/spot/schema.yml deleted file mode 100644 index 240644b5..00000000 --- a/transformers/synthetix/models/marts/base/mainnet/spot/schema.yml +++ /dev/null @@ -1,132 +0,0 @@ -models: - - name: fct_synth_supply_base_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: synth_market_id - description: "Synth market ID" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: supply - description: "Supply" - data_type: numeric - tests: - - not_null - - name: fct_spot_atomics_base_mainnet - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: tx_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: synth_market_id - description: "Synth market ID" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: price - description: "Price" - data_type: numeric - tests: - - not_null - - name: amount - description: "Amount" - data_type: numeric - tests: - - not_null - - name: referrer - description: "Address of the referrer" - data_type: text - tests: - - not_null - - name: fct_spot_markets_base_mainnet - columns: - - name: id - description: "Synth market ID" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: created_ts - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: token_address - description: "Token address" - data_type: text - tests: - - not_null - - name: fct_spot_wrapper_base_mainnet - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: tx_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: synth_market_id - description: "Synth market ID" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: amount_wrapped - description: "Amount wrapped" - data_type: numeric - tests: - - not_null diff --git a/transformers/synthetix/models/marts/base/sepolia/buyback/fct_buyback_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/buyback/fct_buyback_base_sepolia.sql deleted file mode 100644 index f6b25a01..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/buyback/fct_buyback_base_sepolia.sql +++ /dev/null @@ -1,9 +0,0 @@ -select - id, - block_timestamp as ts, - buyer, - {{ convert_wei('snx') }} as snx, - {{ convert_wei('usd') }} as usd, - ({{ convert_wei('usd') }}) / ({{ convert_wei('snx') }}) as snx_price -from - {{ ref('buyback_processed_base_sepolia') }} diff --git a/transformers/synthetix/models/marts/base/sepolia/buyback/fct_buyback_daily_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/buyback/fct_buyback_daily_base_sepolia.sql deleted file mode 100644 index a46ed6cb..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/buyback/fct_buyback_daily_base_sepolia.sql +++ /dev/null @@ -1,31 +0,0 @@ -with agg as ( - select - date_trunc( - 'day', - ts - ) as ts, - sum(snx) as snx_amount, - sum(usd) as usd_amount - from - {{ ref('fct_buyback_base_sepolia') }} - group by - date_trunc( - 'day', - ts - ) -) -- add cumulative amounts - -select - ts, - snx_amount, - usd_amount, - sum(snx_amount) over ( - order by - ts - ) as cumulative_snx_amount, - sum(usd_amount) over ( - order by - ts - ) as cumulative_usd_amount -from - agg diff --git a/transformers/synthetix/models/marts/base/sepolia/buyback/fct_buyback_hourly_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/buyback/fct_buyback_hourly_base_sepolia.sql deleted file mode 100644 index 87b81451..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/buyback/fct_buyback_hourly_base_sepolia.sql +++ /dev/null @@ -1,31 +0,0 @@ -with agg as ( - select - date_trunc( - 'hour', - ts - ) as ts, - sum(snx) as snx_amount, - sum(usd) as usd_amount - from - {{ ref('fct_buyback_base_sepolia') }} - group by - date_trunc( - 'hour', - ts - ) -) -- add cumulative amounts - -select - ts, - snx_amount, - usd_amount, - sum(snx_amount) over ( - order by - ts - ) as cumulative_snx_amount, - sum(usd_amount) over ( - order by - ts - ) as cumulative_usd_amount -from - agg diff --git a/transformers/synthetix/models/marts/base/sepolia/buyback/schema.yml b/transformers/synthetix/models/marts/base/sepolia/buyback/schema.yml deleted file mode 100644 index 08f547ff..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/buyback/schema.yml +++ /dev/null @@ -1,121 +0,0 @@ -models: - - name: fct_buyback_daily_base_sepolia - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: snx_amount - description: "Amount in SNX" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: usd_amount - description: "Amount in USD" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: cumulative_snx_amount - description: "Cumulative amount in SNX" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: cumulative_usd_amount - description: "Cumulative amount in USD" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fct_buyback_hourly_base_sepolia - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: snx_amount - description: "Amount in SNX" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: usd_amount - description: "Amount in USD" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: cumulative_snx_amount - description: "Cumulative amount in SNX" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: cumulative_usd_amount - description: "Cumulative amount in USD" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fct_buyback_base_sepolia - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: buyer - description: "Address of buyer" - data_type: text - tests: - - not_null - - name: snx - description: "Amount in SNX" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: usd - description: "Amount in USD" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: snx_price - description: "SNX Price" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true diff --git a/transformers/synthetix/models/marts/base/sepolia/core/fct_core_account_activity_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/core/fct_core_account_activity_base_sepolia.sql deleted file mode 100644 index d3d95206..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/core/fct_core_account_activity_base_sepolia.sql +++ /dev/null @@ -1,42 +0,0 @@ -{{ config( - materialized = "view", - tags = ["core", "account_activity", "daily", "base", "sepolia"] -) }} - -with delegated as ( - select distinct - block_timestamp, - account_id, - 'Delegated' as account_action - from {{ ref('core_delegation_updated_base_sepolia') }} -), - -withdrawn as ( - select - block_timestamp, - account_id, - 'Withdrawn' as account_action - from {{ ref('core_withdrawn_base_sepolia') }} -), - -claimed as ( - select - block_timestamp, - account_id, - 'Claimed' as account_action - from {{ ref('core_rewards_claimed_base_sepolia') }} -), - -combined as ( - select * from delegated - union all - select * from withdrawn - union all - select * from claimed -) - -select - block_timestamp, - account_action, - account_id -from combined diff --git a/transformers/synthetix/models/marts/base/sepolia/core/fct_core_account_delegation_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/core/fct_core_account_delegation_base_sepolia.sql deleted file mode 100644 index deb41bbc..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/core/fct_core_account_delegation_base_sepolia.sql +++ /dev/null @@ -1,60 +0,0 @@ -with delegation_changes as ( - select - block_timestamp, - account_id, - pool_id, - collateral_type, - {{ convert_wei('amount') }} - - LAG({{ convert_wei('amount') }}, 1, 0) over ( - partition by - account_id, - pool_id, - collateral_type - order by - block_timestamp - ) as change_in_amount - from - {{ ref('core_delegation_updated_base_sepolia') }} -), - -cumulative_delegation as ( - select - block_timestamp, - account_id, - pool_id, - collateral_type, - SUM(change_in_amount) over ( - partition by - pool_id, - account_id, - collateral_type - order by - block_timestamp - ) as cumulative_amount_delegated, - ROW_NUMBER() over ( - partition by - pool_id, - account_id, - collateral_type - order by - block_timestamp desc - ) as rn - from - delegation_changes -) - -select - block_timestamp as ts, - pool_id, - collateral_type, - cumulative_amount_delegated as amount_delegated, - CAST( - account_id as text - ) as account_id -from - cumulative_delegation -where - rn = 1 -order by - block_timestamp, - collateral_type diff --git a/transformers/synthetix/models/marts/base/sepolia/core/fct_core_active_stakers_daily_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/core/fct_core_active_stakers_daily_base_sepolia.sql deleted file mode 100644 index d15bf2cf..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/core/fct_core_active_stakers_daily_base_sepolia.sql +++ /dev/null @@ -1,52 +0,0 @@ -{{ config( - materialized = "view", - tags = ["core", "active_stakers", "daily", "base", "sepolia"] -) }} - -with delegation_updated as ( - select - block_timestamp, - account_id, - amount - from {{ ref('core_delegation_updated_base_sepolia') }} -), - -dim as ( - select - d.block_date, - accounts_unique.account_id - from ( - select - generate_series( - date_trunc('day', date('2023-12-15')), - date_trunc('day', current_date), '1 day'::interval - ) as block_date - ) as d - cross join ( - select distinct account_id from delegation_updated - ) as accounts_unique -), - -stakers as ( - select - dim.block_date, - dim.account_id, - case - when coalesce(last(delegation_updated.amount) over ( - partition by dim.account_id - order by dim.block_date - rows between unbounded preceding and current row - ), 0) = 0 then 0 - else 1 - end as is_staking - from dim - left join delegation_updated on - dim.block_date = date(delegation_updated.block_timestamp) - and dim.account_id = delegation_updated.account_id -) - -select - block_date, - sum(is_staking) as nof_stakers_daily -from stakers -group by block_date diff --git a/transformers/synthetix/models/marts/base/sepolia/core/fct_core_apr_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/core/fct_core_apr_base_sepolia.sql deleted file mode 100644 index bcc1c71b..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/core/fct_core_apr_base_sepolia.sql +++ /dev/null @@ -1,238 +0,0 @@ -{{ - config( - materialized = 'table', - ) -}} - -with pnl_hourly as ( - select - ts, - pool_id, - collateral_type, - collateral_value, - debt, - hourly_pnl, - hourly_issuance, - rewards_usd, - hourly_pnl_pct, - hourly_rewards_pct, - hourly_total_pct, - SUM( - COALESCE( - hourly_issuance, - 0 - ) - ) over ( - partition by - pool_id, - collateral_type - order by - ts - ) as cumulative_issuance, - SUM( - hourly_pnl - ) over ( - partition by - pool_id, - collateral_type - order by - ts - ) as cumulative_pnl - from - {{ ref('fct_pool_pnl_hourly_base_sepolia') }} -), - -avg_returns as ( - select - ts, - pool_id, - collateral_type, - AVG( - hourly_pnl_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '24 HOURS' preceding - and current row - ) as avg_24h_pnl_pct, - AVG( - hourly_pnl_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '7 DAYS' preceding - and current row - ) as avg_7d_pnl_pct, - AVG( - hourly_pnl_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '28 DAYS' preceding - and current row - ) as avg_28d_pnl_pct, - AVG( - hourly_rewards_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '24 HOURS' preceding - and current row - ) as avg_24h_rewards_pct, - AVG( - hourly_rewards_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '7 DAYS' preceding - and current row - ) as avg_7d_rewards_pct, - AVG( - hourly_rewards_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '28 DAYS' preceding - and current row - ) as avg_28d_rewards_pct, - AVG( - hourly_total_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '24 HOURS' preceding - and current row - ) as avg_24h_total_pct, - AVG( - hourly_total_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '7 DAYS' preceding - and current row - ) as avg_7d_total_pct, - AVG( - hourly_total_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '28 DAYS' preceding - and current row - ) as avg_28d_total_pct - from - pnl_hourly -), - -apr_calculations as ( - select - pnl_hourly.ts, - pnl_hourly.pool_id, - pnl_hourly.collateral_type, - pnl_hourly.collateral_value, - pnl_hourly.debt, - pnl_hourly.hourly_pnl, - pnl_hourly.cumulative_pnl, - pnl_hourly.hourly_issuance, - pnl_hourly.cumulative_issuance, - pnl_hourly.rewards_usd, - pnl_hourly.hourly_pnl_pct, - pnl_hourly.hourly_rewards_pct, - -- total pnls - avg_returns.avg_24h_total_pct * 24 * 365 as apr_24h, - avg_returns.avg_7d_total_pct * 24 * 365 as apr_7d, - avg_returns.avg_28d_total_pct * 24 * 365 as apr_28d, - -- pool pnls - avg_returns.avg_24h_pnl_pct * 24 * 365 as apr_24h_pnl, - avg_returns.avg_7d_pnl_pct * 24 * 365 as apr_7d_pnl, - avg_returns.avg_28d_pnl_pct * 24 * 365 as apr_28d_pnl, - -- rewards pnls - avg_returns.avg_24h_rewards_pct * 24 * 365 as apr_24h_rewards, - avg_returns.avg_7d_rewards_pct * 24 * 365 as apr_7d_rewards, - avg_returns.avg_28d_rewards_pct * 24 * 365 as apr_28d_rewards - from - pnl_hourly - inner join avg_returns - on - pnl_hourly.ts = avg_returns.ts - and pnl_hourly.pool_id = avg_returns.pool_id - and pnl_hourly.collateral_type = avg_returns.collateral_type -), - -apy_calculations as ( - select - *, - (POWER(1 + apr_24h / 8760, 8760) - 1) as apy_24h, - (POWER(1 + apr_7d / 8760, 8760) - 1) as apy_7d, - (POWER(1 + apr_28d / 8760, 8760) - 1) as apy_28d, - (POWER(1 + apr_24h_pnl / 8760, 8760) - 1) as apy_24h_pnl, - (POWER(1 + apr_7d_pnl / 8760, 8760) - 1) as apy_7d_pnl, - (POWER(1 + apr_28d_pnl / 8760, 8760) - 1) as apy_28d_pnl, - (POWER(1 + apr_24h_rewards / 8760, 8760) - 1) as apy_24h_rewards, - (POWER(1 + apr_7d_rewards / 8760, 8760) - 1) as apy_7d_rewards, - (POWER(1 + apr_28d_rewards / 8760, 8760) - 1) as apy_28d_rewards - from - apr_calculations -) - -select - ts, - pool_id, - collateral_type, - collateral_value, - debt, - hourly_issuance, - hourly_pnl, - cumulative_pnl, - cumulative_issuance, - rewards_usd, - hourly_pnl_pct, - hourly_rewards_pct, - apr_24h, - apy_24h, - apr_7d, - apy_7d, - apr_28d, - apy_28d, - apr_24h_pnl, - apy_24h_pnl, - apr_7d_pnl, - apy_7d_pnl, - apr_28d_pnl, - apy_28d_pnl, - apr_24h_rewards, - apy_24h_rewards, - apr_7d_rewards, - apy_7d_rewards, - apr_28d_rewards, - apy_28d_rewards -from - apy_calculations -order by - ts diff --git a/transformers/synthetix/models/marts/base/sepolia/core/fct_core_apr_rewards_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/core/fct_core_apr_rewards_base_sepolia.sql deleted file mode 100644 index 29a50d2a..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/core/fct_core_apr_rewards_base_sepolia.sql +++ /dev/null @@ -1,115 +0,0 @@ -{{ - config( - materialized = 'table', - ) -}} - -with pnl_hourly as ( - select - ts, - pool_id, - collateral_type, - reward_token, - collateral_value, - rewards_usd, - hourly_rewards_pct - from - {{ ref('fct_pool_pnl_hourly_reward_base_sepolia') }} -), - -avg_returns as ( - select - ts, - pool_id, - collateral_type, - reward_token, - AVG( - hourly_rewards_pct - ) over ( - partition by - pool_id, - collateral_type, - reward_token - order by - ts - range between interval '24 HOURS' preceding - and current row - ) as avg_24h_rewards_pct, - AVG( - hourly_rewards_pct - ) over ( - partition by - pool_id, - collateral_type, - reward_token - order by - ts - range between interval '7 DAYS' preceding - and current row - ) as avg_7d_rewards_pct, - AVG( - hourly_rewards_pct - ) over ( - partition by - pool_id, - collateral_type, - reward_token - order by - ts - range between interval '28 DAYS' preceding - and current row - ) as avg_28d_rewards_pct - from - pnl_hourly -), - -apr_calculations as ( - select - pnl_hourly.ts, - pnl_hourly.pool_id, - pnl_hourly.collateral_type, - pnl_hourly.reward_token, - pnl_hourly.collateral_value, - pnl_hourly.rewards_usd, - pnl_hourly.hourly_rewards_pct, - avg_returns.avg_24h_rewards_pct * 24 * 365 as apr_24h_rewards, - avg_returns.avg_7d_rewards_pct * 24 * 365 as apr_7d_rewards, - avg_returns.avg_28d_rewards_pct * 24 * 365 as apr_28d_rewards - from - pnl_hourly - inner join avg_returns - on - pnl_hourly.ts = avg_returns.ts - and pnl_hourly.pool_id = avg_returns.pool_id - and pnl_hourly.collateral_type = avg_returns.collateral_type - and pnl_hourly.reward_token = avg_returns.reward_token -), - -apy_calculations as ( - select - *, - (POWER(1 + apr_24h_rewards / 8760, 8760) - 1) as apy_24h_rewards, - (POWER(1 + apr_7d_rewards / 8760, 8760) - 1) as apy_7d_rewards, - (POWER(1 + apr_28d_rewards / 8760, 8760) - 1) as apy_28d_rewards - from - apr_calculations -) - -select - ts, - pool_id, - collateral_type, - reward_token, - collateral_value, - rewards_usd, - hourly_rewards_pct, - apr_24h_rewards, - apy_24h_rewards, - apr_7d_rewards, - apy_7d_rewards, - apr_28d_rewards, - apy_28d_rewards -from - apy_calculations -order by - ts diff --git a/transformers/synthetix/models/marts/base/sepolia/core/fct_core_market_updated_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/core/fct_core_market_updated_base_sepolia.sql deleted file mode 100644 index af8fce14..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/core/fct_core_market_updated_base_sepolia.sql +++ /dev/null @@ -1,30 +0,0 @@ -with market_updated as ( - select - id, - block_timestamp, - block_number, - transaction_hash, - contract, - event_name, - market_id, - net_issuance, - sender, - collateral_type, - credit_capacity, - token_amount - from - {{ ref('core_market_updated_base_sepolia') }} -) - -select - id, - block_timestamp as ts, - transaction_hash, - event_name, - market_id, - collateral_type, - {{ convert_wei("credit_capacity") }} as credit_capacity, - {{ convert_wei("net_issuance") }} as net_issuance, - {{ convert_wei("token_amount") }} as token_amount -from - market_updated diff --git a/transformers/synthetix/models/marts/base/sepolia/core/fct_core_pool_collateral_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/core/fct_core_pool_collateral_base_sepolia.sql deleted file mode 100644 index 63b1e74b..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/core/fct_core_pool_collateral_base_sepolia.sql +++ /dev/null @@ -1,39 +0,0 @@ -with events as ( - select - block_timestamp, - {{ convert_wei('token_amount') }} as token_amount, - collateral_type - from - {{ ref('core_deposited_base_sepolia') }} - union all - select - block_timestamp, - -{{ convert_wei('token_amount') }} as token_amount, - collateral_type - from - {{ ref('core_withdrawn_base_sepolia') }} -), - -ranked_events as ( - select - *, - SUM(token_amount) over ( - partition by collateral_type - order by - block_timestamp - rows between unbounded preceding - and current row - ) as amount_deposited - from - events -) - -select - block_timestamp as ts, - collateral_type, - amount_deposited -from - ranked_events -order by - block_timestamp, - collateral_type diff --git a/transformers/synthetix/models/marts/base/sepolia/core/fct_core_pool_delegation_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/core/fct_core_pool_delegation_base_sepolia.sql deleted file mode 100644 index f2d04353..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/core/fct_core_pool_delegation_base_sepolia.sql +++ /dev/null @@ -1,45 +0,0 @@ -with delegation_changes as ( - select - block_timestamp, - account_id, - pool_id, - collateral_type, - {{ convert_wei('amount') }} - - LAG({{ convert_wei('amount') }}, 1, 0) over ( - partition by - account_id, - pool_id, - collateral_type - order by - block_timestamp - ) as change_in_amount - from - {{ ref('core_delegation_updated_base_sepolia') }} -), - -cumulative_delegation as ( - select - block_timestamp, - pool_id, - collateral_type, - SUM(change_in_amount) over ( - partition by - pool_id, - collateral_type - order by - block_timestamp - ) as cumulative_amount_delegated - from - delegation_changes -) - -select - block_timestamp as ts, - pool_id, - collateral_type, - cumulative_amount_delegated as amount_delegated -from - cumulative_delegation -order by - block_timestamp, - collateral_type diff --git a/transformers/synthetix/models/marts/base/sepolia/core/fct_core_pools_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/core/fct_core_pools_base_sepolia.sql deleted file mode 100644 index 2449cee4..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/core/fct_core_pools_base_sepolia.sql +++ /dev/null @@ -1,13 +0,0 @@ -with base as ( - select - pool_id as id, - block_timestamp as created_ts, - block_number, - owner - from - {{ ref('core_pool_created_base_sepolia') }} -) - -select * -from - base diff --git a/transformers/synthetix/models/marts/base/sepolia/core/fct_pool_debt_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/core/fct_pool_debt_base_sepolia.sql deleted file mode 100644 index b135eb9d..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/core/fct_pool_debt_base_sepolia.sql +++ /dev/null @@ -1,10 +0,0 @@ -select - ts, - block_number, - pool_id, - collateral_type, - debt -from - {{ ref('core_vault_debt_base_sepolia') }} -order by - ts diff --git a/transformers/synthetix/models/marts/base/sepolia/core/fct_pool_issuance_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/core/fct_pool_issuance_base_sepolia.sql deleted file mode 100644 index 5bb38444..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/core/fct_pool_issuance_base_sepolia.sql +++ /dev/null @@ -1,39 +0,0 @@ -with burns as ( - select - block_timestamp as ts, - block_number, - transaction_hash, - pool_id, - collateral_type, - account_id, - -1 * {{ convert_wei('amount') }} as amount - from - {{ ref('core_usd_burned_base_sepolia') }} - order by - block_timestamp desc -), - -mints as ( - select - block_timestamp as ts, - block_number, - transaction_hash, - pool_id, - collateral_type, - account_id, - {{ convert_wei('amount') }} as amount - from - {{ ref('core_usd_minted_base_sepolia') }} - order by - block_timestamp desc -) - -select * -from - burns -union all -select * -from - mints -order by - ts desc diff --git a/transformers/synthetix/models/marts/base/sepolia/core/fct_pool_issuance_hourly_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/core/fct_pool_issuance_hourly_base_sepolia.sql deleted file mode 100644 index 42e21da1..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/core/fct_pool_issuance_hourly_base_sepolia.sql +++ /dev/null @@ -1,122 +0,0 @@ -with dim as ( - select - m.pool_id, - m.collateral_type, - generate_series( - date_trunc('hour', min(t.ts)), - date_trunc('hour', max(t.ts)), - '1 hour'::interval - ) as ts - from - ( - select ts - from - {{ ref('fct_pool_issuance_base_sepolia') }} - ) as t - cross join ( - select distinct - pool_id, - collateral_type - from - {{ ref('fct_pool_issuance_base_sepolia') }} - ) as m - group by - m.pool_id, - m.collateral_type -), - -max_debt_block as ( - select - pool_id, - collateral_type, - date_trunc( - 'hour', - ts - ) as "hour", - max(block_number) as max_block_number - from - {{ ref('fct_pool_debt_base_sepolia') }} - group by - date_trunc( - 'hour', - ts - ), - pool_id, - collateral_type -), - -filt_issuance as ( - select - i.pool_id, - i.collateral_type, - i.amount, - case - when - i.block_number <= d.max_block_number - or d.max_block_number is null then i.ts - else i.ts + interval '1 hour' - end as ts - from - {{ ref('fct_pool_issuance_base_sepolia') }} - as i - left join max_debt_block as d - on date_trunc( - 'hour', - i.ts - ) = d.hour - and i.pool_id = d.pool_id - and lower( - i.collateral_type - ) = lower( - d.collateral_type - ) - where - i.block_number <= ( - select - max( - max_block_number - ) as b - from - max_debt_block - ) -), - -issuance as ( - select - date_trunc( - 'hour', - ts - ) as ts, - pool_id, - collateral_type, - sum(amount) as hourly_issuance - from - filt_issuance - group by - date_trunc( - 'hour', - ts - ), - pool_id, - collateral_type -) - -select - dim.ts, - dim.pool_id, - dim.collateral_type, - coalesce( - i.hourly_issuance, - 0 - ) as hourly_issuance -from - dim -left join issuance as i - on - dim.pool_id = i.pool_id - and lower( - dim.collateral_type - ) = lower( - i.collateral_type - ) - and dim.ts = i.ts diff --git a/transformers/synthetix/models/marts/base/sepolia/core/fct_pool_pnl_hourly_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/core/fct_pool_pnl_hourly_base_sepolia.sql deleted file mode 100644 index 2d6154f9..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/core/fct_pool_pnl_hourly_base_sepolia.sql +++ /dev/null @@ -1,217 +0,0 @@ -{{ config( - materialized = 'table', - unique_key = ['ts', 'pool_id', 'collateral_type'], -) }} - -with dim as ( - select - p.pool_id, - p.collateral_type, - generate_series( - date_trunc('hour', min(t.ts)), - date_trunc('hour', max(t.ts)), - '1 hour'::INTERVAL - ) as ts - from - ( - select ts - from - {{ ref('fct_pool_debt_base_sepolia') }} - ) as t - cross join ( - select distinct - pool_id, - collateral_type - from - {{ ref('fct_pool_debt_base_sepolia') }} - ) as p - group by - p.pool_id, - p.collateral_type -), - -issuance as ( - select - ts, - pool_id, - collateral_type, - hourly_issuance - from - {{ ref('fct_pool_issuance_hourly_base_sepolia') }} -), - -debt as ( - select distinct - pool_id, - collateral_type, - date_trunc( - 'hour', - ts - ) as ts, - last_value(debt) over ( - partition by date_trunc('hour', ts), pool_id, collateral_type - order by - ts - rows between unbounded preceding - and unbounded following - ) as debt - from - {{ ref('fct_pool_debt_base_sepolia') }} -), - -collateral as ( - select distinct - pool_id, - collateral_type, - date_trunc( - 'hour', - ts - ) as ts, - last_value(collateral_value) over ( - partition by date_trunc('hour', ts), pool_id, collateral_type - order by - ts - rows between unbounded preceding - and unbounded following - ) as collateral_value - from - {{ ref('core_vault_collateral_base_sepolia') }} - where - pool_id = 1 -), - -ffill as ( - select - dim.ts, - dim.pool_id, - dim.collateral_type, - coalesce( - last(debt) over ( - partition by dim.collateral_type, dim.pool_id - order by dim.ts - rows between unbounded preceding and current row - ), - 0 - ) as debt, - coalesce( - last(collateral_value) over ( - partition by dim.collateral_type, dim.pool_id - order by dim.ts - rows between unbounded preceding and current row - ), - 0 - ) as collateral_value - from - dim - left join debt - on - dim.ts = debt.ts - and dim.pool_id = debt.pool_id - and dim.collateral_type = debt.collateral_type - left join collateral - on - dim.ts = collateral.ts - and dim.pool_id = collateral.pool_id - and dim.collateral_type = collateral.collateral_type -), - -hourly_pnl as ( - select - ts, - pool_id, - collateral_type, - collateral_value, - debt, - coalesce(lag(debt) over ( - partition by pool_id, collateral_type - order by - ts - ) - debt, 0) as hourly_pnl - from - ffill -), - -hourly_rewards as ( - select - ts, - pool_id, - collateral_type, - rewards_usd - from - {{ ref('fct_pool_rewards_hourly_base_sepolia') }} -), - -hourly_returns as ( - select - pnl.ts, - pnl.pool_id, - pnl.collateral_type, - pnl.collateral_value, - pnl.debt, - coalesce( - iss.hourly_issuance, - 0 - ) as hourly_issuance, - pnl.hourly_pnl + coalesce( - iss.hourly_issuance, - 0 - ) as hourly_pnl, - coalesce( - rewards.rewards_usd, - 0 - ) as rewards_usd, - case - when pnl.collateral_value = 0 then 0 - else coalesce( - rewards.rewards_usd, - 0 - ) / pnl.collateral_value - end as hourly_rewards_pct, - case - when pnl.collateral_value = 0 then 0 - else - (coalesce(iss.hourly_issuance, 0) + pnl.hourly_pnl) - / pnl.collateral_value - end as hourly_pnl_pct, - case - when pnl.collateral_value = 0 then 0 - else - ( - coalesce(rewards.rewards_usd, 0) - + pnl.hourly_pnl - + coalesce(iss.hourly_issuance, 0) - ) - / pnl.collateral_value - end as hourly_total_pct - from - hourly_pnl as pnl - left join hourly_rewards as rewards - on - pnl.ts = rewards.ts - and pnl.pool_id = rewards.pool_id - and lower(pnl.collateral_type) = lower(rewards.collateral_type) - left join issuance as iss - on - pnl.ts = iss.ts - and pnl.pool_id = iss.pool_id - and lower( - pnl.collateral_type - ) = lower( - iss.collateral_type - ) -) - -select - ts, - pool_id, - collateral_type, - collateral_value, - debt, - hourly_issuance, - hourly_pnl, - rewards_usd, - hourly_pnl_pct, - hourly_rewards_pct, - hourly_total_pct -from - hourly_returns diff --git a/transformers/synthetix/models/marts/base/sepolia/core/fct_pool_pnl_hourly_reward_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/core/fct_pool_pnl_hourly_reward_base_sepolia.sql deleted file mode 100644 index 7adf194b..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/core/fct_pool_pnl_hourly_reward_base_sepolia.sql +++ /dev/null @@ -1,85 +0,0 @@ -{{ config( - materialized = 'table', - unique_key = ['ts', 'pool_id', 'collateral_type', 'reward_token'], -) }} - -with dim as ( - - select - t.ts, - t.pool_id, - t.collateral_type, - t.collateral_value, - p.token_symbol as reward_token - from - ( - select - ts, - collateral_type, - pool_id, - collateral_value - from - {{ ref('fct_pool_pnl_hourly_base_sepolia') }} - group by - ts, - collateral_type, - pool_id, - collateral_value - ) as t - cross join ( - select distinct token_symbol - from - {{ ref('fct_pool_rewards_token_hourly_base_sepolia') }} - ) as p - group by - t.ts, - t.pool_id, - t.collateral_type, - t.collateral_value, - p.token_symbol -), - -reward_hourly_token as ( - select - ts, - pool_id, - collateral_type, - token_symbol as reward_token, - SUM( - rewards_usd - ) as rewards_usd - from - {{ ref('fct_pool_rewards_token_hourly_base_sepolia') }} - group by - ts, - pool_id, - collateral_type, - token_symbol -) - -select - dim.ts, - dim.pool_id, - dim.collateral_type, - dim.collateral_value, - dim.reward_token, - COALESCE( - reward_hourly_token.rewards_usd, - 0 - ) as rewards_usd, - case - when dim.collateral_value = 0 then 0 - else COALESCE( - reward_hourly_token.rewards_usd, - 0 - ) / dim.collateral_value - end as hourly_rewards_pct -from - dim -left join reward_hourly_token - on - dim.ts = reward_hourly_token.ts - and dim.pool_id = reward_hourly_token.pool_id - and LOWER(dim.collateral_type) - = LOWER(reward_hourly_token.collateral_type) - and dim.reward_token = reward_hourly_token.reward_token diff --git a/transformers/synthetix/models/marts/base/sepolia/core/fct_pool_rewards_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/core/fct_pool_rewards_base_sepolia.sql deleted file mode 100644 index aff30cec..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/core/fct_pool_rewards_base_sepolia.sql +++ /dev/null @@ -1,37 +0,0 @@ -with rewards_distributed as ( - select - block_timestamp as ts, - CAST( - pool_id as INTEGER - ) as pool_id, - collateral_type, - distributor, - {{ convert_wei('amount') }} as amount, - TO_TIMESTAMP("start") as ts_start, - "duration" - from - {{ ref('core_rewards_distributed_base_sepolia') }} -), - -distributors as ( - select - CAST(distributor_address as TEXT) as distributor_address, - CAST(token_symbol as TEXT) as token_symbol - from - {{ ref('base_sepolia_reward_distributors') }} -) - -select - rd.ts, - rd.pool_id, - rd.collateral_type, - rd.distributor, - distributors.token_symbol, - rd.amount, - rd.ts_start, - rd.duration -from - rewards_distributed as rd -inner join distributors on rd.distributor = distributors.distributor_address -order by - ts diff --git a/transformers/synthetix/models/marts/base/sepolia/core/fct_pool_rewards_hourly_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/core/fct_pool_rewards_hourly_base_sepolia.sql deleted file mode 100644 index dc265a0f..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/core/fct_pool_rewards_hourly_base_sepolia.sql +++ /dev/null @@ -1,21 +0,0 @@ -with token_hourly as ( - select - ts, - pool_id, - collateral_type, - rewards_usd - from - {{ ref('fct_pool_rewards_token_hourly_base_sepolia') }} -) - -select - ts, - pool_id, - collateral_type, - SUM(rewards_usd) as rewards_usd -from - token_hourly -group by - ts, - pool_id, - collateral_type diff --git a/transformers/synthetix/models/marts/base/sepolia/core/fct_pool_rewards_token_hourly_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/core/fct_pool_rewards_token_hourly_base_sepolia.sql deleted file mode 100644 index de85ce7d..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/core/fct_pool_rewards_token_hourly_base_sepolia.sql +++ /dev/null @@ -1,190 +0,0 @@ -with dim as ( - select - m.pool_id, - m.collateral_type, - generate_series( - date_trunc('hour', min(t.min_ts)), - date_trunc('hour', max(t.max_ts)), - '1 hour'::INTERVAL - ) as ts - from - ( - select - min(ts_start) as min_ts, - max( - ts_start + "duration" * '1 second'::INTERVAL - ) as max_ts - from - {{ ref('fct_pool_rewards_base_sepolia') }} - ) as t - cross join ( - select distinct - pool_id, - collateral_type - from - {{ ref('fct_pool_debt_base_sepolia') }} - ) as m - group by - m.pool_id, - m.collateral_type -), - -rewards_distributed as ( - select - ts, - pool_id, - collateral_type, - distributor, - token_symbol, - amount, - ts_start, - "duration" - from - {{ ref('fct_pool_rewards_base_sepolia') }} -), - -hourly_distributions as ( - select - dim.ts, - dim.pool_id, - dim.collateral_type, - r.distributor, - r.token_symbol, - r.amount, - r.ts_start, - r."duration", - row_number() over ( - partition by - dim.ts, - dim.pool_id, - dim.collateral_type, - r.distributor - order by - r.ts_start desc - ) as distributor_index - from - dim - left join rewards_distributed as r - on - dim.pool_id = r.pool_id - and lower( - dim.collateral_type - ) = lower( - r.collateral_type - ) - and dim.ts + '1 hour'::INTERVAL >= r.ts_start - and dim.ts < r.ts_start + r."duration" * '1 second'::INTERVAL - where - r."duration" > 0 -), - -streamed_rewards as ( - select - d.ts, - d.pool_id, - d.collateral_type, - d.distributor, - d.token_symbol, - -- get the amount of time distributed this hour - -- use the smaller of those two intervals - -- convert the interval to a number of hours - -- multiply the result by the hourly amount to get the amount distributed this hour - ( - extract( - epoch - from - least( - d."duration" / 3600 * '1 hour'::INTERVAL, - least( - d.ts + '1 hour'::INTERVAL - greatest( - d.ts, - d.ts_start - ), - least( - d.ts_start + d."duration" * '1 second'::INTERVAL, - d.ts + '1 hour'::INTERVAL - ) - d.ts - ) - ) - ) / 3600 - ) * d.amount / ( - d."duration" / 3600 - ) as amount - from - hourly_distributions as d - where - d.distributor_index = 1 -), - -instant_rewards as ( - select - date_trunc( - 'hour', - ts - ) as ts, - pool_id, - collateral_type, - distributor, - token_symbol, - amount - from - rewards_distributed - where - "duration" = 0 -), - -combined as ( - select - combo.ts, - combo.pool_id, - combo.collateral_type, - combo.distributor, - combo.token_symbol, - combo.amount, - p.price - from - ( - select - ts, - pool_id, - collateral_type, - distributor, - token_symbol, - amount - from - streamed_rewards - union all - select - ts, - pool_id, - collateral_type, - distributor, - token_symbol, - amount - from - instant_rewards - ) as combo - left join {{ ref('fct_prices_hourly_base_sepolia') }} as p - on - combo.token_symbol = p.market_symbol - and combo.ts = p.ts -) - -select - ts, - pool_id, - collateral_type, - distributor, - token_symbol, - sum(amount) as amount, - sum( - amount * price - ) as rewards_usd -from - combined -group by - ts, - pool_id, - collateral_type, - distributor, - token_symbol diff --git a/transformers/synthetix/models/marts/base/sepolia/core/schema.yml b/transformers/synthetix/models/marts/base/sepolia/core/schema.yml deleted file mode 100644 index 4fa7bc4f..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/core/schema.yml +++ /dev/null @@ -1,592 +0,0 @@ -version: 2 -models: - - name: fct_core_account_activity_base_sepolia - description: "Daily number of accounts by action (Delegated, Withdrawn, Claimed)" - columns: - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: account_action - description: "Type of LP action" - data_type: text - tests: - - not_null - - accepted_values: - values: ["Delegated", "Withdrawn", "Claimed"] - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - name: fct_core_active_stakers_daily_base_sepolia - description: "Daily number of active stakers" - columns: - - name: block_date - description: "Date" - data_type: date - tests: - - not_null - - name: nof_stakers_daily - description: "Number of active stakers daily" - - name: fct_pool_rewards_base_sepolia - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: distributor - description: "Address of the distributor" - data_type: text - tests: - - not_null - - name: token_symbol - description: "Token symbol" - data_type: text - tests: - - not_null - - name: amount - description: "Reward amount" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: ts_start - data_type: timestamp with time zone - - name: duration - data_type: numeric - - name: fct_core_account_delegation_base_sepolia - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: amount_delegated - description: "Amount of delegated collateral" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fct_core_apr_base_sepolia - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: collateral_value - description: "Collateral value (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: debt - description: "Debt value (USD)" - data_type: numeric - tests: - - not_null - - name: hourly_issuance - description: "Hourly issuance" - data_type: numeric - tests: - - not_null - - name: hourly_pnl - description: "Hourly PnL" - data_type: numeric - tests: - - not_null - - name: cumulative_pnl - description: "Cumulative PnL" - data_type: numeric - tests: - - not_null - - name: cumulative_issuance - description: "Cumulative Issuance" - data_type: numeric - tests: - - not_null - - name: rewards_usd - description: "Rewards value (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: hourly_pnl_pct - description: "Hourly PnL (%)" - data_type: numeric - tests: - - not_null - - name: hourly_rewards_pct - description: "Hourly Rewards (%)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - max_value: 1 - inclusive: true - - name: apr_24h - description: "APR (24h)" - data_type: numeric - tests: - - not_null - - name: apy_24h - description: "APY (24h)" - data_type: numeric - tests: - - not_null - - name: apr_7d - description: "APR (7d)" - data_type: numeric - tests: - - not_null - - name: apy_7d - description: "APY (7d)" - data_type: numeric - tests: - - not_null - - name: apr_28d - description: "APR (28d)" - data_type: numeric - tests: - - not_null - - name: apy_28d - description: "APY (28d)" - data_type: numeric - tests: - - not_null - - name: apr_24h_pnl - data_type: numeric - - name: apy_24h_pnl - data_type: numeric - - name: apr_7d_pnl - data_type: numeric - - name: apy_7d_pnl - data_type: numeric - - name: apr_28d_pnl - data_type: numeric - - name: apy_28d_pnl - data_type: numeric - - name: apr_24h_rewards - data_type: numeric - - name: apy_24h_rewards - data_type: numeric - - name: apr_7d_rewards - data_type: numeric - - name: apy_7d_rewards - data_type: numeric - - name: apr_28d_rewards - data_type: numeric - - name: apy_28d_rewards - data_type: numeric - - name: fct_core_market_updated_base_sepolia - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["MarketCollateralWithdrawn", "MarketCollateralDeposited", "MarketUsdWithdrawn", "MarketUsdDeposited"] - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: credit_capacity - description: "Credit capacity" - data_type: numeric - tests: - - not_null - - name: net_issuance - description: "Net issuance" - data_type: numeric - tests: - - not_null - - name: token_amount - description: "Token amount" - data_type: numeric - tests: - - not_null - - name: fct_core_pool_collateral_base_sepolia - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: amount_deposited - description: "Amount deposited" - data_type: numeric - tests: - - not_null - - name: fct_core_pool_delegation_base_sepolia - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: amount_delegated - data_type: numeric - - name: fct_core_pools_base_sepolia - columns: - - name: id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: created_ts - description: "Pool creation timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: owner - description: "Address of the pool owner" - data_type: text - tests: - - not_null - - name: fct_pool_debt_base_sepolia - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: debt - description: "Debt value (USD)" - data_type: numeric - tests: - - not_null - - name: fct_pool_issuance_hourly_base_sepolia - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: hourly_issuance - description: "Hourly issuance" - data_type: numeric - tests: - - not_null - - name: fct_pool_issuance_base_sepolia - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - name: amount - description: "Amount issued" - data_type: numeric - tests: - - not_null - - name: fct_pool_pnl_hourly_base_sepolia - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: collateral_value - description: "Collateral value (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: debt - description: "Debt value (USD)" - data_type: numeric - tests: - - not_null - - name: hourly_issuance - description: "Hourly issuance" - data_type: numeric - tests: - - not_null - - name: hourly_pnl - description: "Hourly PnL" - data_type: numeric - tests: - - not_null - - name: rewards_usd - description: "Rewards value (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: hourly_pnl_pct - description: "Hourly PnL (%)" - data_type: numeric - tests: - - not_null - - name: hourly_rewards_pct - description: "Hourly Rewards (%)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - max_value: 1 - inclusive: true - - name: hourly_total_pct - description: "Hourly Total (%)" - data_type: numeric - tests: - - not_null - - name: fct_pool_rewards_hourly_base_sepolia - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: rewards_usd - description: "Rewards value (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fct_pool_rewards_token_hourly_base_sepolia - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: distributor - description: "Address of the distributor" - data_type: text - tests: - - not_null - - name: token_symbol - description: "Token symbol" - data_type: text - tests: - - not_null - - name: amount - description: "Distributed rewards amount" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: rewards_usd - description: "Rewards value (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true diff --git a/transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_account_activity_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_account_activity_base_sepolia.sql deleted file mode 100644 index a214c3f8..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_account_activity_base_sepolia.sql +++ /dev/null @@ -1,89 +0,0 @@ -{{ config( - materialized = "view", - tags = ["perp", "account_activity", "base", "sepolia"] -) }} - -with active_accounts as ( - select distinct - date_trunc('day', ts) as activity_date, - account_id - from {{ ref('fct_perp_trades_base_sepolia') }} -), - -date_range as ( - select - generate_series( - date(min(activity_date)), - date(max(activity_date)), - interval '1 day' - )::date as activity_date - from active_accounts -), - -active_accounts_daily as ( - select - date_range.activity_date, - count(distinct active_accounts.account_id) as active_accounts - from date_range - left join active_accounts - on date_range.activity_date = active_accounts.activity_date - group by date_range.activity_date -), - -active_accounts_monthly as ( - select - date_range.activity_date, - count(distinct active_accounts.account_id) as active_accounts - from date_range - left join active_accounts - on - date_range.activity_date - interval '27 days' - <= active_accounts.activity_date - and date_range.activity_date >= active_accounts.activity_date - group by date_range.activity_date -), - -new_accounts as ( - select - min(activity_date) as start_date, - account_id - from active_accounts - group by account_id -), - -new_accounts_daily as ( - select - date_range.activity_date, - count(new_accounts.account_id) as new_accounts - from date_range - left join new_accounts - on date_range.activity_date = new_accounts.start_date - group by date_range.activity_date, new_accounts.start_date -), - -new_accounts_monthly as ( - select distinct - activity_date, - sum(new_accounts) over ( - order by activity_date - range between interval '27 days' preceding and current row - ) as new_accounts - from new_accounts_daily -) - -select - dr.activity_date as ts, - dau.active_accounts as dau, - mau.active_accounts as mau, - new_accounts_daily.new_accounts as new_accounts_daily, - new_accounts_monthly.new_accounts as new_accounts_monthly -from date_range as dr -left join active_accounts_daily as dau - on dr.activity_date = dau.activity_date -left join active_accounts_monthly as mau - on dr.activity_date = mau.activity_date -left join new_accounts_daily - on dr.activity_date = new_accounts_daily.activity_date -left join new_accounts_monthly - on dr.activity_date = new_accounts_monthly.activity_date -order by ts desc diff --git a/transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_accounts_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_accounts_base_sepolia.sql deleted file mode 100644 index d12ffd92..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_accounts_base_sepolia.sql +++ /dev/null @@ -1,14 +0,0 @@ -with base as ( - select - block_timestamp as created_ts, - "owner", - CAST( - account_id as VARCHAR - ) as id - from - {{ ref('perp_account_created_base_sepolia') }} -) - -select * -from - base diff --git a/transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_collateral_modified_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_collateral_modified_base_sepolia.sql deleted file mode 100644 index c03695ab..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_collateral_modified_base_sepolia.sql +++ /dev/null @@ -1,18 +0,0 @@ -select - cm.id, - cm.block_timestamp, - cm.account_id, - cm.block_number, - cm.transaction_hash, - cm.contract, - cm.event_name, - synths.synth_symbol, - cm.synth_market_id, - synths.synth_token_address, - cm.sender, - {{ convert_wei("cm.amount_delta") }} as amount_delta -from - {{ ref("perp_collateral_modified_base_sepolia") }} - as cm -inner join {{ ref('base_sepolia_synths') }} as synths - on cm.synth_market_id = synths.synth_market_id diff --git a/transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_interest_charged_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_interest_charged_base_sepolia.sql deleted file mode 100644 index 17557bc2..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_interest_charged_base_sepolia.sql +++ /dev/null @@ -1,11 +0,0 @@ -select - id, - block_timestamp, - block_number, - transaction_hash, - contract, - event_name, - account_id, - {{ convert_wei("interest") }} as interest -from - {{ ref("perp_interest_charged_base_sepolia") }} diff --git a/transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_liq_account_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_liq_account_base_sepolia.sql deleted file mode 100644 index bc7b2398..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_liq_account_base_sepolia.sql +++ /dev/null @@ -1,59 +0,0 @@ -with liquidation_events as ( - select - account_id, - reward, - block_timestamp, - full_liquidation, - SUM( - case - when full_liquidation then 1 - else 0 - end - ) over ( - partition by account_id - order by - block_timestamp - rows between unbounded preceding - and current row - ) as liquidation_id - from - {{ ref('perp_account_liquidation_attempt_base_sepolia') }} -), - -cumulative_rewards as ( - select - block_timestamp, - reward, - full_liquidation, - liquidation_id, - CAST( - account_id as text - ) as account_id, - SUM({{ convert_wei('reward') }}) over ( - partition by - account_id, - liquidation_id - order by - block_timestamp - ) as cumulative_reward, - ROW_NUMBER() over ( - partition by - account_id, - liquidation_id - order by - block_timestamp desc - ) as rn - from - liquidation_events - order by - block_timestamp -) - -select - account_id, - block_timestamp as ts, - cumulative_reward as total_reward -from - cumulative_rewards -where - rn = 1 diff --git a/transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_liq_position_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_liq_position_base_sepolia.sql deleted file mode 100644 index ed491f06..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_liq_position_base_sepolia.sql +++ /dev/null @@ -1,38 +0,0 @@ -with liquidations as ( - select - id, - block_timestamp as ts, - block_number, - transaction_hash, - account_id, - market_id, - {{ convert_wei('amount_liquidated') }} as amount_liquidated, - {{ convert_wei('current_position_size') }} as position_size - from - {{ ref('perp_position_liquidated_base_sepolia') }} -), - -markets as ( - select - id, - market_symbol - from - {{ ref('fct_perp_markets_base_sepolia') }} -) - -select - l.id, - l.ts, - l.block_number, - l.transaction_hash, - l.market_id, - m.market_symbol, - l.amount_liquidated, - l.position_size, - CAST( - l.account_id as text - ) as account_id -from - liquidations as l -left join markets as m - on l.market_id = m.id diff --git a/transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_market_history_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_market_history_base_sepolia.sql deleted file mode 100644 index 4dd19065..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_market_history_base_sepolia.sql +++ /dev/null @@ -1,106 +0,0 @@ -with base as ( - select - mu.id, - mu.block_timestamp as ts, - mu.block_number, - mu.transaction_hash, - m.id as market_id, - m.market_symbol, - {{ convert_wei('price') }} as price, - {{ convert_wei('skew') }} as skew, - {{ convert_wei('size') }} as size, - {{ convert_wei('size_delta') }} as size_delta, - {{ convert_wei('current_funding_rate') }} as funding_rate, - {{ convert_wei('current_funding_velocity') }} as funding_velocity, - {{ convert_wei('interest_rate') }} as interest_rate, - {{ convert_wei('current_funding_rate') }} * 365.25 as funding_rate_apr, - {{ convert_wei('current_funding_rate') }} * 365.25 - + {{ convert_wei('interest_rate') }} as long_rate_apr, - {{ convert_wei('current_funding_rate') }} * -1 * 365.25 - + {{ convert_wei('interest_rate') }} as short_rate_apr, - LAG({{ convert_wei('size') }}, 1, 0) over ( - partition by m.market_symbol - order by - mu.block_timestamp - ) as prev_size - from - {{ ref('perp_market_updated_base_sepolia') }} as mu - left join {{ ref('fct_perp_markets_base_sepolia') }} as m - on mu.market_id = m.id -), - -oi as ( - select - id, - ts, - size * price as market_oi_usd, - LAG( - size * price, - 1, - 0 - ) over ( - partition by market_symbol - order by - ts asc - ) as prev_market_oi_usd, - ( - size + skew - ) * price / 2 as long_oi, - ( - size - skew - ) * price / 2 as short_oi, - case - when size * price = 0 then null - else ((size + skew) * price / 2) / ( - size * price - ) - end as long_oi_pct, - case - when size * price = 0 then null - else ((size - skew) * price / 2) / ( - size * price - ) - end as short_oi_pct - from - base -), - -total_oi as ( - select - id, - SUM( - market_oi_usd - prev_market_oi_usd - ) over ( - order by - ts asc - ) as total_oi_usd - from - oi -) - -select - base.*, - ROUND( - oi.market_oi_usd, - 2 - ) as market_oi_usd, - ROUND( - total_oi.total_oi_usd, - 2 - ) as total_oi_usd, - ROUND( - oi.long_oi, - 2 - ) as long_oi, - ROUND( - oi.short_oi, - 2 - ) as short_oi, - oi.long_oi_pct, - oi.short_oi_pct -from - base -inner join oi - on base.id = oi.id -inner join total_oi - on base.id = total_oi.id diff --git a/transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_markets_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_markets_base_sepolia.sql deleted file mode 100644 index a6d8f5f5..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_markets_base_sepolia.sql +++ /dev/null @@ -1,14 +0,0 @@ -with base as ( - select - perps_market_id as id, - block_timestamp as created_ts, - block_number, - market_symbol, - market_name - from - {{ ref('perp_market_created_base_sepolia') }} -) - -select * -from - base diff --git a/transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_orders_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_orders_base_sepolia.sql deleted file mode 100644 index fb8ca9a8..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_orders_base_sepolia.sql +++ /dev/null @@ -1,29 +0,0 @@ -with base as ( - select - oc.id, - oc.block_timestamp as ts, - oc.block_number, - oc.transaction_hash, - oc.contract, - oc.market_id, - markets.market_symbol, - CAST( - oc.account_id as text - ) as account_id, - oc.order_type, - {{ convert_wei('oc.size_delta') }} as size, - {{ convert_wei('oc.acceptable_price') }} as acceptable_price, - oc.settlement_time, - oc.expiration_time, - {{ convert_hex('oc.tracking_code') }} as tracking_code, - oc.sender - from - {{ ref('perp_order_committed_base_sepolia') }} - as oc - left join {{ ref('fct_perp_markets_base_sepolia') }} as markets - on oc.market_id = markets.id -) - -select * -from - base diff --git a/transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_pnl_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_pnl_base_sepolia.sql deleted file mode 100644 index 9ced20e3..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_pnl_base_sepolia.sql +++ /dev/null @@ -1,18 +0,0 @@ -{# DEPRECATED: deprecate this table in dashboards and remove #} -with debt as ( - select - ts, - 2 as market_id, - debt * -1 as market_pnl - from - {{ ref('core_vault_debt_base_sepolia') }} -) - -select - ts, - market_id, - market_pnl -from - debt -order by - ts diff --git a/transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_previous_order_expired_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_previous_order_expired_base_sepolia.sql deleted file mode 100644 index 94fc76d2..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_previous_order_expired_base_sepolia.sql +++ /dev/null @@ -1,15 +0,0 @@ -select - id, - block_timestamp, - block_number, - transaction_hash, - contract, - event_name, - market_id, - account_id, - commitment_time, - tracking_code, - {{ convert_wei("acceptable_price") }} as acceptable_price, - {{ convert_wei("size_delta") }} as size_delta -from - {{ ref("perp_previous_order_expired_base_sepolia") }} diff --git a/transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_trades_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_trades_base_sepolia.sql deleted file mode 100644 index 2ab97bf1..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_trades_base_sepolia.sql +++ /dev/null @@ -1,39 +0,0 @@ -with base as ( - select - pos.id, - pos.block_timestamp as ts, - pos.block_number, - pos.transaction_hash, - pos.contract, - pos.market_id, - markets.market_symbol, - CAST( - pos.account_id as text - ) as account_id, - {{ convert_wei('fill_price') }} as fill_price, - {{ convert_wei('pnl') }} as pnl, - {{ convert_wei('accrued_funding') }} as accrued_funding, - {{ convert_wei('size_delta') }} as trade_size, - {{ convert_wei('new_size') }} as position_size, - {{ convert_wei('total_fees') }} as total_fees, - {{ convert_wei('referral_fees') }} as referral_fees, - {{ convert_wei('collected_fees') }} as collected_fees, - {{ convert_wei('settlement_reward') }} as settlement_reward, - {{ convert_hex('tracking_code') }} as tracking_code, - pos.settler - from - {{ ref('perp_order_settled_base_sepolia') }} as pos - left join {{ ref('fct_perp_markets_base_sepolia') }} as markets - on pos.market_id = markets.id -) - -select - *, - ABS( - fill_price * trade_size - ) as notional_trade_size, - fill_price * position_size as notional_position_size, - total_fees - referral_fees - collected_fees - settlement_reward as lp_fees, - total_fees - settlement_reward as exchange_fees -from - base diff --git a/transformers/synthetix/models/marts/base/sepolia/perp/schema.yml b/transformers/synthetix/models/marts/base/sepolia/perp/schema.yml deleted file mode 100644 index 1dbca19d..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/perp/schema.yml +++ /dev/null @@ -1,664 +0,0 @@ -models: - - name: fct_perp_account_activity_base_sepolia - columns: - - name: ts - description: "Activity date" - data_type: date - tests: - - not_null - - name: dau - description: "Daily active users" - data_type: integer - tests: - - not_null - - name: mau - description: "Monthly active users" - data_type: integer - tests: - - not_null - - name: new_accounts_daily - description: "Daily new accounts" - data_type: integer - tests: - - not_null - - name: new_accounts_monthly - description: "Monthly new accounts" - data_type: integer - tests: - - not_null - - name: fct_perp_interest_charged_base_sepolia - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["InterestCharged"] - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: interest - description: "Interest amount" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fct_perp_collateral_modified_base_sepolia - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["CollateralModified"] - - name: synth_market_id - description: "Synth market ID" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: sender - data_type: text - tests: - - not_null - - name: amount_delta - data_type: numeric - - name: fct_perp_previous_order_expired_base_sepolia - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["PreviousOrderExpired"] - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: commitment_time - data_type: numeric - - name: tracking_code - data_type: text - - name: acceptable_price - data_type: numeric - - name: size_delta - data_type: numeric - - name: fct_perp_trades_base_sepolia - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: market_symbol - description: "Market symbol" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: text - tests: - - not_null - - name: fill_price - description: "Fill price (ETH)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: pnl - description: "PnL (ETH)" - data_type: numeric - tests: - - not_null - - name: accrued_funding - description: "Accrued funding (ETH)" - data_type: numeric - tests: - - not_null - - name: trade_size - description: "Trade size (ETH)" - data_type: numeric - tests: - - not_null - - name: position_size - description: "Position size" - data_type: numeric - tests: - - not_null - - name: total_fees - description: "Total fees (ETH)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: referral_fees - description: "Referral fees (ETH)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collected_fees - description: "Collected fees (ETH)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: settlement_reward - description: "Settlement reward (ETH)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: tracking_code - description: "Account tracking code" - data_type: text - tests: - - not_null - - name: settler - description: "Address of the settler" - data_type: text - tests: - - not_null - - name: notional_trade_size - description: "Notional trade size (ETH)" - data_type: numeric - tests: - - not_null - - name: notional_position_size - description: "Notional position size (ETH)" - data_type: numeric - tests: - - not_null - - name: lp_fees - description: "LP fees (ETH)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - severity: warn - min_value: 0 - inclusive: true - - name: exchange_fees - description: "Exchange fees (ETH)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fct_perp_pnl_base_sepolia - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: market_pnl - data_type: numeric - - name: fct_perp_orders_base_sepolia - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: market_symbol - description: "Market symbol" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: text - tests: - - not_null - - name: order_type - data_type: integer - - name: size - data_type: numeric - - name: acceptable_price - data_type: numeric - - name: settlement_time - data_type: numeric - - name: expiration_time - data_type: numeric - - name: tracking_code - data_type: text - - name: sender - data_type: text - - name: fct_perp_markets_base_sepolia - columns: - - name: id - description: "Market ID" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: created_ts - description: "Market creation timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: market_symbol - description: "Market symbol" - data_type: text - tests: - - not_null - - name: market_name - description: "Market name" - data_type: text - tests: - - not_null - - name: fct_perp_market_history_base_sepolia - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: market_symbol - description: "Market symbol" - data_type: text - tests: - - not_null - - name: price - description: "Price (USD)" - data_type: numeric - tests: - - not_null - - name: skew - description: "Skew (ETH)" - data_type: numeric - tests: - - not_null - - name: size - description: "Size (ETH)" - data_type: numeric - tests: - - not_null - - name: size_delta - description: "Size delta (ETH)" - data_type: numeric - tests: - - not_null - - name: funding_rate - description: "Funding rate (%)" - data_type: numeric - tests: - - not_null - - name: funding_velocity - description: "Funding velocity" - data_type: numeric - tests: - - not_null - - name: interest_rate - description: "Interest rate (%)" - data_type: numeric - tests: - - not_null - - name: funding_rate_apr - description: "Funding rate APR (%)" - data_type: numeric - tests: - - not_null - - name: long_rate_apr - description: "Long rate APR (%)" - data_type: numeric - tests: - - not_null - - name: short_rate_apr - description: "Short rate APR (%)" - data_type: numeric - tests: - - not_null - - name: prev_size - description: "Previous size (ETH)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: market_oi_usd - description: "Market open interest (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: total_oi_usd - description: "Total open interest (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: long_oi - description: "Long open interest (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: short_oi - description: "Short open interest (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: long_oi_pct - description: "Long open interest (%)" - data_type: numeric - - name: short_oi_pct - description: "Short open interest (%)" - data_type: numeric - - name: fct_perp_liq_position_base_sepolia - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: text - tests: - - not_null - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: market_symbol - description: "Market symbol" - data_type: text - tests: - - not_null - - name: amount_liquidated - description: "Amount liquidated" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: position_size - description: "Liquidated position size" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fct_perp_liq_account_base_sepolia - columns: - - name: account_id - description: "ID of the account" - data_type: text - tests: - - not_null - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: total_reward - description: "Total reward" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fct_perp_accounts_base_sepolia - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: created_ts - description: "Account creation timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: owner - description: "Address of the account owner" - data_type: text - tests: - - not_null diff --git a/transformers/synthetix/models/marts/base/sepolia/perp_stats/fct_perp_account_stats_daily_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/perp_stats/fct_perp_account_stats_daily_base_sepolia.sql deleted file mode 100644 index 89349825..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/perp_stats/fct_perp_account_stats_daily_base_sepolia.sql +++ /dev/null @@ -1,45 +0,0 @@ -with daily as ( - select - DATE_TRUNC( - 'day', - ts - ) as ts, - account_id, - SUM(fees) as fees, - SUM(volume) as volume, - SUM(amount_liquidated) as amount_liquidated, - SUM(liquidations) as liquidations - from - {{ ref('fct_perp_account_stats_hourly_base_sepolia') }} - group by - DATE_TRUNC( - 'day', - ts - ), - account_id -), - -stats as ( - select - *, - SUM(fees) over ( - partition by account_id - order by - ts - range between unbounded preceding - and current row - ) as cumulative_fees, - SUM(volume) over ( - partition by account_id - order by - ts - range between unbounded preceding - and current row - ) as cumulative_volume - from - daily -) - -select * -from - stats diff --git a/transformers/synthetix/models/marts/base/sepolia/perp_stats/fct_perp_account_stats_hourly_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/perp_stats/fct_perp_account_stats_hourly_base_sepolia.sql deleted file mode 100644 index 080dbbc5..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/perp_stats/fct_perp_account_stats_hourly_base_sepolia.sql +++ /dev/null @@ -1,119 +0,0 @@ -with trades as ( - select - ts, - account_id, - total_fees, - notional_trade_size, - 1 as trades, - SUM( - total_fees - ) over ( - partition by account_id - order by - ts - ) as cumulative_fees, - SUM( - notional_trade_size - ) over ( - partition by account_id - order by - ts - ) as cumulative_volume - from - {{ ref('fct_perp_trades_base_sepolia') }} -), - -liq as ( - select - ts, - account_id, - amount_liquidated, - 1 as liquidations - from - {{ ref('fct_perp_liq_position_base_sepolia') }} -), - -inc_trades as ( - select - DATE_TRUNC( - 'hour', - ts - ) as ts, - account_id, - SUM(trades) as trades, - SUM(total_fees) as fees, - SUM(notional_trade_size) as volume, - MAX(cumulative_fees) as cumulative_fees, - MAX(cumulative_volume) as cumulative_volume - from - trades - group by - DATE_TRUNC( - 'hour', - ts - ), - account_id -), - -inc_liq as ( - select - DATE_TRUNC( - 'hour', - ts - ) as ts, - account_id, - SUM(amount_liquidated) as amount_liquidated, - SUM(liquidations) as liquidations - from - liq - group by - DATE_TRUNC( - 'hour', - ts - ), - account_id -), - -inc as ( - select - h.ts, - h.account_id, - COALESCE( - h.trades, - 0 - ) as trades, - COALESCE( - h.fees, - 0 - ) as fees, - COALESCE( - h.volume, - 0 - ) as volume, - COALESCE( - l.amount_liquidated, - 0 - ) as amount_liquidated, - COALESCE( - l.liquidations, - 0 - ) as liquidations, - COALESCE( - h.cumulative_fees, - 0 - ) as cumulative_fees, - COALESCE( - h.cumulative_volume, - 0 - ) as cumulative_volume - from - inc_trades as h - left join inc_liq as l - on - h.ts = l.ts - and h.account_id = l.account_id -) - -select * -from - inc diff --git a/transformers/synthetix/models/marts/base/sepolia/perp_stats/fct_perp_keeper_stats_daily_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/perp_stats/fct_perp_keeper_stats_daily_base_sepolia.sql deleted file mode 100644 index a9f4dcfe..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/perp_stats/fct_perp_keeper_stats_daily_base_sepolia.sql +++ /dev/null @@ -1,44 +0,0 @@ -with hourly as ( - select - keeper, - settlement_rewards, - amount_settled, - trades, - DATE_TRUNC( - 'day', - ts - ) as ts - from - {{ ref('fct_perp_keeper_stats_hourly_base_sepolia') }} -), - -total as ( - select - ts, - SUM(trades) as trades_total, - SUM(settlement_rewards) as settlement_reward_total, - SUM(amount_settled) as amount_settled_total - from - hourly - group by - ts -) - -select - hourly.ts, - hourly.keeper, - SUM(hourly.trades) as trades, - SUM(hourly.settlement_rewards) as settlement_rewards, - SUM(hourly.amount_settled) as amount_settled, - SUM(hourly.trades) / MAX(total.trades_total) as trades_pct, - SUM(hourly.settlement_rewards) - / MAX(total.settlement_reward_total) as settlement_rewards_pct, - SUM(hourly.amount_settled) - / MAX(total.amount_settled_total) as amount_settled_pct -from - hourly -inner join total - on hourly.ts = total.ts -group by - hourly.ts, - hourly.keeper diff --git a/transformers/synthetix/models/marts/base/sepolia/perp_stats/fct_perp_keeper_stats_hourly_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/perp_stats/fct_perp_keeper_stats_hourly_base_sepolia.sql deleted file mode 100644 index dafcb25c..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/perp_stats/fct_perp_keeper_stats_hourly_base_sepolia.sql +++ /dev/null @@ -1,44 +0,0 @@ -with trades as ( - select - settler, - settlement_reward, - notional_trade_size, - 1 as trades, - DATE_TRUNC( - 'hour', - ts - ) as ts - from - {{ ref('fct_perp_trades_base_sepolia') }} -), - -total as ( - select - ts, - SUM(trades) as trades_total, - SUM(settlement_reward) as settlement_reward_total, - SUM(notional_trade_size) as notional_trade_size_total - from - trades - group by - ts -) - -select - trades.ts, - trades.settler as keeper, - SUM(trades.trades) as trades, - SUM(trades.settlement_reward) as settlement_rewards, - SUM(trades.notional_trade_size) as amount_settled, - SUM(trades.trades) / MAX(total.trades_total) as trades_pct, - SUM(trades.settlement_reward) - / MAX(total.settlement_reward_total) as settlement_rewards_pct, - SUM(trades.notional_trade_size) - / MAX(total.notional_trade_size_total) as amount_settled_pct -from - trades -inner join total - on trades.ts = total.ts -group by - trades.ts, - trades.settler diff --git a/transformers/synthetix/models/marts/base/sepolia/perp_stats/fct_perp_market_stats_daily_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/perp_stats/fct_perp_market_stats_daily_base_sepolia.sql deleted file mode 100644 index 5778bf3f..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/perp_stats/fct_perp_market_stats_daily_base_sepolia.sql +++ /dev/null @@ -1,25 +0,0 @@ -select - DATE_TRUNC( - 'day', - ts - ) as ts, - market_symbol, - SUM(trades) as trades, - SUM(exchange_fees) as exchange_fees, - SUM(referral_fees) as referral_fees, - SUM(collected_fees) as collected_fees, - SUM(volume) as volume, - SUM(amount_liquidated) as amount_liquidated, - SUM(liquidations) as liquidations, - MAX(cumulative_exchange_fees) as cumulative_exchange_fees, - MAX(cumulative_referral_fees) as cumulative_referral_fees, - MAX(cumulative_collected_fees) as cumulative_collected_fees, - MAX(cumulative_volume) as cumulative_volume -from - {{ ref('fct_perp_market_stats_hourly_base_sepolia') }} -group by - DATE_TRUNC( - 'day', - ts - ), - market_symbol diff --git a/transformers/synthetix/models/marts/base/sepolia/perp_stats/fct_perp_market_stats_hourly_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/perp_stats/fct_perp_market_stats_hourly_base_sepolia.sql deleted file mode 100644 index 0b9e09be..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/perp_stats/fct_perp_market_stats_hourly_base_sepolia.sql +++ /dev/null @@ -1,162 +0,0 @@ -with trades as ( - select - ts, - market_symbol, - exchange_fees, - referral_fees, - collected_fees, - notional_trade_size, - 1 as trades - from - {{ ref('fct_perp_trades_base_sepolia') }} -), - -liq as ( - select - ts, - market_symbol, - amount_liquidated, - 1 as liquidations - from - {{ ref('fct_perp_liq_position_base_sepolia') }} -), - -inc_trades as ( - select - DATE_TRUNC( - 'hour', - ts - ) as ts, - market_symbol, - SUM(trades) as trades, - SUM(exchange_fees) as exchange_fees, - SUM(referral_fees) as referral_fees, - SUM(collected_fees) as collected_fees, - SUM(notional_trade_size) as volume - from - trades - group by - DATE_TRUNC( - 'hour', - ts - ), - market_symbol -), - -inc_liq as ( - select - DATE_TRUNC( - 'hour', - ts - ) as ts, - market_symbol, - SUM(amount_liquidated) as amount_liquidated, - SUM(liquidations) as liquidations - from - liq - group by - DATE_TRUNC( - 'hour', - ts - ), - market_symbol -), - -dim as ( - select - m.market_symbol, - GENERATE_SERIES( - DATE_TRUNC('hour', MIN(t.ts)), - DATE_TRUNC('hour', MAX(t.ts)), - '1 hour'::INTERVAL - ) as ts - from - ( - select ts - from - trades - ) as t - cross join ( - select distinct market_symbol - from - trades - ) as m - group by - m.market_symbol -), - -inc as ( - select - dim.ts, - dim.market_symbol, - COALESCE( - h.trades, - 0 - ) as trades, - COALESCE( - h.exchange_fees, - 0 - ) as exchange_fees, - COALESCE( - h.referral_fees, - 0 - ) as referral_fees, - COALESCE( - h.collected_fees, - 0 - ) as collected_fees, - COALESCE( - h.volume, - 0 - ) as volume, - COALESCE( - l.amount_liquidated, - 0 - ) as amount_liquidated, - COALESCE( - l.liquidations, - 0 - ) as liquidations, - SUM( - h.exchange_fees - ) over ( - partition by dim.market_symbol - order by - dim.ts - ) as cumulative_exchange_fees, - SUM( - h.referral_fees - ) over ( - partition by dim.market_symbol - order by - dim.ts - ) as cumulative_referral_fees, - SUM( - h.collected_fees - ) over ( - partition by dim.market_symbol - order by - dim.ts - ) as cumulative_collected_fees, - SUM( - h.volume - ) over ( - partition by dim.market_symbol - order by - dim.ts - ) as cumulative_volume - from - dim - left join inc_trades as h - on - dim.ts = h.ts - and dim.market_symbol = h.market_symbol - left join inc_liq as l - on - dim.ts = l.ts - and dim.market_symbol = l.market_symbol -) - -select * -from - inc diff --git a/transformers/synthetix/models/marts/base/sepolia/perp_stats/fct_perp_stats_daily_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/perp_stats/fct_perp_stats_daily_base_sepolia.sql deleted file mode 100644 index 65d232f5..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/perp_stats/fct_perp_stats_daily_base_sepolia.sql +++ /dev/null @@ -1,23 +0,0 @@ -select - DATE_TRUNC( - 'day', - ts - ) as ts, - SUM(trades) as trades, - SUM(exchange_fees) as exchange_fees, - SUM(referral_fees) as referral_fees, - SUM(collected_fees) as collected_fees, - SUM(volume) as volume, - SUM(liquidation_rewards) as liquidation_rewards, - SUM(liquidated_accounts) as liquidated_accounts, - MAX(cumulative_exchange_fees) as cumulative_exchange_fees, - MAX(cumulative_referral_fees) as cumulative_referral_fees, - MAX(cumulative_collected_fees) as cumulative_collected_fees, - MAX(cumulative_volume) as cumulative_volume -from - {{ ref('fct_perp_stats_hourly_base_sepolia') }} -group by - DATE_TRUNC( - 'day', - ts - ) diff --git a/transformers/synthetix/models/marts/base/sepolia/perp_stats/fct_perp_stats_hourly_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/perp_stats/fct_perp_stats_hourly_base_sepolia.sql deleted file mode 100644 index 64e62bc5..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/perp_stats/fct_perp_stats_hourly_base_sepolia.sql +++ /dev/null @@ -1,91 +0,0 @@ -with inc_market as ( - select - ts, - market_symbol, - trades, - exchange_fees, - referral_fees, - collected_fees, - volume, - liquidations, - cumulative_exchange_fees, - cumulative_referral_fees, - cumulative_collected_fees, - cumulative_volume - from - {{ ref('fct_perp_market_stats_hourly_base_sepolia') }} -), - -liq as ( - select - ts, - total_reward, - 1 as liquidated_accounts - from - {{ ref('fct_perp_liq_account_base_sepolia') }} -), - -inc_liq as ( - select - DATE_TRUNC( - 'hour', - ts - ) as ts, - SUM(total_reward) as liquidation_rewards, - SUM(liquidated_accounts) as liquidated_accounts - from - liq - group by - DATE_TRUNC( - 'hour', - ts - ) -), - -inc_trade as ( - select - ts, - SUM(trades) as trades, - SUM(exchange_fees) as exchange_fees, - SUM(referral_fees) as referral_fees, - SUM(collected_fees) as collected_fees, - SUM(volume) as volume, - SUM(cumulative_exchange_fees) as cumulative_exchange_fees, - SUM(cumulative_referral_fees) as cumulative_referral_fees, - SUM(cumulative_collected_fees) as cumulative_collected_fees, - SUM(cumulative_volume) as cumulative_volume - from - inc_market - group by - ts -), - -inc as ( - select - h.ts, - h.trades, - h.exchange_fees, - h.referral_fees, - h.collected_fees, - h.volume, - h.cumulative_exchange_fees, - h.cumulative_referral_fees, - h.cumulative_collected_fees, - h.cumulative_volume, - COALESCE( - l.liquidation_rewards, - 0 - ) as liquidation_rewards, - COALESCE( - l.liquidated_accounts, - 0 - ) as liquidated_accounts - from - inc_trade as h - left join inc_liq as l - on h.ts = l.ts -) - -select * -from - inc diff --git a/transformers/synthetix/models/marts/base/sepolia/perp_stats/fct_perp_tracking_stats_daily_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/perp_stats/fct_perp_tracking_stats_daily_base_sepolia.sql deleted file mode 100644 index 78a599e4..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/perp_stats/fct_perp_tracking_stats_daily_base_sepolia.sql +++ /dev/null @@ -1,93 +0,0 @@ -with trades as ( - select - DATE_TRUNC( - 'day', - ts - ) as ts, - tracking_code, - SUM(exchange_fees) as exchange_fees, - SUM(referral_fees) as referral_fees, - SUM(collected_fees) as collected_fees, - SUM(volume) as volume, - SUM(trades) as trades - from - {{ ref('fct_perp_tracking_stats_hourly_base_sepolia') }} - group by - DATE_TRUNC( - 'day', - ts - ), - tracking_code -), - -accounts as ( - select - DATE_TRUNC( - 'day', - ts - ) as ts, - tracking_code, - COUNT( - distinct account_id - ) as "accounts" - from - {{ ref('fct_perp_trades_base_sepolia') }} - group by - DATE_TRUNC( - 'day', - ts - ), - tracking_code -), - -total as ( - select - ts, - SUM(exchange_fees) as exchange_fees_total, - SUM(referral_fees) as referral_fees_total, - SUM(collected_fees) as collected_fees_total, - SUM(volume) as volume_total, - SUM(trades) as trades_total - from - trades - group by - ts -) - -select - trades.ts, - trades.tracking_code, - trades.exchange_fees, - trades.referral_fees, - trades.collected_fees, - trades.volume, - trades.trades, - accounts.accounts, - case - when total.exchange_fees_total = 0 then 0 - else trades.exchange_fees / total.exchange_fees_total - end as exchange_fees_share, - case - when total.referral_fees_total = 0 then 0 - else trades.referral_fees / total.referral_fees_total - end as referral_fees_share, - case - when total.collected_fees_total = 0 then 0 - else trades.collected_fees / total.collected_fees_total - end as collected_fees_share, - case - when total.volume_total = 0 then 0 - else trades.volume / total.volume_total - end as volume_share, - case - when total.trades_total = 0 then 0 - else trades.trades / total.trades_total - end as trades_share -from - trades -inner join accounts - on - trades.ts = accounts.ts - and trades.tracking_code = accounts.tracking_code -inner join total - on trades.ts = total.ts diff --git a/transformers/synthetix/models/marts/base/sepolia/perp_stats/fct_perp_tracking_stats_hourly_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/perp_stats/fct_perp_tracking_stats_hourly_base_sepolia.sql deleted file mode 100644 index c90782fe..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/perp_stats/fct_perp_tracking_stats_hourly_base_sepolia.sql +++ /dev/null @@ -1,93 +0,0 @@ -with trades as ( - select - DATE_TRUNC( - 'hour', - ts - ) as ts, - tracking_code, - SUM(exchange_fees) as exchange_fees, - SUM(referral_fees) as referral_fees, - SUM(collected_fees) as collected_fees, - SUM(notional_trade_size) as volume, - SUM(1) as trades - from - {{ ref('fct_perp_trades_base_sepolia') }} - group by - DATE_TRUNC( - 'hour', - ts - ), - tracking_code -), - -accounts as ( - select - DATE_TRUNC( - 'hour', - ts - ) as ts, - tracking_code, - COUNT( - distinct account_id - ) as "accounts" - from - {{ ref('fct_perp_trades_base_sepolia') }} - group by - DATE_TRUNC( - 'hour', - ts - ), - tracking_code -), - -total as ( - select - ts, - SUM(trades) as trades_total, - SUM(exchange_fees) as exchange_fees_total, - SUM(referral_fees) as referral_fees_total, - SUM(collected_fees) as collected_fees_total, - SUM(volume) as volume_total - from - trades - group by - ts -) - -select - trades.ts, - trades.tracking_code, - trades.exchange_fees, - trades.referral_fees, - trades.collected_fees, - trades.volume, - trades.trades, - accounts.accounts, - case - when total.exchange_fees_total = 0 then 0 - else trades.exchange_fees / total.exchange_fees_total - end as exchange_fees_share, - case - when total.referral_fees_total = 0 then 0 - else trades.referral_fees / total.referral_fees_total - end as referral_fees_share, - case - when total.collected_fees_total = 0 then 0 - else trades.collected_fees / total.collected_fees_total - end as collected_fees_share, - case - when total.volume_total = 0 then 0 - else trades.volume / total.volume_total - end as volume_share, - case - when total.trades_total = 0 then 0 - else trades.trades / total.trades_total - end as trades_share -from - trades -inner join accounts - on - trades.ts = accounts.ts - and trades.tracking_code = accounts.tracking_code -inner join total - on trades.ts = total.ts diff --git a/transformers/synthetix/models/marts/base/sepolia/perp_stats/schema.yml b/transformers/synthetix/models/marts/base/sepolia/perp_stats/schema.yml deleted file mode 100644 index 4ef76fb9..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/perp_stats/schema.yml +++ /dev/null @@ -1,239 +0,0 @@ -models: - - name: fct_perp_tracking_stats_hourly_base_sepolia - columns: - - name: ts - data_type: timestamp with time zone - - name: tracking_code - data_type: text - - name: exchange_fees - data_type: numeric - - name: referral_fees - data_type: numeric - - name: collected_fees - data_type: numeric - - name: volume - data_type: numeric - - name: trades - data_type: bigint - - name: accounts - data_type: bigint - - name: exchange_fees_share - data_type: numeric - - name: referral_fees_share - data_type: numeric - - name: collected_fees_share - data_type: numeric - - name: volume_share - data_type: numeric - - name: trades_share - data_type: numeric - - name: fct_perp_tracking_stats_daily_base_sepolia - columns: - - name: ts - data_type: timestamp with time zone - - name: tracking_code - data_type: text - - name: exchange_fees - data_type: numeric - - name: referral_fees - data_type: numeric - - name: collected_fees - data_type: numeric - - name: volume - data_type: numeric - - name: trades - data_type: numeric - - name: accounts - data_type: bigint - - name: exchange_fees_share - data_type: numeric - - name: referral_fees_share - data_type: numeric - - name: collected_fees_share - data_type: numeric - - name: volume_share - data_type: numeric - - name: trades_share - data_type: numeric - - name: fct_perp_stats_hourly_base_sepolia - columns: - - name: ts - data_type: timestamp with time zone - - name: trades - data_type: numeric - - name: exchange_fees - data_type: numeric - - name: referral_fees - data_type: numeric - - name: collected_fees - data_type: numeric - - name: volume - data_type: numeric - - name: liquidation_rewards - data_type: numeric - - name: liquidated_accounts - data_type: bigint - - name: cumulative_exchange_fees - data_type: numeric - - name: cumulative_referral_fees - data_type: numeric - - name: cumulative_collected_fees - data_type: numeric - - name: cumulative_volume - data_type: numeric - - name: fct_perp_stats_daily_base_sepolia - columns: - - name: ts - data_type: timestamp with time zone - - name: trades - data_type: numeric - - name: exchange_fees - data_type: numeric - - name: referral_fees - data_type: numeric - - name: collected_fees - data_type: numeric - - name: volume - data_type: numeric - - name: liquidation_rewards - data_type: numeric - - name: liquidated_accounts - data_type: numeric - - name: cumulative_exchange_fees - data_type: numeric - - name: cumulative_referral_fees - data_type: numeric - - name: cumulative_collected_fees - data_type: numeric - - name: cumulative_volume - data_type: numeric - - name: fct_perp_market_stats_hourly_base_sepolia - columns: - - name: ts - data_type: timestamp with time zone - - name: market_symbol - data_type: text - - name: trades - data_type: bigint - - name: exchange_fees - data_type: numeric - - name: referral_fees - data_type: numeric - - name: collected_fees - data_type: numeric - - name: volume - data_type: numeric - - name: amount_liquidated - data_type: numeric - - name: liquidations - data_type: bigint - - name: cumulative_exchange_fees - data_type: numeric - - name: cumulative_referral_fees - data_type: numeric - - name: cumulative_collected_fees - data_type: numeric - - name: cumulative_volume - data_type: numeric - - name: fct_perp_market_stats_daily_base_sepolia - columns: - - name: ts - data_type: timestamp with time zone - - name: market_symbol - data_type: text - - name: trades - data_type: numeric - - name: exchange_fees - data_type: numeric - - name: referral_fees - data_type: numeric - - name: collected_fees - data_type: numeric - - name: volume - data_type: numeric - - name: amount_liquidated - data_type: numeric - - name: liquidations - data_type: numeric - - name: cumulative_exchange_fees - data_type: numeric - - name: cumulative_referral_fees - data_type: numeric - - name: cumulative_collected_fees - data_type: numeric - - name: cumulative_volume - data_type: numeric - - name: fct_perp_keeper_stats_hourly_base_sepolia - columns: - - name: ts - data_type: timestamp with time zone - - name: keeper - data_type: text - - name: trades - data_type: bigint - - name: settlement_rewards - data_type: numeric - - name: amount_settled - data_type: numeric - - name: trades_pct - data_type: bigint - - name: settlement_rewards_pct - data_type: numeric - - name: amount_settled_pct - data_type: numeric - - name: fct_perp_keeper_stats_daily_base_sepolia - columns: - - name: ts - data_type: timestamp with time zone - - name: keeper - data_type: text - - name: trades - data_type: numeric - - name: settlement_rewards - data_type: numeric - - name: amount_settled - data_type: numeric - - name: trades_pct - data_type: numeric - - name: settlement_rewards_pct - data_type: numeric - - name: amount_settled_pct - data_type: numeric - - name: fct_perp_account_stats_hourly_base_sepolia - columns: - - name: ts - data_type: timestamp with time zone - - name: account_id - data_type: text - - name: trades - data_type: bigint - - name: fees - data_type: numeric - - name: volume - data_type: numeric - - name: amount_liquidated - data_type: numeric - - name: liquidations - data_type: bigint - - name: cumulative_fees - data_type: numeric - - name: cumulative_volume - data_type: numeric - - name: fct_perp_account_stats_daily_base_sepolia - columns: - - name: ts - data_type: timestamp with time zone - - name: account_id - data_type: text - - name: fees - data_type: numeric - - name: volume - data_type: numeric - - name: amount_liquidated - data_type: numeric - - name: liquidations - data_type: numeric - - name: cumulative_fees - data_type: numeric - - name: cumulative_volume - data_type: numeric diff --git a/transformers/synthetix/models/marts/base/sepolia/prices/fct_prices_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/prices/fct_prices_base_sepolia.sql deleted file mode 100644 index b9906bee..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/prices/fct_prices_base_sepolia.sql +++ /dev/null @@ -1,54 +0,0 @@ -with all_prices as ( - select - ts, - null as market_address, - market_symbol, - price - from - {{ ref('fct_perp_market_history_base_sepolia') }} - union all - select - ts, - null as market_address, - 'SNX' as market_symbol, - snx_price as price - from - {{ ref('fct_buyback_base_sepolia') }} - where - snx_price > 0 - union all - select - ts, - collateral_type as market_address, - null as market_symbol, - collateral_value / amount as price - from - {{ ref('core_vault_collateral_base_sepolia') }} - where - collateral_value > 0 -), - -tokens as ( - select - token_address, - token_symbol - from - {{ ref('base_sepolia_tokens') }} -) - -select - p.ts, - p.market_address, - p.price, - COALESCE( - t.token_symbol, - p.market_symbol - ) as market_symbol -from - all_prices as p -left join tokens as t - on LOWER( - p.market_address - ) = LOWER( - t.token_address - ) diff --git a/transformers/synthetix/models/marts/base/sepolia/prices/fct_prices_hourly_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/prices/fct_prices_hourly_base_sepolia.sql deleted file mode 100644 index 1e297106..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/prices/fct_prices_hourly_base_sepolia.sql +++ /dev/null @@ -1,72 +0,0 @@ -with prices as ( - select distinct - market_symbol, - DATE_TRUNC( - 'hour', - ts - ) as ts, - LAST_VALUE(price) over ( - partition by DATE_TRUNC('hour', ts), market_symbol - order by - ts - rows between unbounded preceding - and unbounded following - ) as price - from - {{ ref('fct_prices_base_sepolia') }} -), - -dim as ( - select - m.market_symbol, - GENERATE_SERIES( - DATE_TRUNC('hour', MIN(t.ts)), - DATE_TRUNC('hour', MAX(t.ts)), - '1 hour'::INTERVAL - ) as ts - from - ( - select ts - from - prices - ) as t - cross join ( - select distinct market_symbol - from - prices - ) as m - group by - m.market_symbol -), - -ffill as ( - select - dim.ts, - dim.market_symbol, - LAST(prices.price) over ( - partition by dim.market_symbol - order by dim.ts - rows between unbounded preceding and current row - ) as price - from - dim - left join prices - on - dim.ts = prices.ts - and dim.market_symbol = prices.market_symbol -), - -hourly_prices as ( - select - ts, - market_symbol, - price - from - ffill -) - -select * -from - hourly_prices -where - price is not null diff --git a/transformers/synthetix/models/marts/base/sepolia/prices/schema.yml b/transformers/synthetix/models/marts/base/sepolia/prices/schema.yml deleted file mode 100644 index ec390256..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/prices/schema.yml +++ /dev/null @@ -1,44 +0,0 @@ -models: - - name: fct_prices_base_sepolia - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: market_address - description: "Market address" - data_type: text - - name: market_symbol - description: "Market symbol" - data_type: text - tests: - - not_null - - name: price - description: "Price" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fct_prices_hourly_base_sepolia - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: market_symbol - description: "Market symbol" - data_type: text - tests: - - not_null - - name: price - description: "Price" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true diff --git a/transformers/synthetix/models/marts/base/sepolia/spot/fct_spot_atomics_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/spot/fct_spot_atomics_base_sepolia.sql deleted file mode 100644 index 699a6450..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/spot/fct_spot_atomics_base_sepolia.sql +++ /dev/null @@ -1,53 +0,0 @@ -with bought as ( - select - id, - block_timestamp as ts, - block_number, - transaction_hash as tx_hash, - synth_market_id, - {{ convert_wei('price') }} as price, - {{ convert_wei('synth_returned') }} as amount, - referrer - from - {{ ref('spot_synth_bought_base_sepolia') }} -), - -sold as ( - select - id, - block_timestamp as ts, - block_number, - transaction_hash as tx_hash, - synth_market_id, - {{ convert_wei('price') }} as price, - -1 * {{ convert_wei('amount_returned') }} as amount, - referrer - from - {{ ref('spot_synth_sold_base_sepolia') }} -) - -select - id, - ts, - block_number, - tx_hash, - synth_market_id, - price, - amount, - referrer -from - bought -union all -select - id, - ts, - block_number, - tx_hash, - synth_market_id, - price, - amount, - referrer -from - sold -order by - ts diff --git a/transformers/synthetix/models/marts/base/sepolia/spot/fct_spot_markets_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/spot/fct_spot_markets_base_sepolia.sql deleted file mode 100644 index 30baec15..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/spot/fct_spot_markets_base_sepolia.sql +++ /dev/null @@ -1,13 +0,0 @@ -with base as ( - select - synth_market_id as id, - block_timestamp as created_ts, - block_number, - synth_token_address as token_address - from - {{ ref('spot_synth_registered_base_sepolia') }} -) - -select * -from - base diff --git a/transformers/synthetix/models/marts/base/sepolia/spot/fct_spot_wrapper_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/spot/fct_spot_wrapper_base_sepolia.sql deleted file mode 100644 index 63117e07..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/spot/fct_spot_wrapper_base_sepolia.sql +++ /dev/null @@ -1,45 +0,0 @@ -with wraps as ( - select - id, - block_timestamp as ts, - block_number, - transaction_hash as tx_hash, - synth_market_id, - {{ convert_wei('amount_wrapped') }} as amount_wrapped - from - {{ ref('spot_synth_wrapped_base_sepolia') }} -), - -unwraps as ( - select - id, - block_timestamp as ts, - block_number, - transaction_hash as tx_hash, - synth_market_id, - -1 * {{ convert_wei('amount_unwrapped') }} as amount_wrapped - from - {{ ref('spot_synth_unwrapped_base_sepolia') }} -) - -select - id, - ts, - block_number, - tx_hash, - synth_market_id, - amount_wrapped -from - wraps -union all -select - id, - ts, - block_number, - tx_hash, - synth_market_id, - amount_wrapped -from - unwraps -order by - ts diff --git a/transformers/synthetix/models/marts/base/sepolia/spot/fct_synth_supply_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/spot/fct_synth_supply_base_sepolia.sql deleted file mode 100644 index 1d14be59..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/spot/fct_synth_supply_base_sepolia.sql +++ /dev/null @@ -1,72 +0,0 @@ -with wrapper as ( - select - ts, - block_number, - synth_market_id, - amount_wrapped as change_amount - from - {{ ref('fct_spot_wrapper_base_sepolia') }} -), - -atomics as ( - select - ts, - block_number, - synth_market_id, - amount as change_amount - from - {{ ref('fct_spot_atomics_base_sepolia') }} - union all - select - ts, - block_number, - 0 as synth_market_id, - amount * price * -1 as change_amount - from - {{ ref('fct_spot_atomics_base_sepolia') }} -), - -usd_changes as ( - select - block_timestamp as ts, - block_number, - 0 as synth_market_id, - {{ convert_wei("amount") }} as change_amount - from - {{ ref('core_usd_minted_base_sepolia') }} - union all - select - block_timestamp as ts, - block_number, - 0 as synth_market_id, - -1 * {{ convert_wei("amount") }} as change_amount - from - {{ ref('core_usd_burned_base_sepolia') }} -), - -all_changes as ( - select * - from - wrapper - union all - select * - from - atomics - union all - select * - from - usd_changes -) - -select - ts, - block_number, - synth_market_id, - SUM(change_amount) over ( - partition by synth_market_id - order by - ts, - block_number - ) as supply -from - all_changes diff --git a/transformers/synthetix/models/marts/base/sepolia/spot/schema.yml b/transformers/synthetix/models/marts/base/sepolia/spot/schema.yml deleted file mode 100644 index b6c561f8..00000000 --- a/transformers/synthetix/models/marts/base/sepolia/spot/schema.yml +++ /dev/null @@ -1,132 +0,0 @@ -models: - - name: fct_synth_supply_base_sepolia - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: synth_market_id - description: "Synth market ID" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: supply - description: "Supply" - data_type: numeric - tests: - - not_null - - name: fct_spot_atomics_base_sepolia - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: tx_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: synth_market_id - description: "Synth market ID" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: price - description: "Price" - data_type: numeric - tests: - - not_null - - name: amount - description: "Amount" - data_type: numeric - tests: - - not_null - - name: referrer - description: "Address of the referrer" - data_type: text - tests: - - not_null - - name: fct_spot_markets_base_sepolia - columns: - - name: id - description: "Synth market ID" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: created_ts - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: token_address - description: "Token address" - data_type: text - tests: - - not_null - - name: fct_spot_wrapper_base_sepolia - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: tx_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: synth_market_id - description: "Synth market ID" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: amount_wrapped - description: "Amount wrapped" - data_type: numeric - tests: - - not_null diff --git a/transformers/synthetix/models/marts/eth/mainnet/core/fct_core_account_activity_eth_mainnet.sql b/transformers/synthetix/models/marts/eth/mainnet/core/fct_core_account_activity_eth_mainnet.sql deleted file mode 100644 index d35a5e97..00000000 --- a/transformers/synthetix/models/marts/eth/mainnet/core/fct_core_account_activity_eth_mainnet.sql +++ /dev/null @@ -1,42 +0,0 @@ -{{ config( - materialized = "view", - tags = ["core", "account_activity", "daily", "eth", "mainnet"] -) }} - -with delegated as ( - select distinct - block_timestamp, - account_id, - 'Delegated' as account_action - from {{ ref('core_delegation_updated_eth_mainnet') }} -), - -withdrawn as ( - select - block_timestamp, - account_id, - 'Withdrawn' as account_action - from {{ ref('core_withdrawn_eth_mainnet') }} -), - -claimed as ( - select - block_timestamp, - account_id, - 'Claimed' as account_action - from {{ ref('core_rewards_claimed_eth_mainnet') }} -), - -combined as ( - select * from delegated - union all - select * from withdrawn - union all - select * from claimed -) - -select - block_timestamp, - account_action, - account_id -from combined diff --git a/transformers/synthetix/models/marts/eth/mainnet/core/fct_core_account_delegation_eth_mainnet.sql b/transformers/synthetix/models/marts/eth/mainnet/core/fct_core_account_delegation_eth_mainnet.sql deleted file mode 100644 index b9880525..00000000 --- a/transformers/synthetix/models/marts/eth/mainnet/core/fct_core_account_delegation_eth_mainnet.sql +++ /dev/null @@ -1,60 +0,0 @@ -with delegation_changes as ( - select - block_timestamp, - account_id, - pool_id, - collateral_type, - {{ convert_wei('amount') }} - - LAG({{ convert_wei('amount') }}, 1, 0) over ( - partition by - account_id, - pool_id, - collateral_type - order by - block_timestamp - ) as change_in_amount - from - {{ ref('core_delegation_updated_eth_mainnet') }} -), - -cumulative_delegation as ( - select - block_timestamp, - account_id, - pool_id, - collateral_type, - SUM(change_in_amount) over ( - partition by - pool_id, - account_id, - collateral_type - order by - block_timestamp - ) as cumulative_amount_delegated, - ROW_NUMBER() over ( - partition by - pool_id, - account_id, - collateral_type - order by - block_timestamp desc - ) as rn - from - delegation_changes -) - -select - block_timestamp as ts, - pool_id, - collateral_type, - cumulative_amount_delegated as amount_delegated, - CAST( - account_id as text - ) as account_id -from - cumulative_delegation -where - rn = 1 -order by - block_timestamp, - collateral_type diff --git a/transformers/synthetix/models/marts/eth/mainnet/core/fct_core_active_stakers_daily_eth_mainnet.sql b/transformers/synthetix/models/marts/eth/mainnet/core/fct_core_active_stakers_daily_eth_mainnet.sql deleted file mode 100644 index 82dd35aa..00000000 --- a/transformers/synthetix/models/marts/eth/mainnet/core/fct_core_active_stakers_daily_eth_mainnet.sql +++ /dev/null @@ -1,52 +0,0 @@ -{{ config( - materialized = "view", - tags = ["core", "active_stakers", "daily", "eth", "mainnet"] -) }} - -with delegation_updated as ( - select - block_timestamp, - account_id, - amount - from {{ ref('core_delegation_updated_eth_mainnet') }} -), - -dim as ( - select - d.block_date, - accounts_unique.account_id - from ( - select - generate_series( - date_trunc('day', date('2023-12-15')), - date_trunc('day', current_date), '1 day'::interval - ) as block_date - ) as d - cross join ( - select distinct account_id from delegation_updated - ) as accounts_unique -), - -stakers as ( - select - dim.block_date, - dim.account_id, - case - when coalesce(last(delegation_updated.amount) over ( - partition by dim.account_id - order by dim.block_date - rows between unbounded preceding and current row - ), 0) = 0 then 0 - else 1 - end as is_staking - from dim - left join delegation_updated on - dim.block_date = date(delegation_updated.block_timestamp) - and dim.account_id = delegation_updated.account_id -) - -select - block_date, - sum(is_staking) as nof_stakers_daily -from stakers -group by block_date diff --git a/transformers/synthetix/models/marts/eth/mainnet/core/fct_core_apr_eth_mainnet.sql b/transformers/synthetix/models/marts/eth/mainnet/core/fct_core_apr_eth_mainnet.sql deleted file mode 100644 index 511ed391..00000000 --- a/transformers/synthetix/models/marts/eth/mainnet/core/fct_core_apr_eth_mainnet.sql +++ /dev/null @@ -1,241 +0,0 @@ -{{ - config( - materialized = 'table', - ) -}} - -with pnl_hourly as ( - select - ts, - pool_id, - collateral_type, - collateral_value, - debt, - hourly_pnl, - hourly_issuance, - hourly_debt_migrated, - rewards_usd, - hourly_pnl_pct, - hourly_rewards_pct, - hourly_total_pct, - SUM( - COALESCE( - hourly_issuance, - 0 - ) - ) over ( - partition by - pool_id, - collateral_type - order by - ts - ) as cumulative_issuance, - SUM( - hourly_pnl - ) over ( - partition by - pool_id, - collateral_type - order by - ts - ) as cumulative_pnl - from - {{ ref('fct_pool_pnl_hourly_eth_mainnet') }} -), - -avg_returns as ( - select - ts, - pool_id, - collateral_type, - AVG( - hourly_pnl_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '24 HOURS' preceding - and current row - ) as avg_24h_pnl_pct, - AVG( - hourly_pnl_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '7 DAYS' preceding - and current row - ) as avg_7d_pnl_pct, - AVG( - hourly_pnl_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '28 DAYS' preceding - and current row - ) as avg_28d_pnl_pct, - AVG( - hourly_rewards_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '24 HOURS' preceding - and current row - ) as avg_24h_rewards_pct, - AVG( - hourly_rewards_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '7 DAYS' preceding - and current row - ) as avg_7d_rewards_pct, - AVG( - hourly_rewards_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '28 DAYS' preceding - and current row - ) as avg_28d_rewards_pct, - AVG( - hourly_total_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '24 HOURS' preceding - and current row - ) as avg_24h_total_pct, - AVG( - hourly_total_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '7 DAYS' preceding - and current row - ) as avg_7d_total_pct, - AVG( - hourly_total_pct - ) over ( - partition by - pool_id, - collateral_type - order by - ts - range between interval '28 DAYS' preceding - and current row - ) as avg_28d_total_pct - from - pnl_hourly -), - -apr_calculations as ( - select - pnl_hourly.ts, - pnl_hourly.pool_id, - pnl_hourly.collateral_type, - pnl_hourly.collateral_value, - pnl_hourly.debt, - pnl_hourly.hourly_pnl, - pnl_hourly.cumulative_pnl, - pnl_hourly.hourly_issuance, - pnl_hourly.hourly_debt_migrated, - pnl_hourly.cumulative_issuance, - pnl_hourly.rewards_usd, - pnl_hourly.hourly_pnl_pct, - pnl_hourly.hourly_rewards_pct, - -- total pnls - avg_returns.avg_24h_total_pct * 24 * 365 as apr_24h, - avg_returns.avg_7d_total_pct * 24 * 365 as apr_7d, - avg_returns.avg_28d_total_pct * 24 * 365 as apr_28d, - -- pool pnls - avg_returns.avg_24h_pnl_pct * 24 * 365 as apr_24h_pnl, - avg_returns.avg_7d_pnl_pct * 24 * 365 as apr_7d_pnl, - avg_returns.avg_28d_pnl_pct * 24 * 365 as apr_28d_pnl, - -- rewards pnls - avg_returns.avg_24h_rewards_pct * 24 * 365 as apr_24h_rewards, - avg_returns.avg_7d_rewards_pct * 24 * 365 as apr_7d_rewards, - avg_returns.avg_28d_rewards_pct * 24 * 365 as apr_28d_rewards - from - pnl_hourly - inner join avg_returns - on - pnl_hourly.ts = avg_returns.ts - and pnl_hourly.pool_id = avg_returns.pool_id - and pnl_hourly.collateral_type = avg_returns.collateral_type -), - -apy_calculations as ( - select - *, - (POWER(1 + apr_24h / 8760, 8760) - 1) as apy_24h, - (POWER(1 + apr_7d / 8760, 8760) - 1) as apy_7d, - (POWER(1 + apr_28d / 8760, 8760) - 1) as apy_28d, - (POWER(1 + apr_24h_pnl / 8760, 8760) - 1) as apy_24h_pnl, - (POWER(1 + apr_7d_pnl / 8760, 8760) - 1) as apy_7d_pnl, - (POWER(1 + apr_28d_pnl / 8760, 8760) - 1) as apy_28d_pnl, - (POWER(1 + apr_24h_rewards / 8760, 8760) - 1) as apy_24h_rewards, - (POWER(1 + apr_7d_rewards / 8760, 8760) - 1) as apy_7d_rewards, - (POWER(1 + apr_28d_rewards / 8760, 8760) - 1) as apy_28d_rewards - from - apr_calculations -) - -select - ts, - pool_id, - collateral_type, - collateral_value, - debt, - hourly_issuance, - hourly_debt_migrated, - hourly_pnl, - cumulative_pnl, - cumulative_issuance, - rewards_usd, - hourly_pnl_pct, - hourly_rewards_pct, - apr_24h, - apy_24h, - apr_7d, - apy_7d, - apr_28d, - apy_28d, - apr_24h_pnl, - apy_24h_pnl, - apr_7d_pnl, - apy_7d_pnl, - apr_28d_pnl, - apy_28d_pnl, - apr_24h_rewards, - apy_24h_rewards, - apr_7d_rewards, - apy_7d_rewards, - apr_28d_rewards, - apy_28d_rewards -from - apy_calculations -order by - ts diff --git a/transformers/synthetix/models/marts/eth/mainnet/core/fct_core_apr_rewards_eth_mainnet.sql b/transformers/synthetix/models/marts/eth/mainnet/core/fct_core_apr_rewards_eth_mainnet.sql deleted file mode 100644 index b41ef2f8..00000000 --- a/transformers/synthetix/models/marts/eth/mainnet/core/fct_core_apr_rewards_eth_mainnet.sql +++ /dev/null @@ -1,115 +0,0 @@ -{{ - config( - materialized = 'table', - ) -}} - -with pnl_hourly as ( - select - ts, - pool_id, - collateral_type, - reward_token, - collateral_value, - rewards_usd, - hourly_rewards_pct - from - {{ ref('fct_pool_pnl_hourly_reward_eth_mainnet') }} -), - -avg_returns as ( - select - ts, - pool_id, - collateral_type, - reward_token, - AVG( - hourly_rewards_pct - ) over ( - partition by - pool_id, - collateral_type, - reward_token - order by - ts - range between interval '24 HOURS' preceding - and current row - ) as avg_24h_rewards_pct, - AVG( - hourly_rewards_pct - ) over ( - partition by - pool_id, - collateral_type, - reward_token - order by - ts - range between interval '7 DAYS' preceding - and current row - ) as avg_7d_rewards_pct, - AVG( - hourly_rewards_pct - ) over ( - partition by - pool_id, - collateral_type, - reward_token - order by - ts - range between interval '28 DAYS' preceding - and current row - ) as avg_28d_rewards_pct - from - pnl_hourly -), - -apr_calculations as ( - select - pnl_hourly.ts, - pnl_hourly.pool_id, - pnl_hourly.collateral_type, - pnl_hourly.reward_token, - pnl_hourly.collateral_value, - pnl_hourly.rewards_usd, - pnl_hourly.hourly_rewards_pct, - avg_returns.avg_24h_rewards_pct * 24 * 365 as apr_24h_rewards, - avg_returns.avg_7d_rewards_pct * 24 * 365 as apr_7d_rewards, - avg_returns.avg_28d_rewards_pct * 24 * 365 as apr_28d_rewards - from - pnl_hourly - inner join avg_returns - on - pnl_hourly.ts = avg_returns.ts - and pnl_hourly.pool_id = avg_returns.pool_id - and pnl_hourly.collateral_type = avg_returns.collateral_type - and pnl_hourly.reward_token = avg_returns.reward_token -), - -apy_calculations as ( - select - *, - (POWER(1 + apr_24h_rewards / 8760, 8760) - 1) as apy_24h_rewards, - (POWER(1 + apr_7d_rewards / 8760, 8760) - 1) as apy_7d_rewards, - (POWER(1 + apr_28d_rewards / 8760, 8760) - 1) as apy_28d_rewards - from - apr_calculations -) - -select - ts, - pool_id, - collateral_type, - reward_token, - collateral_value, - rewards_usd, - hourly_rewards_pct, - apr_24h_rewards, - apy_24h_rewards, - apr_7d_rewards, - apy_7d_rewards, - apr_28d_rewards, - apy_28d_rewards -from - apy_calculations -order by - ts diff --git a/transformers/synthetix/models/marts/eth/mainnet/core/fct_core_market_updated_eth_mainnet.sql b/transformers/synthetix/models/marts/eth/mainnet/core/fct_core_market_updated_eth_mainnet.sql deleted file mode 100644 index ad7e4dbc..00000000 --- a/transformers/synthetix/models/marts/eth/mainnet/core/fct_core_market_updated_eth_mainnet.sql +++ /dev/null @@ -1,30 +0,0 @@ -with market_updated as ( - select - id, - block_timestamp, - block_number, - transaction_hash, - contract, - event_name, - market_id, - net_issuance, - sender, - collateral_type, - credit_capacity, - token_amount - from - {{ ref('core_market_updated_eth_mainnet') }} -) - -select - id, - block_timestamp as ts, - transaction_hash, - event_name, - market_id, - collateral_type, - {{ convert_wei("credit_capacity") }} as credit_capacity, - {{ convert_wei("net_issuance") }} as net_issuance, - {{ convert_wei("token_amount") }} as token_amount -from - market_updated diff --git a/transformers/synthetix/models/marts/eth/mainnet/core/fct_core_migration_eth_mainnet.sql b/transformers/synthetix/models/marts/eth/mainnet/core/fct_core_migration_eth_mainnet.sql deleted file mode 100644 index 67d8008b..00000000 --- a/transformers/synthetix/models/marts/eth/mainnet/core/fct_core_migration_eth_mainnet.sql +++ /dev/null @@ -1,14 +0,0 @@ -select - block_timestamp as ts, - block_number, - transaction_hash, - 1 as pool_id, -- Spartan Council pool - -- SNX collateral - '0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F' as collateral_type, - staker, - account_id, - {{ convert_wei('collateral_amount') }} as collateral_amount, - {{ convert_wei('debt_amount') }} as debt_amount -from - {{ ref('core_account_migrated_eth_mainnet') }} -order by block_timestamp diff --git a/transformers/synthetix/models/marts/eth/mainnet/core/fct_core_migration_hourly_eth_mainnet.sql b/transformers/synthetix/models/marts/eth/mainnet/core/fct_core_migration_hourly_eth_mainnet.sql deleted file mode 100644 index dff230e5..00000000 --- a/transformers/synthetix/models/marts/eth/mainnet/core/fct_core_migration_hourly_eth_mainnet.sql +++ /dev/null @@ -1,63 +0,0 @@ -with dim as ( - select - m.pool_id, - m.collateral_type, - generate_series( - date_trunc('hour', min(t.ts)), - date_trunc('hour', max(t.ts)), - '1 hour'::INTERVAL - ) as ts - from - ( - select ts - from - {{ ref('fct_pool_debt_eth_mainnet') }} - ) as t - cross join ( - select distinct - pool_id, - collateral_type - from - {{ ref('fct_pool_debt_eth_mainnet') }} - ) as m - group by - m.pool_id, - m.collateral_type -), - -migration as ( - select - date_trunc( - 'hour', - ts - ) as ts, - pool_id, - collateral_type, - sum(debt_amount) as hourly_debt_migrated - from - {{ ref('fct_core_migration_eth_mainnet') }} - group by - date_trunc('hour', ts), - pool_id, - collateral_type -) - -select - dim.ts, - dim.pool_id, - dim.collateral_type, - coalesce( - m.hourly_debt_migrated, - 0 - ) as hourly_debt_migrated -from - dim -left join migration as m - on - dim.pool_id = m.pool_id - and lower( - dim.collateral_type - ) = lower( - m.collateral_type - ) - and dim.ts = m.ts diff --git a/transformers/synthetix/models/marts/eth/mainnet/core/fct_core_pool_collateral_eth_mainnet.sql b/transformers/synthetix/models/marts/eth/mainnet/core/fct_core_pool_collateral_eth_mainnet.sql deleted file mode 100644 index 6e6611eb..00000000 --- a/transformers/synthetix/models/marts/eth/mainnet/core/fct_core_pool_collateral_eth_mainnet.sql +++ /dev/null @@ -1,39 +0,0 @@ -with events as ( - select - block_timestamp, - {{ convert_wei('token_amount') }} as token_amount, - collateral_type - from - {{ ref('core_deposited_eth_mainnet') }} - union all - select - block_timestamp, - -{{ convert_wei('token_amount') }} as token_amount, - collateral_type - from - {{ ref('core_withdrawn_eth_mainnet') }} -), - -ranked_events as ( - select - *, - SUM(token_amount) over ( - partition by collateral_type - order by - block_timestamp - rows between unbounded preceding - and current row - ) as amount_deposited - from - events -) - -select - block_timestamp as ts, - collateral_type, - amount_deposited -from - ranked_events -order by - block_timestamp, - collateral_type diff --git a/transformers/synthetix/models/marts/eth/mainnet/core/fct_core_pool_delegation_eth_mainnet.sql b/transformers/synthetix/models/marts/eth/mainnet/core/fct_core_pool_delegation_eth_mainnet.sql deleted file mode 100644 index e615a337..00000000 --- a/transformers/synthetix/models/marts/eth/mainnet/core/fct_core_pool_delegation_eth_mainnet.sql +++ /dev/null @@ -1,45 +0,0 @@ -with delegation_changes as ( - select - block_timestamp, - account_id, - pool_id, - collateral_type, - {{ convert_wei('amount') }} - - LAG({{ convert_wei('amount') }}, 1, 0) over ( - partition by - account_id, - pool_id, - collateral_type - order by - block_timestamp - ) as change_in_amount - from - {{ ref('core_delegation_updated_eth_mainnet') }} -), - -cumulative_delegation as ( - select - block_timestamp, - pool_id, - collateral_type, - SUM(change_in_amount) over ( - partition by - pool_id, - collateral_type - order by - block_timestamp - ) as cumulative_amount_delegated - from - delegation_changes -) - -select - block_timestamp as ts, - pool_id, - collateral_type, - cumulative_amount_delegated as amount_delegated -from - cumulative_delegation -order by - block_timestamp, - collateral_type diff --git a/transformers/synthetix/models/marts/eth/mainnet/core/fct_core_pools_eth_mainnet.sql b/transformers/synthetix/models/marts/eth/mainnet/core/fct_core_pools_eth_mainnet.sql deleted file mode 100644 index 782e703f..00000000 --- a/transformers/synthetix/models/marts/eth/mainnet/core/fct_core_pools_eth_mainnet.sql +++ /dev/null @@ -1,13 +0,0 @@ -with base as ( - select - pool_id as id, - block_timestamp as created_ts, - block_number, - owner - from - {{ ref('core_pool_created_eth_mainnet') }} -) - -select * -from - base diff --git a/transformers/synthetix/models/marts/eth/mainnet/core/fct_pool_debt_eth_mainnet.sql b/transformers/synthetix/models/marts/eth/mainnet/core/fct_pool_debt_eth_mainnet.sql deleted file mode 100644 index 39e48ea9..00000000 --- a/transformers/synthetix/models/marts/eth/mainnet/core/fct_pool_debt_eth_mainnet.sql +++ /dev/null @@ -1,10 +0,0 @@ -select - ts, - block_number, - pool_id, - collateral_type, - debt -from - {{ ref('core_vault_debt_eth_mainnet') }} -order by - ts diff --git a/transformers/synthetix/models/marts/eth/mainnet/core/fct_pool_issuance_eth_mainnet.sql b/transformers/synthetix/models/marts/eth/mainnet/core/fct_pool_issuance_eth_mainnet.sql deleted file mode 100644 index 63caebcb..00000000 --- a/transformers/synthetix/models/marts/eth/mainnet/core/fct_pool_issuance_eth_mainnet.sql +++ /dev/null @@ -1,39 +0,0 @@ -with burns as ( - select - block_timestamp as ts, - block_number, - transaction_hash, - pool_id, - collateral_type, - account_id, - -1 * {{ convert_wei('amount') }} as amount - from - {{ ref('core_usd_burned_eth_mainnet') }} - order by - block_timestamp desc -), - -mints as ( - select - block_timestamp as ts, - block_number, - transaction_hash, - pool_id, - collateral_type, - account_id, - {{ convert_wei('amount') }} as amount - from - {{ ref('core_usd_minted_eth_mainnet') }} - order by - block_timestamp desc -) - -select * -from - burns -union all -select * -from - mints -order by - ts desc diff --git a/transformers/synthetix/models/marts/eth/mainnet/core/fct_pool_issuance_hourly_eth_mainnet.sql b/transformers/synthetix/models/marts/eth/mainnet/core/fct_pool_issuance_hourly_eth_mainnet.sql deleted file mode 100644 index ea3cc753..00000000 --- a/transformers/synthetix/models/marts/eth/mainnet/core/fct_pool_issuance_hourly_eth_mainnet.sql +++ /dev/null @@ -1,122 +0,0 @@ -with dim as ( - select - m.pool_id, - m.collateral_type, - generate_series( - date_trunc('hour', min(t.ts)), - date_trunc('hour', max(t.ts)), - '1 hour'::interval - ) as ts - from - ( - select ts - from - {{ ref('fct_pool_issuance_eth_mainnet') }} - ) as t - cross join ( - select distinct - pool_id, - collateral_type - from - {{ ref('fct_pool_issuance_eth_mainnet') }} - ) as m - group by - m.pool_id, - m.collateral_type -), - -max_debt_block as ( - select - pool_id, - collateral_type, - date_trunc( - 'hour', - ts - ) as "hour", - max(block_number) as max_block_number - from - {{ ref('fct_pool_debt_eth_mainnet') }} - group by - date_trunc( - 'hour', - ts - ), - pool_id, - collateral_type -), - -filt_issuance as ( - select - i.pool_id, - i.collateral_type, - i.amount, - case - when - i.block_number <= d.max_block_number - or d.max_block_number is null then i.ts - else i.ts + interval '1 hour' - end as ts - from - {{ ref('fct_pool_issuance_eth_mainnet') }} - as i - left join max_debt_block as d - on date_trunc( - 'hour', - i.ts - ) = d.hour - and i.pool_id = d.pool_id - and lower( - i.collateral_type - ) = lower( - d.collateral_type - ) - where - i.block_number <= ( - select - max( - max_block_number - ) as b - from - max_debt_block - ) -), - -issuance as ( - select - date_trunc( - 'hour', - ts - ) as ts, - pool_id, - collateral_type, - sum(amount) as hourly_issuance - from - filt_issuance - group by - date_trunc( - 'hour', - ts - ), - pool_id, - collateral_type -) - -select - dim.ts, - dim.pool_id, - dim.collateral_type, - coalesce( - i.hourly_issuance, - 0 - ) as hourly_issuance -from - dim -left join issuance as i - on - dim.pool_id = i.pool_id - and lower( - dim.collateral_type - ) = lower( - i.collateral_type - ) - and dim.ts = i.ts diff --git a/transformers/synthetix/models/marts/eth/mainnet/core/fct_pool_pnl_hourly_eth_mainnet.sql b/transformers/synthetix/models/marts/eth/mainnet/core/fct_pool_pnl_hourly_eth_mainnet.sql deleted file mode 100644 index 6d2ef689..00000000 --- a/transformers/synthetix/models/marts/eth/mainnet/core/fct_pool_pnl_hourly_eth_mainnet.sql +++ /dev/null @@ -1,244 +0,0 @@ -{{ config( - materialized = 'table', - unique_key = ['ts', 'pool_id', 'collateral_type'], -) }} - -with dim as ( - select - generate_series( - date_trunc('hour', min(t.ts)), - date_trunc('hour', max(t.ts)), '1 hour'::interval - ) as ts, - p.pool_id, - p.collateral_type - from - ( - select ts - from - {{ ref('fct_pool_debt_eth_mainnet') }} - ) as t - cross join ( - select distinct - pool_id, - collateral_type - from - {{ ref('fct_pool_debt_eth_mainnet') }} - ) as p - group by - p.pool_id, - p.collateral_type -), - -issuance as ( - select - ts, - pool_id, - collateral_type, - hourly_issuance - from - {{ ref('fct_pool_issuance_hourly_eth_mainnet') }} -), - -debt as ( - select distinct - pool_id, - collateral_type, - date_trunc( - 'hour', - ts - ) as ts, - last_value(debt) over ( - partition by date_trunc('hour', ts), pool_id, collateral_type - order by - ts - rows between unbounded preceding - and unbounded following - ) as debt - from - {{ ref('fct_pool_debt_eth_mainnet') }} -), - -collateral as ( - select distinct - pool_id, - collateral_type, - date_trunc( - 'hour', - ts - ) as ts, - last_value(collateral_value) over ( - partition by date_trunc('hour', ts), pool_id, collateral_type - order by - ts - rows between unbounded preceding - and unbounded following - ) as collateral_value - from - {{ ref('core_vault_collateral_eth_mainnet') }} - where - pool_id = 1 -), - -ffill as ( - select - dim.ts, - dim.pool_id, - dim.collateral_type, - coalesce( - last(debt.debt) over ( - partition by dim.collateral_type, dim.pool_id - order by dim.ts - rows between unbounded preceding and current row - ), - 0 - ) as debt, - coalesce( - last(collateral.collateral_value) over ( - partition by dim.collateral_type, dim.pool_id - order by dim.ts - rows between unbounded preceding and current row - ), - 0 - ) as collateral_value - from - dim - left join debt - on - dim.ts = debt.ts - and dim.pool_id = debt.pool_id - and dim.collateral_type = debt.collateral_type - left join collateral - on - dim.ts = collateral.ts - and dim.pool_id = collateral.pool_id - and dim.collateral_type = collateral.collateral_type -), - -hourly_pnl as ( - select - ts, - pool_id, - collateral_type, - collateral_value, - debt, - coalesce(lag(debt) over ( - partition by pool_id, collateral_type - order by - ts - ) - debt, 0) as hourly_pnl - from - ffill -), - -hourly_rewards as ( - select - ts, - pool_id, - collateral_type, - rewards_usd - from - {{ ref('fct_pool_rewards_hourly_eth_mainnet') }} -), - -hourly_migration as ( - select - ts, - pool_id, - collateral_type, - hourly_debt_migrated - from - {{ ref('fct_core_migration_hourly_eth_mainnet') }} -), - -hourly_returns as ( - select - pnl.ts, - pnl.pool_id, - pnl.collateral_type, - pnl.collateral_value, - pnl.debt, - coalesce( - iss.hourly_issuance, - 0 - ) as hourly_issuance, - coalesce( - migration.hourly_debt_migrated, - 0 - ) as hourly_debt_migrated, - pnl.hourly_pnl + coalesce( - iss.hourly_issuance, - 0 - ) + coalesce( - migration.hourly_debt_migrated, - 0 - ) as hourly_pnl, - coalesce( - rewards.rewards_usd, - 0 - ) as rewards_usd, - case - when pnl.collateral_value = 0 then 0 - else coalesce( - rewards.rewards_usd, - 0 - ) / pnl.collateral_value - end as hourly_rewards_pct, - case - when pnl.collateral_value = 0 then 0 - else ( - coalesce(iss.hourly_issuance, 0) - + pnl.hourly_pnl - + coalesce(migration.hourly_debt_migrated, 0) - ) / pnl.collateral_value - end as hourly_pnl_pct, - case - when pnl.collateral_value = 0 then 0 - else ( - coalesce(rewards.rewards_usd, 0) - + pnl.hourly_pnl - + coalesce(iss.hourly_issuance, 0) - + coalesce(migration.hourly_debt_migrated, 0) - ) / pnl.collateral_value - end as hourly_total_pct - from - hourly_pnl as pnl - left join hourly_rewards as rewards - on - pnl.ts = rewards.ts - and pnl.pool_id = rewards.pool_id - and pnl.collateral_type = rewards.collateral_type - left join issuance as iss - on - pnl.ts = iss.ts - and pnl.pool_id = iss.pool_id - and lower( - pnl.collateral_type - ) = lower( - iss.collateral_type - ) - left join hourly_migration as migration - on - pnl.ts = migration.ts - and pnl.pool_id = migration.pool_id - and lower( - pnl.collateral_type - ) = lower( - migration.collateral_type - ) -) - -select - ts, - pool_id, - collateral_type, - collateral_value, - debt, - hourly_issuance, - hourly_pnl, - hourly_debt_migrated, - rewards_usd, - hourly_pnl_pct, - hourly_rewards_pct, - hourly_total_pct -from - hourly_returns diff --git a/transformers/synthetix/models/marts/eth/mainnet/core/fct_pool_pnl_hourly_reward_eth_mainnet.sql b/transformers/synthetix/models/marts/eth/mainnet/core/fct_pool_pnl_hourly_reward_eth_mainnet.sql deleted file mode 100644 index 292cee73..00000000 --- a/transformers/synthetix/models/marts/eth/mainnet/core/fct_pool_pnl_hourly_reward_eth_mainnet.sql +++ /dev/null @@ -1,87 +0,0 @@ -{{ config( - materialized = 'table', - unique_key = ['ts', 'pool_id', 'collateral_type', 'reward_token'], -) }} - -with dim as ( - - select - t.pool_id, - t.collateral_type, - t.collateral_value, - p.token_symbol as reward_token, - generate_series( - date_trunc('hour', min(t.ts)), - date_trunc('hour', max(t.ts)), - '1 hour'::INTERVAL - ) as ts - from - ( - select - ts, - collateral_type, - pool_id, - collateral_value - from - {{ ref('fct_pool_pnl_hourly_eth_mainnet') }} - group by - ts, - collateral_type, - pool_id, - collateral_value - ) as t - cross join ( - select distinct token_symbol - from - {{ ref('fct_pool_rewards_token_hourly_eth_mainnet') }} - ) as p - group by - t.pool_id, - t.collateral_type, - t.collateral_value, - p.token_symbol -), - -reward_hourly_token as ( - select - ts, - pool_id, - collateral_type, - token_symbol as reward_token, - sum( - rewards_usd - ) as rewards_usd - from - {{ ref('fct_pool_rewards_token_hourly_eth_mainnet') }} - group by - ts, - pool_id, - collateral_type, - token_symbol -) - -select - dim.ts, - dim.pool_id, - dim.collateral_type, - dim.collateral_value, - dim.reward_token, - coalesce( - reward_hourly_token.rewards_usd, - 0 - ) as rewards_usd, - case - when dim.collateral_value = 0 then 0 - else coalesce( - reward_hourly_token.rewards_usd, - 0 - ) / dim.collateral_value - end as hourly_rewards_pct -from - dim -left join reward_hourly_token - on - dim.ts = reward_hourly_token.ts - and dim.pool_id = reward_hourly_token.pool_id - and dim.collateral_type = reward_hourly_token.collateral_type - and dim.reward_token = reward_hourly_token.reward_token diff --git a/transformers/synthetix/models/marts/eth/mainnet/core/fct_pool_rewards_eth_mainnet.sql b/transformers/synthetix/models/marts/eth/mainnet/core/fct_pool_rewards_eth_mainnet.sql deleted file mode 100644 index 833db834..00000000 --- a/transformers/synthetix/models/marts/eth/mainnet/core/fct_pool_rewards_eth_mainnet.sql +++ /dev/null @@ -1,37 +0,0 @@ -with rewards_distributed as ( - select - block_timestamp as ts, - CAST( - pool_id as INTEGER - ) as pool_id, - collateral_type, - distributor, - {{ convert_wei('amount') }} as amount, - TO_TIMESTAMP("start") as ts_start, - "duration" - from - {{ ref('core_rewards_distributed_eth_mainnet') }} -), - -distributors as ( - select - CAST(distributor_address as TEXT) as distributor_address, - CAST(token_symbol as TEXT) as token_symbol - from - {{ ref('eth_mainnet_reward_distributors') }} -) - -select - rd.ts, - rd.pool_id, - rd.collateral_type, - rd.distributor, - distributors.token_symbol, - rd.amount, - rd.ts_start, - rd.duration -from - rewards_distributed as rd -inner join distributors on rd.distributor = distributors.distributor_address -order by - ts diff --git a/transformers/synthetix/models/marts/eth/mainnet/core/fct_pool_rewards_hourly_eth_mainnet.sql b/transformers/synthetix/models/marts/eth/mainnet/core/fct_pool_rewards_hourly_eth_mainnet.sql deleted file mode 100644 index 457af8ad..00000000 --- a/transformers/synthetix/models/marts/eth/mainnet/core/fct_pool_rewards_hourly_eth_mainnet.sql +++ /dev/null @@ -1,21 +0,0 @@ -with token_hourly as ( - select - ts, - pool_id, - collateral_type, - rewards_usd - from - {{ ref('fct_pool_rewards_token_hourly_eth_mainnet') }} -) - -select - ts, - pool_id, - collateral_type, - SUM(rewards_usd) as rewards_usd -from - token_hourly -group by - ts, - pool_id, - collateral_type diff --git a/transformers/synthetix/models/marts/eth/mainnet/core/fct_pool_rewards_token_hourly_eth_mainnet.sql b/transformers/synthetix/models/marts/eth/mainnet/core/fct_pool_rewards_token_hourly_eth_mainnet.sql deleted file mode 100644 index 465a7809..00000000 --- a/transformers/synthetix/models/marts/eth/mainnet/core/fct_pool_rewards_token_hourly_eth_mainnet.sql +++ /dev/null @@ -1,124 +0,0 @@ -with dim as ( - select - m.pool_id, - m.collateral_type, - generate_series( - date_trunc('hour', min(t.ts)), - date_trunc('hour', max(t.ts)), - '1 hour'::INTERVAL - ) as ts - from - ( - select ts - from - {{ ref('fct_pool_debt_eth_mainnet') }} - ) as t - cross join ( - select distinct - pool_id, - collateral_type - from - {{ ref('fct_pool_debt_eth_mainnet') }} - ) as m - group by - m.pool_id, - m.collateral_type -), - -rewards_distributed as ( - select - ts, - pool_id, - collateral_type, - distributor, - token_symbol, - amount, - ts_start, - "duration" - from - {{ ref('fct_pool_rewards_eth_mainnet') }} -), - -hourly_distributions as ( - select - dim.ts, - dim.pool_id, - dim.collateral_type, - r.distributor, - r.token_symbol, - r.amount, - r.ts_start, - r."duration", - row_number() over ( - partition by - dim.ts, - dim.pool_id, - dim.collateral_type, - r.distributor - order by - r.ts_start desc - ) as distributor_index - from - dim - left join rewards_distributed as r - on - dim.pool_id = r.pool_id - and lower( - dim.collateral_type - ) = lower( - r.collateral_type - ) - and dim.ts + '1 hour'::INTERVAL >= r.ts_start - and dim.ts < r.ts_start + r."duration" * '1 second'::INTERVAL -), - -hourly_rewards as ( - select - d.ts, - d.pool_id, - d.collateral_type, - d.distributor, - d.token_symbol, - p.price, - -- get the hourly amount distributed - d.amount / ( - d."duration" / 3600 - ) as hourly_amount, - -- get the amount of time distributed this hour - -- use the smaller of those two intervals - -- convert the interval to a number of hours - -- multiply the result by the hourly amount to get the amount distributed this hour - ( - extract( - epoch - from - least( - d."duration" / 3600 * '1 hour'::INTERVAL, - d.ts + '1 hour'::INTERVAL - greatest( - d.ts, - d.ts_start - ) - ) - ) / 3600 - ) * d.amount / ( - d."duration" / 3600 - ) as amount_distributed - from - hourly_distributions as d - left join - {{ ref('fct_prices_hourly_eth_mainnet') }} - as p - on - d.ts = p.ts - and d.token_symbol = p.market_symbol - where - d.distributor_index = 1 -) - -select - *, - amount_distributed * price as rewards_usd -from - hourly_rewards -where - amount_distributed is not null diff --git a/transformers/synthetix/models/marts/eth/mainnet/core/schema.yml b/transformers/synthetix/models/marts/eth/mainnet/core/schema.yml deleted file mode 100644 index a9cb2ab0..00000000 --- a/transformers/synthetix/models/marts/eth/mainnet/core/schema.yml +++ /dev/null @@ -1,717 +0,0 @@ -version: 2 -models: - - name: fct_core_account_activity_eth_mainnet - description: "Daily number of accounts by action (Delegated, Withdrawn, Claimed)" - columns: - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: account_action - description: "Type of LP action" - data_type: text - tests: - - not_null - - accepted_values: - values: ["Delegated", "Withdrawn", "Claimed"] - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - name: fct_core_active_stakers_daily_eth_mainnet - description: "Daily number of active stakers" - columns: - - name: block_date - description: "Date" - data_type: date - tests: - - not_null - - name: nof_stakers_daily - description: "Number of active stakers daily" - - name: fct_pool_rewards_eth_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: distributor - description: "Address of the distributor" - data_type: text - tests: - - not_null - - name: token_symbol - description: "Token symbol" - data_type: text - tests: - - not_null - - name: amount - description: "Reward amount" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: ts_start - data_type: timestamp with time zone - - name: duration - data_type: numeric - - name: fct_core_account_delegation_eth_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: amount_delegated - description: "Amount of delegated collateral" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fct_core_apr_eth_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: collateral_value - description: "Collateral value (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: debt - description: "Debt value (USD)" - data_type: numeric - tests: - - not_null - - name: hourly_issuance - description: "Hourly issuance" - data_type: numeric - tests: - - not_null - - name: hourly_debt_migrated - description: "Hourly debt migrated from V2x to V3" - data_type: numeric - tests: - - not_null - - name: hourly_pnl - description: "Hourly PnL" - data_type: numeric - tests: - - not_null - - name: cumulative_pnl - description: "Cumulative PnL" - data_type: numeric - tests: - - not_null - - name: cumulative_issuance - description: "Cumulative Issuance" - data_type: numeric - tests: - - not_null - - name: rewards_usd - description: "Rewards value (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: hourly_pnl_pct - description: "Hourly PnL (%)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: -1 - max_value: 1 - inclusive: true - - name: hourly_rewards_pct - description: "Hourly Rewards (%)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - max_value: 1 - inclusive: true - - name: apr_24h - description: "APR (24h)" - data_type: numeric - tests: - - not_null - - name: apy_24h - description: "APY (24h)" - data_type: numeric - tests: - - not_null - - name: apr_7d - description: "APR (7d)" - data_type: numeric - tests: - - not_null - - name: apy_7d - description: "APY (7d)" - data_type: numeric - tests: - - not_null - - name: apr_28d - description: "APR (28d)" - data_type: numeric - tests: - - not_null - - name: apy_28d - description: "APY (28d)" - data_type: numeric - tests: - - not_null - - name: apr_24h_pnl - data_type: numeric - - name: apy_24h_pnl - data_type: numeric - - name: apr_7d_pnl - data_type: numeric - - name: apy_7d_pnl - data_type: numeric - - name: apr_28d_pnl - data_type: numeric - - name: apy_28d_pnl - data_type: numeric - - name: apr_24h_rewards - data_type: numeric - - name: apy_24h_rewards - data_type: numeric - - name: apr_7d_rewards - data_type: numeric - - name: apy_7d_rewards - data_type: numeric - - name: apr_28d_rewards - data_type: numeric - - name: apy_28d_rewards - data_type: numeric - - name: fct_core_market_updated_eth_mainnet - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: - [ - "MarketCollateralWithdrawn", - "MarketCollateralDeposited", - "MarketUsdWithdrawn", - "MarketUsdDeposited", - ] - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: credit_capacity - description: "Credit capacity" - data_type: numeric - tests: - - not_null - - name: net_issuance - description: "Net issuance" - data_type: numeric - tests: - - not_null - - name: token_amount - description: "Token amount" - data_type: numeric - tests: - - not_null - - name: fct_core_pool_collateral_eth_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: amount_deposited - description: "Amount deposited" - data_type: numeric - tests: - - not_null - - name: fct_core_pool_delegation_eth_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: amount_delegated - data_type: numeric - - name: fct_core_pools_eth_mainnet - columns: - - name: id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: created_ts - description: "Pool creation timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: owner - description: "Address of the pool owner" - data_type: text - tests: - - not_null - - name: fct_pool_debt_eth_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: debt - description: "Debt value (USD)" - data_type: numeric - tests: - - not_null - - name: fct_pool_issuance_hourly_eth_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: hourly_issuance - description: "Hourly issuance" - data_type: numeric - tests: - - not_null - - name: fct_pool_issuance_eth_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - name: amount - description: "Amount issued" - data_type: numeric - tests: - - not_null - - name: fct_pool_pnl_hourly_eth_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: collateral_value - description: "Collateral value (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: debt - description: "Debt value (USD)" - data_type: numeric - tests: - - not_null - - name: hourly_issuance - description: "Hourly issuance" - data_type: numeric - tests: - - not_null - - name: hourly_pnl - description: "Hourly PnL" - data_type: numeric - tests: - - not_null - - name: hourly_debt_migrated - description: "Hourly debt migrated from V2x to V3" - data_type: numeric - tests: - - not_null - - name: rewards_usd - description: "Rewards value (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: hourly_pnl_pct - description: "Hourly PnL (%)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: -1 - max_value: 1 - inclusive: true - - name: hourly_rewards_pct - description: "Hourly Rewards (%)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - max_value: 1 - inclusive: true - - name: hourly_total_pct - description: "Hourly Total (%)" - data_type: numeric - tests: - - not_null - - name: fct_pool_rewards_hourly_eth_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: rewards_usd - description: "Rewards value (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fct_pool_rewards_token_hourly_eth_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: distributor - description: "Address of the distributor" - data_type: text - tests: - - not_null - - name: token_symbol - description: "Token symbol" - data_type: text - tests: - - not_null - - name: price - description: "Price" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: hourly_amount - description: "Hourly rewards amount" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: amount_distributed - description: "Distributed rewards amount" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: rewards_usd - description: "Rewards value (USD)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fct_core_migration_eth_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: pool_id - description: "ID of the pool (Spartan Council pool)" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 1 - max_value: 1 - inclusive: true - - name: collateral_type - description: "Type of collateral (SNX)" - data_type: text - tests: - - not_null - - accepted_values: - values: ["0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F"] - - name: staker - description: "Address of the staker" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - name: collateral_amount - description: "Amount of collateral" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: debt_amount - description: "Amount of debt" - data_type: numeric - tests: - - not_null - - - name: fct_core_migration_hourly_eth_mainnet - columns: - - name: ts - description: "Hourly timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of collateral" - data_type: text - tests: - - not_null - - name: hourly_debt_migrated - description: "Hourly debt migrated" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true diff --git a/transformers/synthetix/models/marts/eth/mainnet/prices/fct_prices_eth_mainnet.sql b/transformers/synthetix/models/marts/eth/mainnet/prices/fct_prices_eth_mainnet.sql deleted file mode 100644 index dde4236c..00000000 --- a/transformers/synthetix/models/marts/eth/mainnet/prices/fct_prices_eth_mainnet.sql +++ /dev/null @@ -1,36 +0,0 @@ -with all_prices as ( - select - ts, - collateral_type as market_address, - null as market_symbol, - collateral_value / amount as price - from - {{ ref('core_vault_collateral_eth_mainnet') }} - where - collateral_value > 0 -), - -tokens as ( - select - token_address, - token_symbol - from - {{ ref('eth_mainnet_tokens') }} -) - -select - p.ts, - p.market_address, - p.price, - COALESCE( - t.token_symbol, - p.market_symbol - ) as market_symbol -from - all_prices as p -left join tokens as t - on LOWER( - p.market_address - ) = LOWER( - t.token_address - ) diff --git a/transformers/synthetix/models/marts/eth/mainnet/prices/fct_prices_hourly_eth_mainnet.sql b/transformers/synthetix/models/marts/eth/mainnet/prices/fct_prices_hourly_eth_mainnet.sql deleted file mode 100644 index 6e447a9f..00000000 --- a/transformers/synthetix/models/marts/eth/mainnet/prices/fct_prices_hourly_eth_mainnet.sql +++ /dev/null @@ -1,72 +0,0 @@ -with prices as ( - select distinct - market_symbol, - DATE_TRUNC( - 'hour', - ts - ) as ts, - LAST_VALUE(price) over ( - partition by DATE_TRUNC('hour', ts), market_symbol - order by - ts - rows between unbounded preceding - and unbounded following - ) as price - from - {{ ref('fct_prices_eth_mainnet') }} -), - -dim as ( - select - m.market_symbol, - GENERATE_SERIES( - DATE_TRUNC('hour', MIN(t.ts)), - DATE_TRUNC('hour', MAX(t.ts)), - '1 hour'::INTERVAL - ) as ts - from - ( - select ts - from - prices - ) as t - cross join ( - select distinct market_symbol - from - prices - ) as m - group by - m.market_symbol -), - -ffill as ( - select - dim.ts, - dim.market_symbol, - LAST(prices.price) over ( - partition by dim.market_symbol - order by dim.ts - rows between unbounded preceding and current row - ) as price - from - dim - left join prices - on - dim.ts = prices.ts - and dim.market_symbol = prices.market_symbol -), - -hourly_prices as ( - select - ts, - market_symbol, - price - from - ffill -) - -select * -from - hourly_prices -where - price is not null diff --git a/transformers/synthetix/models/marts/eth/mainnet/prices/schema.yml b/transformers/synthetix/models/marts/eth/mainnet/prices/schema.yml deleted file mode 100644 index e41cca92..00000000 --- a/transformers/synthetix/models/marts/eth/mainnet/prices/schema.yml +++ /dev/null @@ -1,44 +0,0 @@ -models: - - name: fct_prices_eth_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: market_address - description: "Market address" - data_type: text - - name: market_symbol - description: "Market symbol" - data_type: text - tests: - - not_null - - name: price - description: "Price" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fct_prices_hourly_eth_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: market_symbol - description: "Market symbol" - data_type: text - tests: - - not_null - - name: price - description: "Price" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true diff --git a/transformers/synthetix/models/marts/optimism/mainnet/fct_v2_actions_optimism_mainnet.sql b/transformers/synthetix/models/marts/optimism/mainnet/fct_v2_actions_optimism_mainnet.sql deleted file mode 100644 index e37d1d49..00000000 --- a/transformers/synthetix/models/marts/optimism/mainnet/fct_v2_actions_optimism_mainnet.sql +++ /dev/null @@ -1,34 +0,0 @@ -with combined_base as ( - select * - from - {{ ref('fct_v2_trades_optimism_mainnet') }} - union all - select * - from - {{ ref('fct_v2_liquidations_optimism_mainnet') }} -), - -all_base as ( - select - id, - ts, - block_number, - transaction_hash, - price, - account, - market, - margin, - trade_size, - "size", - last_size, - skew, - fee, - order_type, - tracking_code - from - combined_base -) - -select * -from - all_base diff --git a/transformers/synthetix/models/marts/optimism/mainnet/fct_v2_funding_optimism_mainnet.sql b/transformers/synthetix/models/marts/optimism/mainnet/fct_v2_funding_optimism_mainnet.sql deleted file mode 100644 index f7764902..00000000 --- a/transformers/synthetix/models/marts/optimism/mainnet/fct_v2_funding_optimism_mainnet.sql +++ /dev/null @@ -1,45 +0,0 @@ -{{ config( - materialized = 'incremental', - unique_key = 'block_number', - post_hook = [ "create index if not exists idx_block_number on {{ this }} (block_number)", "create index if not exists idx_market on {{ this }} (market)"] -) }} - -with funding as ( - select - block_number, - market, - {{ convert_wei('funding_rate') }} as funding_rate - from - ( - select - block_number, - market, - funding_rate, - ROW_NUMBER() over ( - partition by - block_number, - market - order by - id desc - ) as rn - from - {{ ref( - 'v2_perp_funding_recomputed_optimism_mainnet' - ) }} - - {% if is_incremental() %} - where - block_number > ( - select COALESCE(MAX(block_number), 0) as b - from - {{ this }} - ) - {% endif %} - ) as subquery - where - rn = 1 -) - -select * -from - funding diff --git a/transformers/synthetix/models/marts/optimism/mainnet/fct_v2_liquidations_optimism_mainnet.sql b/transformers/synthetix/models/marts/optimism/mainnet/fct_v2_liquidations_optimism_mainnet.sql deleted file mode 100644 index 3627007c..00000000 --- a/transformers/synthetix/models/marts/optimism/mainnet/fct_v2_liquidations_optimism_mainnet.sql +++ /dev/null @@ -1,98 +0,0 @@ -{{ config( - materialized = 'incremental', - unique_key = 'id', -) }} - -with liq_trades as ( - select - id, - block_timestamp, - block_number, - transaction_hash, - last_price, - account, - market, - margin, - trade_size, - "size", - skew, - fee, - COALESCE(LAG("size", 1) over ( - partition by market, account - order by - id - ), 0) as last_size - from - {{ ref('v2_perp_position_modified_optimism_mainnet') }} -), - -liq_events as ( - select - block_number, - account, - market, - transaction_hash, - total_fee - from - {{ ref('v2_perp_position_liquidated_optimism_mainnet') }} - - {% if is_incremental() %} - where - block_number > ( - select COALESCE(MAX(block_number), 0) as b - from - {{ this }} - ) - {% endif %} -), - -liq_base as ( - select - lt.id, - lt.block_timestamp, - lt.block_number, - lt.transaction_hash, - lt.last_price, - lt.account, - lt.market, - lt.margin, - lt.last_size, - lt.size, - lt.skew, - 'liquidation' as order_type, - null as tracking_code, - -1 * lt.last_size as trade_size, - lt.fee + le.total_fee as fee - from - liq_trades as lt - inner join liq_events as le - on - lt.block_number = le.block_number - and lt.account = le.account - and lt.market = le.market - and lt.transaction_hash = le.transaction_hash - where - lt.margin = 0 - and lt.trade_size = 0 - and lt.size = 0 - and lt.last_size != 0 -) - -select - id, - block_timestamp as ts, - block_number, - transaction_hash, - {{ convert_wei('last_price') }} as price, - account, - market, - {{ convert_wei('margin') }} as margin, - {{ convert_wei('trade_size') }} as trade_size, - {{ convert_wei('size') }} as "size", - {{ convert_wei('last_size') }} as last_size, - {{ convert_wei('skew') }} as skew, - {{ convert_wei('fee') }} as fee, - 'liquidation' as order_type, - null as tracking_code -from - liq_base diff --git a/transformers/synthetix/models/marts/optimism/mainnet/fct_v2_market_stats_optimism_mainnet.sql b/transformers/synthetix/models/marts/optimism/mainnet/fct_v2_market_stats_optimism_mainnet.sql deleted file mode 100644 index d4d3f8f0..00000000 --- a/transformers/synthetix/models/marts/optimism/mainnet/fct_v2_market_stats_optimism_mainnet.sql +++ /dev/null @@ -1,174 +0,0 @@ -{{ config( - materialized = 'incremental', - unique_key = 'id', - post_hook = [ "create index if not exists idx_id on {{ this }} (id)", "create index if not exists idx_ts on {{ this }} (ts)", "create index if not exists idx_market on {{ this }} (market)"] -) }} - -with trades as ( - select - id, - ts, - block_number, - market, - fee as exchange_fees, - 0 as liquidation_fees, - 0 as amount_liquidated, - 1 as trades, - 0 as liquidations, - tracking_code, - price * ABS(trade_size) as volume - from - {{ ref( - 'fct_v2_actions_optimism_mainnet' - ) }} - where - order_type = 'trade' -), - -liquidations as ( - select - id, - ts, - block_number, - market, - 0 as exchange_fees, - fee as liquidation_fees, - price * ABS(trade_size) as amount_liquidated, - 0 as trades, - 1 as liquidations, - tracking_code, - 0 as volume - from - {{ ref( - 'fct_v2_actions_optimism_mainnet' - ) }} - where - order_type = 'liquidation' -), - -actions as ( - select * - from - trades - union all - select * - from - liquidations -), - -oi as ( - select - id, - ts, - market, - skew, - long_oi, - short_oi, - long_oi_pct, - short_oi_pct, - total_oi, - long_oi_usd, - short_oi_usd, - total_oi_usd - from - {{ ref( - 'fct_v2_open_interest_optimism_mainnet' - ) }} - - {% if is_incremental() %} - where - id > ( - select MAX(id) as max_id - from - {{ this }} - ) - {% endif %} -), - -market_stats as ( - select - actions.ts, - actions.id, - actions.market, - actions.block_number, - funding.funding_rate, - actions.exchange_fees, - actions.liquidation_fees, - actions.volume, - actions.amount_liquidated, - actions.trades, - actions.liquidations, - actions.tracking_code, - oi.skew, - oi.long_oi, - oi.short_oi, - oi.total_oi, - oi.long_oi_usd, - oi.short_oi_usd, - oi.total_oi_usd, - oi.long_oi_pct, - oi.short_oi_pct, - SUM( - actions.exchange_fees - ) over ( - partition by actions.market - order by - actions.id - ) as cumulative_exchange_fees, - SUM( - actions.liquidation_fees - ) over ( - partition by actions.market - order by - actions.id - ) as cumulative_liquidation_fees, - SUM( - actions.volume - ) over ( - partition by actions.market - order by - actions.id - ) as cumulative_volume, - SUM( - actions.amount_liquidated - ) over ( - partition by actions.market - order by - actions.id - ) as cumulative_amount_liquidated, - SUM( - actions.trades - ) over ( - partition by actions.market - order by - actions.id - ) as cumulative_trades, - SUM( - actions.liquidations - ) over ( - partition by actions.market - order by - actions.id - ) as cumulative_liquidations - from - actions - left join oi - on actions.id = oi.id - left join {{ ref('fct_v2_funding_optimism_mainnet') }} as funding - on - actions.block_number = funding.block_number - and actions.market = funding.market -) - -select * -from - market_stats - -{% if is_incremental() %} - where - id > ( - select MAX(id) as max_id - from - {{ this }} - ) -{% endif %} diff --git a/transformers/synthetix/models/marts/optimism/mainnet/fct_v2_open_interest_optimism_mainnet.sql b/transformers/synthetix/models/marts/optimism/mainnet/fct_v2_open_interest_optimism_mainnet.sql deleted file mode 100644 index cf4c3c61..00000000 --- a/transformers/synthetix/models/marts/optimism/mainnet/fct_v2_open_interest_optimism_mainnet.sql +++ /dev/null @@ -1,149 +0,0 @@ -with oi_base as ( - select - id, - ts, - market, - order_type, - trade_size, - price, - skew, - case - when - last_size > 0 -- long cross - and "size" < 0 then -1 * last_size - when - last_size < 0 --short cross - and "size" > 0 then "size" - when - "size" > 0 -- long increase - and "size" > last_size - then ( - "size" - last_size - ) - when - "size" >= 0 -- long decrease - and "size" < last_size - then ( - "size" - last_size - ) - else 0 - end as long_oi_change, - case - when - last_size > 0 -- long cross - and "size" < 0 then "size" * -1 - when - last_size < 0 --short cross - and "size" > 0 then last_size - when - "size" < 0 -- short increase - and "size" < last_size - then ( - last_size - "size" - ) - when - "size" <= 0 -- short decrease - and "size" > last_size - then ( - last_size - "size" - ) - else 0 - end as short_oi_change, - -- get the cumulative sum - SUM( - case - when - last_size > 0 -- long cross - and "size" < 0 then -1 * last_size - when - last_size < 0 --short cross - and "size" > 0 then "size" - when - "size" > 0 -- long increase - and "size" > last_size - then ( - "size" - last_size - ) - when - "size" >= 0 -- long decrease - and "size" < last_size - then ( - "size" - last_size - ) - else 0 - end - ) over ( - partition by market - order by - id - ) as long_oi, - SUM( - case - when - last_size > 0 -- long cross - and "size" < 0 then "size" * -1 - when - last_size < 0 --short cross - and "size" > 0 then last_size - when - "size" < 0 -- short increase - and "size" < last_size - then ( - last_size - "size" - ) - when - "size" <= 0 -- short decrease - and "size" > last_size - then ( - last_size - "size" - ) - else 0 - end - ) over ( - partition by market - order by - id - ) as short_oi - from - {{ ref('fct_v2_actions_optimism_mainnet') }} -) - -select - id, - ts, - market, - order_type, - trade_size, - price, - long_oi, - short_oi, - COALESCE( - skew, - long_oi - short_oi - ) as skew, - case - when ( - long_oi + short_oi - ) > 0 - then long_oi / ( - long_oi + short_oi - ) - else 0 - end as long_oi_pct, - case - when ( - long_oi + short_oi - ) > 0 - then short_oi / ( - long_oi + short_oi - ) - else 0 - end as short_oi_pct, - long_oi + short_oi as total_oi, - long_oi * price as long_oi_usd, - short_oi * price as short_oi_usd, - ( - long_oi + short_oi - ) * price as total_oi_usd -from - oi_base diff --git a/transformers/synthetix/models/marts/optimism/mainnet/fct_v2_trade_tracking_optimism_mainnet.sql b/transformers/synthetix/models/marts/optimism/mainnet/fct_v2_trade_tracking_optimism_mainnet.sql deleted file mode 100644 index 938e3ed8..00000000 --- a/transformers/synthetix/models/marts/optimism/mainnet/fct_v2_trade_tracking_optimism_mainnet.sql +++ /dev/null @@ -1,71 +0,0 @@ -{{ config( - materialized = 'incremental', - unique_key = 'id', - post_hook = [ "create index if not exists idx_id on {{ this }} (id)"] -) }} - -with order_submit as ( - select - block_timestamp, - contract, - account, - tracking_code - from - {{ ref('v2_perp_delayed_order_submitted_optimism_mainnet') }} -), - -position_modified as ( - select - id, - block_number, - contract, - account, - block_timestamp - from - {{ ref('v2_perp_position_modified_optimism_mainnet') }} - where - trade_size != 0 - - {% if is_incremental() %} - and block_number > ( - select COALESCE(MAX(block_number), 0) as b - from - {{ this }} - ) - {% endif %} -), - -combined as ( - select - position_modified.id, - position_modified.block_number, - order_submit.tracking_code, - ROW_NUMBER() over ( - partition by - position_modified.contract, - position_modified.account, - position_modified.id - order by - order_submit.block_timestamp desc - ) as rn - from - position_modified - inner join order_submit - on - position_modified.contract = order_submit.contract - and position_modified.account = order_submit.account - and - position_modified.block_timestamp - between - order_submit.block_timestamp - and order_submit.block_timestamp + interval '5' minute -) - -select - id, - block_number, - tracking_code -from - combined -where - rn = 1 diff --git a/transformers/synthetix/models/marts/optimism/mainnet/fct_v2_trades_optimism_mainnet.sql b/transformers/synthetix/models/marts/optimism/mainnet/fct_v2_trades_optimism_mainnet.sql deleted file mode 100644 index 25457fee..00000000 --- a/transformers/synthetix/models/marts/optimism/mainnet/fct_v2_trades_optimism_mainnet.sql +++ /dev/null @@ -1,67 +0,0 @@ -{{ config( - materialized = 'incremental', - unique_key = 'id', - post_hook = [ "create index if not exists idx_id on {{ this }} (id)", "create index if not exists idx_ts on {{ this }} (ts)", "create index if not exists idx_market on {{ this }} (market)"] -) }} - -with trade_base as ( - select - id, - block_timestamp, - block_number, - transaction_hash, - last_price, - account, - market, - margin, - trade_size, - size, - skew, - fee, - 'trade' as order_type, - COALESCE(LAG(size, 1) over ( - partition by market, account - order by - id - ), 0) as last_size - from - {{ ref('v2_perp_position_modified_optimism_mainnet') }} - - {% if is_incremental() %} - where - block_number > ( - select COALESCE(MAX(block_number), 0) as b - from - {{ this }} - ) - {% endif %} -) - -select - trade_base.id, - trade_base.block_timestamp as ts, - trade_base.block_number, - trade_base.transaction_hash, - {{ convert_wei('last_price') }} as price, - trade_base.account, - trade_base.market, - {{ convert_wei('margin') }} as margin, - {{ convert_wei('trade_size') }} as trade_size, - {{ convert_wei('size') }} as "size", - {{ convert_wei('last_size') }} as last_size, - {{ convert_wei('skew') }} as skew, - {{ convert_wei('fee') }} as fee, - trade_base.order_type, - UPPER( - COALESCE( - {{ convert_hex('tracking_code.tracking_code') }}, 'NO TRACKING CODE' - ) - ) as tracking_code -from - trade_base -left join - {{ ref('fct_v2_trade_tracking_optimism_mainnet') }} - as tracking_code - on trade_base.id = tracking_code.id -where - trade_size != 0 diff --git a/transformers/synthetix/models/marts/optimism/mainnet/fct_v2_transfers_optimism_mainnet.sql b/transformers/synthetix/models/marts/optimism/mainnet/fct_v2_transfers_optimism_mainnet.sql deleted file mode 100644 index 3818a9cb..00000000 --- a/transformers/synthetix/models/marts/optimism/mainnet/fct_v2_transfers_optimism_mainnet.sql +++ /dev/null @@ -1,26 +0,0 @@ -with events as ( - select * - from - {{ ref('v2_perp_margin_transferred_optimism_mainnet') }} -) - -select - id, - transaction_hash, - block_timestamp as ts, - block_number, - market, - account, - margin_delta, - -- calculate cumulative net delta - SUM(margin_delta) over ( - partition by market - order by - id - ) as net_market_transfers, - SUM(margin_delta) over ( - order by - id - ) as net_transfers -from - events diff --git a/transformers/synthetix/models/marts/optimism/mainnet/schema.yml b/transformers/synthetix/models/marts/optimism/mainnet/schema.yml deleted file mode 100644 index c2d3598b..00000000 --- a/transformers/synthetix/models/marts/optimism/mainnet/schema.yml +++ /dev/null @@ -1,433 +0,0 @@ -models: - - name: fct_v2_integrator_daily_optimism_mainnet - columns: - - name: ts - data_type: timestamp with time zone - - name: tracking_code - data_type: text - - name: exchange_fees - data_type: numeric - - name: exchange_fees_total - data_type: numeric - - name: volume - data_type: numeric - - name: volume_total - data_type: numeric - - name: trades - data_type: bigint - - name: trades_total - data_type: numeric - - name: traders - data_type: bigint - - name: volume_share - data_type: numeric - - name: trades_share - data_type: numeric - - name: exchange_fees_share - data_type: numeric - - name: cumulative_exchange_fees - data_type: numeric - - name: cumulative_volume - data_type: numeric - - name: cumulative_trades - data_type: numeric - - name: fct_v2_integrator_hourly_optimism_mainnet - columns: - - name: ts - data_type: timestamp with time zone - - name: tracking_code - data_type: text - - name: exchange_fees - data_type: numeric - - name: exchange_fees_total - data_type: numeric - - name: volume - data_type: numeric - - name: volume_total - data_type: numeric - - name: trades - data_type: bigint - - name: trades_total - data_type: numeric - - name: traders - data_type: bigint - - name: volume_share - data_type: numeric - - name: trades_share - data_type: numeric - - name: exchange_fees_share - data_type: numeric - - name: cumulative_exchange_fees - data_type: numeric - - name: cumulative_volume - data_type: numeric - - name: cumulative_trades - data_type: numeric - - name: fct_v2_market_daily_optimism_mainnet - columns: - - name: ts - data_type: timestamp with time zone - - name: market - data_type: text - - name: exchange_fees - data_type: numeric - - name: liquidation_fees - data_type: numeric - - name: volume - data_type: numeric - - name: amount_liquidated - data_type: numeric - - name: trades - data_type: bigint - - name: liquidations - data_type: bigint - - name: long_oi_usd - data_type: numeric - - name: short_oi_usd - data_type: numeric - - name: total_oi_usd - data_type: numeric - - name: cumulative_exchange_fees - data_type: numeric - - name: cumulative_liquidation_fees - data_type: numeric - - name: cumulative_volume - data_type: numeric - - name: cumulative_amount_liquidated - data_type: numeric - - name: cumulative_trades - data_type: bigint - - name: cumulative_liquidations - data_type: bigint - - name: fct_v2_market_hourly_optimism_mainnet - columns: - - name: ts - data_type: timestamp with time zone - - name: market - data_type: text - - name: exchange_fees - data_type: numeric - - name: liquidation_fees - data_type: numeric - - name: volume - data_type: numeric - - name: amount_liquidated - data_type: numeric - - name: trades - data_type: bigint - - name: liquidations - data_type: bigint - - name: long_oi_usd - data_type: numeric - - name: short_oi_usd - data_type: numeric - - name: total_oi_usd - data_type: numeric - - name: cumulative_exchange_fees - data_type: numeric - - name: cumulative_liquidation_fees - data_type: numeric - - name: cumulative_volume - data_type: numeric - - name: cumulative_amount_liquidated - data_type: numeric - - name: cumulative_trades - data_type: bigint - - name: cumulative_liquidations - data_type: bigint - - name: fct_v2_stats_daily_optimism_mainnet - columns: - - name: ts - data_type: timestamp with time zone - - name: exchange_fees - data_type: numeric - - name: liquidation_fees - data_type: numeric - - name: volume - data_type: numeric - - name: amount_liquidated - data_type: numeric - - name: trades - data_type: numeric - - name: liquidations - data_type: numeric - - name: long_oi_usd - data_type: numeric - - name: short_oi_usd - data_type: numeric - - name: total_oi_usd - data_type: numeric - - name: eth_btc_oi_usd - data_type: numeric - - name: alt_oi_usd - data_type: numeric - - name: cumulative_exchange_fees - data_type: numeric - - name: cumulative_liquidation_fees - data_type: numeric - - name: cumulative_volume - data_type: numeric - - name: cumulative_amount_liquidated - data_type: numeric - - name: cumulative_trades - data_type: numeric - - name: cumulative_liquidations - data_type: numeric - - name: fct_v2_stats_hourly_optimism_mainnet - columns: - - name: ts - data_type: timestamp with time zone - - name: exchange_fees - data_type: numeric - - name: liquidation_fees - data_type: numeric - - name: volume - data_type: numeric - - name: amount_liquidated - data_type: numeric - - name: trades - data_type: numeric - - name: liquidations - data_type: numeric - - name: long_oi_usd - data_type: numeric - - name: short_oi_usd - data_type: numeric - - name: total_oi_usd - data_type: numeric - - name: eth_btc_oi_usd - data_type: numeric - - name: alt_oi_usd - data_type: numeric - - name: cumulative_exchange_fees - data_type: numeric - - name: cumulative_liquidation_fees - data_type: numeric - - name: cumulative_volume - data_type: numeric - - name: cumulative_amount_liquidated - data_type: numeric - - name: cumulative_trades - data_type: numeric - - name: cumulative_liquidations - data_type: numeric - - name: fct_v2_actions_optimism_mainnet - columns: - - name: id - data_type: character varying - - name: ts - data_type: timestamp with time zone - - name: block_number - data_type: integer - - name: transaction_hash - data_type: text - - name: price - data_type: numeric - - name: account - data_type: text - - name: market - data_type: text - - name: margin - data_type: numeric - - name: trade_size - data_type: numeric - - name: size - data_type: numeric - - name: last_size - data_type: numeric - - name: skew - data_type: numeric - - name: fee - data_type: numeric - - name: order_type - data_type: text - - name: tracking_code - data_type: text - - name: fct_v2_funding_optimism_mainnet - columns: - - name: block_number - data_type: integer - - name: market - data_type: text - - name: funding_rate - data_type: numeric - - name: fct_v2_liquidations_optimism_mainnet - columns: - - name: id - data_type: character varying - - name: ts - data_type: timestamp with time zone - - name: block_number - data_type: integer - - name: transaction_hash - data_type: text - - name: price - data_type: numeric - - name: account - data_type: text - - name: market - data_type: text - - name: margin - data_type: numeric - - name: trade_size - data_type: numeric - - name: size - data_type: numeric - - name: last_size - data_type: numeric - - name: skew - data_type: numeric - - name: fee - data_type: numeric - - name: order_type - data_type: text - - name: tracking_code - data_type: text - - name: fct_v2_market_stats_optimism_mainnet - columns: - - name: ts - data_type: timestamp with time zone - - name: id - data_type: character varying - - name: market - data_type: text - - name: block_number - data_type: integer - - name: funding_rate - data_type: numeric - - name: exchange_fees - data_type: numeric - - name: liquidation_fees - data_type: numeric - - name: volume - data_type: numeric - - name: amount_liquidated - data_type: numeric - - name: trades - data_type: integer - - name: liquidations - data_type: integer - - name: tracking_code - data_type: text - - name: skew - data_type: numeric - - name: long_oi - data_type: numeric - - name: short_oi - data_type: numeric - - name: total_oi - data_type: numeric - - name: long_oi_usd - data_type: numeric - - name: short_oi_usd - data_type: numeric - - name: total_oi_usd - data_type: numeric - - name: long_oi_pct - data_type: numeric - - name: short_oi_pct - data_type: numeric - - name: cumulative_exchange_fees - data_type: numeric - - name: cumulative_liquidation_fees - data_type: numeric - - name: cumulative_volume - data_type: numeric - - name: cumulative_amount_liquidated - data_type: numeric - - name: cumulative_trades - data_type: bigint - - name: cumulative_liquidations - data_type: bigint - - name: fct_v2_open_interest_optimism_mainnet - columns: - - name: id - data_type: character varying - - name: ts - data_type: timestamp with time zone - - name: market - data_type: text - - name: order_type - data_type: text - - name: trade_size - data_type: numeric - - name: price - data_type: numeric - - name: skew - data_type: numeric - - name: long_oi - data_type: numeric - - name: short_oi - data_type: numeric - - name: long_oi_pct - data_type: numeric - - name: short_oi_pct - data_type: numeric - - name: total_oi - data_type: numeric - - name: long_oi_usd - data_type: numeric - - name: short_oi_usd - data_type: numeric - - name: total_oi_usd - data_type: numeric - - name: fct_v2_trade_tracking_optimism_mainnet - columns: - - name: id - data_type: character varying - - name: block_number - data_type: integer - - name: tracking_code - data_type: text - - name: fct_v2_trades_optimism_mainnet - columns: - - name: id - data_type: character varying - - name: ts - data_type: timestamp with time zone - - name: block_number - data_type: integer - - name: transaction_hash - data_type: text - - name: price - data_type: numeric - - name: account - data_type: text - - name: market - data_type: text - - name: margin - data_type: numeric - - name: trade_size - data_type: numeric - - name: size - data_type: numeric - - name: last_size - data_type: numeric - - name: skew - data_type: numeric - - name: fee - data_type: numeric - - name: order_type - data_type: text - - name: tracking_code - data_type: text - - name: fct_v2_transfers_optimism_mainnet - columns: - - name: id - data_type: character varying - - name: transaction_hash - data_type: text - - name: ts - data_type: timestamp with time zone - - name: block_number - data_type: integer - - name: market - data_type: text - - name: account - data_type: text - - name: margin_delta - data_type: numeric - - name: net_market_transfers - data_type: numeric - - name: net_transfers - data_type: numeric diff --git a/transformers/synthetix/models/marts/optimism/mainnet/stats/fct_v2_integrator_daily_optimism_mainnet.sql b/transformers/synthetix/models/marts/optimism/mainnet/stats/fct_v2_integrator_daily_optimism_mainnet.sql deleted file mode 100644 index d908f855..00000000 --- a/transformers/synthetix/models/marts/optimism/mainnet/stats/fct_v2_integrator_daily_optimism_mainnet.sql +++ /dev/null @@ -1,144 +0,0 @@ -with aggregated_data as ( - select - DATE_TRUNC( - 'day', - ts - ) as ts, - tracking_code, - SUM(exchange_fees) as exchange_fees, - SUM(volume) as volume, - SUM(trades) as trades - from - {{ ref('fct_v2_market_stats_optimism_mainnet') }} - group by - DATE_TRUNC( - 'day', - ts - ), - tracking_code -), - -date_series as ( - select - q.ts, - q2.tracking_code - from - ( - select - GENERATE_SERIES( - MIN(DATE_TRUNC('day', ts)), - MAX(DATE_TRUNC('day', ts)), - '1 day'::INTERVAL - ) as ts - from - aggregated_data - ) as q - cross join ( - select distinct tracking_code - from - aggregated_data - ) as q2 -), - -traders as ( - select - ds.ts, - ds.tracking_code, - COALESCE(COUNT(distinct ad.account), 0) as traders - from - date_series as ds - left join - {{ ref('fct_v2_actions_optimism_mainnet') }} - as ad - on ds.ts = DATE_TRUNC( - 'day', - ad.ts - ) - and ds.tracking_code = ad.tracking_code - group by - ds.ts, - ds.tracking_code -), - -complete_data as ( - select - ds.ts, - ds.tracking_code, - t.traders, - COALESCE( - ad.exchange_fees, - 0 - ) as exchange_fees, - COALESCE( - ad.volume, - 0 - ) as volume, - COALESCE( - ad.trades, - 0 - ) as trades - from - date_series as ds - left join aggregated_data as ad - on - ds.ts = ad.ts - and ds.tracking_code = ad.tracking_code - left join traders as t - on - ds.ts = t.ts - and ds.tracking_code = t.tracking_code -), - -total as ( - select - ts, - SUM(exchange_fees) as exchange_fees_total, - SUM(trades) as trades_total, - SUM(volume) as volume_total - from - complete_data - group by - ts -) - -select - complete_data.ts, - complete_data.tracking_code, - complete_data.exchange_fees, - total.exchange_fees_total, - complete_data.volume, - total.volume_total, - complete_data.trades, - total.trades_total, - complete_data.traders, - case - when total.volume_total = 0 then 0 - else complete_data.volume / total.volume_total - end as volume_share, - case - when total.trades_total = 0 then 0 - else complete_data.trades / total.trades_total - end as trades_share, - case - when total.exchange_fees_total = 0 then 0 - else complete_data.exchange_fees / total.exchange_fees_total - end as exchange_fees_share, - SUM(complete_data.exchange_fees) over ( - partition by complete_data.tracking_code - order by - complete_data.ts - ) as cumulative_exchange_fees, - SUM(complete_data.volume) over ( - partition by complete_data.tracking_code - order by - complete_data.ts - ) as cumulative_volume, - SUM(complete_data.trades) over ( - partition by complete_data.tracking_code - order by - complete_data.ts - ) as cumulative_trades -from - complete_data -inner join total - on complete_data.ts = total.ts diff --git a/transformers/synthetix/models/marts/optimism/mainnet/stats/fct_v2_integrator_hourly_optimism_mainnet.sql b/transformers/synthetix/models/marts/optimism/mainnet/stats/fct_v2_integrator_hourly_optimism_mainnet.sql deleted file mode 100644 index d78222cb..00000000 --- a/transformers/synthetix/models/marts/optimism/mainnet/stats/fct_v2_integrator_hourly_optimism_mainnet.sql +++ /dev/null @@ -1,144 +0,0 @@ -with aggregated_data as ( - select - DATE_TRUNC( - 'hour', - ts - ) as ts, - tracking_code, - SUM(exchange_fees) as exchange_fees, - SUM(volume) as volume, - SUM(trades) as trades - from - {{ ref('fct_v2_market_stats_optimism_mainnet') }} - group by - DATE_TRUNC( - 'hour', - ts - ), - tracking_code -), - -date_series as ( - select - q.ts, - q2.tracking_code - from - ( - select - GENERATE_SERIES( - MIN(DATE_TRUNC('hour', ts)), - MAX(DATE_TRUNC('hour', ts)), - '1 hour'::INTERVAL - ) as ts - from - aggregated_data - ) as q - cross join ( - select distinct tracking_code - from - aggregated_data - ) as q2 -), - -traders as ( - select - ds.ts, - ds.tracking_code, - COALESCE(COUNT(distinct ad.account), 0) as traders - from - date_series as ds - left join - {{ ref('fct_v2_actions_optimism_mainnet') }} - as ad - on ds.ts = DATE_TRUNC( - 'hour', - ad.ts - ) - and ds.tracking_code = ad.tracking_code - group by - ds.ts, - ds.tracking_code -), - -complete_data as ( - select - ds.ts, - ds.tracking_code, - t.traders, - COALESCE( - ad.exchange_fees, - 0 - ) as exchange_fees, - COALESCE( - ad.volume, - 0 - ) as volume, - COALESCE( - ad.trades, - 0 - ) as trades - from - date_series as ds - left join aggregated_data as ad - on - ds.ts = ad.ts - and ds.tracking_code = ad.tracking_code - left join traders as t - on - ds.ts = t.ts - and ds.tracking_code = t.tracking_code -), - -total as ( - select - ts, - SUM(exchange_fees) as exchange_fees_total, - SUM(trades) as trades_total, - SUM(volume) as volume_total - from - complete_data - group by - ts -) - -select - complete_data.ts, - complete_data.tracking_code, - complete_data.exchange_fees, - total.exchange_fees_total, - complete_data.volume, - total.volume_total, - complete_data.trades, - total.trades_total, - complete_data.traders, - case - when total.volume_total = 0 then 0 - else complete_data.volume / total.volume_total - end as volume_share, - case - when total.trades_total = 0 then 0 - else complete_data.trades / total.trades_total - end as trades_share, - case - when total.exchange_fees_total = 0 then 0 - else complete_data.exchange_fees / total.exchange_fees_total - end as exchange_fees_share, - SUM(complete_data.exchange_fees) over ( - partition by complete_data.tracking_code - order by - complete_data.ts - ) as cumulative_exchange_fees, - SUM(complete_data.volume) over ( - partition by complete_data.tracking_code - order by - complete_data.ts - ) as cumulative_volume, - SUM(complete_data.trades) over ( - partition by complete_data.tracking_code - order by - complete_data.ts - ) as cumulative_trades -from - complete_data -inner join total - on complete_data.ts = total.ts diff --git a/transformers/synthetix/models/marts/optimism/mainnet/stats/fct_v2_market_daily_optimism_mainnet.sql b/transformers/synthetix/models/marts/optimism/mainnet/stats/fct_v2_market_daily_optimism_mainnet.sql deleted file mode 100644 index eb24e6c3..00000000 --- a/transformers/synthetix/models/marts/optimism/mainnet/stats/fct_v2_market_daily_optimism_mainnet.sql +++ /dev/null @@ -1,232 +0,0 @@ -with raw_data as ( - select - DATE_TRUNC( - 'day', - ts - ) as ts, - market, - MAX(id) as max_id, - SUM(exchange_fees) as exchange_fees, - SUM(liquidation_fees) as liquidation_fees, - SUM(volume) as volume, - SUM(amount_liquidated) as amount_liquidated, - SUM(trades) as trades, - SUM(liquidations) as liquidations - from - {{ ref('fct_v2_market_stats_optimism_mainnet') }} - group by - DATE_TRUNC( - 'day', - ts - ), - market -), - -aggregated_data as ( - select - a.ts, - a.market, - a.exchange_fees, - a.liquidation_fees, - a.volume, - a.amount_liquidated, - a.trades, - a.liquidations, - b.long_oi_usd, - b.short_oi_usd, - b.total_oi_usd, - b.cumulative_exchange_fees, - b.cumulative_liquidation_fees, - b.cumulative_volume, - b.cumulative_amount_liquidated, - b.cumulative_trades, - b.cumulative_liquidations - from - raw_data as a - inner join - {{ ref('fct_v2_market_stats_optimism_mainnet') }} - as b - on a.max_id = b.id -), - -date_series as ( - select - q.ts, - q2.market - from - ( - select - GENERATE_SERIES( - MIN(DATE_TRUNC('day', ts)), - MAX(DATE_TRUNC('day', ts)), - '1 day'::INTERVAL - ) as ts - from - aggregated_data - ) as q - cross join ( - select distinct market - from - aggregated_data - ) as q2 -), - -gap_data as ( - select - ds.ts, - ds.market, - ad.long_oi_usd, - ad.short_oi_usd, - ad.total_oi_usd, - ad.cumulative_exchange_fees, - ad.cumulative_liquidation_fees, - ad.cumulative_volume, - ad.cumulative_amount_liquidated, - ad.cumulative_trades, - ad.cumulative_liquidations, - COALESCE( - ad.exchange_fees, - 0 - ) as exchange_fees, - COALESCE( - ad.liquidation_fees, - 0 - ) as liquidation_fees, - COALESCE( - ad.volume, - 0 - ) as volume, - COALESCE( - ad.amount_liquidated, - 0 - ) as amount_liquidated, - COALESCE( - ad.trades, - 0 - ) as trades, - COALESCE( - ad.liquidations, - 0 - ) as liquidations - from - date_series as ds - left join aggregated_data as ad - on - ds.ts = ad.ts - and ds.market = ad.market -), - -agg_data as ( - select - ts, - market, - FIRST_VALUE(long_oi_usd) over ( - partition by - market, - value_partition - order by - ts - ) as long_oi_usd, - FIRST_VALUE(short_oi_usd) over ( - partition by - market, - value_partition - order by - ts - ) as short_oi_usd, - FIRST_VALUE(total_oi_usd) over ( - partition by - market, - value_partition - order by - ts - ) as total_oi_usd, - FIRST_VALUE(cumulative_exchange_fees) over ( - partition by - market, - value_partition - order by - ts - ) as cumulative_exchange_fees, - FIRST_VALUE(cumulative_liquidation_fees) over ( - partition by - market, - value_partition - order by - ts - ) as cumulative_liquidation_fees, - FIRST_VALUE(cumulative_volume) over ( - partition by - market, - value_partition - order by - ts - ) as cumulative_volume, - FIRST_VALUE(cumulative_amount_liquidated) over ( - partition by - market, - value_partition - order by - ts - ) as cumulative_amount_liquidated, - FIRST_VALUE(cumulative_trades) over ( - partition by - market, - value_partition - order by - ts - ) as cumulative_trades, - FIRST_VALUE(cumulative_liquidations) over ( - partition by - market, - value_partition - order by - ts - ) as cumulative_liquidations - from - ( - select - ts, - market, - long_oi_usd, - short_oi_usd, - total_oi_usd, - cumulative_exchange_fees, - cumulative_liquidation_fees, - cumulative_volume, - cumulative_amount_liquidated, - cumulative_trades, - cumulative_liquidations, - COUNT(long_oi_usd) over ( - partition by market - order by - ts - ) as value_partition - from - gap_data - ) as q -) - -select - gap_data.ts, - gap_data.market, - gap_data.exchange_fees, - gap_data.liquidation_fees, - gap_data.volume, - gap_data.amount_liquidated, - gap_data.trades, - gap_data.liquidations, - agg_data.long_oi_usd, - agg_data.short_oi_usd, - agg_data.total_oi_usd, - agg_data.cumulative_exchange_fees, - agg_data.cumulative_liquidation_fees, - agg_data.cumulative_volume, - agg_data.cumulative_amount_liquidated, - agg_data.cumulative_trades, - agg_data.cumulative_liquidations -from - gap_data -inner join - agg_data - on gap_data.ts = agg_data.ts and gap_data.market = agg_data.market diff --git a/transformers/synthetix/models/marts/optimism/mainnet/stats/fct_v2_market_hourly_optimism_mainnet.sql b/transformers/synthetix/models/marts/optimism/mainnet/stats/fct_v2_market_hourly_optimism_mainnet.sql deleted file mode 100644 index c5899dc7..00000000 --- a/transformers/synthetix/models/marts/optimism/mainnet/stats/fct_v2_market_hourly_optimism_mainnet.sql +++ /dev/null @@ -1,232 +0,0 @@ -with raw_data as ( - select - DATE_TRUNC( - 'hour', - ts - ) as ts, - market, - MAX(id) as max_id, - SUM(exchange_fees) as exchange_fees, - SUM(liquidation_fees) as liquidation_fees, - SUM(volume) as volume, - SUM(amount_liquidated) as amount_liquidated, - SUM(trades) as trades, - SUM(liquidations) as liquidations - from - {{ ref('fct_v2_market_stats_optimism_mainnet') }} - group by - DATE_TRUNC( - 'hour', - ts - ), - market -), - -aggregated_data as ( - select - a.ts, - a.market, - a.exchange_fees, - a.liquidation_fees, - a.volume, - a.amount_liquidated, - a.trades, - a.liquidations, - b.long_oi_usd, - b.short_oi_usd, - b.total_oi_usd, - b.cumulative_exchange_fees, - b.cumulative_liquidation_fees, - b.cumulative_volume, - b.cumulative_amount_liquidated, - b.cumulative_trades, - b.cumulative_liquidations - from - raw_data as a - inner join - {{ ref('fct_v2_market_stats_optimism_mainnet') }} - as b - on a.max_id = b.id -), - -date_series as ( - select - q.ts, - q2.market - from - ( - select - GENERATE_SERIES( - MIN(DATE_TRUNC('hour', ts)), - MAX(DATE_TRUNC('hour', ts)), - '1 hour'::INTERVAL - ) as ts - from - aggregated_data - ) as q - cross join ( - select distinct market - from - aggregated_data - ) as q2 -), - -gap_data as ( - select - ds.ts, - ds.market, - ad.long_oi_usd, - ad.short_oi_usd, - ad.total_oi_usd, - ad.cumulative_exchange_fees, - ad.cumulative_liquidation_fees, - ad.cumulative_volume, - ad.cumulative_amount_liquidated, - ad.cumulative_trades, - ad.cumulative_liquidations, - COALESCE( - ad.exchange_fees, - 0 - ) as exchange_fees, - COALESCE( - ad.liquidation_fees, - 0 - ) as liquidation_fees, - COALESCE( - ad.volume, - 0 - ) as volume, - COALESCE( - ad.amount_liquidated, - 0 - ) as amount_liquidated, - COALESCE( - ad.trades, - 0 - ) as trades, - COALESCE( - ad.liquidations, - 0 - ) as liquidations - from - date_series as ds - left join aggregated_data as ad - on - ds.ts = ad.ts - and ds.market = ad.market -), - -agg_data as ( - select - ts, - market, - FIRST_VALUE(long_oi_usd) over ( - partition by - market, - value_partition - order by - ts - ) as long_oi_usd, - FIRST_VALUE(short_oi_usd) over ( - partition by - market, - value_partition - order by - ts - ) as short_oi_usd, - FIRST_VALUE(total_oi_usd) over ( - partition by - market, - value_partition - order by - ts - ) as total_oi_usd, - FIRST_VALUE(cumulative_exchange_fees) over ( - partition by - market, - value_partition - order by - ts - ) as cumulative_exchange_fees, - FIRST_VALUE(cumulative_liquidation_fees) over ( - partition by - market, - value_partition - order by - ts - ) as cumulative_liquidation_fees, - FIRST_VALUE(cumulative_volume) over ( - partition by - market, - value_partition - order by - ts - ) as cumulative_volume, - FIRST_VALUE(cumulative_amount_liquidated) over ( - partition by - market, - value_partition - order by - ts - ) as cumulative_amount_liquidated, - FIRST_VALUE(cumulative_trades) over ( - partition by - market, - value_partition - order by - ts - ) as cumulative_trades, - FIRST_VALUE(cumulative_liquidations) over ( - partition by - market, - value_partition - order by - ts - ) as cumulative_liquidations - from - ( - select - ts, - market, - long_oi_usd, - short_oi_usd, - total_oi_usd, - cumulative_exchange_fees, - cumulative_liquidation_fees, - cumulative_volume, - cumulative_amount_liquidated, - cumulative_trades, - cumulative_liquidations, - COUNT(long_oi_usd) over ( - partition by market - order by - ts - ) as value_partition - from - gap_data - ) as q -) - -select - gap_data.ts, - gap_data.market, - gap_data.exchange_fees, - gap_data.liquidation_fees, - gap_data.volume, - gap_data.amount_liquidated, - gap_data.trades, - gap_data.liquidations, - agg_data.long_oi_usd, - agg_data.short_oi_usd, - agg_data.total_oi_usd, - agg_data.cumulative_exchange_fees, - agg_data.cumulative_liquidation_fees, - agg_data.cumulative_volume, - agg_data.cumulative_amount_liquidated, - agg_data.cumulative_trades, - agg_data.cumulative_liquidations -from - gap_data -inner join - agg_data - on gap_data.ts = agg_data.ts and gap_data.market = agg_data.market diff --git a/transformers/synthetix/models/marts/optimism/mainnet/stats/fct_v2_stats_daily_optimism_mainnet.sql b/transformers/synthetix/models/marts/optimism/mainnet/stats/fct_v2_stats_daily_optimism_mainnet.sql deleted file mode 100644 index 5263ce21..00000000 --- a/transformers/synthetix/models/marts/optimism/mainnet/stats/fct_v2_stats_daily_optimism_mainnet.sql +++ /dev/null @@ -1,69 +0,0 @@ -select - ts, - SUM( - exchange_fees - ) as exchange_fees, - SUM( - liquidation_fees - ) as liquidation_fees, - SUM( - volume - ) as volume, - SUM( - amount_liquidated - ) as amount_liquidated, - SUM( - trades - ) as trades, - SUM( - liquidations - ) as liquidations, - SUM( - long_oi_usd - ) as long_oi_usd, - SUM( - short_oi_usd - ) as short_oi_usd, - SUM( - total_oi_usd - ) as total_oi_usd, - SUM( - case - when market in ( - 'ETH', - 'BTC' - ) then total_oi_usd - else 0 - end - ) as eth_btc_oi_usd, - SUM( - case - when market not in ( - 'ETH', - 'BTC' - ) then total_oi_usd - else 0 - end - ) as alt_oi_usd, - SUM( - cumulative_exchange_fees - ) as cumulative_exchange_fees, - SUM( - cumulative_liquidation_fees - ) as cumulative_liquidation_fees, - SUM( - cumulative_volume - ) as cumulative_volume, - SUM( - cumulative_amount_liquidated - ) as cumulative_amount_liquidated, - SUM( - cumulative_trades - ) as cumulative_trades, - SUM( - cumulative_liquidations - ) as cumulative_liquidations -from - {{ ref('fct_v2_market_daily_optimism_mainnet') }} -group by - ts diff --git a/transformers/synthetix/models/marts/optimism/mainnet/stats/fct_v2_stats_hourly_optimism_mainnet.sql b/transformers/synthetix/models/marts/optimism/mainnet/stats/fct_v2_stats_hourly_optimism_mainnet.sql deleted file mode 100644 index 2f0f6d22..00000000 --- a/transformers/synthetix/models/marts/optimism/mainnet/stats/fct_v2_stats_hourly_optimism_mainnet.sql +++ /dev/null @@ -1,69 +0,0 @@ -select - ts, - SUM( - exchange_fees - ) as exchange_fees, - SUM( - liquidation_fees - ) as liquidation_fees, - SUM( - volume - ) as volume, - SUM( - amount_liquidated - ) as amount_liquidated, - SUM( - trades - ) as trades, - SUM( - liquidations - ) as liquidations, - SUM( - long_oi_usd - ) as long_oi_usd, - SUM( - short_oi_usd - ) as short_oi_usd, - SUM( - total_oi_usd - ) as total_oi_usd, - SUM( - case - when market in ( - 'ETH', - 'BTC' - ) then total_oi_usd - else 0 - end - ) as eth_btc_oi_usd, - SUM( - case - when market not in ( - 'ETH', - 'BTC' - ) then total_oi_usd - else 0 - end - ) as alt_oi_usd, - SUM( - cumulative_exchange_fees - ) as cumulative_exchange_fees, - SUM( - cumulative_liquidation_fees - ) as cumulative_liquidation_fees, - SUM( - cumulative_volume - ) as cumulative_volume, - SUM( - cumulative_amount_liquidated - ) as cumulative_amount_liquidated, - SUM( - cumulative_trades - ) as cumulative_trades, - SUM( - cumulative_liquidations - ) as cumulative_liquidations -from - {{ ref('fct_v2_market_hourly_optimism_mainnet') }} -group by - ts diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/blocks_arbitrum_mainnet.sql b/transformers/synthetix/models/raw/arbitrum/mainnet/blocks_arbitrum_mainnet.sql index 75156f0c..ae1ea2ff 100644 --- a/transformers/synthetix/models/raw/arbitrum/mainnet/blocks_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/raw/arbitrum/mainnet/blocks_arbitrum_mainnet.sql @@ -7,38 +7,15 @@ with indexer_blocks as ( from {{ source( 'raw_arbitrum_mainnet', - 'block' + 'synthetix_block' ) }} -), - -parquet_blocks as ( - select - TO_TIMESTAMP(timestamp) as ts, - CAST( - block_number as INTEGER - ) as block_number - from - {{ source( - 'raw_arbitrum_mainnet', - 'blocks_parquet' - ) }} -), - -combined_blocks as ( - select * - from - indexer_blocks - - union all - select * - from - parquet_blocks ) + select block_number, MIN(ts) as ts from - combined_blocks + indexer_blocks group by block_number diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_account_created_arbitrum_mainnet.sql b/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_account_created_arbitrum_mainnet.sql index 263531fc..ae44b709 100644 --- a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_account_created_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_account_created_arbitrum_mainnet.sql @@ -1,6 +1,20 @@ -{{ get_event_data( - 'arbitrum', - 'mainnet', - 'core_proxy', - 'account_created' -) }} +with core_account_created as ( + {{ get_event_data( + 'arbitrum', + 'mainnet', + 'synthetix', + 'core_proxy', + 'account_created' + ) }} +) + +select + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + id, + cast(account_id as UInt128) as account_id, + owner +from core_account_created diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_delegation_updated_arbitrum_mainnet.sql b/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_delegation_updated_arbitrum_mainnet.sql index e4f60aaf..16f89c81 100644 --- a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_delegation_updated_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_delegation_updated_arbitrum_mainnet.sql @@ -1,6 +1,25 @@ -{{ get_event_data( - 'arbitrum', - 'mainnet', - 'core_proxy', - 'delegation_updated' -) }} +with delegation_updated as ( + {{ get_event_data( + 'arbitrum', + 'mainnet', + 'synthetix', + 'core_proxy', + 'delegation_updated' + ) }} +) + +select + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + id, + sender, + cast(account_id as UInt128) as account_id, + cast(pool_id as UInt128) as pool_id, + collateral_type, + cast(amount as UInt256) as amount, + cast(leverage as UInt256) as leverage +from + delegation_updated \ No newline at end of file diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_deposited_arbitrum_mainnet.sql b/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_deposited_arbitrum_mainnet.sql index 2918b8f4..c6bd6bb2 100644 --- a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_deposited_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_deposited_arbitrum_mainnet.sql @@ -1,6 +1,22 @@ -{{ get_event_data( - 'arbitrum', - 'mainnet', - 'core_proxy', - 'deposited' -) }} +with core_deposited as ( + {{ get_event_data( + 'arbitrum', + 'mainnet', + 'synthetix', + 'core_proxy', + 'deposited' + ) }} +) + +select + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + id, + sender, + cast(account_id as UInt128) as account_id, + collateral_type, + cast(token_amount as UInt256) as token_amount +from core_deposited \ No newline at end of file diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_liquidation_arbitrum_mainnet.sql b/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_liquidation_arbitrum_mainnet.sql index 8ce826c6..b5c138da 100644 --- a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_liquidation_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_liquidation_arbitrum_mainnet.sql @@ -1,6 +1,24 @@ -{{ get_event_data( - 'arbitrum', - 'mainnet', - 'core_proxy', - 'liquidation' -) }} +with core_liquidation as ( + {{ get_event_data( + 'arbitrum', + 'mainnet', + 'synthetix', + 'core_proxy', + 'liquidation' + ) }} +) + +select + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + id, + sender, + liquidation_data, + cast(account_id as UInt128) as account_id, + cast(pool_id as UInt128) as pool_id, + collateral_type, + cast(liquidate_as_account_id as UInt128) as liquidate_as_account_id +from core_liquidation \ No newline at end of file diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_market_registered_arbitrum_mainnet.sql b/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_market_registered_arbitrum_mainnet.sql index df736c32..87885bfe 100644 --- a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_market_registered_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_market_registered_arbitrum_mainnet.sql @@ -1,6 +1,21 @@ -{{ get_event_data( - 'arbitrum', - 'mainnet', - 'core_proxy', - 'market_registered' -) }} +with core_market_registered as ( + {{ get_event_data( + 'arbitrum', + 'mainnet', + 'synthetix', + 'core_proxy', + 'market_registered' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + sender, + market, + cast(market_id as UInt128) as market_id +from core_market_registered diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_market_updated_arbitrum_mainnet.sql b/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_market_updated_arbitrum_mainnet.sql index beac3e6d..598f9bf0 100644 --- a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_market_updated_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_market_updated_arbitrum_mainnet.sql @@ -6,18 +6,19 @@ with events as ( transaction_hash, contract, event_name, - market_id, - net_issuance, - deposited_collateral_value, sender, collateral_type, - credit_capacity, - token_amount + cast(market_id as UInt128) as market_id, + cast(net_issuance as Int128) as net_issuance, + cast(deposited_collateral_value as UInt256) as deposited_collateral_value, + cast(credit_capacity as Int128) as credit_capacity, + cast(token_amount as UInt256) as token_amount from ( {{ get_event_data( 'arbitrum', 'mainnet', + 'synthetix', 'core_proxy', 'market_collateral_deposited' ) }} @@ -30,18 +31,19 @@ with events as ( transaction_hash, contract, event_name, - market_id, - net_issuance, - deposited_collateral_value, sender, collateral_type, - credit_capacity, - token_amount + cast(market_id as UInt128) as market_id, + cast(net_issuance as Int128) as net_issuance, + cast(deposited_collateral_value as UInt256) as deposited_collateral_value, + cast(credit_capacity as Int128) as credit_capacity, + cast(token_amount as UInt256) as token_amount from ( {{ get_event_data( 'arbitrum', 'mainnet', + 'synthetix', 'core_proxy', 'market_collateral_withdrawn' ) }} @@ -54,18 +56,19 @@ with events as ( transaction_hash, contract, event_name, - market_id, - net_issuance, - deposited_collateral_value, target as sender, 'USD' as collateral_type, - credit_capacity, - amount as token_amount + cast(market_id as UInt128) as market_id, + cast(net_issuance as Int128) as net_issuance, + cast(deposited_collateral_value as UInt256) as deposited_collateral_value, + cast(credit_capacity as Int128) as credit_capacity, + cast(amount as UInt256) as token_amount from ( {{ get_event_data( 'arbitrum', 'mainnet', + 'synthetix', 'core_proxy', 'market_usd_deposited' ) }} @@ -78,18 +81,19 @@ with events as ( transaction_hash, contract, event_name, - market_id, - net_issuance, - deposited_collateral_value, target as sender, 'USD' as collateral_type, - credit_capacity, - amount as token_amount + cast(market_id as UInt128) as market_id, + cast(net_issuance as Int128) as net_issuance, + cast(deposited_collateral_value as UInt256) as deposited_collateral_value, + cast(credit_capacity as Int128) as credit_capacity, + cast(amount as UInt256) as token_amount from ( {{ get_event_data( 'arbitrum', 'mainnet', + 'synthetix', 'core_proxy', 'market_usd_withdrawn' ) }} @@ -100,4 +104,4 @@ select * from events order by - block_timestamp + block_timestamp \ No newline at end of file diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_pool_created_arbitrum_mainnet.sql b/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_pool_created_arbitrum_mainnet.sql index 723d1a1e..24495b73 100644 --- a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_pool_created_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_pool_created_arbitrum_mainnet.sql @@ -1,6 +1,21 @@ -{{ get_event_data( - 'arbitrum', - 'mainnet', - 'core_proxy', - 'pool_created' -) }} +with core_pool_created as ( + {{ get_event_data( + 'arbitrum', + 'mainnet', + 'synthetix', + 'core_proxy', + 'pool_created' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + sender, + owner, + cast(pool_id as UInt128) as pool_id +from core_pool_created diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_rewards_claimed_arbitrum_mainnet.sql b/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_rewards_claimed_arbitrum_mainnet.sql index 0f1d47b5..4623ba7f 100644 --- a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_rewards_claimed_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_rewards_claimed_arbitrum_mainnet.sql @@ -1,6 +1,23 @@ -{{ get_event_data( - 'arbitrum', - 'mainnet', - 'core_proxy', - 'rewards_claimed' -) }} +with core_rewards_claimed as ( + {{ get_event_data( + 'arbitrum', + 'mainnet', + 'synthetix', + 'core_proxy', + 'rewards_claimed' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + cast(account_id as UInt128) as account_id, + cast(pool_id as UInt128) as pool_id, + collateral_type, + distributor, + cast(amount as UInt256) as amount +from core_rewards_claimed \ No newline at end of file diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_rewards_distributed_arbitrum_mainnet.sql b/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_rewards_distributed_arbitrum_mainnet.sql index 09e642e0..6fe569cc 100644 --- a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_rewards_distributed_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_rewards_distributed_arbitrum_mainnet.sql @@ -1,6 +1,24 @@ -{{ get_event_data( - 'arbitrum', - 'mainnet', - 'core_proxy', - 'rewards_distributed' -) }} +with core_rewards_distributed as ( + {{ get_event_data( + 'arbitrum', + 'mainnet', + 'synthetix', + 'core_proxy', + 'rewards_distributed' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + cast(pool_id as UInt128) as pool_id, + collateral_type, + distributor, + cast(amount as UInt256) as amount, + cast(start as UInt256) as start, + cast(duration as UInt256) as duration +from core_rewards_distributed \ No newline at end of file diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_usd_burned_arbitrum_mainnet.sql b/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_usd_burned_arbitrum_mainnet.sql index 0d928458..fcd922e4 100644 --- a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_usd_burned_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_usd_burned_arbitrum_mainnet.sql @@ -1,6 +1,23 @@ -{{ get_event_data( - 'arbitrum', - 'mainnet', - 'core_proxy', - 'usd_burned' -) }} +with core_usd_burned as ( + {{ get_event_data( + 'arbitrum', + 'mainnet', + 'synthetix', + 'core_proxy', + 'usd_burned' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + sender, + cast(account_id as UInt128) as account_id, + cast(pool_id as UInt128) as pool_id, + collateral_type, + cast(amount as UInt256) as amount +from core_usd_burned diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_usd_minted_arbitrum_mainnet.sql b/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_usd_minted_arbitrum_mainnet.sql index c30f4736..51428080 100644 --- a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_usd_minted_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_usd_minted_arbitrum_mainnet.sql @@ -1,6 +1,23 @@ -{{ get_event_data( - 'arbitrum', - 'mainnet', - 'core_proxy', - 'usd_minted' -) }} +with core_usd_minted as ( + {{ get_event_data( + 'arbitrum', + 'mainnet', + 'synthetix', + 'core_proxy', + 'usd_minted' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + sender, + cast(account_id as UInt128) as account_id, + cast(pool_id as UInt128) as pool_id, + collateral_type, + cast(amount as UInt256) as amount +from core_usd_minted \ No newline at end of file diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_vault_collateral_arbitrum_mainnet.sql b/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_vault_collateral_arbitrum_mainnet.sql index 61209af0..003378c7 100644 --- a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_vault_collateral_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_vault_collateral_arbitrum_mainnet.sql @@ -3,35 +3,31 @@ with base as ( block_number, contract_address, chain_id, - pool_id, + cast(pool_id as Int128) as pool_id, collateral_type, cast( - amount as numeric + amount as UInt256 ) as amount, cast( - value as numeric + value as UInt256 ) as collateral_value from {{ source( 'raw_arbitrum_mainnet', - "core_get_vault_collateral" + 'get_vault_collateral' ) }} where amount is not null ) select - to_timestamp(blocks.timestamp) as ts, + from_unixtime(blocks.timestamp) as ts, cast( blocks.block_number as integer ) as block_number, base.contract_address, - cast( - base.pool_id as integer - ) as pool_id, - cast( - base.collateral_type as varchar - ) as collateral_type, + base.pool_id, + base.collateral_type, {{ convert_wei('base.amount') }} as amount, {{ convert_wei('base.collateral_value') }} as collateral_value from diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_vault_debt_arbitrum_mainnet.sql b/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_vault_debt_arbitrum_mainnet.sql index 579a4592..11330726 100644 --- a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_vault_debt_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_vault_debt_arbitrum_mainnet.sql @@ -3,32 +3,28 @@ with base as ( block_number, contract_address, chain_id, - pool_id, + cast(pool_id as Int128) as pool_id, collateral_type, cast( - value_1 as numeric + value_1 as Int256 ) as debt from {{ source( 'raw_arbitrum_mainnet', - "core_get_vault_debt" + 'get_vault_debt' ) }} where value_1 is not null ) select - to_timestamp(blocks.timestamp) as ts, + from_unixtime(blocks.timestamp) as ts, cast( blocks.block_number as integer ) as block_number, base.contract_address, - cast( - base.pool_id as integer - ) as pool_id, - cast( - base.collateral_type as varchar - ) as collateral_type, + base.pool_id, + base.collateral_type, {{ convert_wei('base.debt') }} as debt from base diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_vault_liquidation_arbitrum_mainnet.sql b/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_vault_liquidation_arbitrum_mainnet.sql index d47c5eb2..4f1c05fd 100644 --- a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_vault_liquidation_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_vault_liquidation_arbitrum_mainnet.sql @@ -1,6 +1,22 @@ -{{ get_event_data( - 'arbitrum', - 'mainnet', - 'core_proxy', - 'vault_liquidation' -) }} +with core_vault_liquidation as ( + {{ get_event_data( + 'arbitrum', + 'mainnet', + 'synthetix', + 'core_proxy', + 'vault_liquidation' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + sender, + cast(pool_id as UInt128) as pool_id, + cast(collateral_type as text) as collateral_type, + cast(liquidate_as_account_id as UInt128) as liquidate_as_account_id +from core_vault_liquidation \ No newline at end of file diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_withdrawn_arbitrum_mainnet.sql b/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_withdrawn_arbitrum_mainnet.sql index 8e39ffcf..a89c44c3 100644 --- a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_withdrawn_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_withdrawn_arbitrum_mainnet.sql @@ -1,6 +1,22 @@ -{{ get_event_data( - 'arbitrum', - 'mainnet', - 'core_proxy', - 'withdrawn' -) }} +with core_withdrawn as ( + {{ get_event_data( + 'arbitrum', + 'mainnet', + 'synthetix', + 'core_proxy', + 'withdrawn' + ) }} +) + +select + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + id, + sender, + cast(account_id as UInt128) as account_id, + collateral_type, + cast(token_amount as UInt256) as token_amount +from core_withdrawn diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/core/schema.yml b/transformers/synthetix/models/raw/arbitrum/mainnet/core/schema.yml index 145e7a9d..6e1b9df3 100644 --- a/transformers/synthetix/models/raw/arbitrum/mainnet/core/schema.yml +++ b/transformers/synthetix/models/raw/arbitrum/mainnet/core/schema.yml @@ -1,6 +1,6 @@ version: 2 models: - - name: core_account_created_arbitrum_mainnet + - name: core_account_created_arbitrum_sepolia description: AccountCreated events from the CoreProxy contract columns: - name: owner @@ -10,7 +10,7 @@ models: - not_null - name: account_id description: "ID of the account" - data_type: numeric + data_type: uint128 tests: - not_null - dbt_utils.accepted_range: @@ -18,7 +18,7 @@ models: inclusive: true - name: id description: "ID of the event record" - data_type: character varying + data_type: text tests: - not_null - unique @@ -29,7 +29,7 @@ models: - not_null - name: block_number description: "Block number" - data_type: integer + data_type: text tests: - not_null - name: block_timestamp @@ -49,7 +49,7 @@ models: data_type: text tests: - not_null - - name: core_delegation_updated_arbitrum_mainnet + - name: core_delegation_updated_arbitrum_sepolia description: DelegationUpdated events from the CoreProxy contract columns: - name: contract @@ -59,18 +59,15 @@ models: - not_null - name: id description: "ID of the event record" - data_type: character varying + data_type: text tests: - not_null - unique - name: account_id description: "ID of the account" - data_type: numeric + data_type: text tests: - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - name: collateral_type description: "Type of delegated collateral" data_type: text @@ -78,12 +75,9 @@ models: - not_null - name: pool_id description: "ID of the pool" - data_type: numeric + data_type: uint128 tests: - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - name: sender description: "Address of the delegator" data_type: text @@ -101,7 +95,7 @@ models: - not_null - name: leverage description: "Leverage" - data_type: numeric + data_type: uint256 tests: - not_null - dbt_utils.accepted_range: @@ -115,7 +109,7 @@ models: - not_null - name: amount description: "Amount delegated" - data_type: numeric + data_type: uint256 tests: - not_null - dbt_utils.accepted_range: @@ -128,7 +122,7 @@ models: - not_null - accepted_values: values: ["DelegationUpdated"] - - name: core_deposited_arbitrum_mainnet + - name: core_deposited_arbitrum_sepolia description: Deposited events from the CoreProxy contract columns: - name: collateral_type @@ -138,7 +132,7 @@ models: - not_null - name: id description: "ID of the event record" - data_type: character varying + data_type: text tests: - not_null - unique @@ -161,12 +155,9 @@ models: - not_null - name: account_id description: "ID of the account" - data_type: numeric + data_type: uint128 tests: - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - name: sender description: "Address of the depositor" data_type: text @@ -184,13 +175,13 @@ models: - not_null - name: token_amount description: "Token amount deposited" - data_type: numeric + data_type: uint256 tests: - not_null - dbt_utils.accepted_range: min_value: 0 inclusive: true - - name: core_withdrawn_arbitrum_mainnet + - name: core_withdrawn_arbitrum_sepolia description: Withdrawn events from the CoreProxy contract columns: - name: block_timestamp @@ -215,7 +206,7 @@ models: - not_null - name: token_amount description: "Token amount withdrawn" - data_type: numeric + data_type: uint256 tests: - not_null - dbt_utils.accepted_range: @@ -228,7 +219,7 @@ models: - not_null - name: account_id description: "ID of the account" - data_type: numeric + data_type: uint128 tests: - not_null - dbt_utils.accepted_range: @@ -252,17 +243,14 @@ models: - not_null - accepted_values: values: ["Withdrawn"] - - name: core_liquidation_arbitrum_mainnet + - name: core_liquidation_arbitrum_sepolia description: Liquidation events from the CoreProxy contract columns: - name: pool_id description: "ID of the pool" - data_type: numeric + data_type: uint128 tests: - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - name: block_timestamp description: "Block timestamp" data_type: timestamp with time zone @@ -275,7 +263,7 @@ models: - not_null - name: id description: "ID of the event record" - data_type: character varying + data_type: text tests: - not_null - unique @@ -302,10 +290,10 @@ models: tests: - not_null - name: liquidation_data - data_type: jsonb + data_type: array - name: account_id description: "ID of the account" - data_type: numeric + data_type: uint128 tests: - not_null - dbt_utils.accepted_range: @@ -317,20 +305,20 @@ models: tests: - not_null - name: liquidate_as_account_id - data_type: numeric + data_type: uint128 tests: - not_null - dbt_utils.accepted_range: min_value: 0 inclusive: true - - name: core_market_updated_arbitrum_mainnet + - name: core_market_updated_arbitrum_sepolia description: > Combination of MarketCollateralDeposited, MarketCollateralWithdrawn, MarketUsdDeposited, MarketUsdWithdrawn events from the CoreProxy contract columns: - name: id description: "ID of the event record" - data_type: character varying + data_type: text tests: - not_null - unique @@ -363,7 +351,7 @@ models: values: ["MarketCollateralWithdrawn", "MarketCollateralDeposited", "MarketUsdWithdrawn", "MarketUsdDeposited"] - name: market_id description: "ID of the market" - data_type: numeric + data_type: uint128 tests: - not_null - dbt_utils.accepted_range: @@ -371,12 +359,12 @@ models: inclusive: true - name: net_issuance description: "Net issuance" - data_type: numeric + data_type: int128 tests: - not_null - name: deposited_collateral_value description: "Deposited collateral value" - data_type: numeric + data_type: uint256 tests: - not_null - dbt_utils.accepted_range: @@ -394,22 +382,22 @@ models: - not_null - name: credit_capacity description: "Credit capacity" - data_type: numeric + data_type: int128 tests: - not_null - name: token_amount description: "Token amount" - data_type: numeric + data_type: uint256 tests: - not_null - dbt_utils.accepted_range: min_value: 0 inclusive: true - - name: core_market_registered_arbitrum_mainnet + - name: core_market_registered_arbitrum_sepolia description: MarketRegistered events from the CoreProxy contract columns: - name: market - description: "Market name" + description: "Market address" data_type: text tests: - not_null @@ -421,7 +409,7 @@ models: - unique - name: id description: "ID of the event record" - data_type: character varying + data_type: text tests: - not_null - unique @@ -457,7 +445,7 @@ models: data_type: text tests: - not_null - - name: core_pool_created_arbitrum_mainnet + - name: core_pool_created_arbitrum_sepolia description: "PoolCreated events from the CoreProxy contract" columns: - name: contract @@ -477,7 +465,7 @@ models: - not_null - name: id description: "ID of the event record" - data_type: character varying + data_type: text tests: - not_null - unique @@ -505,13 +493,13 @@ models: - not_null - name: pool_id description: "ID of the pool" - data_type: numeric + data_type: uint128 tests: - not_null - dbt_utils.accepted_range: min_value: 0 inclusive: true - - name: core_rewards_claimed_arbitrum_mainnet + - name: core_rewards_claimed_arbitrum_sepolia description: RewardsClaimed events from the CoreProxy contract columns: - name: transaction_hash @@ -521,7 +509,7 @@ models: - not_null - name: account_id description: "ID of the account" - data_type: numeric + data_type: uint128 tests: - not_null - dbt_utils.accepted_range: @@ -546,7 +534,7 @@ models: - not_null - name: amount description: "Amount delegated" - data_type: numeric + data_type: uint256 tests: - not_null - dbt_utils.accepted_range: @@ -564,13 +552,13 @@ models: - not_null - name: id description: "ID of the event record" - data_type: character varying + data_type: text tests: - not_null - unique - name: pool_id description: "ID of the pool" - data_type: numeric + data_type: uint128 tests: - not_null - dbt_utils.accepted_range: @@ -581,12 +569,12 @@ models: data_type: integer tests: - not_null - - name: core_rewards_distributed_arbitrum_mainnet + - name: core_rewards_distributed_arbitrum_sepolia description: RewardsDistributed events from the CoreProxy contract columns: - name: id description: "ID of the event record" - data_type: character varying + data_type: text tests: - not_null - unique @@ -599,7 +587,7 @@ models: values: ["RewardsDistributed"] - name: amount description: "Amount claimed" - data_type: numeric + data_type: uint256 tests: - not_null - dbt_utils.accepted_range: @@ -607,7 +595,12 @@ models: inclusive: true - name: start description: "UNIX timestamp" - data_type: numeric + data_type: uint256 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true - name: contract description: "Address of the contract" data_type: text @@ -635,7 +628,7 @@ models: - not_null - name: duration description: "Duration in seconds" - data_type: numeric + data_type: uint256 tests: - not_null - dbt_utils.accepted_range: @@ -648,18 +641,18 @@ models: - not_null - name: pool_id description: "ID of the pool" - data_type: numeric + data_type: uint128 tests: - not_null - dbt_utils.accepted_range: min_value: 0 inclusive: true - - name: core_usd_burned_arbitrum_mainnet + - name: core_usd_burned_arbitrum_sepolia description: UsdBurned events from the CoreProxy contract columns: - name: amount description: "Amount burned" - data_type: numeric + data_type: uint256 tests: - not_null - dbt_utils.accepted_range: @@ -667,7 +660,7 @@ models: inclusive: true - name: pool_id description: "ID of the pool" - data_type: numeric + data_type: uint128 tests: - not_null - dbt_utils.accepted_range: @@ -682,7 +675,7 @@ models: values: ["UsdBurned"] - name: id description: "ID of the event record" - data_type: character varying + data_type: text tests: - not_null - unique @@ -693,7 +686,7 @@ models: - not_null - name: account_id description: "ID of the account" - data_type: numeric + data_type: uint128 tests: - not_null - dbt_utils.accepted_range: @@ -724,7 +717,7 @@ models: data_type: timestamp with time zone tests: - not_null - - name: core_usd_minted_arbitrum_mainnet + - name: core_usd_minted_arbitrum_sepolia description: UsdMinted events from the CoreProxy contract columns: - name: pool_id @@ -794,7 +787,7 @@ models: data_type: text tests: - not_null - - name: core_vault_liquidation_arbitrum_mainnet + - name: core_vault_liquidation_arbitrum_sepolia description: VaultLiquidation events from the CoreProxy contract columns: - name: transaction_hash @@ -859,7 +852,7 @@ models: data_type: text tests: - not_null - - name: core_vault_collateral_arbitrum_mainnet + - name: core_vault_collateral_arbitrum_sepolia columns: - name: ts description: "Block timestamp" @@ -868,7 +861,7 @@ models: - not_null - name: block_number description: "Block number" - data_type: bigint + data_type: integer tests: - not_null - name: pool_id @@ -905,7 +898,7 @@ models: data_type: text tests: - not_null - - name: core_vault_debt_arbitrum_mainnet + - name: core_vault_debt_arbitrum_sepolia columns: - name: ts description: "Block timestamp" @@ -914,7 +907,7 @@ models: - not_null - name: block_number description: "Block number" - data_type: bigint + data_type: integer tests: - not_null - name: pool_id @@ -932,11 +925,11 @@ models: - not_null - name: debt description: "Vault debt" - data_type: numeric + data_type: int256 tests: - not_null - name: contract_address description: "Address of the contract" data_type: text tests: - - not_null + - not_null \ No newline at end of file diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_account_created_arbitrum_mainnet.sql b/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_account_created_arbitrum_mainnet.sql index eb79eec7..4f799913 100644 --- a/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_account_created_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_account_created_arbitrum_mainnet.sql @@ -1,6 +1,20 @@ -{{ get_event_data( - 'arbitrum', - 'mainnet', - 'perps_market_proxy', - 'account_created' -) }} +with perps_account_created as ( + {{ get_event_data( + 'arbitrum', + 'mainnet', + 'synthetix', + 'perps_market_proxy', + 'account_created' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + owner, + cast(account_id as UInt128) as account_id +from perps_account_created diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_account_liquidation_attempt_arbitrum_mainnet.sql b/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_account_liquidation_attempt_arbitrum_mainnet.sql index 3fe034c1..2ff04fe9 100644 --- a/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_account_liquidation_attempt_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_account_liquidation_attempt_arbitrum_mainnet.sql @@ -1,6 +1,21 @@ -{{ get_event_data( - 'arbitrum', - 'mainnet', - 'perps_market_proxy', - 'account_liquidation_attempt' -) }} +with perps_account_liquidation_attempt as ( + {{ get_event_data( + 'arbitrum', + 'mainnet', + 'synthetix', + 'perps_market_proxy', + 'account_liquidation_attempt' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + cast(account_id as UInt128) as account_id, + cast(reward as UInt256) as reward, + full_liquidation +from perps_account_liquidation_attempt \ No newline at end of file diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_collateral_modified_arbitrum_mainnet.sql b/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_collateral_modified_arbitrum_mainnet.sql index fb2c8566..9706b5c1 100644 --- a/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_collateral_modified_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_collateral_modified_arbitrum_mainnet.sql @@ -1,6 +1,22 @@ -{{ get_event_data( - 'arbitrum', - 'mainnet', - 'perps_market_proxy', - 'collateral_modified' -) }} +with perps_collateral_modified as ( + {{ get_event_data( + 'arbitrum', + 'mainnet', + 'synthetix', + 'perps_market_proxy', + 'collateral_modified' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + cast(account_id as UInt128) as account_id, + cast(collateral_id as UInt128) as collateral_id, + cast(amount_delta as Int256) as amount_delta, + sender +from perps_collateral_modified \ No newline at end of file diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_interest_charged_arbitrum_mainnet.sql b/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_interest_charged_arbitrum_mainnet.sql index 2c81bba5..e905a76c 100644 --- a/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_interest_charged_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_interest_charged_arbitrum_mainnet.sql @@ -1,6 +1,20 @@ -{{ get_event_data( - 'arbitrum', - 'mainnet', - 'perps_market_proxy', - 'interest_charged' -) }} +with perps_interest_charged as ( + {{ get_event_data( + 'arbitrum', + 'mainnet', + 'synthetix', + 'perps_market_proxy', + 'interest_charged' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + cast(account_id as UInt128) as account_id, + cast(interest as UInt256) as interest +from perps_interest_charged \ No newline at end of file diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_interest_rate_updated_arbitrum_mainnet.sql b/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_interest_rate_updated_arbitrum_mainnet.sql index f30a5f85..66da02eb 100644 --- a/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_interest_rate_updated_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_interest_rate_updated_arbitrum_mainnet.sql @@ -1,6 +1,20 @@ -{{ get_event_data( - 'arbitrum', - 'mainnet', - 'perps_market_proxy', - 'interest_rate_updated' -) }} +with perps_interest_rate_updated as ( + {{ get_event_data( + 'arbitrum', + 'mainnet', + 'synthetix', + 'perps_market_proxy', + 'interest_rate_updated' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + cast(super_market_id as UInt128) as super_market_id, + cast(interest_rate as UInt128) as interest_rate +from perps_interest_rate_updated \ No newline at end of file diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_market_created_arbitrum_mainnet.sql b/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_market_created_arbitrum_mainnet.sql index ffaafa40..91118827 100644 --- a/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_market_created_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_market_created_arbitrum_mainnet.sql @@ -1,6 +1,21 @@ -{{ get_event_data( - 'arbitrum', - 'mainnet', - 'perps_market_proxy', - 'market_created' -) }} +with perps_market_created as ( + {{ get_event_data( + 'arbitrum', + 'mainnet', + 'synthetix', + 'perps_market_proxy', + 'market_created' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + market_name, + market_symbol, + cast(perps_market_id as UInt128) as perps_market_id +from perps_market_created \ No newline at end of file diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_market_updated_arbitrum_mainnet.sql b/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_market_updated_arbitrum_mainnet.sql index 868c305b..03dcefd2 100644 --- a/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_market_updated_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_market_updated_arbitrum_mainnet.sql @@ -1,7 +1,8 @@ -with current_events as ( +with perps_market_updated as ( {{ get_event_data( 'arbitrum', 'mainnet', + 'synthetix', 'perps_market_proxy', 'market_updated' ) }} @@ -14,13 +15,13 @@ select transaction_hash, contract, event_name, - market_id, - price, - skew, - size, - size_delta, - current_funding_rate, - current_funding_velocity, - interest_rate + cast(market_id as UInt128) as market_id, + cast(price as UInt256) as price, + cast(skew as Int256) as skew, + cast(size as UInt256) as size, + cast(size_delta as Int256) as size_delta, + cast(current_funding_rate as Int256) as current_funding_rate, + cast(current_funding_velocity as Int256) as current_funding_velocity, + cast(interest_rate as UInt128) as interest_rate from - current_events + perps_market_updated \ No newline at end of file diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_order_committed_arbitrum_mainnet.sql b/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_order_committed_arbitrum_mainnet.sql index 9ce7aca5..15c07532 100644 --- a/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_order_committed_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_order_committed_arbitrum_mainnet.sql @@ -1,7 +1,8 @@ -with current_events as ( +with perps_order_committed as ( {{ get_event_data( 'arbitrum', 'mainnet', + 'synthetix', 'perps_market_proxy', 'order_committed' ) }} @@ -14,16 +15,16 @@ select transaction_hash, contract, event_name, - market_id, - account_id, - commitment_time, - expiration_time, - settlement_time, - expected_price_time, - acceptable_price, - order_type, - size_delta, + cast(market_id as UInt128) as market_id, + cast(account_id as UInt128) as account_id, + cast(commitment_time as UInt256) as commitment_time, + cast(expiration_time as UInt256) as expiration_time, + cast(settlement_time as UInt256) as settlement_time, + cast(expected_price_time as UInt256) as expected_price_time, + cast(acceptable_price as UInt256) as acceptable_price, + cast(order_type as UInt8) as order_type, + cast(size_delta as Int128) as size_delta, sender, - tracking_code + {{ convert_hex('tracking_code') }} as tracking_code from - current_events + perps_order_committed \ No newline at end of file diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_order_settled_arbitrum_mainnet.sql b/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_order_settled_arbitrum_mainnet.sql index 751d4dad..fee1cc7e 100644 --- a/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_order_settled_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_order_settled_arbitrum_mainnet.sql @@ -1,6 +1,31 @@ -{{ get_event_data( - 'arbitrum', - 'mainnet', - 'perps_market_proxy', - 'order_settled' -) }} +with perps_order_settled as ( + {{ get_event_data( + 'arbitrum', + 'mainnet', + 'synthetix', + 'perps_market_proxy', + 'order_settled' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + cast(market_id as UInt128) as market_id, + cast(account_id as UInt128) as account_id, + cast(fill_price as UInt256) as fill_price, + cast(pnl as Int256) as pnl, + cast(accrued_funding as Int256) as accrued_funding, + cast(size_delta as Int128) as size_delta, + cast(new_size as Int128) as new_size, + cast(total_fees as UInt256) as total_fees, + cast(referral_fees as UInt256) as referral_fees, + cast(collected_fees as UInt256) as collected_fees, + cast(settlement_reward as UInt256) as settlement_reward, + {{ convert_hex('tracking_code') }} as tracking_code, + settler +from perps_order_settled \ No newline at end of file diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_position_liquidated_arbitrum_mainnet.sql b/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_position_liquidated_arbitrum_mainnet.sql index 71803cf8..bd078778 100644 --- a/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_position_liquidated_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_position_liquidated_arbitrum_mainnet.sql @@ -1,6 +1,22 @@ -{{ get_event_data( - 'arbitrum', - 'mainnet', - 'perps_market_proxy', - 'position_liquidated' -) }} +with perps_position_liquidated as ( + {{ get_event_data( + 'arbitrum', + 'mainnet', + 'synthetix', + 'perps_market_proxy', + 'position_liquidated' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + cast(account_id as UInt128) as account_id, + cast(market_id as UInt128) as market_id, + cast(amount_liquidated as UInt256) as amount_liquidated, + cast(current_position_size as Int128) as current_position_size +from perps_position_liquidated \ No newline at end of file diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_previous_order_expired_arbitrum_mainnet.sql b/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_previous_order_expired_arbitrum_mainnet.sql index d19b64b8..91ef62b9 100644 --- a/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_previous_order_expired_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_previous_order_expired_arbitrum_mainnet.sql @@ -1,6 +1,24 @@ -{{ get_event_data( - 'arbitrum', - 'mainnet', - 'perps_market_proxy', - 'previous_order_expired' -) }} +with perps_previous_order_expired as ( + {{ get_event_data( + 'arbitrum', + 'mainnet', + 'synthetix', + 'perps_market_proxy', + 'previous_order_expired' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + cast(market_id as UInt128) as market_id, + cast(account_id as UInt128) as account_id, + cast(size_delta as Int128) as size_delta, + cast(acceptable_price as UInt256) as acceptable_price, + cast(commitment_time as UInt256) as commitment_time, + {{ convert_hex('tracking_code') }} as tracking_code +from perps_previous_order_expired \ No newline at end of file diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/perp/schema.yml b/transformers/synthetix/models/raw/arbitrum/mainnet/perp/schema.yml index 137b404d..9b2ef522 100644 --- a/transformers/synthetix/models/raw/arbitrum/mainnet/perp/schema.yml +++ b/transformers/synthetix/models/raw/arbitrum/mainnet/perp/schema.yml @@ -5,6 +5,7 @@ models: columns: - name: id description: "ID of the event record" + data_type: text tests: - unique - not_null @@ -32,7 +33,7 @@ models: - not_null - name: account_id description: "ID of the account" - data_type: numeric + data_type: uint128 tests: - not_null - dbt_utils.accepted_range: @@ -53,6 +54,7 @@ models: columns: - name: id description: "ID of the event record" + data_type: text tests: - unique - not_null @@ -85,7 +87,7 @@ models: values: ["OrderCommitted"] - name: market_id description: "ID of the market" - data_type: numeric + data_type: uint128 tests: - not_null - dbt_utils.accepted_range: @@ -93,26 +95,26 @@ models: inclusive: true - name: account_id description: "ID of the account" - data_type: numeric + data_type: uint128 tests: - not_null - dbt_utils.accepted_range: min_value: 0 inclusive: true - name: commitment_time - data_type: numeric + data_type: uint256 - name: expiration_time - data_type: numeric + data_type: uint256 - name: settlement_time - data_type: numeric + data_type: uint256 - name: expected_price_time - data_type: numeric + data_type: uint256 - name: acceptable_price - data_type: numeric + data_type: uint256 - name: order_type - data_type: integer + data_type: uint8 - name: size_delta - data_type: numeric + data_type: int128 - name: sender data_type: text - name: tracking_code @@ -126,7 +128,7 @@ models: tests: - not_null - name: fill_price - data_type: numeric + data_type: uint256 - name: event_name description: "Event name" data_type: text @@ -135,18 +137,18 @@ models: - accepted_values: values: ["OrderSettled"] - name: settlement_reward - data_type: numeric + data_type: uint256 - name: settler data_type: text - name: tracking_code data_type: text - name: total_fees - data_type: numeric + data_type: uint256 - name: pnl - data_type: numeric + data_type: int256 - name: account_id description: "ID of the account" - data_type: numeric + data_type: uint128 tests: - not_null - dbt_utils.accepted_range: @@ -154,7 +156,7 @@ models: inclusive: true - name: market_id description: "ID of the market" - data_type: numeric + data_type: uint128 tests: - not_null - dbt_utils.accepted_range: @@ -162,14 +164,14 @@ models: inclusive: true - name: collected_fees description: "Amount of fees collected" - data_type: numeric + data_type: uint256 tests: - not_null - dbt_utils.accepted_range: min_value: 0 inclusive: true - name: size_delta - data_type: numeric + data_type: int128 - name: transaction_hash description: "Transaction hash" data_type: text @@ -186,13 +188,14 @@ models: tests: - not_null - name: accrued_funding - data_type: numeric + data_type: int256 - name: referral_fees - data_type: numeric + data_type: uint256 - name: new_size - data_type: numeric + data_type: int128 - name: id description: "ID of the event record" + data_type: text tests: - unique - not_null @@ -201,6 +204,7 @@ models: columns: - name: id description: "ID of the event record" + data_type: text tests: - unique - not_null @@ -232,34 +236,39 @@ models: - accepted_values: values: ["MarketUpdated"] - name: market_id - description: "ID of the market" - data_type: numeric + description: "Id of the market used for the trade." + data_type: uint128 tests: - not_null - dbt_utils.accepted_range: min_value: 0 inclusive: true - name: price - description: "Price" - data_type: numeric + description: "Price at the time of this event." + data_type: uint256 tests: - not_null - dbt_utils.accepted_range: min_value: 0 inclusive: true - name: skew - data_type: numeric + description: "Market skew at the time of the trade. Positive values mean more longs." + data_type: int256 - name: size - data_type: numeric + description: "Size of the entire market after settlement." + data_type: uint256 - name: size_delta - data_type: numeric + description: "Change in market size during this update." + data_type: int256 - name: current_funding_rate - data_type: numeric + description: "The current funding rate of this market (0.001 = 0.1% per day)" + data_type: int256 - name: current_funding_velocity - data_type: numeric + description: "The current rate of change of the funding rate (0.001 = +0.1% per day)" + data_type: int256 - name: interest_rate - description: "Interest rate" - data_type: numeric + description: "Current supermarket interest rate based on updated market OI." + data_type: uint128 tests: - not_null - dbt_utils.accepted_range: @@ -270,7 +279,7 @@ models: columns: - name: account_id description: "ID of the account" - data_type: numeric + data_type: uint128 tests: - not_null - dbt_utils.accepted_range: @@ -278,7 +287,7 @@ models: inclusive: true - name: market_id description: "ID of the market" - data_type: numeric + data_type: uint128 tests: - not_null - dbt_utils.accepted_range: @@ -286,6 +295,7 @@ models: inclusive: true - name: id description: "ID of the event record" + data_type: text tests: - unique - not_null @@ -296,7 +306,7 @@ models: - not_null - name: current_position_size description: "Current position size" - data_type: numeric + data_type: int128 tests: - not_null - dbt_utils.accepted_range: @@ -316,7 +326,7 @@ models: - not_null - name: amount_liquidated description: "Amount liquidated" - data_type: numeric + data_type: uint256 tests: - not_null - dbt_utils.accepted_range: @@ -337,12 +347,13 @@ models: columns: - name: id description: "ID of the event record" + data_type: text tests: - unique - not_null - name: account_id description: "ID of the account" - data_type: numeric + data_type: uint128 tests: - not_null - dbt_utils.accepted_range: @@ -355,7 +366,7 @@ models: - not_null - name: reward description: "Reward" - data_type: numeric + data_type: uint256 tests: - not_null - dbt_utils.accepted_range: @@ -414,10 +425,10 @@ models: tests: - not_null - name: amount_delta - data_type: numeric + data_type: int256 - name: collateral_id description: "ID of the synth market" - data_type: numeric + data_type: uint128 tests: - not_null - dbt_utils.accepted_range: @@ -425,6 +436,7 @@ models: inclusive: true - name: id description: "ID of the event record" + data_type: text tests: - unique - not_null @@ -435,7 +447,7 @@ models: - not_null - name: account_id description: "ID of the account" - data_type: numeric + data_type: uint128 tests: - not_null - dbt_utils.accepted_range: @@ -654,4 +666,4 @@ models: - not_null - dbt_utils.accepted_range: min_value: 0 - inclusive: true + inclusive: true \ No newline at end of file diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/spot/schema.yml b/transformers/synthetix/models/raw/arbitrum/mainnet/spot/schema.yml index dc3b65eb..1ba3db7a 100644 --- a/transformers/synthetix/models/raw/arbitrum/mainnet/spot/schema.yml +++ b/transformers/synthetix/models/raw/arbitrum/mainnet/spot/schema.yml @@ -1,6 +1,6 @@ version: 2 models: - - name: spot_order_committed_arbitrum_mainnet + - name: spot_order_committed_arbitrum_sepolia description: OrderCommitted events from the SpotMarketProxy contract columns: - name: id @@ -70,7 +70,7 @@ models: data_type: integer tests: - not_null - - name: spot_order_settled_arbitrum_mainnet + - name: spot_order_settled_arbitrum_sepolia description: OrderSettled events from the SpotMarketProxy contract columns: - name: final_order_amount @@ -153,7 +153,7 @@ models: - not_null - accepted_values: values: ["OrderSettled"] - - name: spot_order_cancelled_arbitrum_mainnet + - name: spot_order_cancelled_arbitrum_sepolia description: OrderCancelled events from the SpotMarketProxy contract columns: - name: id @@ -208,7 +208,7 @@ models: data_type: integer tests: - not_null - - name: spot_synth_registered_arbitrum_mainnet + - name: spot_synth_registered_arbitrum_sepolia description: SynthRegistered events from the SpotMarketProxy contract columns: - name: id @@ -257,7 +257,7 @@ models: data_type: text tests: - not_null - - name: spot_synth_bought_arbitrum_mainnet + - name: spot_synth_bought_arbitrum_sepolia description: SynthBought events from the SpotMarketProxy contract columns: - name: collected_fees @@ -327,7 +327,7 @@ models: - not_null - accepted_values: values: ["SynthBought"] - - name: spot_synth_sold_arbitrum_mainnet + - name: spot_synth_sold_arbitrum_sepolia description: SynthSold events from the SpotMarketProxy contract columns: - name: event_name @@ -403,7 +403,7 @@ models: data_type: text tests: - not_null - - name: spot_synth_wrapped_arbitrum_mainnet + - name: spot_synth_wrapped_arbitrum_sepolia description: SynthWrapped events from the SpotMarketProxy contract columns: - name: fees @@ -460,7 +460,7 @@ models: - dbt_utils.accepted_range: min_value: 0 inclusive: true - - name: spot_synth_unwrapped_arbitrum_mainnet + - name: spot_synth_unwrapped_arbitrum_sepolia description: SynthUnwrapped events from the SpotMarketProxy contract columns: - name: block_timestamp @@ -522,4 +522,4 @@ models: - not_null - dbt_utils.accepted_range: min_value: 0 - inclusive: true + inclusive: true \ No newline at end of file diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_order_cancelled_arbitrum_mainnet.sql b/transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_order_cancelled_arbitrum_mainnet.sql index dc7db0d2..a46045b7 100644 --- a/transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_order_cancelled_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_order_cancelled_arbitrum_mainnet.sql @@ -1,6 +1,20 @@ -{{ get_event_data( - 'arbitrum', - 'mainnet', - 'spot_market_proxy', - 'order_cancelled' -) }} +with spot_order_cancelled as ( + {{ get_event_data( + 'arbitrum', + 'mainnet', + 'synthetix', + 'spot_market_proxy', + 'order_cancelled' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + sender, + async_order_claim +from spot_order_cancelled \ No newline at end of file diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_order_committed_arbitrum_mainnet.sql b/transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_order_committed_arbitrum_mainnet.sql index 1747db08..14b13888 100644 --- a/transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_order_committed_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_order_committed_arbitrum_mainnet.sql @@ -1,6 +1,24 @@ -{{ get_event_data( - 'arbitrum', - 'mainnet', - 'spot_market_proxy', - 'order_committed' -) }} +with spot_order_committed as ( + {{ get_event_data( + 'arbitrum', + 'mainnet', + 'synthetix', + 'spot_market_proxy', + 'order_committed' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + cast(market_id as UInt128) as market_id, + cast(order_type as UInt8) as order_type, + cast(amount_provided as UInt256) as amount_provided, + cast(async_order_id as UInt128) as async_order_id, + sender, + referrer +from spot_order_committed \ No newline at end of file diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_order_settled_arbitrum_mainnet.sql b/transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_order_settled_arbitrum_mainnet.sql index 08106b7a..d9e30d1b 100644 --- a/transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_order_settled_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_order_settled_arbitrum_mainnet.sql @@ -1,6 +1,26 @@ -{{ get_event_data( - 'arbitrum', - 'mainnet', - 'spot_market_proxy', - 'order_settled' -) }} +with spot_order_settled as ( + {{ get_event_data( + 'arbitrum', + 'mainnet', + 'synthetix', + 'spot_market_proxy', + 'order_settled' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + cast(market_id as UInt128) as market_id, + cast(async_order_id as UInt128) as async_order_id, + cast(final_order_amount as UInt256) as final_order_amount, + fees, + cast(collected_fees as UInt256) as collected_fees, + settler, + cast(price as UInt256) as price, + cast(order_type as UInt8) as order_type +from spot_order_settled \ No newline at end of file diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_synth_bought_arbitrum_mainnet.sql b/transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_synth_bought_arbitrum_mainnet.sql index 19da483b..32ec73a6 100644 --- a/transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_synth_bought_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_synth_bought_arbitrum_mainnet.sql @@ -1,6 +1,24 @@ -{{ get_event_data( - 'arbitrum', - 'mainnet', - 'spot_market_proxy', - 'synth_bought' -) }} +with spot_synth_bought as ( + {{ get_event_data( + 'arbitrum', + 'mainnet', + 'synthetix', + 'spot_market_proxy', + 'synth_bought' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + cast(synth_market_id as UInt128) as synth_market_id, + cast(synth_returned as UInt256) as synth_returned, + fees, + cast(collected_fees as UInt256) as collected_fees, + referrer, + cast(price as UInt256) as price +from spot_synth_bought diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_synth_registered_arbitrum_mainnet.sql b/transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_synth_registered_arbitrum_mainnet.sql index c77d88c1..fa32b5ec 100644 --- a/transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_synth_registered_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_synth_registered_arbitrum_mainnet.sql @@ -1,6 +1,20 @@ -{{ get_event_data( - 'arbitrum', - 'mainnet', - 'spot_market_proxy', - 'synth_registered' -) }} +with spot_synth_registered as ( + {{ get_event_data( + 'arbitrum', + 'mainnet', + 'synthetix', + 'spot_market_proxy', + 'synth_registered' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + cast(synth_market_id as UInt128) as synth_market_id, + synth_token_address +from spot_synth_registered \ No newline at end of file diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_synth_sold_arbitrum_mainnet.sql b/transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_synth_sold_arbitrum_mainnet.sql index d19258f2..e7c91724 100644 --- a/transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_synth_sold_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_synth_sold_arbitrum_mainnet.sql @@ -1,6 +1,24 @@ -{{ get_event_data( - 'arbitrum', - 'mainnet', - 'spot_market_proxy', - 'synth_sold' -) }} +with spot_synth_sold as ( + {{ get_event_data( + 'arbitrum', + 'mainnet', + 'synthetix', + 'spot_market_proxy', + 'synth_sold' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + cast(synth_market_id as UInt128) as synth_market_id, + cast(amount_returned as UInt256) as amount_returned, + fees, + cast(collected_fees as UInt256) as collected_fees, + referrer, + cast(price as UInt256) as price +from spot_synth_sold \ No newline at end of file diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_synth_unwrapped_arbitrum_mainnet.sql b/transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_synth_unwrapped_arbitrum_mainnet.sql index ec4d5436..1c21752a 100644 --- a/transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_synth_unwrapped_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_synth_unwrapped_arbitrum_mainnet.sql @@ -1,6 +1,22 @@ -{{ get_event_data( - 'arbitrum', - 'mainnet', - 'spot_market_proxy', - 'synth_unwrapped' -) }} +with spot_synth_unwrapped as ( + {{ get_event_data( + 'arbitrum', + 'mainnet', + 'synthetix', + 'spot_market_proxy', + 'synth_unwrapped' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + cast(synth_market_id as UInt128) as synth_market_id, + cast(amount_unwrapped as UInt256) as amount_unwrapped, + fees, + cast(fees_collected as UInt256) as fees_collected +from spot_synth_unwrapped diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_synth_wrapped_arbitrum_mainnet.sql b/transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_synth_wrapped_arbitrum_mainnet.sql index 117c6f58..a5ab2bf6 100644 --- a/transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_synth_wrapped_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_synth_wrapped_arbitrum_mainnet.sql @@ -1,6 +1,22 @@ -{{ get_event_data( - 'arbitrum', - 'mainnet', - 'spot_market_proxy', - 'synth_wrapped' -) }} +with spot_synth_wrapped as ( + {{ get_event_data( + 'arbitrum', + 'mainnet', + 'synthetix', + 'spot_market_proxy', + 'synth_wrapped' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + cast(synth_market_id as UInt256) as synth_market_id, + cast(amount_wrapped as UInt256) as amount_wrapped, + fees, + cast(fees_collected as UInt256) as fees_collected +from spot_synth_wrapped diff --git a/transformers/synthetix/models/raw/arbitrum/sepolia/blocks_arbitrum_sepolia.sql b/transformers/synthetix/models/raw/arbitrum/sepolia/blocks_arbitrum_sepolia.sql deleted file mode 100644 index d350f78a..00000000 --- a/transformers/synthetix/models/raw/arbitrum/sepolia/blocks_arbitrum_sepolia.sql +++ /dev/null @@ -1,44 +0,0 @@ -with indexer_blocks as ( - select - timestamp as ts, - CAST( - number as INTEGER - ) as block_number - from - {{ source( - 'raw_arbitrum_sepolia', - 'block' - ) }} -), - -parquet_blocks as ( - select - TO_TIMESTAMP(timestamp) as ts, - CAST( - block_number as INTEGER - ) as block_number - from - {{ source( - 'raw_arbitrum_sepolia', - 'blocks_parquet' - ) }} -), - -combined_blocks as ( - select * - from - indexer_blocks - - union all - select * - from - parquet_blocks -) - -select - block_number, - MIN(ts) as ts -from - combined_blocks -group by - block_number diff --git a/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_account_created_arbitrum_sepolia.sql b/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_account_created_arbitrum_sepolia.sql deleted file mode 100644 index e3e7ebd3..00000000 --- a/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_account_created_arbitrum_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'arbitrum', - 'sepolia', - 'core_proxy', - 'account_created' -) }} diff --git a/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_delegation_updated_arbitrum_sepolia.sql b/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_delegation_updated_arbitrum_sepolia.sql deleted file mode 100644 index d25ff76a..00000000 --- a/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_delegation_updated_arbitrum_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'arbitrum', - 'sepolia', - 'core_proxy', - 'delegation_updated' -) }} diff --git a/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_deposited_arbitrum_sepolia.sql b/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_deposited_arbitrum_sepolia.sql deleted file mode 100644 index 87707ce1..00000000 --- a/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_deposited_arbitrum_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'arbitrum', - 'sepolia', - 'core_proxy', - 'deposited' -) }} diff --git a/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_liquidation_arbitrum_sepolia.sql b/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_liquidation_arbitrum_sepolia.sql deleted file mode 100644 index a72b9281..00000000 --- a/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_liquidation_arbitrum_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'arbitrum', - 'sepolia', - 'core_proxy', - 'liquidation' -) }} diff --git a/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_market_registered_arbitrum_sepolia.sql b/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_market_registered_arbitrum_sepolia.sql deleted file mode 100644 index e053f275..00000000 --- a/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_market_registered_arbitrum_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'arbitrum', - 'sepolia', - 'core_proxy', - 'market_registered' -) }} diff --git a/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_market_updated_arbitrum_sepolia.sql b/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_market_updated_arbitrum_sepolia.sql deleted file mode 100644 index 8e317e1e..00000000 --- a/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_market_updated_arbitrum_sepolia.sql +++ /dev/null @@ -1,103 +0,0 @@ -with events as ( - select - id, - block_timestamp, - block_number, - transaction_hash, - contract, - event_name, - market_id, - net_issuance, - deposited_collateral_value, - sender, - collateral_type, - credit_capacity, - token_amount - from - ( - {{ get_event_data( - 'arbitrum', - 'sepolia', - 'core_proxy', - 'market_collateral_deposited' - ) }} - ) as collateral_deposited -- noqa: AL05 - union all - select - id, - block_timestamp, - block_number, - transaction_hash, - contract, - event_name, - market_id, - net_issuance, - deposited_collateral_value, - sender, - collateral_type, - credit_capacity, - token_amount - from - ( - {{ get_event_data( - 'arbitrum', - 'sepolia', - 'core_proxy', - 'market_collateral_withdrawn' - ) }} - ) as collateral_withdrawn -- noqa: AL05 - union all - select - id, - block_timestamp, - block_number, - transaction_hash, - contract, - event_name, - market_id, - net_issuance, - deposited_collateral_value, - target as sender, - 'USD' as collateral_type, - credit_capacity, - amount as token_amount - from - ( - {{ get_event_data( - 'arbitrum', - 'sepolia', - 'core_proxy', - 'market_usd_deposited' - ) }} - ) as usd_deposited -- noqa: AL05 - union all - select - id, - block_timestamp, - block_number, - transaction_hash, - contract, - event_name, - market_id, - net_issuance, - deposited_collateral_value, - target as sender, - 'USD' as collateral_type, - credit_capacity, - amount as token_amount - from - ( - {{ get_event_data( - 'arbitrum', - 'sepolia', - 'core_proxy', - 'market_usd_withdrawn' - ) }} - ) as usd_withdrawn -- noqa: AL05 -) - -select * -from - events -order by - block_timestamp diff --git a/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_pool_created_arbitrum_sepolia.sql b/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_pool_created_arbitrum_sepolia.sql deleted file mode 100644 index 38b71faa..00000000 --- a/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_pool_created_arbitrum_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'arbitrum', - 'sepolia', - 'core_proxy', - 'pool_created' -) }} diff --git a/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_rewards_claimed_arbitrum_sepolia.sql b/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_rewards_claimed_arbitrum_sepolia.sql deleted file mode 100644 index a5cc68b1..00000000 --- a/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_rewards_claimed_arbitrum_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'arbitrum', - 'sepolia', - 'core_proxy', - 'rewards_claimed' -) }} diff --git a/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_rewards_distributed_arbitrum_sepolia.sql b/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_rewards_distributed_arbitrum_sepolia.sql deleted file mode 100644 index 10fd31bf..00000000 --- a/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_rewards_distributed_arbitrum_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'arbitrum', - 'sepolia', - 'core_proxy', - 'rewards_distributed' -) }} diff --git a/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_usd_burned_arbitrum_sepolia.sql b/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_usd_burned_arbitrum_sepolia.sql deleted file mode 100644 index 0dfa0007..00000000 --- a/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_usd_burned_arbitrum_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'arbitrum', - 'sepolia', - 'core_proxy', - 'usd_burned' -) }} diff --git a/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_usd_minted_arbitrum_sepolia.sql b/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_usd_minted_arbitrum_sepolia.sql deleted file mode 100644 index aaa0049b..00000000 --- a/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_usd_minted_arbitrum_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'arbitrum', - 'sepolia', - 'core_proxy', - 'usd_minted' -) }} diff --git a/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_vault_collateral_arbitrum_sepolia.sql b/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_vault_collateral_arbitrum_sepolia.sql deleted file mode 100644 index 5c19fd03..00000000 --- a/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_vault_collateral_arbitrum_sepolia.sql +++ /dev/null @@ -1,40 +0,0 @@ -with base as ( - select - block_number, - contract_address, - chain_id, - pool_id, - collateral_type, - cast( - amount as numeric - ) as amount, - cast( - value as numeric - ) as collateral_value - from - {{ source( - 'raw_arbitrum_sepolia', - "core_get_vault_collateral" - ) }} - where - amount is not null -) - -select - to_timestamp(blocks.timestamp) as ts, - cast( - blocks.block_number as integer - ) as block_number, - base.contract_address, - cast( - base.pool_id as integer - ) as pool_id, - cast( - base.collateral_type as varchar - ) as collateral_type, - {{ convert_wei('base.amount') }} as amount, - {{ convert_wei('base.collateral_value') }} as collateral_value -from - base -inner join {{ source('raw_arbitrum_sepolia', 'blocks_parquet') }} as blocks - on base.block_number = blocks.block_number diff --git a/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_vault_debt_arbitrum_sepolia.sql b/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_vault_debt_arbitrum_sepolia.sql deleted file mode 100644 index 562dfc79..00000000 --- a/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_vault_debt_arbitrum_sepolia.sql +++ /dev/null @@ -1,36 +0,0 @@ -with base as ( - select - block_number, - contract_address, - chain_id, - pool_id, - collateral_type, - cast( - value_1 as numeric - ) as debt - from - {{ source( - 'raw_arbitrum_sepolia', - "core_get_vault_debt" - ) }} - where - value_1 is not null -) - -select - to_timestamp(blocks.timestamp) as ts, - cast( - blocks.block_number as integer - ) as block_number, - base.contract_address, - cast( - base.pool_id as integer - ) as pool_id, - cast( - base.collateral_type as varchar - ) as collateral_type, - {{ convert_wei('base.debt') }} as debt -from - base -inner join {{ source('raw_arbitrum_sepolia', 'blocks_parquet') }} as blocks - on base.block_number = blocks.block_number diff --git a/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_vault_liquidation_arbitrum_sepolia.sql b/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_vault_liquidation_arbitrum_sepolia.sql deleted file mode 100644 index bccbee61..00000000 --- a/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_vault_liquidation_arbitrum_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'arbitrum', - 'sepolia', - 'core_proxy', - 'vault_liquidation' -) }} diff --git a/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_withdrawn_arbitrum_sepolia.sql b/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_withdrawn_arbitrum_sepolia.sql deleted file mode 100644 index cc2bfd91..00000000 --- a/transformers/synthetix/models/raw/arbitrum/sepolia/core/core_withdrawn_arbitrum_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'arbitrum', - 'sepolia', - 'core_proxy', - 'withdrawn' -) }} diff --git a/transformers/synthetix/models/raw/arbitrum/sepolia/core/schema.yml b/transformers/synthetix/models/raw/arbitrum/sepolia/core/schema.yml deleted file mode 100644 index 60f7801c..00000000 --- a/transformers/synthetix/models/raw/arbitrum/sepolia/core/schema.yml +++ /dev/null @@ -1,942 +0,0 @@ -version: 2 -models: - - name: core_account_created_arbitrum_sepolia - description: AccountCreated events from the CoreProxy contract - columns: - - name: owner - description: "Address of the account owner" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["AccountCreated"] - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: core_delegation_updated_arbitrum_sepolia - description: DelegationUpdated events from the CoreProxy contract - columns: - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: sender - description: "Address of the delegator" - data_type: text - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: leverage - description: "Leverage" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 1000000000000000000 - max_value: 1000000000000000000 - inclusive: true - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: amount - description: "Amount delegated" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["DelegationUpdated"] - - name: core_deposited_arbitrum_sepolia - description: Deposited events from the CoreProxy contract - columns: - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["Deposited"] - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: sender - description: "Address of the depositor" - data_type: text - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: token_amount - description: "Token amount deposited" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: core_withdrawn_arbitrum_sepolia - description: Withdrawn events from the CoreProxy contract - columns: - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: token_amount - description: "Token amount withdrawn" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: sender - description: "Address of the withdrawer" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["Withdrawn"] - - name: core_liquidation_arbitrum_sepolia - description: Liquidation events from the CoreProxy contract - columns: - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["Liquidation"] - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: sender - description: "Address of the liquidator" - data_type: text - tests: - - not_null - - name: liquidation_data - data_type: jsonb - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: liquidate_as_account_id - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: core_market_updated_arbitrum_sepolia - description: > - Combination of MarketCollateralDeposited, MarketCollateralWithdrawn, - MarketUsdDeposited, MarketUsdWithdrawn events from the CoreProxy contract - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["MarketCollateralWithdrawn", "MarketCollateralDeposited", "MarketUsdWithdrawn", "MarketUsdDeposited"] - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: net_issuance - description: "Net issuance" - data_type: numeric - tests: - - not_null - - name: deposited_collateral_value - description: "Deposited collateral value" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: sender - description: "Address of the event initiator" - data_type: text - tests: - - not_null - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: credit_capacity - description: "Credit capacity" - data_type: numeric - tests: - - not_null - - name: token_amount - description: "Token amount" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: core_market_registered_arbitrum_sepolia - description: MarketRegistered events from the CoreProxy contract - columns: - - name: market - description: "Market name" - data_type: text - tests: - - not_null - - name: market_id - description: "Market ID" - data_type: numeric - tests: - - not_null - - unique - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["MarketRegistered"] - - name: sender - description: "Address of the event initiator" - data_type: text - tests: - - not_null - - name: core_pool_created_arbitrum_sepolia - description: "PoolCreated events from the CoreProxy contract" - columns: - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: sender - description: "Address of the event initiator" - data_type: text - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["PoolCreated"] - - name: owner - description: "Address of the pool owner" - data_type: text - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: core_rewards_claimed_arbitrum_sepolia - description: RewardsClaimed events from the CoreProxy contract - columns: - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["RewardsClaimed"] - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: amount - description: "Amount delegated" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: distributor - description: "Address of the distributor" - data_type: text - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: core_rewards_distributed_arbitrum_sepolia - description: RewardsDistributed events from the CoreProxy contract - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["RewardsDistributed"] - - name: amount - description: "Amount claimed" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: start - description: "UNIX timestamp" - data_type: numeric - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: duration - description: "Duration in seconds" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: distributor - description: "Address of the distributor" - data_type: text - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: core_usd_burned_arbitrum_sepolia - description: UsdBurned events from the CoreProxy contract - columns: - - name: amount - description: "Amount burned" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["UsdBurned"] - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: sender - description: "Address of the event initiator" - data_type: text - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: core_usd_minted_arbitrum_sepolia - description: UsdMinted events from the CoreProxy contract - columns: - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: sender - description: "Address of the event initiator" - data_type: text - tests: - - not_null - - name: amount - description: "Amount minted" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["UsdMinted"] - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: core_vault_liquidation_arbitrum_sepolia - description: VaultLiquidation events from the CoreProxy contract - columns: - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["VaultLiquidation"] - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: liquidate_as_account_id - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: liquidation_data - data_type: jsonb - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: sender - description: "Address of the event initiator" - data_type: text - tests: - - not_null - - name: core_vault_collateral_arbitrum_sepolia - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: bigint - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: integer - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: character varying - tests: - - not_null - - name: amount - description: "Collateral amount" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_value - description: "Vault collateral value" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: contract_address - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: core_vault_debt_arbitrum_sepolia - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: bigint - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: integer - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: character varying - tests: - - not_null - - name: debt - description: "Vault debt" - data_type: numeric - tests: - - not_null - - name: contract_address - description: "Address of the contract" - data_type: text - tests: - - not_null diff --git a/transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_account_created_arbitrum_sepolia.sql b/transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_account_created_arbitrum_sepolia.sql deleted file mode 100644 index 8547efd8..00000000 --- a/transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_account_created_arbitrum_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'arbitrum', - 'sepolia', - 'perps_market_proxy', - 'account_created' -) }} diff --git a/transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_account_liquidation_attempt_arbitrum_sepolia.sql b/transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_account_liquidation_attempt_arbitrum_sepolia.sql deleted file mode 100644 index 3366dba2..00000000 --- a/transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_account_liquidation_attempt_arbitrum_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'arbitrum', - 'sepolia', - 'perps_market_proxy', - 'account_liquidation_attempt' -) }} diff --git a/transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_collateral_modified_arbitrum_sepolia.sql b/transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_collateral_modified_arbitrum_sepolia.sql deleted file mode 100644 index ad7df06e..00000000 --- a/transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_collateral_modified_arbitrum_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'arbitrum', - 'sepolia', - 'perps_market_proxy', - 'collateral_modified' -) }} diff --git a/transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_interest_charged_arbitrum_sepolia.sql b/transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_interest_charged_arbitrum_sepolia.sql deleted file mode 100644 index f2157af7..00000000 --- a/transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_interest_charged_arbitrum_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'arbitrum', - 'sepolia', - 'perps_market_proxy', - 'interest_charged' -) }} diff --git a/transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_interest_rate_updated_arbitrum_sepolia.sql b/transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_interest_rate_updated_arbitrum_sepolia.sql deleted file mode 100644 index 06bc4b93..00000000 --- a/transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_interest_rate_updated_arbitrum_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'arbitrum', - 'sepolia', - 'perps_market_proxy', - 'interest_rate_updated' -) }} diff --git a/transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_market_created_arbitrum_sepolia.sql b/transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_market_created_arbitrum_sepolia.sql deleted file mode 100644 index 4453ecff..00000000 --- a/transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_market_created_arbitrum_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'arbitrum', - 'sepolia', - 'perps_market_proxy', - 'market_created' -) }} diff --git a/transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_market_updated_arbitrum_sepolia.sql b/transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_market_updated_arbitrum_sepolia.sql deleted file mode 100644 index 4c214d35..00000000 --- a/transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_market_updated_arbitrum_sepolia.sql +++ /dev/null @@ -1,26 +0,0 @@ -with current_events as ( - {{ get_event_data( - 'arbitrum', - 'sepolia', - 'perps_market_proxy', - 'market_updated' - ) }} -) - -select - id, - block_number, - block_timestamp, - transaction_hash, - contract, - event_name, - market_id, - price, - skew, - size, - size_delta, - current_funding_rate, - current_funding_velocity, - interest_rate -from - current_events diff --git a/transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_order_committed_arbitrum_sepolia.sql b/transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_order_committed_arbitrum_sepolia.sql deleted file mode 100644 index a96947b4..00000000 --- a/transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_order_committed_arbitrum_sepolia.sql +++ /dev/null @@ -1,29 +0,0 @@ -with current_events as ( - {{ get_event_data( - 'arbitrum', - 'sepolia', - 'perps_market_proxy', - 'order_committed' - ) }} -) - -select - id, - block_number, - block_timestamp, - transaction_hash, - contract, - event_name, - market_id, - account_id, - commitment_time, - expiration_time, - settlement_time, - expected_price_time, - acceptable_price, - order_type, - size_delta, - sender, - tracking_code -from - current_events diff --git a/transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_order_settled_arbitrum_sepolia.sql b/transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_order_settled_arbitrum_sepolia.sql deleted file mode 100644 index d0507d84..00000000 --- a/transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_order_settled_arbitrum_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'arbitrum', - 'sepolia', - 'perps_market_proxy', - 'order_settled' -) }} diff --git a/transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_position_liquidated_arbitrum_sepolia.sql b/transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_position_liquidated_arbitrum_sepolia.sql deleted file mode 100644 index c4e1e437..00000000 --- a/transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_position_liquidated_arbitrum_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'arbitrum', - 'sepolia', - 'perps_market_proxy', - 'position_liquidated' -) }} diff --git a/transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_previous_order_expired_arbitrum_sepolia.sql b/transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_previous_order_expired_arbitrum_sepolia.sql deleted file mode 100644 index c37a917b..00000000 --- a/transformers/synthetix/models/raw/arbitrum/sepolia/perp/perp_previous_order_expired_arbitrum_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'arbitrum', - 'sepolia', - 'perps_market_proxy', - 'previous_order_expired' -) }} diff --git a/transformers/synthetix/models/raw/arbitrum/sepolia/perp/schema.yml b/transformers/synthetix/models/raw/arbitrum/sepolia/perp/schema.yml deleted file mode 100644 index fa277388..00000000 --- a/transformers/synthetix/models/raw/arbitrum/sepolia/perp/schema.yml +++ /dev/null @@ -1,657 +0,0 @@ -version: 2 -models: - - name: perp_account_created_arbitrum_sepolia - description: AccountCreated events from the PerpsMarketProxy contract - columns: - - name: id - description: "ID of the event record" - tests: - - unique - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["AccountCreated"] - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: owner - description: "Address of the pool owner" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: perp_order_committed_arbitrum_sepolia - description: OrderCommitted events from the PerpsMarketProxy contract - columns: - - name: id - description: "ID of the event record" - tests: - - unique - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["OrderCommitted"] - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: commitment_time - data_type: numeric - - name: expiration_time - data_type: numeric - - name: settlement_time - data_type: numeric - - name: expected_price_time - data_type: numeric - - name: acceptable_price - data_type: numeric - - name: order_type - data_type: integer - - name: size_delta - data_type: numeric - - name: sender - data_type: text - - name: tracking_code - data_type: text - - name: perp_order_settled_arbitrum_sepolia - description: OrderSettled events from the PerpsMarketProxy contract - columns: - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: fill_price - data_type: numeric - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["OrderSettled"] - - name: settlement_reward - data_type: numeric - - name: settler - data_type: text - - name: tracking_code - data_type: text - - name: total_fees - data_type: numeric - - name: pnl - data_type: numeric - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collected_fees - description: "Amount of fees collected" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: size_delta - data_type: numeric - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: accrued_funding - data_type: numeric - - name: referral_fees - data_type: numeric - - name: new_size - data_type: numeric - - name: id - description: "ID of the event record" - tests: - - unique - - not_null - - name: perp_market_updated_arbitrum_sepolia - description: MarketUpdated events from the PerpsMarketProxy contract - columns: - - name: id - description: "ID of the event record" - tests: - - unique - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["MarketUpdated"] - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: price - description: "Price" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: skew - data_type: numeric - - name: size - data_type: numeric - - name: size_delta - data_type: numeric - - name: current_funding_rate - data_type: numeric - - name: current_funding_velocity - data_type: numeric - - name: interest_rate - description: "Interest rate" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: perp_position_liquidated_arbitrum_sepolia - description: PositionLiquidated events from the PerpsMarketProxy contract - columns: - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: id - description: "ID of the event record" - tests: - - unique - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: current_position_size - description: "Current position size" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["PositionLiquidated"] - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: amount_liquidated - description: "Amount liquidated" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: perp_account_liquidation_attempt_arbitrum_sepolia - description: AccountLiquidationAttempt events from the PerpsMarketProxy contract - columns: - - name: id - description: "ID of the event record" - tests: - - unique - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: reward - description: "Reward" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["AccountLiquidationAttempt"] - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: full_liquidation - description: "Whether it is a full or partial liquidation" - data_type: boolean - tests: - - not_null - - name: perp_collateral_modified_arbitrum_sepolia - description: CollateralModified events from the PerpsMarketProxy contract - columns: - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["CollateralModified"] - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: amount_delta - data_type: numeric - - name: collateral_id - description: "ID of the synth market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: id - description: "ID of the event record" - tests: - - unique - - not_null - - name: sender - description: "Sender address" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: perp_previous_order_expired_arbitrum_sepolia - description: PreviousOrderExpired events from the PerpsMarketProxy contract - columns: - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: tracking_code - description: "Tracking code" - data_type: text - - name: id - description: "ID of the event record" - tests: - - unique - - not_null - - name: size_delta - data_type: numeric - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["PreviousOrderExpired"] - - name: commitment_time - data_type: numeric - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: acceptable_price - data_type: numeric - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: perp_market_created_arbitrum_sepolia - description: MarketCreated events from the PerpsMarketProxy contract - columns: - - name: market_name - description: "Market name" - data_type: text - tests: - - not_null - - name: id - description: "ID of the event record" - tests: - - unique - - not_null - - name: market_symbol - description: "Market symbol" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["MarketCreated"] - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: perps_market_id - description: "ID of the perps market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: perp_interest_charged_arbitrum_sepolia - description: InterestCharged events from the PerpsMarketProxy contract - columns: - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["InterestCharged"] - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: id - description: "ID of the event record" - tests: - - unique - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: interest - data_type: numeric - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: perp_interest_rate_updated_arbitrum_sepolia - description: InterestRateUpdated events from the PerpsMarketProxy contract - columns: - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["InterestRateUpdated"] - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: interest_rate - description: "Interest rate" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: id - description: "ID of the event record" - tests: - - unique - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: super_market_id - description: "ID of the super market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true diff --git a/transformers/synthetix/models/raw/arbitrum/sepolia/schema.yml b/transformers/synthetix/models/raw/arbitrum/sepolia/schema.yml deleted file mode 100644 index 5f45e213..00000000 --- a/transformers/synthetix/models/raw/arbitrum/sepolia/schema.yml +++ /dev/null @@ -1,19 +0,0 @@ -version: 2 -models: - - name: blocks_arbitrum_sepolia - description: Block numbers and timestamps - tests: - - dbt_utils.recency: - datepart: hour - field: ts - interval: 1 - columns: - - name: ts - description: UTC timestamp - data_type: timestamp with time zone - - name: block_number - description: Block height - data_type: integer - tests: - - not_null - - unique diff --git a/transformers/synthetix/models/raw/arbitrum/sepolia/spot/schema.yml b/transformers/synthetix/models/raw/arbitrum/sepolia/spot/schema.yml deleted file mode 100644 index 70121a81..00000000 --- a/transformers/synthetix/models/raw/arbitrum/sepolia/spot/schema.yml +++ /dev/null @@ -1,525 +0,0 @@ -version: 2 -models: - - name: spot_order_committed_arbitrum_sepolia - description: OrderCommitted events from the SpotMarketProxy contract - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["OrderCommitted"] - - name: sender - description: "Address of the delegator" - data_type: text - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: referrer - description: "Address of the referrer" - data_type: text - tests: - - not_null - - name: amount_provided - description: "Amount provided" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: async_order_id - description: "Async order ID" - data_type: numeric - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: order_type - description: "Type of order" - data_type: integer - tests: - - not_null - - name: spot_order_settled_arbitrum_sepolia - description: OrderSettled events from the SpotMarketProxy contract - columns: - - name: final_order_amount - description: "Final order amount" - data_type: numeric - tests: - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: settler - description: "Address of the settler" - data_type: text - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: async_order_id - description: "Async order ID" - data_type: numeric - - name: order_type - description: "Type of order" - data_type: integer - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: price - description: "Synth price" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collected_fees - description: "Amount of fees collected" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fees - description: "Fees data" - data_type: jsonb - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["OrderSettled"] - - name: spot_order_cancelled_arbitrum_sepolia - description: OrderCancelled events from the SpotMarketProxy contract - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: async_order_claim - description: "Async order clain" - data_type: jsonb - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: sender - description: "Address of the delegator" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["OrderCancelled"] - - name: async_order_id - description: "Async order ID" - data_type: numeric - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: spot_synth_registered_arbitrum_sepolia - description: SynthRegistered events from the SpotMarketProxy contract - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: synth_market_id - description: "ID of the synth market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: synth_token_address - description: "Address of the synth token" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["SynthRegistered"] - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: spot_synth_bought_arbitrum_sepolia - description: SynthBought events from the SpotMarketProxy contract - columns: - - name: collected_fees - description: "Amount of fees collected" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: synth_market_id - description: "ID of the synth market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: price - description: "Synth price" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: referrer - description: "Address of the referrer" - data_type: text - tests: - - not_null - - name: fees - description: "Fees data" - data_type: jsonb - - name: synth_returned - data_type: numeric - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["SynthBought"] - - name: spot_synth_sold_arbitrum_sepolia - description: SynthSold events from the SpotMarketProxy contract - columns: - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["SynthSold"] - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: collected_fees - description: "Amount of fees collected" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: referrer - description: "Address of the referrer" - data_type: text - tests: - - not_null - - name: fees - description: "Fees data" - data_type: jsonb - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: price - description: "Synth price" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: amount_returned - description: "Amount returned" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: synth_market_id - description: "ID of the synth market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: spot_synth_wrapped_arbitrum_sepolia - description: SynthWrapped events from the SpotMarketProxy contract - columns: - - name: fees - description: "Fees data" - data_type: jsonb - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: synth_market_id - description: "ID of the synth market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["SynthWrapped"] - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: amount_wrapped - data_type: numeric - - name: fees_collected - description: "Amount of fees collected" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: spot_synth_unwrapped_arbitrum_sepolia - description: SynthUnwrapped events from the SpotMarketProxy contract - columns: - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: amount_unwrapped - description: "Amount of synth unwrapped" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fees_collected - description: "Amount of fees collected" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["SynthUnwrapped"] - - name: fees - description: "Fees data" - data_type: jsonb - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: synth_market_id - description: "ID of the synth market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true diff --git a/transformers/synthetix/models/raw/arbitrum/sepolia/spot/spot_order_cancelled_arbitrum_sepolia.sql b/transformers/synthetix/models/raw/arbitrum/sepolia/spot/spot_order_cancelled_arbitrum_sepolia.sql deleted file mode 100644 index 418808ea..00000000 --- a/transformers/synthetix/models/raw/arbitrum/sepolia/spot/spot_order_cancelled_arbitrum_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'arbitrum', - 'sepolia', - 'spot_market_proxy', - 'order_cancelled' -) }} diff --git a/transformers/synthetix/models/raw/arbitrum/sepolia/spot/spot_order_committed_arbitrum_sepolia.sql b/transformers/synthetix/models/raw/arbitrum/sepolia/spot/spot_order_committed_arbitrum_sepolia.sql deleted file mode 100644 index d8b14b91..00000000 --- a/transformers/synthetix/models/raw/arbitrum/sepolia/spot/spot_order_committed_arbitrum_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'arbitrum', - 'sepolia', - 'spot_market_proxy', - 'order_committed' -) }} diff --git a/transformers/synthetix/models/raw/arbitrum/sepolia/spot/spot_order_settled_arbitrum_sepolia.sql b/transformers/synthetix/models/raw/arbitrum/sepolia/spot/spot_order_settled_arbitrum_sepolia.sql deleted file mode 100644 index c8e9da25..00000000 --- a/transformers/synthetix/models/raw/arbitrum/sepolia/spot/spot_order_settled_arbitrum_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'arbitrum', - 'sepolia', - 'spot_market_proxy', - 'order_settled' -) }} diff --git a/transformers/synthetix/models/raw/arbitrum/sepolia/spot/spot_synth_bought_arbitrum_sepolia.sql b/transformers/synthetix/models/raw/arbitrum/sepolia/spot/spot_synth_bought_arbitrum_sepolia.sql deleted file mode 100644 index 4e23940c..00000000 --- a/transformers/synthetix/models/raw/arbitrum/sepolia/spot/spot_synth_bought_arbitrum_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'arbitrum', - 'sepolia', - 'spot_market_proxy', - 'synth_bought' -) }} diff --git a/transformers/synthetix/models/raw/arbitrum/sepolia/spot/spot_synth_registered_arbitrum_sepolia.sql b/transformers/synthetix/models/raw/arbitrum/sepolia/spot/spot_synth_registered_arbitrum_sepolia.sql deleted file mode 100644 index 42297685..00000000 --- a/transformers/synthetix/models/raw/arbitrum/sepolia/spot/spot_synth_registered_arbitrum_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'arbitrum', - 'sepolia', - 'spot_market_proxy', - 'synth_registered' -) }} diff --git a/transformers/synthetix/models/raw/arbitrum/sepolia/spot/spot_synth_sold_arbitrum_sepolia.sql b/transformers/synthetix/models/raw/arbitrum/sepolia/spot/spot_synth_sold_arbitrum_sepolia.sql deleted file mode 100644 index 9695b4d9..00000000 --- a/transformers/synthetix/models/raw/arbitrum/sepolia/spot/spot_synth_sold_arbitrum_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'arbitrum', - 'sepolia', - 'spot_market_proxy', - 'synth_sold' -) }} diff --git a/transformers/synthetix/models/raw/arbitrum/sepolia/spot/spot_synth_unwrapped_arbitrum_sepolia.sql b/transformers/synthetix/models/raw/arbitrum/sepolia/spot/spot_synth_unwrapped_arbitrum_sepolia.sql deleted file mode 100644 index 140272b0..00000000 --- a/transformers/synthetix/models/raw/arbitrum/sepolia/spot/spot_synth_unwrapped_arbitrum_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'arbitrum', - 'sepolia', - 'spot_market_proxy', - 'synth_unwrapped' -) }} diff --git a/transformers/synthetix/models/raw/arbitrum/sepolia/spot/spot_synth_wrapped_arbitrum_sepolia.sql b/transformers/synthetix/models/raw/arbitrum/sepolia/spot/spot_synth_wrapped_arbitrum_sepolia.sql deleted file mode 100644 index 46c35923..00000000 --- a/transformers/synthetix/models/raw/arbitrum/sepolia/spot/spot_synth_wrapped_arbitrum_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'arbitrum', - 'sepolia', - 'spot_market_proxy', - 'synth_wrapped' -) }} diff --git a/transformers/synthetix/models/raw/base/mainnet/blocks_base_mainnet.sql b/transformers/synthetix/models/raw/base/mainnet/blocks_base_mainnet.sql deleted file mode 100644 index f7866cf9..00000000 --- a/transformers/synthetix/models/raw/base/mainnet/blocks_base_mainnet.sql +++ /dev/null @@ -1,45 +0,0 @@ -with indexer_blocks as ( - select - timestamp as ts, - CAST( - number as INTEGER - ) as block_number - from - {{ source( - 'raw_base_mainnet', - 'block' - ) }} -), - -parquet_blocks as ( - select - TO_TIMESTAMP(timestamp) as ts, - CAST( - block_number as INTEGER - ) as block_number - from - {{ source( - 'raw_base_mainnet', - 'blocks_parquet' - ) }} -), - -combined_blocks as ( - select * - from - indexer_blocks - - union all - - select * - from - parquet_blocks -) - -select - block_number, - MIN(ts) as ts -from - combined_blocks -group by - block_number diff --git a/transformers/synthetix/models/raw/base/mainnet/buyback/buyback_processed_base_mainnet.sql b/transformers/synthetix/models/raw/base/mainnet/buyback/buyback_processed_base_mainnet.sql deleted file mode 100644 index 90eb0cbf..00000000 --- a/transformers/synthetix/models/raw/base/mainnet/buyback/buyback_processed_base_mainnet.sql +++ /dev/null @@ -1,43 +0,0 @@ -with legacy_events as ( - {{ get_event_data( - 'base', - 'mainnet', - 'buyback_snx_legacy', - 'buyback_processed' - ) }} -), - -current_events as ( - {{ get_event_data( - 'base', - 'mainnet', - 'buyback_snx', - 'buyback_processed' - ) }} -) - -select - id, - block_number, - block_timestamp, - transaction_hash, - event_name, - contract, - buyer, - snx, - usd -from - legacy_events -union all -select - id, - block_number, - block_timestamp, - transaction_hash, - event_name, - contract, - buyer, - snx, - usd -from - current_events diff --git a/transformers/synthetix/models/raw/base/mainnet/buyback/schema.yml b/transformers/synthetix/models/raw/base/mainnet/buyback/schema.yml deleted file mode 100644 index df2905fa..00000000 --- a/transformers/synthetix/models/raw/base/mainnet/buyback/schema.yml +++ /dev/null @@ -1,57 +0,0 @@ -models: - - name: buyback_processed_base_mainnet - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["BuybackProcessed"] - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: buyer - description: "Address of the buyer" - data_type: text - tests: - - not_null - - name: snx - description: "Amount in SNX" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: usd - description: "Value in USD" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true diff --git a/transformers/synthetix/models/raw/base/mainnet/core/core_account_created_base_mainnet.sql b/transformers/synthetix/models/raw/base/mainnet/core/core_account_created_base_mainnet.sql deleted file mode 100644 index e2cdb7b9..00000000 --- a/transformers/synthetix/models/raw/base/mainnet/core/core_account_created_base_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'mainnet', - 'core_proxy', - 'account_created' -) }} diff --git a/transformers/synthetix/models/raw/base/mainnet/core/core_delegation_updated_base_mainnet.sql b/transformers/synthetix/models/raw/base/mainnet/core/core_delegation_updated_base_mainnet.sql deleted file mode 100644 index e32a6d08..00000000 --- a/transformers/synthetix/models/raw/base/mainnet/core/core_delegation_updated_base_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'mainnet', - 'core_proxy', - 'delegation_updated' -) }} diff --git a/transformers/synthetix/models/raw/base/mainnet/core/core_deposited_base_mainnet.sql b/transformers/synthetix/models/raw/base/mainnet/core/core_deposited_base_mainnet.sql deleted file mode 100644 index d11d379a..00000000 --- a/transformers/synthetix/models/raw/base/mainnet/core/core_deposited_base_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'mainnet', - 'core_proxy', - 'deposited' -) }} diff --git a/transformers/synthetix/models/raw/base/mainnet/core/core_liquidation_base_mainnet.sql b/transformers/synthetix/models/raw/base/mainnet/core/core_liquidation_base_mainnet.sql deleted file mode 100644 index 053f33b2..00000000 --- a/transformers/synthetix/models/raw/base/mainnet/core/core_liquidation_base_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'mainnet', - 'core_proxy', - 'liquidation' -) }} diff --git a/transformers/synthetix/models/raw/base/mainnet/core/core_market_registered_base_mainnet.sql b/transformers/synthetix/models/raw/base/mainnet/core/core_market_registered_base_mainnet.sql deleted file mode 100644 index a9cb1303..00000000 --- a/transformers/synthetix/models/raw/base/mainnet/core/core_market_registered_base_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'mainnet', - 'core_proxy', - 'market_registered' -) }} diff --git a/transformers/synthetix/models/raw/base/mainnet/core/core_market_updated_base_mainnet.sql b/transformers/synthetix/models/raw/base/mainnet/core/core_market_updated_base_mainnet.sql deleted file mode 100644 index efb04d87..00000000 --- a/transformers/synthetix/models/raw/base/mainnet/core/core_market_updated_base_mainnet.sql +++ /dev/null @@ -1,151 +0,0 @@ -with events as ( - select - id, - block_timestamp, - block_number, - transaction_hash, - contract, - event_name, - market_id, - net_issuance, - deposited_collateral_value, - target as sender, - 'USD' as collateral_type, - credit_capacity, - amount as token_amount - from - ( - {{ get_event_data( - 'base', - 'mainnet', - 'core_proxy_legacy', - 'market_usd_deposited' - ) }} - ) as usd_deposited -- noqa: AL05 - union all - select - id, - block_timestamp, - block_number, - transaction_hash, - contract, - event_name, - market_id, - net_issuance, - deposited_collateral_value, - target as sender, - 'USD' as collateral_type, - credit_capacity, - amount as token_amount - from - ( - {{ get_event_data( - 'base', - 'mainnet', - 'core_proxy_legacy', - 'market_usd_withdrawn' - ) }} - ) as usd_withdrawn -- noqa: AL05 - union all - select - id, - block_timestamp, - block_number, - transaction_hash, - contract, - event_name, - market_id, - net_issuance, - deposited_collateral_value, - sender, - collateral_type, - credit_capacity, - token_amount - from - ( - {{ get_event_data( - 'base', - 'mainnet', - 'core_proxy', - 'market_collateral_deposited' - ) }} - ) as collateral_deposited -- noqa: AL05 - union all - select - id, - block_timestamp, - block_number, - transaction_hash, - contract, - event_name, - market_id, - net_issuance, - deposited_collateral_value, - sender, - collateral_type, - credit_capacity, - token_amount - from - ( - {{ get_event_data( - 'base', - 'mainnet', - 'core_proxy', - 'market_collateral_withdrawn' - ) }} - ) as collateral_withdrawn -- noqa: AL05 - union all - select - id, - block_timestamp, - block_number, - transaction_hash, - contract, - event_name, - market_id, - net_issuance, - deposited_collateral_value, - target as sender, - 'USD' as collateral_type, - credit_capacity, - amount as token_amount - from - ( - {{ get_event_data( - 'base', - 'mainnet', - 'core_proxy', - 'market_usd_deposited' - ) }} - ) as usd_deposited -- noqa: AL05 - union all - select - id, - block_timestamp, - block_number, - transaction_hash, - contract, - event_name, - market_id, - net_issuance, - deposited_collateral_value, - target as sender, - 'USD' as collateral_type, - credit_capacity, - amount as token_amount - from - ( - {{ get_event_data( - 'base', - 'mainnet', - 'core_proxy', - 'market_usd_withdrawn' - ) }} - ) as usd_withdrawn -- noqa: AL05 -) - -select * -from - events -order by - block_timestamp diff --git a/transformers/synthetix/models/raw/base/mainnet/core/core_pool_created_base_mainnet.sql b/transformers/synthetix/models/raw/base/mainnet/core/core_pool_created_base_mainnet.sql deleted file mode 100644 index 5a098697..00000000 --- a/transformers/synthetix/models/raw/base/mainnet/core/core_pool_created_base_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'mainnet', - 'core_proxy', - 'pool_created' -) }} diff --git a/transformers/synthetix/models/raw/base/mainnet/core/core_rewards_claimed_base_mainnet.sql b/transformers/synthetix/models/raw/base/mainnet/core/core_rewards_claimed_base_mainnet.sql deleted file mode 100644 index 3458de50..00000000 --- a/transformers/synthetix/models/raw/base/mainnet/core/core_rewards_claimed_base_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'mainnet', - 'core_proxy', - 'rewards_claimed' -) }} diff --git a/transformers/synthetix/models/raw/base/mainnet/core/core_rewards_distributed_base_mainnet.sql b/transformers/synthetix/models/raw/base/mainnet/core/core_rewards_distributed_base_mainnet.sql deleted file mode 100644 index c10b8730..00000000 --- a/transformers/synthetix/models/raw/base/mainnet/core/core_rewards_distributed_base_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'mainnet', - 'core_proxy', - 'rewards_distributed' -) }} diff --git a/transformers/synthetix/models/raw/base/mainnet/core/core_usd_burned_base_mainnet.sql b/transformers/synthetix/models/raw/base/mainnet/core/core_usd_burned_base_mainnet.sql deleted file mode 100644 index a114619e..00000000 --- a/transformers/synthetix/models/raw/base/mainnet/core/core_usd_burned_base_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'mainnet', - 'core_proxy', - 'usd_burned' -) }} diff --git a/transformers/synthetix/models/raw/base/mainnet/core/core_usd_minted_base_mainnet.sql b/transformers/synthetix/models/raw/base/mainnet/core/core_usd_minted_base_mainnet.sql deleted file mode 100644 index b0e273af..00000000 --- a/transformers/synthetix/models/raw/base/mainnet/core/core_usd_minted_base_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'mainnet', - 'core_proxy', - 'usd_minted' -) }} diff --git a/transformers/synthetix/models/raw/base/mainnet/core/core_vault_collateral_base_mainnet.sql b/transformers/synthetix/models/raw/base/mainnet/core/core_vault_collateral_base_mainnet.sql deleted file mode 100644 index 499b4bb1..00000000 --- a/transformers/synthetix/models/raw/base/mainnet/core/core_vault_collateral_base_mainnet.sql +++ /dev/null @@ -1,40 +0,0 @@ -with base as ( - select - block_number, - contract_address, - chain_id, - pool_id, - collateral_type, - cast( - amount as numeric - ) as amount, - cast( - value as numeric - ) as collateral_value - from - {{ source( - 'raw_base_mainnet', - "core_get_vault_collateral" - ) }} - where - amount is not null -) - -select - to_timestamp(blocks.timestamp) as ts, - cast( - blocks.block_number as integer - ) as block_number, - base.contract_address, - cast( - base.pool_id as integer - ) as pool_id, - cast( - base.collateral_type as varchar - ) as collateral_type, - {{ convert_wei('base.amount') }} as amount, - {{ convert_wei('base.collateral_value') }} as collateral_value -from - base -inner join {{ source('raw_base_mainnet', 'blocks_parquet') }} as blocks - on base.block_number = blocks.block_number diff --git a/transformers/synthetix/models/raw/base/mainnet/core/core_vault_debt_base_mainnet.sql b/transformers/synthetix/models/raw/base/mainnet/core/core_vault_debt_base_mainnet.sql deleted file mode 100644 index dac22b90..00000000 --- a/transformers/synthetix/models/raw/base/mainnet/core/core_vault_debt_base_mainnet.sql +++ /dev/null @@ -1,41 +0,0 @@ -with base as ( - select - block_number, - contract_address, - chain_id, - pool_id, - collateral_type, - CAST( - value_1 as numeric - ) as debt - from - {{ source( - 'raw_base_mainnet', - "core_get_vault_debt" - ) }} - where - value_1 is not null -) - -select - TO_TIMESTAMP( - blocks.timestamp - ) as ts, - CAST( - blocks.block_number as integer - ) as block_number, - base.contract_address, - CAST( - base.pool_id as integer - ) as pool_id, - CAST( - base.collateral_type as varchar - ) as collateral_type, - {{ convert_wei('base.debt') }} as debt -from - base -inner join {{ source( - 'raw_base_mainnet', - 'blocks_parquet' - ) }} as blocks - on base.block_number = blocks.block_number diff --git a/transformers/synthetix/models/raw/base/mainnet/core/core_vault_liquidation_base_mainnet.sql b/transformers/synthetix/models/raw/base/mainnet/core/core_vault_liquidation_base_mainnet.sql deleted file mode 100644 index 61179a05..00000000 --- a/transformers/synthetix/models/raw/base/mainnet/core/core_vault_liquidation_base_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'mainnet', - 'core_proxy', - 'vault_liquidation' -) }} diff --git a/transformers/synthetix/models/raw/base/mainnet/core/core_withdrawn_base_mainnet.sql b/transformers/synthetix/models/raw/base/mainnet/core/core_withdrawn_base_mainnet.sql deleted file mode 100644 index 9e00f5ff..00000000 --- a/transformers/synthetix/models/raw/base/mainnet/core/core_withdrawn_base_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'mainnet', - 'core_proxy', - 'withdrawn' -) }} diff --git a/transformers/synthetix/models/raw/base/mainnet/core/schema.yml b/transformers/synthetix/models/raw/base/mainnet/core/schema.yml deleted file mode 100644 index cffe9f83..00000000 --- a/transformers/synthetix/models/raw/base/mainnet/core/schema.yml +++ /dev/null @@ -1,942 +0,0 @@ -version: 2 -models: - - name: core_account_created_base_mainnet - description: AccountCreated events from the CoreProxy contract - columns: - - name: owner - description: "Address of the account owner" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["AccountCreated"] - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: core_delegation_updated_base_mainnet - description: DelegationUpdated events from the CoreProxy contract - columns: - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: sender - description: "Address of the delegator" - data_type: text - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: leverage - description: "Leverage" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 1000000000000000000 - max_value: 1000000000000000000 - inclusive: true - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: amount - description: "Amount delegated" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["DelegationUpdated"] - - name: core_deposited_base_mainnet - description: Deposited events from the CoreProxy contract - columns: - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["Deposited"] - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: sender - description: "Address of the depositor" - data_type: text - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: token_amount - description: "Token amount deposited" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: core_withdrawn_base_mainnet - description: Withdrawn events from the CoreProxy contract - columns: - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: token_amount - description: "Token amount withdrawn" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: sender - description: "Address of the withdrawer" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["Withdrawn"] - - name: core_liquidation_base_mainnet - description: Liquidation events from the CoreProxy contract - columns: - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["Liquidation"] - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: sender - description: "Address of the liquidator" - data_type: text - tests: - - not_null - - name: liquidation_data - data_type: jsonb - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: liquidate_as_account_id - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: core_market_updated_base_mainnet - description: > - Combination of MarketCollateralDeposited, MarketCollateralWithdrawn, - MarketUsdDeposited, MarketUsdWithdrawn events from the CoreProxy contract - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["MarketCollateralWithdrawn", "MarketCollateralDeposited", "MarketUsdWithdrawn", "MarketUsdDeposited"] - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: net_issuance - description: "Net issuance" - data_type: numeric - tests: - - not_null - - name: deposited_collateral_value - description: "Deposited collateral value" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: sender - description: "Address of the event initiator" - data_type: text - tests: - - not_null - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: credit_capacity - description: "Credit capacity" - data_type: numeric - tests: - - not_null - - name: token_amount - description: "Token amount" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: core_market_registered_base_mainnet - description: MarketRegistered events from the CoreProxy contract - columns: - - name: market - description: "Market name" - data_type: text - tests: - - not_null - - name: market_id - description: "Market ID" - data_type: numeric - tests: - - not_null - - unique - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["MarketRegistered"] - - name: sender - description: "Address of the event initiator" - data_type: text - tests: - - not_null - - name: core_pool_created_base_mainnet - description: "PoolCreated events from the CoreProxy contract" - columns: - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: sender - description: "Address of the event initiator" - data_type: text - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["PoolCreated"] - - name: owner - description: "Address of the pool owner" - data_type: text - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: core_rewards_claimed_base_mainnet - description: RewardsClaimed events from the CoreProxy contract - columns: - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["RewardsClaimed"] - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: amount - description: "Amount delegated" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: distributor - description: "Address of the distributor" - data_type: text - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: core_rewards_distributed_base_mainnet - description: RewardsDistributed events from the CoreProxy contract - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["RewardsDistributed"] - - name: amount - description: "Amount claimed" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: start - description: "UNIX timestamp" - data_type: numeric - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: duration - description: "Duration in seconds" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: distributor - description: "Address of the distributor" - data_type: text - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: core_usd_burned_base_mainnet - description: UsdBurned events from the CoreProxy contract - columns: - - name: amount - description: "Amount burned" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["UsdBurned"] - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: sender - description: "Address of the event initiator" - data_type: text - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: core_usd_minted_base_mainnet - description: UsdMinted events from the CoreProxy contract - columns: - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: sender - description: "Address of the event initiator" - data_type: text - tests: - - not_null - - name: amount - description: "Amount minted" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["UsdMinted"] - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: core_vault_liquidation_base_mainnet - description: VaultLiquidation events from the CoreProxy contract - columns: - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["VaultLiquidation"] - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: liquidate_as_account_id - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: liquidation_data - data_type: jsonb - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: sender - description: "Address of the event initiator" - data_type: text - tests: - - not_null - - name: core_vault_collateral_base_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: bigint - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: integer - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: character varying - tests: - - not_null - - name: amount - description: "Collateral amount" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_value - description: "Vault collateral value" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: contract_address - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: core_vault_debt_base_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: bigint - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: integer - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: character varying - tests: - - not_null - - name: debt - description: "Vault debt" - data_type: numeric - tests: - - not_null - - name: contract_address - description: "Address of the contract" - data_type: text - tests: - - not_null diff --git a/transformers/synthetix/models/raw/base/mainnet/perp/perp_account_created_base_mainnet.sql b/transformers/synthetix/models/raw/base/mainnet/perp/perp_account_created_base_mainnet.sql deleted file mode 100644 index 08d41037..00000000 --- a/transformers/synthetix/models/raw/base/mainnet/perp/perp_account_created_base_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'mainnet', - 'perps_market_proxy', - 'account_created' -) }} diff --git a/transformers/synthetix/models/raw/base/mainnet/perp/perp_account_liquidation_attempt_base_mainnet.sql b/transformers/synthetix/models/raw/base/mainnet/perp/perp_account_liquidation_attempt_base_mainnet.sql deleted file mode 100644 index d7bb27bc..00000000 --- a/transformers/synthetix/models/raw/base/mainnet/perp/perp_account_liquidation_attempt_base_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'mainnet', - 'perps_market_proxy', - 'account_liquidation_attempt' -) }} diff --git a/transformers/synthetix/models/raw/base/mainnet/perp/perp_collateral_modified_base_mainnet.sql b/transformers/synthetix/models/raw/base/mainnet/perp/perp_collateral_modified_base_mainnet.sql deleted file mode 100644 index b51407db..00000000 --- a/transformers/synthetix/models/raw/base/mainnet/perp/perp_collateral_modified_base_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'mainnet', - 'perps_market_proxy', - 'collateral_modified' -) }} diff --git a/transformers/synthetix/models/raw/base/mainnet/perp/perp_interest_charged_base_mainnet.sql b/transformers/synthetix/models/raw/base/mainnet/perp/perp_interest_charged_base_mainnet.sql deleted file mode 100644 index 199f711b..00000000 --- a/transformers/synthetix/models/raw/base/mainnet/perp/perp_interest_charged_base_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'mainnet', - 'perps_market_proxy', - 'interest_charged' -) }} diff --git a/transformers/synthetix/models/raw/base/mainnet/perp/perp_interest_rate_updated_base_mainnet.sql b/transformers/synthetix/models/raw/base/mainnet/perp/perp_interest_rate_updated_base_mainnet.sql deleted file mode 100644 index 6729dabb..00000000 --- a/transformers/synthetix/models/raw/base/mainnet/perp/perp_interest_rate_updated_base_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'mainnet', - 'perps_market_proxy', - 'interest_rate_updated' -) }} diff --git a/transformers/synthetix/models/raw/base/mainnet/perp/perp_market_created_base_mainnet.sql b/transformers/synthetix/models/raw/base/mainnet/perp/perp_market_created_base_mainnet.sql deleted file mode 100644 index dd0c67c2..00000000 --- a/transformers/synthetix/models/raw/base/mainnet/perp/perp_market_created_base_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'mainnet', - 'perps_market_proxy', - 'market_created' -) }} diff --git a/transformers/synthetix/models/raw/base/mainnet/perp/perp_market_updated_base_mainnet.sql b/transformers/synthetix/models/raw/base/mainnet/perp/perp_market_updated_base_mainnet.sql deleted file mode 100644 index 520a2307..00000000 --- a/transformers/synthetix/models/raw/base/mainnet/perp/perp_market_updated_base_mainnet.sql +++ /dev/null @@ -1,53 +0,0 @@ -with legacy_events as ( - {{ get_event_data( - 'base', - 'mainnet', - 'perps_market_proxy_legacy', - 'market_updated' - ) }} -), - -current_events as ( - {{ get_event_data( - 'base', - 'mainnet', - 'perps_market_proxy', - 'market_updated' - ) }} -) - -select - id, - block_number, - block_timestamp, - transaction_hash, - contract, - event_name, - market_id, - price, - skew, - size, - size_delta, - current_funding_rate, - current_funding_velocity, - 0 as interest_rate -from - legacy_events -union all -select - id, - block_number, - block_timestamp, - transaction_hash, - contract, - event_name, - market_id, - price, - skew, - size, - size_delta, - current_funding_rate, - current_funding_velocity, - interest_rate -from - current_events diff --git a/transformers/synthetix/models/raw/base/mainnet/perp/perp_order_committed_base_mainnet.sql b/transformers/synthetix/models/raw/base/mainnet/perp/perp_order_committed_base_mainnet.sql deleted file mode 100644 index 32cffb40..00000000 --- a/transformers/synthetix/models/raw/base/mainnet/perp/perp_order_committed_base_mainnet.sql +++ /dev/null @@ -1,61 +0,0 @@ -with legacy_events as ( - {{ get_event_data( - 'base', - 'mainnet', - 'perps_market_proxy_legacy', - 'order_committed' - ) }} -), - -current_events as ( - {{ get_event_data( - 'base', - 'mainnet', - 'perps_market_proxy', - 'order_committed' - ) }} -) - -select - id, - block_number, - block_timestamp, - transaction_hash, - contract, - event_name, - market_id, - account_id, - commitment_time, - expiration_time, - settlement_time, - cast( - null as numeric - ) as expected_price_time, - acceptable_price, - order_type, - size_delta, - sender, - tracking_code -from - legacy_events -union all -select - id, - block_number, - block_timestamp, - transaction_hash, - contract, - event_name, - market_id, - account_id, - commitment_time, - expiration_time, - settlement_time, - expected_price_time, - acceptable_price, - order_type, - size_delta, - sender, - tracking_code -from - current_events diff --git a/transformers/synthetix/models/raw/base/mainnet/perp/perp_order_settled_base_mainnet.sql b/transformers/synthetix/models/raw/base/mainnet/perp/perp_order_settled_base_mainnet.sql deleted file mode 100644 index 52a5328b..00000000 --- a/transformers/synthetix/models/raw/base/mainnet/perp/perp_order_settled_base_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'mainnet', - 'perps_market_proxy', - 'order_settled' -) }} diff --git a/transformers/synthetix/models/raw/base/mainnet/perp/perp_position_liquidated_base_mainnet.sql b/transformers/synthetix/models/raw/base/mainnet/perp/perp_position_liquidated_base_mainnet.sql deleted file mode 100644 index 690e3470..00000000 --- a/transformers/synthetix/models/raw/base/mainnet/perp/perp_position_liquidated_base_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'mainnet', - 'perps_market_proxy', - 'position_liquidated' -) }} diff --git a/transformers/synthetix/models/raw/base/mainnet/perp/perp_previous_order_expired_base_mainnet.sql b/transformers/synthetix/models/raw/base/mainnet/perp/perp_previous_order_expired_base_mainnet.sql deleted file mode 100644 index 8c42fef5..00000000 --- a/transformers/synthetix/models/raw/base/mainnet/perp/perp_previous_order_expired_base_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'mainnet', - 'perps_market_proxy', - 'previous_order_expired' -) }} diff --git a/transformers/synthetix/models/raw/base/mainnet/perp/schema.yml b/transformers/synthetix/models/raw/base/mainnet/perp/schema.yml deleted file mode 100644 index 9855abd6..00000000 --- a/transformers/synthetix/models/raw/base/mainnet/perp/schema.yml +++ /dev/null @@ -1,657 +0,0 @@ -version: 2 -models: - - name: perp_account_created_base_mainnet - description: AccountCreated events from the PerpsMarketProxy contract - columns: - - name: id - description: "ID of the event record" - tests: - - unique - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["AccountCreated"] - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: owner - description: "Address of the pool owner" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: perp_order_committed_base_mainnet - description: OrderCommitted events from the PerpsMarketProxy contract - columns: - - name: id - description: "ID of the event record" - tests: - - unique - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["OrderCommitted"] - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: commitment_time - data_type: numeric - - name: expiration_time - data_type: numeric - - name: settlement_time - data_type: numeric - - name: expected_price_time - data_type: numeric - - name: acceptable_price - data_type: numeric - - name: order_type - data_type: integer - - name: size_delta - data_type: numeric - - name: sender - data_type: text - - name: tracking_code - data_type: text - - name: perp_order_settled_base_mainnet - description: OrderSettled events from the PerpsMarketProxy contract - columns: - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: fill_price - data_type: numeric - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["OrderSettled"] - - name: settlement_reward - data_type: numeric - - name: settler - data_type: text - - name: tracking_code - data_type: text - - name: total_fees - data_type: numeric - - name: pnl - data_type: numeric - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collected_fees - description: "Amount of fees collected" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: size_delta - data_type: numeric - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: accrued_funding - data_type: numeric - - name: referral_fees - data_type: numeric - - name: new_size - data_type: numeric - - name: id - description: "ID of the event record" - tests: - - unique - - not_null - - name: perp_market_updated_base_mainnet - description: MarketUpdated events from the PerpsMarketProxy contract - columns: - - name: id - description: "ID of the event record" - tests: - - unique - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["MarketUpdated"] - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: price - description: "Price" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: skew - data_type: numeric - - name: size - data_type: numeric - - name: size_delta - data_type: numeric - - name: current_funding_rate - data_type: numeric - - name: current_funding_velocity - data_type: numeric - - name: interest_rate - description: "Interest rate" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: perp_position_liquidated_base_mainnet - description: PositionLiquidated events from the PerpsMarketProxy contract - columns: - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: id - description: "ID of the event record" - tests: - - unique - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: current_position_size - description: "Current position size" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["PositionLiquidated"] - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: amount_liquidated - description: "Amount liquidated" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: perp_account_liquidation_attempt_base_mainnet - description: AccountLiquidationAttempt events from the PerpsMarketProxy contract - columns: - - name: id - description: "ID of the event record" - tests: - - unique - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: reward - description: "Reward" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["AccountLiquidationAttempt"] - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: full_liquidation - description: "Whether it is a full or partial liquidation" - data_type: boolean - tests: - - not_null - - name: perp_collateral_modified_base_mainnet - description: CollateralModified events from the PerpsMarketProxy contract - columns: - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["CollateralModified"] - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: amount_delta - data_type: numeric - - name: synth_market_id - description: "ID of the synth market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: id - description: "ID of the event record" - tests: - - unique - - not_null - - name: sender - description: "Sender address" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: perp_previous_order_expired_base_mainnet - description: PreviousOrderExpired events from the PerpsMarketProxy contract - columns: - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: tracking_code - description: "Tracking code" - data_type: text - - name: id - description: "ID of the event record" - tests: - - unique - - not_null - - name: size_delta - data_type: numeric - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["PreviousOrderExpired"] - - name: commitment_time - data_type: numeric - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: acceptable_price - data_type: numeric - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: perp_market_created_base_mainnet - description: MarketCreated events from the PerpsMarketProxy contract - columns: - - name: market_name - description: "Market name" - data_type: text - tests: - - not_null - - name: id - description: "ID of the event record" - tests: - - unique - - not_null - - name: market_symbol - description: "Market symbol" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["MarketCreated"] - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: perps_market_id - description: "ID of the perps market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: perp_interest_charged_base_mainnet - description: InterestCharged events from the PerpsMarketProxy contract - columns: - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["InterestCharged"] - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: id - description: "ID of the event record" - tests: - - unique - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: interest - data_type: numeric - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: perp_interest_rate_updated_base_mainnet - description: InterestRateUpdated events from the PerpsMarketProxy contract - columns: - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["InterestRateUpdated"] - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: interest_rate - description: "Interest rate" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: id - description: "ID of the event record" - tests: - - unique - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: super_market_id - description: "ID of the super market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true diff --git a/transformers/synthetix/models/raw/base/mainnet/schema.yml b/transformers/synthetix/models/raw/base/mainnet/schema.yml deleted file mode 100644 index a56c30ab..00000000 --- a/transformers/synthetix/models/raw/base/mainnet/schema.yml +++ /dev/null @@ -1,19 +0,0 @@ -version: 2 -models: - - name: blocks_base_mainnet - description: Block numbers and timestamps - tests: - - dbt_utils.recency: - datepart: hour - field: ts - interval: 1 - columns: - - name: ts - description: UTC timestamp - data_type: timestamp with time zone - - name: block_number - description: Block height - data_type: integer - tests: - - not_null - - unique diff --git a/transformers/synthetix/models/raw/base/mainnet/spot/schema.yml b/transformers/synthetix/models/raw/base/mainnet/spot/schema.yml deleted file mode 100644 index ea2fe5f6..00000000 --- a/transformers/synthetix/models/raw/base/mainnet/spot/schema.yml +++ /dev/null @@ -1,525 +0,0 @@ -version: 2 -models: - - name: spot_order_committed_base_mainnet - description: OrderCommitted events from the SpotMarketProxy contract - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["OrderCommitted"] - - name: sender - description: "Address of the delegator" - data_type: text - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: referrer - description: "Address of the referrer" - data_type: text - tests: - - not_null - - name: amount_provided - description: "Amount provided" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: async_order_id - description: "Async order ID" - data_type: numeric - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: order_type - description: "Type of order" - data_type: integer - tests: - - not_null - - name: spot_order_settled_base_mainnet - description: OrderSettled events from the SpotMarketProxy contract - columns: - - name: final_order_amount - description: "Final order amount" - data_type: numeric - tests: - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: settler - description: "Address of the settler" - data_type: text - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: async_order_id - description: "Async order ID" - data_type: numeric - - name: order_type - description: "Type of order" - data_type: integer - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: price - description: "Synth price" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collected_fees - description: "Amount of fees collected" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fees - description: "Fees data" - data_type: jsonb - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["OrderSettled"] - - name: spot_order_cancelled_base_mainnet - description: OrderCancelled events from the SpotMarketProxy contract - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: async_order_claim - description: "Async order clain" - data_type: jsonb - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: sender - description: "Address of the delegator" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["OrderCancelled"] - - name: async_order_id - description: "Async order ID" - data_type: numeric - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: spot_synth_registered_base_mainnet - description: SynthRegistered events from the SpotMarketProxy contract - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: synth_market_id - description: "ID of the synth market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: synth_token_address - description: "Address of the synth token" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["SynthRegistered"] - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: spot_synth_bought_base_mainnet - description: SynthBought events from the SpotMarketProxy contract - columns: - - name: collected_fees - description: "Amount of fees collected" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: synth_market_id - description: "ID of the synth market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: price - description: "Synth price" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: referrer - description: "Address of the referrer" - data_type: text - tests: - - not_null - - name: fees - description: "Fees data" - data_type: jsonb - - name: synth_returned - data_type: numeric - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["SynthBought"] - - name: spot_synth_sold_base_mainnet - description: SynthSold events from the SpotMarketProxy contract - columns: - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["SynthSold"] - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: collected_fees - description: "Amount of fees collected" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: referrer - description: "Address of the referrer" - data_type: text - tests: - - not_null - - name: fees - description: "Fees data" - data_type: jsonb - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: price - description: "Synth price" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: amount_returned - description: "Amount returned" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: synth_market_id - description: "ID of the synth market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: spot_synth_wrapped_base_mainnet - description: SynthWrapped events from the SpotMarketProxy contract - columns: - - name: fees - description: "Fees data" - data_type: jsonb - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: synth_market_id - description: "ID of the synth market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["SynthWrapped"] - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: amount_wrapped - data_type: numeric - - name: fees_collected - description: "Amount of fees collected" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: spot_synth_unwrapped_base_mainnet - description: SynthUnwrapped events from the SpotMarketProxy contract - columns: - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: amount_unwrapped - description: "Amount of synth unwrapped" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fees_collected - description: "Amount of fees collected" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["SynthUnwrapped"] - - name: fees - description: "Fees data" - data_type: jsonb - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: synth_market_id - description: "ID of the synth market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true diff --git a/transformers/synthetix/models/raw/base/mainnet/spot/spot_order_cancelled_base_mainnet.sql b/transformers/synthetix/models/raw/base/mainnet/spot/spot_order_cancelled_base_mainnet.sql deleted file mode 100644 index 840498b5..00000000 --- a/transformers/synthetix/models/raw/base/mainnet/spot/spot_order_cancelled_base_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'mainnet', - 'spot_market_proxy', - 'order_cancelled' -) }} diff --git a/transformers/synthetix/models/raw/base/mainnet/spot/spot_order_committed_base_mainnet.sql b/transformers/synthetix/models/raw/base/mainnet/spot/spot_order_committed_base_mainnet.sql deleted file mode 100644 index 2c79c94c..00000000 --- a/transformers/synthetix/models/raw/base/mainnet/spot/spot_order_committed_base_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'mainnet', - 'spot_market_proxy', - 'order_committed' -) }} diff --git a/transformers/synthetix/models/raw/base/mainnet/spot/spot_order_settled_base_mainnet.sql b/transformers/synthetix/models/raw/base/mainnet/spot/spot_order_settled_base_mainnet.sql deleted file mode 100644 index 368e2e9e..00000000 --- a/transformers/synthetix/models/raw/base/mainnet/spot/spot_order_settled_base_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'mainnet', - 'spot_market_proxy', - 'order_settled' -) }} diff --git a/transformers/synthetix/models/raw/base/mainnet/spot/spot_synth_bought_base_mainnet.sql b/transformers/synthetix/models/raw/base/mainnet/spot/spot_synth_bought_base_mainnet.sql deleted file mode 100644 index e3a764cb..00000000 --- a/transformers/synthetix/models/raw/base/mainnet/spot/spot_synth_bought_base_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'mainnet', - 'spot_market_proxy', - 'synth_bought' -) }} diff --git a/transformers/synthetix/models/raw/base/mainnet/spot/spot_synth_registered_base_mainnet.sql b/transformers/synthetix/models/raw/base/mainnet/spot/spot_synth_registered_base_mainnet.sql deleted file mode 100644 index cdc4388d..00000000 --- a/transformers/synthetix/models/raw/base/mainnet/spot/spot_synth_registered_base_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'mainnet', - 'spot_market_proxy', - 'synth_registered' -) }} diff --git a/transformers/synthetix/models/raw/base/mainnet/spot/spot_synth_sold_base_mainnet.sql b/transformers/synthetix/models/raw/base/mainnet/spot/spot_synth_sold_base_mainnet.sql deleted file mode 100644 index bee92873..00000000 --- a/transformers/synthetix/models/raw/base/mainnet/spot/spot_synth_sold_base_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'mainnet', - 'spot_market_proxy', - 'synth_sold' -) }} diff --git a/transformers/synthetix/models/raw/base/mainnet/spot/spot_synth_unwrapped_base_mainnet.sql b/transformers/synthetix/models/raw/base/mainnet/spot/spot_synth_unwrapped_base_mainnet.sql deleted file mode 100644 index a956fcb8..00000000 --- a/transformers/synthetix/models/raw/base/mainnet/spot/spot_synth_unwrapped_base_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'mainnet', - 'spot_market_proxy', - 'synth_unwrapped' -) }} diff --git a/transformers/synthetix/models/raw/base/mainnet/spot/spot_synth_wrapped_base_mainnet.sql b/transformers/synthetix/models/raw/base/mainnet/spot/spot_synth_wrapped_base_mainnet.sql deleted file mode 100644 index 89a616bb..00000000 --- a/transformers/synthetix/models/raw/base/mainnet/spot/spot_synth_wrapped_base_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'mainnet', - 'spot_market_proxy', - 'synth_wrapped' -) }} diff --git a/transformers/synthetix/models/raw/base/sepolia/blocks_base_sepolia.sql b/transformers/synthetix/models/raw/base/sepolia/blocks_base_sepolia.sql deleted file mode 100644 index dc44d677..00000000 --- a/transformers/synthetix/models/raw/base/sepolia/blocks_base_sepolia.sql +++ /dev/null @@ -1,45 +0,0 @@ -with indexer_blocks as ( - select - timestamp as ts, - CAST( - number as INTEGER - ) as block_number - from - {{ source( - 'raw_base_sepolia', - 'block' - ) }} -), - -parquet_blocks as ( - select - TO_TIMESTAMP(timestamp) as ts, - CAST( - block_number as INTEGER - ) as block_number - from - {{ source( - 'raw_base_sepolia', - 'blocks_parquet' - ) }} -), - -combined_blocks as ( - select * - from - indexer_blocks - - union all - - select * - from - parquet_blocks -) - -select - block_number, - MIN(ts) as ts -from - combined_blocks -group by - block_number diff --git a/transformers/synthetix/models/raw/base/sepolia/buyback/buyback_processed_base_sepolia.sql b/transformers/synthetix/models/raw/base/sepolia/buyback/buyback_processed_base_sepolia.sql deleted file mode 100644 index 8a5183a4..00000000 --- a/transformers/synthetix/models/raw/base/sepolia/buyback/buyback_processed_base_sepolia.sql +++ /dev/null @@ -1,21 +0,0 @@ -with current_events as ( - {{ get_event_data( - 'base', - 'sepolia', - 'buyback_snx', - 'buyback_processed' - ) }} -) - -select - id, - block_number, - block_timestamp, - transaction_hash, - event_name, - contract, - buyer, - snx, - usd -from - current_events diff --git a/transformers/synthetix/models/raw/base/sepolia/buyback/schema.yml b/transformers/synthetix/models/raw/base/sepolia/buyback/schema.yml deleted file mode 100644 index f35fb22d..00000000 --- a/transformers/synthetix/models/raw/base/sepolia/buyback/schema.yml +++ /dev/null @@ -1,57 +0,0 @@ -models: - - name: buyback_processed_base_sepolia - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["BuybackProcessed"] - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: buyer - description: "Address of the buyer" - data_type: text - tests: - - not_null - - name: snx - description: "Amount in SNX" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: usd - description: "Value in USD" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true diff --git a/transformers/synthetix/models/raw/base/sepolia/core/core_account_created_base_sepolia.sql b/transformers/synthetix/models/raw/base/sepolia/core/core_account_created_base_sepolia.sql deleted file mode 100644 index 4144d445..00000000 --- a/transformers/synthetix/models/raw/base/sepolia/core/core_account_created_base_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'sepolia', - 'core_proxy', - 'account_created' -) }} diff --git a/transformers/synthetix/models/raw/base/sepolia/core/core_delegation_updated_base_sepolia.sql b/transformers/synthetix/models/raw/base/sepolia/core/core_delegation_updated_base_sepolia.sql deleted file mode 100644 index cfd43216..00000000 --- a/transformers/synthetix/models/raw/base/sepolia/core/core_delegation_updated_base_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'sepolia', - 'core_proxy', - 'delegation_updated' -) }} diff --git a/transformers/synthetix/models/raw/base/sepolia/core/core_deposited_base_sepolia.sql b/transformers/synthetix/models/raw/base/sepolia/core/core_deposited_base_sepolia.sql deleted file mode 100644 index 2380d04b..00000000 --- a/transformers/synthetix/models/raw/base/sepolia/core/core_deposited_base_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'sepolia', - 'core_proxy', - 'deposited' -) }} diff --git a/transformers/synthetix/models/raw/base/sepolia/core/core_liquidation_base_sepolia.sql b/transformers/synthetix/models/raw/base/sepolia/core/core_liquidation_base_sepolia.sql deleted file mode 100644 index 1723c061..00000000 --- a/transformers/synthetix/models/raw/base/sepolia/core/core_liquidation_base_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'sepolia', - 'core_proxy', - 'liquidation' -) }} diff --git a/transformers/synthetix/models/raw/base/sepolia/core/core_market_registered_base_sepolia.sql b/transformers/synthetix/models/raw/base/sepolia/core/core_market_registered_base_sepolia.sql deleted file mode 100644 index 19a1d1ad..00000000 --- a/transformers/synthetix/models/raw/base/sepolia/core/core_market_registered_base_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'sepolia', - 'core_proxy', - 'market_registered' -) }} diff --git a/transformers/synthetix/models/raw/base/sepolia/core/core_market_updated_base_sepolia.sql b/transformers/synthetix/models/raw/base/sepolia/core/core_market_updated_base_sepolia.sql deleted file mode 100644 index b2c6555c..00000000 --- a/transformers/synthetix/models/raw/base/sepolia/core/core_market_updated_base_sepolia.sql +++ /dev/null @@ -1,151 +0,0 @@ -with events as ( - select - id, - block_timestamp, - block_number, - transaction_hash, - contract, - event_name, - market_id, - net_issuance, - deposited_collateral_value, - target as sender, - 'USD' as collateral_type, - credit_capacity, - amount as token_amount - from - ( - {{ get_event_data( - 'base', - 'sepolia', - 'core_proxy_legacy', - 'market_usd_deposited' - ) }} - ) as usd_deposited -- noqa: AL05 - union all - select - id, - block_timestamp, - block_number, - transaction_hash, - contract, - event_name, - market_id, - net_issuance, - deposited_collateral_value, - target as sender, - 'USD' as collateral_type, - credit_capacity, - amount as token_amount - from - ( - {{ get_event_data( - 'base', - 'sepolia', - 'core_proxy_legacy', - 'market_usd_withdrawn' - ) }} - ) as usd_withdrawn -- noqa: AL05 - union all - select - id, - block_timestamp, - block_number, - transaction_hash, - contract, - event_name, - market_id, - net_issuance, - deposited_collateral_value, - sender, - collateral_type, - credit_capacity, - token_amount - from - ( - {{ get_event_data( - 'base', - 'sepolia', - 'core_proxy', - 'market_collateral_deposited' - ) }} - ) as collateral_deposited -- noqa: AL05 - union all - select - id, - block_timestamp, - block_number, - transaction_hash, - contract, - event_name, - market_id, - net_issuance, - deposited_collateral_value, - sender, - collateral_type, - credit_capacity, - token_amount - from - ( - {{ get_event_data( - 'base', - 'sepolia', - 'core_proxy', - 'market_collateral_withdrawn' - ) }} - ) as collateral_withdrawn -- noqa: AL05 - union all - select - id, - block_timestamp, - block_number, - transaction_hash, - contract, - event_name, - market_id, - net_issuance, - deposited_collateral_value, - target as sender, - 'USD' as collateral_type, - credit_capacity, - amount as token_amount - from - ( - {{ get_event_data( - 'base', - 'sepolia', - 'core_proxy', - 'market_usd_deposited' - ) }} - ) as usd_deposited -- noqa: AL05 - union all - select - id, - block_timestamp, - block_number, - transaction_hash, - contract, - event_name, - market_id, - net_issuance, - deposited_collateral_value, - target as sender, - 'USD' as collateral_type, - credit_capacity, - amount as token_amount - from - ( - {{ get_event_data( - 'base', - 'sepolia', - 'core_proxy', - 'market_usd_withdrawn' - ) }} - ) as usd_withdrawn -- noqa: AL05 -) - -select * -from - events -order by - block_timestamp diff --git a/transformers/synthetix/models/raw/base/sepolia/core/core_pool_created_base_sepolia.sql b/transformers/synthetix/models/raw/base/sepolia/core/core_pool_created_base_sepolia.sql deleted file mode 100644 index 55425995..00000000 --- a/transformers/synthetix/models/raw/base/sepolia/core/core_pool_created_base_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'sepolia', - 'core_proxy', - 'pool_created' -) }} diff --git a/transformers/synthetix/models/raw/base/sepolia/core/core_rewards_claimed_base_sepolia.sql b/transformers/synthetix/models/raw/base/sepolia/core/core_rewards_claimed_base_sepolia.sql deleted file mode 100644 index 14db8a0d..00000000 --- a/transformers/synthetix/models/raw/base/sepolia/core/core_rewards_claimed_base_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'sepolia', - 'core_proxy', - 'rewards_claimed' -) }} diff --git a/transformers/synthetix/models/raw/base/sepolia/core/core_rewards_distributed_base_sepolia.sql b/transformers/synthetix/models/raw/base/sepolia/core/core_rewards_distributed_base_sepolia.sql deleted file mode 100644 index 21e39eb8..00000000 --- a/transformers/synthetix/models/raw/base/sepolia/core/core_rewards_distributed_base_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'sepolia', - 'core_proxy', - 'rewards_distributed' -) }} diff --git a/transformers/synthetix/models/raw/base/sepolia/core/core_usd_burned_base_sepolia.sql b/transformers/synthetix/models/raw/base/sepolia/core/core_usd_burned_base_sepolia.sql deleted file mode 100644 index 7bc4e31b..00000000 --- a/transformers/synthetix/models/raw/base/sepolia/core/core_usd_burned_base_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'sepolia', - 'core_proxy', - 'usd_burned' -) }} diff --git a/transformers/synthetix/models/raw/base/sepolia/core/core_usd_minted_base_sepolia.sql b/transformers/synthetix/models/raw/base/sepolia/core/core_usd_minted_base_sepolia.sql deleted file mode 100644 index 7f7e4d5d..00000000 --- a/transformers/synthetix/models/raw/base/sepolia/core/core_usd_minted_base_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'sepolia', - 'core_proxy', - 'usd_minted' -) }} diff --git a/transformers/synthetix/models/raw/base/sepolia/core/core_vault_collateral_base_sepolia.sql b/transformers/synthetix/models/raw/base/sepolia/core/core_vault_collateral_base_sepolia.sql deleted file mode 100644 index 162f7f7f..00000000 --- a/transformers/synthetix/models/raw/base/sepolia/core/core_vault_collateral_base_sepolia.sql +++ /dev/null @@ -1,40 +0,0 @@ -with base as ( - select - block_number, - contract_address, - chain_id, - pool_id, - collateral_type, - cast( - amount as numeric - ) as amount, - cast( - value as numeric - ) as collateral_value - from - {{ source( - 'raw_base_sepolia', - "core_get_vault_collateral" - ) }} - where - amount is not null -) - -select - to_timestamp(blocks.timestamp) as ts, - cast( - blocks.block_number as integer - ) as block_number, - base.contract_address, - cast( - base.pool_id as integer - ) as pool_id, - cast( - base.collateral_type as varchar - ) as collateral_type, - {{ convert_wei('base.amount') }} as amount, - {{ convert_wei('base.collateral_value') }} as collateral_value -from - base -inner join {{ source('raw_base_sepolia', 'blocks_parquet') }} as blocks - on base.block_number = blocks.block_number diff --git a/transformers/synthetix/models/raw/base/sepolia/core/core_vault_debt_base_sepolia.sql b/transformers/synthetix/models/raw/base/sepolia/core/core_vault_debt_base_sepolia.sql deleted file mode 100644 index 2170054d..00000000 --- a/transformers/synthetix/models/raw/base/sepolia/core/core_vault_debt_base_sepolia.sql +++ /dev/null @@ -1,36 +0,0 @@ -with base as ( - select - block_number, - contract_address, - chain_id, - pool_id, - collateral_type, - cast( - value_1 as numeric - ) as debt - from - {{ source( - 'raw_base_sepolia', - "core_get_vault_debt" - ) }} - where - value_1 is not null -) - -select - to_timestamp(blocks.timestamp) as ts, - cast( - blocks.block_number as integer - ) as block_number, - base.contract_address, - cast( - base.pool_id as integer - ) as pool_id, - cast( - base.collateral_type as varchar - ) as collateral_type, - {{ convert_wei('base.debt') }} as debt -from - base -inner join {{ source('raw_base_sepolia', 'blocks_parquet') }} as blocks - on base.block_number = blocks.block_number diff --git a/transformers/synthetix/models/raw/base/sepolia/core/core_vault_liquidation_base_sepolia.sql b/transformers/synthetix/models/raw/base/sepolia/core/core_vault_liquidation_base_sepolia.sql deleted file mode 100644 index d23b507e..00000000 --- a/transformers/synthetix/models/raw/base/sepolia/core/core_vault_liquidation_base_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'sepolia', - 'core_proxy', - 'vault_liquidation' -) }} diff --git a/transformers/synthetix/models/raw/base/sepolia/core/core_withdrawn_base_sepolia.sql b/transformers/synthetix/models/raw/base/sepolia/core/core_withdrawn_base_sepolia.sql deleted file mode 100644 index a42f8618..00000000 --- a/transformers/synthetix/models/raw/base/sepolia/core/core_withdrawn_base_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'sepolia', - 'core_proxy', - 'withdrawn' -) }} diff --git a/transformers/synthetix/models/raw/base/sepolia/core/schema.yml b/transformers/synthetix/models/raw/base/sepolia/core/schema.yml deleted file mode 100644 index ae561d14..00000000 --- a/transformers/synthetix/models/raw/base/sepolia/core/schema.yml +++ /dev/null @@ -1,942 +0,0 @@ -version: 2 -models: - - name: core_account_created_base_sepolia - description: AccountCreated events from the CoreProxy contract - columns: - - name: owner - description: "Address of the account owner" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["AccountCreated"] - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: core_delegation_updated_base_sepolia - description: DelegationUpdated events from the CoreProxy contract - columns: - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: sender - description: "Address of the delegator" - data_type: text - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: leverage - description: "Leverage" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 1000000000000000000 - max_value: 1000000000000000000 - inclusive: true - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: amount - description: "Amount delegated" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["DelegationUpdated"] - - name: core_deposited_base_sepolia - description: Deposited events from the CoreProxy contract - columns: - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["Deposited"] - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: sender - description: "Address of the depositor" - data_type: text - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: token_amount - description: "Token amount deposited" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: core_withdrawn_base_sepolia - description: Withdrawn events from the CoreProxy contract - columns: - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: token_amount - description: "Token amount withdrawn" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: sender - description: "Address of the withdrawer" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["Withdrawn"] - - name: core_liquidation_base_sepolia - description: Liquidation events from the CoreProxy contract - columns: - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["Liquidation"] - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: sender - description: "Address of the liquidator" - data_type: text - tests: - - not_null - - name: liquidation_data - data_type: jsonb - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: liquidate_as_account_id - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: core_market_updated_base_sepolia - description: > - Combination of MarketCollateralDeposited, MarketCollateralWithdrawn, - MarketUsdDeposited, MarketUsdWithdrawn events from the CoreProxy contract - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["MarketCollateralWithdrawn", "MarketCollateralDeposited", "MarketUsdWithdrawn", "MarketUsdDeposited"] - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: net_issuance - description: "Net issuance" - data_type: numeric - tests: - - not_null - - name: deposited_collateral_value - description: "Deposited collateral value" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: sender - description: "Address of the event initiator" - data_type: text - tests: - - not_null - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: credit_capacity - description: "Credit capacity" - data_type: numeric - tests: - - not_null - - name: token_amount - description: "Token amount" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: core_market_registered_base_sepolia - description: MarketRegistered events from the CoreProxy contract - columns: - - name: market - description: "Market name" - data_type: text - tests: - - not_null - - name: market_id - description: "Market ID" - data_type: numeric - tests: - - not_null - - unique - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["MarketRegistered"] - - name: sender - description: "Address of the event initiator" - data_type: text - tests: - - not_null - - name: core_pool_created_base_sepolia - description: "PoolCreated events from the CoreProxy contract" - columns: - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: sender - description: "Address of the event initiator" - data_type: text - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["PoolCreated"] - - name: owner - description: "Address of the pool owner" - data_type: text - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: core_rewards_claimed_base_sepolia - description: RewardsClaimed events from the CoreProxy contract - columns: - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["RewardsClaimed"] - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: amount - description: "Amount delegated" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: distributor - description: "Address of the distributor" - data_type: text - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: core_rewards_distributed_base_sepolia - description: RewardsDistributed events from the CoreProxy contract - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["RewardsDistributed"] - - name: amount - description: "Amount claimed" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: start - description: "UNIX timestamp" - data_type: numeric - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: duration - description: "Duration in seconds" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: distributor - description: "Address of the distributor" - data_type: text - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: core_usd_burned_base_sepolia - description: UsdBurned events from the CoreProxy contract - columns: - - name: amount - description: "Amount burned" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["UsdBurned"] - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: sender - description: "Address of the event initiator" - data_type: text - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: core_usd_minted_base_sepolia - description: UsdMinted events from the CoreProxy contract - columns: - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: sender - description: "Address of the event initiator" - data_type: text - tests: - - not_null - - name: amount - description: "Amount minted" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["UsdMinted"] - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: core_vault_liquidation_base_sepolia - description: VaultLiquidation events from the CoreProxy contract - columns: - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["VaultLiquidation"] - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: liquidate_as_account_id - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: liquidation_data - data_type: jsonb - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: sender - description: "Address of the event initiator" - data_type: text - tests: - - not_null - - name: core_vault_collateral_base_sepolia - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: bigint - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: integer - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: character varying - tests: - - not_null - - name: amount - description: "Collateral amount" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_value - description: "Vault collateral value" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: contract_address - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: core_vault_debt_base_sepolia - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: bigint - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: integer - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: character varying - tests: - - not_null - - name: debt - description: "Vault debt" - data_type: numeric - tests: - - not_null - - name: contract_address - description: "Address of the contract" - data_type: text - tests: - - not_null diff --git a/transformers/synthetix/models/raw/base/sepolia/perp/perp_account_created_base_sepolia.sql b/transformers/synthetix/models/raw/base/sepolia/perp/perp_account_created_base_sepolia.sql deleted file mode 100644 index 35f96150..00000000 --- a/transformers/synthetix/models/raw/base/sepolia/perp/perp_account_created_base_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'sepolia', - 'perps_market_proxy', - 'account_created' -) }} diff --git a/transformers/synthetix/models/raw/base/sepolia/perp/perp_account_liquidation_attempt_base_sepolia.sql b/transformers/synthetix/models/raw/base/sepolia/perp/perp_account_liquidation_attempt_base_sepolia.sql deleted file mode 100644 index ab4704af..00000000 --- a/transformers/synthetix/models/raw/base/sepolia/perp/perp_account_liquidation_attempt_base_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'sepolia', - 'perps_market_proxy', - 'account_liquidation_attempt' -) }} diff --git a/transformers/synthetix/models/raw/base/sepolia/perp/perp_collateral_modified_base_sepolia.sql b/transformers/synthetix/models/raw/base/sepolia/perp/perp_collateral_modified_base_sepolia.sql deleted file mode 100644 index 8d0b2303..00000000 --- a/transformers/synthetix/models/raw/base/sepolia/perp/perp_collateral_modified_base_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'sepolia', - 'perps_market_proxy', - 'collateral_modified' -) }} diff --git a/transformers/synthetix/models/raw/base/sepolia/perp/perp_interest_charged_base_sepolia.sql b/transformers/synthetix/models/raw/base/sepolia/perp/perp_interest_charged_base_sepolia.sql deleted file mode 100644 index cc351c8a..00000000 --- a/transformers/synthetix/models/raw/base/sepolia/perp/perp_interest_charged_base_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'sepolia', - 'perps_market_proxy', - 'interest_charged' -) }} diff --git a/transformers/synthetix/models/raw/base/sepolia/perp/perp_interest_rate_updated_base_sepolia.sql b/transformers/synthetix/models/raw/base/sepolia/perp/perp_interest_rate_updated_base_sepolia.sql deleted file mode 100644 index c607d047..00000000 --- a/transformers/synthetix/models/raw/base/sepolia/perp/perp_interest_rate_updated_base_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'sepolia', - 'perps_market_proxy', - 'interest_rate_updated' -) }} diff --git a/transformers/synthetix/models/raw/base/sepolia/perp/perp_market_created_base_sepolia.sql b/transformers/synthetix/models/raw/base/sepolia/perp/perp_market_created_base_sepolia.sql deleted file mode 100644 index dc4d5910..00000000 --- a/transformers/synthetix/models/raw/base/sepolia/perp/perp_market_created_base_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'sepolia', - 'perps_market_proxy', - 'market_created' -) }} diff --git a/transformers/synthetix/models/raw/base/sepolia/perp/perp_market_updated_base_sepolia.sql b/transformers/synthetix/models/raw/base/sepolia/perp/perp_market_updated_base_sepolia.sql deleted file mode 100644 index e68158f6..00000000 --- a/transformers/synthetix/models/raw/base/sepolia/perp/perp_market_updated_base_sepolia.sql +++ /dev/null @@ -1,53 +0,0 @@ -with legacy_events as ( - {{ get_event_data( - 'base', - 'sepolia', - 'perps_market_proxy_legacy', - 'market_updated' - ) }} -), - -current_events as ( - {{ get_event_data( - 'base', - 'sepolia', - 'perps_market_proxy', - 'market_updated' - ) }} -) - -select - id, - block_number, - block_timestamp, - transaction_hash, - contract, - event_name, - market_id, - price, - skew, - size, - size_delta, - current_funding_rate, - current_funding_velocity, - 0 as interest_rate -from - legacy_events -union all -select - id, - block_number, - block_timestamp, - transaction_hash, - contract, - event_name, - market_id, - price, - skew, - size, - size_delta, - current_funding_rate, - current_funding_velocity, - interest_rate -from - current_events diff --git a/transformers/synthetix/models/raw/base/sepolia/perp/perp_order_committed_base_sepolia.sql b/transformers/synthetix/models/raw/base/sepolia/perp/perp_order_committed_base_sepolia.sql deleted file mode 100644 index 0da9c88a..00000000 --- a/transformers/synthetix/models/raw/base/sepolia/perp/perp_order_committed_base_sepolia.sql +++ /dev/null @@ -1,61 +0,0 @@ -with legacy_events as ( - {{ get_event_data( - 'base', - 'sepolia', - 'perps_market_proxy_legacy', - 'order_committed' - ) }} -), - -current_events as ( - {{ get_event_data( - 'base', - 'sepolia', - 'perps_market_proxy', - 'order_committed' - ) }} -) - -select - id, - block_number, - block_timestamp, - transaction_hash, - contract, - event_name, - market_id, - account_id, - commitment_time, - expiration_time, - settlement_time, - cast( - null as numeric - ) as expected_price_time, - acceptable_price, - order_type, - size_delta, - sender, - tracking_code -from - legacy_events -union all -select - id, - block_number, - block_timestamp, - transaction_hash, - contract, - event_name, - market_id, - account_id, - commitment_time, - expiration_time, - settlement_time, - expected_price_time, - acceptable_price, - order_type, - size_delta, - sender, - tracking_code -from - current_events diff --git a/transformers/synthetix/models/raw/base/sepolia/perp/perp_order_settled_base_sepolia.sql b/transformers/synthetix/models/raw/base/sepolia/perp/perp_order_settled_base_sepolia.sql deleted file mode 100644 index e105636a..00000000 --- a/transformers/synthetix/models/raw/base/sepolia/perp/perp_order_settled_base_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'sepolia', - 'perps_market_proxy', - 'order_settled' -) }} diff --git a/transformers/synthetix/models/raw/base/sepolia/perp/perp_position_liquidated_base_sepolia.sql b/transformers/synthetix/models/raw/base/sepolia/perp/perp_position_liquidated_base_sepolia.sql deleted file mode 100644 index cc05aa5e..00000000 --- a/transformers/synthetix/models/raw/base/sepolia/perp/perp_position_liquidated_base_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'sepolia', - 'perps_market_proxy', - 'position_liquidated' -) }} diff --git a/transformers/synthetix/models/raw/base/sepolia/perp/perp_previous_order_expired_base_sepolia.sql b/transformers/synthetix/models/raw/base/sepolia/perp/perp_previous_order_expired_base_sepolia.sql deleted file mode 100644 index 2e668609..00000000 --- a/transformers/synthetix/models/raw/base/sepolia/perp/perp_previous_order_expired_base_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'sepolia', - 'perps_market_proxy', - 'previous_order_expired' -) }} diff --git a/transformers/synthetix/models/raw/base/sepolia/perp/schema.yml b/transformers/synthetix/models/raw/base/sepolia/perp/schema.yml deleted file mode 100644 index 09df7ff6..00000000 --- a/transformers/synthetix/models/raw/base/sepolia/perp/schema.yml +++ /dev/null @@ -1,657 +0,0 @@ -version: 2 -models: - - name: perp_account_created_base_sepolia - description: AccountCreated events from the PerpsMarketProxy contract - columns: - - name: id - description: "ID of the event record" - tests: - - unique - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["AccountCreated"] - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: owner - description: "Address of the pool owner" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: perp_order_committed_base_sepolia - description: OrderCommitted events from the PerpsMarketProxy contract - columns: - - name: id - description: "ID of the event record" - tests: - - unique - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["OrderCommitted"] - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: commitment_time - data_type: numeric - - name: expiration_time - data_type: numeric - - name: settlement_time - data_type: numeric - - name: expected_price_time - data_type: numeric - - name: acceptable_price - data_type: numeric - - name: order_type - data_type: integer - - name: size_delta - data_type: numeric - - name: sender - data_type: text - - name: tracking_code - data_type: text - - name: perp_order_settled_base_sepolia - description: OrderSettled events from the PerpsMarketProxy contract - columns: - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: fill_price - data_type: numeric - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["OrderSettled"] - - name: settlement_reward - data_type: numeric - - name: settler - data_type: text - - name: tracking_code - data_type: text - - name: total_fees - data_type: numeric - - name: pnl - data_type: numeric - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collected_fees - description: "Amount of fees collected" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: size_delta - data_type: numeric - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: accrued_funding - data_type: numeric - - name: referral_fees - data_type: numeric - - name: new_size - data_type: numeric - - name: id - description: "ID of the event record" - tests: - - unique - - not_null - - name: perp_market_updated_base_sepolia - description: MarketUpdated events from the PerpsMarketProxy contract - columns: - - name: id - description: "ID of the event record" - tests: - - unique - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["MarketUpdated"] - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: price - description: "Price" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: skew - data_type: numeric - - name: size - data_type: numeric - - name: size_delta - data_type: numeric - - name: current_funding_rate - data_type: numeric - - name: current_funding_velocity - data_type: numeric - - name: interest_rate - description: "Interest rate" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: perp_position_liquidated_base_sepolia - description: PositionLiquidated events from the PerpsMarketProxy contract - columns: - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: id - description: "ID of the event record" - tests: - - unique - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: current_position_size - description: "Current position size" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["PositionLiquidated"] - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: amount_liquidated - description: "Amount liquidated" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: perp_account_liquidation_attempt_base_sepolia - description: AccountLiquidationAttempt events from the PerpsMarketProxy contract - columns: - - name: id - description: "ID of the event record" - tests: - - unique - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: reward - description: "Reward" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["AccountLiquidationAttempt"] - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: full_liquidation - description: "Whether it is a full or partial liquidation" - data_type: boolean - tests: - - not_null - - name: perp_collateral_modified_base_sepolia - description: CollateralModified events from the PerpsMarketProxy contract - columns: - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["CollateralModified"] - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: amount_delta - data_type: numeric - - name: synth_market_id - description: "ID of the synth market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: id - description: "ID of the event record" - tests: - - unique - - not_null - - name: sender - description: "Sender address" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: perp_previous_order_expired_base_sepolia - description: PreviousOrderExpired events from the PerpsMarketProxy contract - columns: - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: tracking_code - description: "Tracking code" - data_type: text - - name: id - description: "ID of the event record" - tests: - - unique - - not_null - - name: size_delta - data_type: numeric - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["PreviousOrderExpired"] - - name: commitment_time - data_type: numeric - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: acceptable_price - data_type: numeric - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: perp_market_created_base_sepolia - description: MarketCreated events from the PerpsMarketProxy contract - columns: - - name: market_name - description: "Market name" - data_type: text - tests: - - not_null - - name: id - description: "ID of the event record" - tests: - - unique - - not_null - - name: market_symbol - description: "Market symbol" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["MarketCreated"] - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: perps_market_id - description: "ID of the perps market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: perp_interest_charged_base_sepolia - description: InterestCharged events from the PerpsMarketProxy contract - columns: - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["InterestCharged"] - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: id - description: "ID of the event record" - tests: - - unique - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: interest - data_type: numeric - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: perp_interest_rate_updated_base_sepolia - description: InterestRateUpdated events from the PerpsMarketProxy contract - columns: - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["InterestRateUpdated"] - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: interest_rate - description: "Interest rate" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: id - description: "ID of the event record" - tests: - - unique - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: super_market_id - description: "ID of the super market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true diff --git a/transformers/synthetix/models/raw/base/sepolia/schema.yml b/transformers/synthetix/models/raw/base/sepolia/schema.yml deleted file mode 100644 index 3e032ac7..00000000 --- a/transformers/synthetix/models/raw/base/sepolia/schema.yml +++ /dev/null @@ -1,19 +0,0 @@ -version: 2 -models: - - name: blocks_base_sepolia - description: Block numbers and timestamps - tests: - - dbt_utils.recency: - datepart: hour - field: ts - interval: 1 - columns: - - name: ts - description: UTC timestamp - data_type: timestamp with time zone - - name: block_number - description: Block height - data_type: integer - tests: - - not_null - - unique diff --git a/transformers/synthetix/models/raw/base/sepolia/spot/schema.yml b/transformers/synthetix/models/raw/base/sepolia/spot/schema.yml deleted file mode 100644 index 1f5d9113..00000000 --- a/transformers/synthetix/models/raw/base/sepolia/spot/schema.yml +++ /dev/null @@ -1,525 +0,0 @@ -version: 2 -models: - - name: spot_order_committed_base_sepolia - description: OrderCommitted events from the SpotMarketProxy contract - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["OrderCommitted"] - - name: sender - description: "Address of the delegator" - data_type: text - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: referrer - description: "Address of the referrer" - data_type: text - tests: - - not_null - - name: amount_provided - description: "Amount provided" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: async_order_id - description: "Async order ID" - data_type: numeric - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: order_type - description: "Type of order" - data_type: integer - tests: - - not_null - - name: spot_order_settled_base_sepolia - description: OrderSettled events from the SpotMarketProxy contract - columns: - - name: final_order_amount - description: "Final order amount" - data_type: numeric - tests: - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: settler - description: "Address of the settler" - data_type: text - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: async_order_id - description: "Async order ID" - data_type: numeric - - name: order_type - description: "Type of order" - data_type: integer - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: price - description: "Synth price" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collected_fees - description: "Amount of fees collected" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fees - description: "Fees data" - data_type: jsonb - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["OrderSettled"] - - name: spot_order_cancelled_base_sepolia - description: OrderCancelled events from the SpotMarketProxy contract - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: async_order_claim - description: "Async order clain" - data_type: jsonb - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: sender - description: "Address of the delegator" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["OrderCancelled"] - - name: async_order_id - description: "Async order ID" - data_type: numeric - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: spot_synth_registered_base_sepolia - description: SynthRegistered events from the SpotMarketProxy contract - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: synth_market_id - description: "ID of the synth market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: synth_token_address - description: "Address of the synth token" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["SynthRegistered"] - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: spot_synth_bought_base_sepolia - description: SynthBought events from the SpotMarketProxy contract - columns: - - name: collected_fees - description: "Amount of fees collected" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: synth_market_id - description: "ID of the synth market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: price - description: "Synth price" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: referrer - description: "Address of the referrer" - data_type: text - tests: - - not_null - - name: fees - description: "Fees data" - data_type: jsonb - - name: synth_returned - data_type: numeric - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["SynthBought"] - - name: spot_synth_sold_base_sepolia - description: SynthSold events from the SpotMarketProxy contract - columns: - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["SynthSold"] - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: collected_fees - description: "Amount of fees collected" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: referrer - description: "Address of the referrer" - data_type: text - tests: - - not_null - - name: fees - description: "Fees data" - data_type: jsonb - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: price - description: "Synth price" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: amount_returned - description: "Amount returned" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: synth_market_id - description: "ID of the synth market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: spot_synth_wrapped_base_sepolia - description: SynthWrapped events from the SpotMarketProxy contract - columns: - - name: fees - description: "Fees data" - data_type: jsonb - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: synth_market_id - description: "ID of the synth market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["SynthWrapped"] - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: amount_wrapped - data_type: numeric - - name: fees_collected - description: "Amount of fees collected" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: spot_synth_unwrapped_base_sepolia - description: SynthUnwrapped events from the SpotMarketProxy contract - columns: - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: amount_unwrapped - description: "Amount of synth unwrapped" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: fees_collected - description: "Amount of fees collected" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["SynthUnwrapped"] - - name: fees - description: "Fees data" - data_type: jsonb - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: synth_market_id - description: "ID of the synth market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true diff --git a/transformers/synthetix/models/raw/base/sepolia/spot/spot_order_cancelled_base_sepolia.sql b/transformers/synthetix/models/raw/base/sepolia/spot/spot_order_cancelled_base_sepolia.sql deleted file mode 100644 index 6b2d9494..00000000 --- a/transformers/synthetix/models/raw/base/sepolia/spot/spot_order_cancelled_base_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'sepolia', - 'spot_market_proxy', - 'order_cancelled' -) }} diff --git a/transformers/synthetix/models/raw/base/sepolia/spot/spot_order_committed_base_sepolia.sql b/transformers/synthetix/models/raw/base/sepolia/spot/spot_order_committed_base_sepolia.sql deleted file mode 100644 index e67d5052..00000000 --- a/transformers/synthetix/models/raw/base/sepolia/spot/spot_order_committed_base_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'sepolia', - 'spot_market_proxy', - 'order_committed' -) }} diff --git a/transformers/synthetix/models/raw/base/sepolia/spot/spot_order_settled_base_sepolia.sql b/transformers/synthetix/models/raw/base/sepolia/spot/spot_order_settled_base_sepolia.sql deleted file mode 100644 index bb47e084..00000000 --- a/transformers/synthetix/models/raw/base/sepolia/spot/spot_order_settled_base_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'sepolia', - 'spot_market_proxy', - 'order_settled' -) }} diff --git a/transformers/synthetix/models/raw/base/sepolia/spot/spot_synth_bought_base_sepolia.sql b/transformers/synthetix/models/raw/base/sepolia/spot/spot_synth_bought_base_sepolia.sql deleted file mode 100644 index 4c781a11..00000000 --- a/transformers/synthetix/models/raw/base/sepolia/spot/spot_synth_bought_base_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'sepolia', - 'spot_market_proxy', - 'synth_bought' -) }} diff --git a/transformers/synthetix/models/raw/base/sepolia/spot/spot_synth_registered_base_sepolia.sql b/transformers/synthetix/models/raw/base/sepolia/spot/spot_synth_registered_base_sepolia.sql deleted file mode 100644 index 5af66198..00000000 --- a/transformers/synthetix/models/raw/base/sepolia/spot/spot_synth_registered_base_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'sepolia', - 'spot_market_proxy', - 'synth_registered' -) }} diff --git a/transformers/synthetix/models/raw/base/sepolia/spot/spot_synth_sold_base_sepolia.sql b/transformers/synthetix/models/raw/base/sepolia/spot/spot_synth_sold_base_sepolia.sql deleted file mode 100644 index 289d7806..00000000 --- a/transformers/synthetix/models/raw/base/sepolia/spot/spot_synth_sold_base_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'sepolia', - 'spot_market_proxy', - 'synth_sold' -) }} diff --git a/transformers/synthetix/models/raw/base/sepolia/spot/spot_synth_unwrapped_base_sepolia.sql b/transformers/synthetix/models/raw/base/sepolia/spot/spot_synth_unwrapped_base_sepolia.sql deleted file mode 100644 index 688e4a69..00000000 --- a/transformers/synthetix/models/raw/base/sepolia/spot/spot_synth_unwrapped_base_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'sepolia', - 'spot_market_proxy', - 'synth_unwrapped' -) }} diff --git a/transformers/synthetix/models/raw/base/sepolia/spot/spot_synth_wrapped_base_sepolia.sql b/transformers/synthetix/models/raw/base/sepolia/spot/spot_synth_wrapped_base_sepolia.sql deleted file mode 100644 index a4e5a08d..00000000 --- a/transformers/synthetix/models/raw/base/sepolia/spot/spot_synth_wrapped_base_sepolia.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'base', - 'sepolia', - 'spot_market_proxy', - 'synth_wrapped' -) }} diff --git a/transformers/synthetix/models/raw/eth/mainnet/blocks_eth_mainnet.sql b/transformers/synthetix/models/raw/eth/mainnet/blocks_eth_mainnet.sql deleted file mode 100644 index 4361c840..00000000 --- a/transformers/synthetix/models/raw/eth/mainnet/blocks_eth_mainnet.sql +++ /dev/null @@ -1,45 +0,0 @@ -with indexer_blocks as ( - select - timestamp as ts, - CAST( - number as INTEGER - ) as block_number - from - {{ source( - 'raw_eth_mainnet', - 'block' - ) }} -), - -parquet_blocks as ( - select - TO_TIMESTAMP(timestamp) as ts, - CAST( - block_number as INTEGER - ) as block_number - from - {{ source( - 'raw_eth_mainnet', - 'blocks_parquet' - ) }} -), - -combined_blocks as ( - select * - from - indexer_blocks - - union all - - select * - from - parquet_blocks -) - -select - block_number, - MIN(ts) as ts -from - combined_blocks -group by - block_number diff --git a/transformers/synthetix/models/raw/eth/mainnet/core/core_account_created_eth_mainnet.sql b/transformers/synthetix/models/raw/eth/mainnet/core/core_account_created_eth_mainnet.sql deleted file mode 100644 index ddef1873..00000000 --- a/transformers/synthetix/models/raw/eth/mainnet/core/core_account_created_eth_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'eth', - 'mainnet', - 'core_proxy', - 'account_created' -) }} diff --git a/transformers/synthetix/models/raw/eth/mainnet/core/core_account_migrated_eth_mainnet.sql b/transformers/synthetix/models/raw/eth/mainnet/core/core_account_migrated_eth_mainnet.sql deleted file mode 100644 index b22e8110..00000000 --- a/transformers/synthetix/models/raw/eth/mainnet/core/core_account_migrated_eth_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'eth', - 'mainnet', - 'legacy_market_proxy', - 'account_migrated' -) }} diff --git a/transformers/synthetix/models/raw/eth/mainnet/core/core_delegation_updated_eth_mainnet.sql b/transformers/synthetix/models/raw/eth/mainnet/core/core_delegation_updated_eth_mainnet.sql deleted file mode 100644 index 2eb4a683..00000000 --- a/transformers/synthetix/models/raw/eth/mainnet/core/core_delegation_updated_eth_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'eth', - 'mainnet', - 'core_proxy', - 'delegation_updated' -) }} diff --git a/transformers/synthetix/models/raw/eth/mainnet/core/core_deposited_eth_mainnet.sql b/transformers/synthetix/models/raw/eth/mainnet/core/core_deposited_eth_mainnet.sql deleted file mode 100644 index 81280709..00000000 --- a/transformers/synthetix/models/raw/eth/mainnet/core/core_deposited_eth_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'eth', - 'mainnet', - 'core_proxy', - 'deposited' -) }} diff --git a/transformers/synthetix/models/raw/eth/mainnet/core/core_liquidation_eth_mainnet.sql b/transformers/synthetix/models/raw/eth/mainnet/core/core_liquidation_eth_mainnet.sql deleted file mode 100644 index af289b4b..00000000 --- a/transformers/synthetix/models/raw/eth/mainnet/core/core_liquidation_eth_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'eth', - 'mainnet', - 'core_proxy', - 'liquidation' -) }} diff --git a/transformers/synthetix/models/raw/eth/mainnet/core/core_market_registered_eth_mainnet.sql b/transformers/synthetix/models/raw/eth/mainnet/core/core_market_registered_eth_mainnet.sql deleted file mode 100644 index 261f1019..00000000 --- a/transformers/synthetix/models/raw/eth/mainnet/core/core_market_registered_eth_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'eth', - 'mainnet', - 'core_proxy', - 'market_registered' -) }} diff --git a/transformers/synthetix/models/raw/eth/mainnet/core/core_market_updated_eth_mainnet.sql b/transformers/synthetix/models/raw/eth/mainnet/core/core_market_updated_eth_mainnet.sql deleted file mode 100644 index 09dad1f0..00000000 --- a/transformers/synthetix/models/raw/eth/mainnet/core/core_market_updated_eth_mainnet.sql +++ /dev/null @@ -1,103 +0,0 @@ -with events as ( - select - id, - block_timestamp, - block_number, - transaction_hash, - contract, - event_name, - market_id, - net_issuance, - deposited_collateral_value, - sender, - collateral_type, - credit_capacity, - token_amount - from - ( - {{ get_event_data( - 'eth', - 'mainnet', - 'core_proxy', - 'market_collateral_deposited' - ) }} - ) as collateral_deposited -- noqa: AL05 - union all - select - id, - block_timestamp, - block_number, - transaction_hash, - contract, - event_name, - market_id, - net_issuance, - deposited_collateral_value, - sender, - collateral_type, - credit_capacity, - token_amount - from - ( - {{ get_event_data( - 'eth', - 'mainnet', - 'core_proxy', - 'market_collateral_withdrawn' - ) }} - ) as collateral_withdrawn -- noqa: AL05 - union all - select - id, - block_timestamp, - block_number, - transaction_hash, - contract, - event_name, - market_id, - net_issuance, - deposited_collateral_value, - target as sender, - 'USD' as collateral_type, - credit_capacity, - amount as token_amount - from - ( - {{ get_event_data( - 'eth', - 'mainnet', - 'core_proxy', - 'market_usd_deposited' - ) }} - ) as usd_deposited -- noqa: AL05 - union all - select - id, - block_timestamp, - block_number, - transaction_hash, - contract, - event_name, - market_id, - net_issuance, - deposited_collateral_value, - target as sender, - 'USD' as collateral_type, - credit_capacity, - amount as token_amount - from - ( - {{ get_event_data( - 'eth', - 'mainnet', - 'core_proxy', - 'market_usd_withdrawn' - ) }} - ) as usd_withdrawn -- noqa: AL05 -) - -select * -from - events -order by - block_timestamp diff --git a/transformers/synthetix/models/raw/eth/mainnet/core/core_pool_created_eth_mainnet.sql b/transformers/synthetix/models/raw/eth/mainnet/core/core_pool_created_eth_mainnet.sql deleted file mode 100644 index 42e88b1b..00000000 --- a/transformers/synthetix/models/raw/eth/mainnet/core/core_pool_created_eth_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'eth', - 'mainnet', - 'core_proxy', - 'pool_created' -) }} diff --git a/transformers/synthetix/models/raw/eth/mainnet/core/core_rewards_claimed_eth_mainnet.sql b/transformers/synthetix/models/raw/eth/mainnet/core/core_rewards_claimed_eth_mainnet.sql deleted file mode 100644 index 5b5fe726..00000000 --- a/transformers/synthetix/models/raw/eth/mainnet/core/core_rewards_claimed_eth_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'eth', - 'mainnet', - 'core_proxy', - 'rewards_claimed' -) }} diff --git a/transformers/synthetix/models/raw/eth/mainnet/core/core_rewards_distributed_eth_mainnet.sql b/transformers/synthetix/models/raw/eth/mainnet/core/core_rewards_distributed_eth_mainnet.sql deleted file mode 100644 index 3a7c2588..00000000 --- a/transformers/synthetix/models/raw/eth/mainnet/core/core_rewards_distributed_eth_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'eth', - 'mainnet', - 'core_proxy', - 'rewards_distributed' -) }} diff --git a/transformers/synthetix/models/raw/eth/mainnet/core/core_usd_burned_eth_mainnet.sql b/transformers/synthetix/models/raw/eth/mainnet/core/core_usd_burned_eth_mainnet.sql deleted file mode 100644 index 33aca000..00000000 --- a/transformers/synthetix/models/raw/eth/mainnet/core/core_usd_burned_eth_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'eth', - 'mainnet', - 'core_proxy', - 'usd_burned' -) }} diff --git a/transformers/synthetix/models/raw/eth/mainnet/core/core_usd_minted_eth_mainnet.sql b/transformers/synthetix/models/raw/eth/mainnet/core/core_usd_minted_eth_mainnet.sql deleted file mode 100644 index 3e2c4f3b..00000000 --- a/transformers/synthetix/models/raw/eth/mainnet/core/core_usd_minted_eth_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'eth', - 'mainnet', - 'core_proxy', - 'usd_minted' -) }} diff --git a/transformers/synthetix/models/raw/eth/mainnet/core/core_vault_collateral_eth_mainnet.sql b/transformers/synthetix/models/raw/eth/mainnet/core/core_vault_collateral_eth_mainnet.sql deleted file mode 100644 index 31285403..00000000 --- a/transformers/synthetix/models/raw/eth/mainnet/core/core_vault_collateral_eth_mainnet.sql +++ /dev/null @@ -1,42 +0,0 @@ -with base as ( - select - block_number, - contract_address, - chain_id, - pool_id, - collateral_type, - cast( - amount as numeric - ) as amount, - cast( - "value" as numeric - ) as collateral_value - from - {{ source( - 'raw_eth_mainnet', - "core_get_vault_collateral" - ) }} - where - amount is not null -) - -select - to_timestamp( - blocks.timestamp - ) as ts, - base.block_number, - base.contract_address, - cast( - base.pool_id as integer - ) as pool_id, - cast( - base.collateral_type as varchar - ) as collateral_type, - {{ convert_wei('base.amount') }} as amount, - {{ convert_wei('base.collateral_value') }} as collateral_value -from base -inner join {{ source( - 'raw_eth_mainnet', - 'blocks_parquet' -) }} as blocks - on base.block_number = blocks.block_number diff --git a/transformers/synthetix/models/raw/eth/mainnet/core/core_vault_debt_eth_mainnet.sql b/transformers/synthetix/models/raw/eth/mainnet/core/core_vault_debt_eth_mainnet.sql deleted file mode 100644 index 60d0adb8..00000000 --- a/transformers/synthetix/models/raw/eth/mainnet/core/core_vault_debt_eth_mainnet.sql +++ /dev/null @@ -1,38 +0,0 @@ -with base as ( - select - block_number, - contract_address, - chain_id, - pool_id, - collateral_type, - cast( - value_1 as numeric - ) as debt - from - {{ source( - 'raw_eth_mainnet', - "core_get_vault_debt" - ) }} - where - value_1 is not null -) - -select - to_timestamp( - blocks.timestamp - ) as ts, - base.block_number, - base.contract_address, - cast( - base.pool_id as integer - ) as pool_id, - cast( - base.collateral_type as varchar - ) as collateral_type, - {{ convert_wei('base.debt') }} as debt -from base -inner join {{ source( - 'raw_eth_mainnet', - 'blocks_parquet' -) }} as blocks - on base.block_number = blocks.block_number diff --git a/transformers/synthetix/models/raw/eth/mainnet/core/core_vault_liquidation_eth_mainnet.sql b/transformers/synthetix/models/raw/eth/mainnet/core/core_vault_liquidation_eth_mainnet.sql deleted file mode 100644 index 4356bb0b..00000000 --- a/transformers/synthetix/models/raw/eth/mainnet/core/core_vault_liquidation_eth_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'eth', - 'mainnet', - 'core_proxy', - 'vault_liquidation' -) }} diff --git a/transformers/synthetix/models/raw/eth/mainnet/core/core_withdrawn_eth_mainnet.sql b/transformers/synthetix/models/raw/eth/mainnet/core/core_withdrawn_eth_mainnet.sql deleted file mode 100644 index 8faa239f..00000000 --- a/transformers/synthetix/models/raw/eth/mainnet/core/core_withdrawn_eth_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'eth', - 'mainnet', - 'core_proxy', - 'withdrawn' -) }} diff --git a/transformers/synthetix/models/raw/eth/mainnet/core/schema.yml b/transformers/synthetix/models/raw/eth/mainnet/core/schema.yml deleted file mode 100644 index 768844d9..00000000 --- a/transformers/synthetix/models/raw/eth/mainnet/core/schema.yml +++ /dev/null @@ -1,1005 +0,0 @@ -version: 2 -models: - - name: core_account_created_eth_mainnet - description: AccountCreated events from the CoreProxy contract - columns: - - name: owner - description: "Address of the account owner" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["AccountCreated"] - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: core_account_migrated_eth_mainnet - description: AccountMigrated events from the legacy market Proxy contract - columns: - - name: staker - description: "Address of the V2x staker" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: collateral_amount - description: "Amount of SNX collateral being migrated" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: debt_amount - description: "Amount of SNX debt being migrated" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: core_delegation_updated_eth_mainnet - description: DelegationUpdated events from the CoreProxy contract - columns: - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: sender - description: "Address of the delegator" - data_type: text - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: leverage - description: "Leverage" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 1000000000000000000 - max_value: 1000000000000000000 - inclusive: true - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: amount - description: "Amount delegated" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["DelegationUpdated"] - - name: core_deposited_eth_mainnet - description: Deposited events from the CoreProxy contract - columns: - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["Deposited"] - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: sender - description: "Address of the depositor" - data_type: text - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: token_amount - description: "Token amount deposited" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: core_withdrawn_eth_mainnet - description: Withdrawn events from the CoreProxy contract - columns: - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: token_amount - description: "Token amount withdrawn" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: sender - description: "Address of the withdrawer" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["Withdrawn"] - - name: core_liquidation_eth_mainnet - description: Liquidation events from the CoreProxy contract - columns: - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["Liquidation"] - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: sender - description: "Address of the liquidator" - data_type: text - tests: - - not_null - - name: liquidation_data - data_type: jsonb - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: liquidate_as_account_id - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: core_market_updated_eth_mainnet - description: > - Combination of MarketCollateralDeposited, MarketCollateralWithdrawn, - MarketUsdDeposited, MarketUsdWithdrawn events from the CoreProxy contract - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["MarketCollateralWithdrawn", "MarketCollateralDeposited", "MarketUsdWithdrawn", "MarketUsdDeposited"] - - name: market_id - description: "ID of the market" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: net_issuance - description: "Net issuance" - data_type: numeric - tests: - - not_null - - name: deposited_collateral_value - description: "Deposited collateral value" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: sender - description: "Address of the event initiator" - data_type: text - tests: - - not_null - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: credit_capacity - description: "Credit capacity" - data_type: numeric - tests: - - not_null - - name: token_amount - description: "Token amount" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: core_market_registered_eth_mainnet - description: MarketRegistered events from the CoreProxy contract - columns: - - name: market - description: "Market name" - data_type: text - tests: - - not_null - - name: market_id - description: "Market ID" - data_type: numeric - tests: - - not_null - - unique - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["MarketRegistered"] - - name: sender - description: "Address of the event initiator" - data_type: text - tests: - - not_null - - name: core_pool_created_eth_mainnet - description: "PoolCreated events from the CoreProxy contract" - columns: - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: sender - description: "Address of the event initiator" - data_type: text - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["PoolCreated"] - - name: owner - description: "Address of the pool owner" - data_type: text - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: core_rewards_claimed_eth_mainnet - description: RewardsClaimed events from the CoreProxy contract - columns: - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["RewardsClaimed"] - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: amount - description: "Amount delegated" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: distributor - description: "Address of the distributor" - data_type: text - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: core_rewards_distributed_eth_mainnet - description: RewardsDistributed events from the CoreProxy contract - columns: - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["RewardsDistributed"] - - name: amount - description: "Amount claimed" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: start - description: "UNIX timestamp" - data_type: numeric - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: duration - description: "Duration in seconds" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: distributor - description: "Address of the distributor" - data_type: text - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: core_usd_burned_eth_mainnet - description: UsdBurned events from the CoreProxy contract - columns: - - name: amount - description: "Amount burned" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["UsdBurned"] - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: sender - description: "Address of the event initiator" - data_type: text - tests: - - not_null - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: core_usd_minted_eth_mainnet - description: UsdMinted events from the CoreProxy contract - columns: - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: account_id - description: "ID of the account" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: sender - description: "Address of the event initiator" - data_type: text - tests: - - not_null - - name: amount - description: "Amount minted" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["UsdMinted"] - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: core_vault_liquidation_eth_mainnet - description: VaultLiquidation events from the CoreProxy contract - columns: - - name: transaction_hash - description: "Transaction hash" - data_type: text - tests: - - not_null - - name: collateral_type - description: "Type of delegated collateral" - data_type: text - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: event_name - description: "Event name" - data_type: text - tests: - - not_null - - accepted_values: - values: ["VaultLiquidation"] - - name: id - description: "ID of the event record" - data_type: character varying - tests: - - not_null - - unique - - name: block_timestamp - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: liquidate_as_account_id - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: liquidation_data - data_type: jsonb - tests: - - not_null - - name: contract - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: block_number - description: "Block number" - data_type: integer - tests: - - not_null - - name: sender - description: "Address of the event initiator" - data_type: text - tests: - - not_null - - name: core_vault_collateral_eth_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: bigint - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: integer - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: character varying - tests: - - not_null - - name: amount - description: "Collateral amount" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_value - description: "Vault collateral value" - data_type: numeric - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: contract_address - description: "Address of the contract" - data_type: text - tests: - - not_null - - name: core_vault_debt_eth_mainnet - columns: - - name: ts - description: "Block timestamp" - data_type: timestamp with time zone - tests: - - not_null - - name: block_number - description: "Block number" - data_type: bigint - tests: - - not_null - - name: pool_id - description: "ID of the pool" - data_type: integer - tests: - - not_null - - dbt_utils.accepted_range: - min_value: 0 - inclusive: true - - name: collateral_type - description: "Type of delegated collateral" - data_type: character varying - tests: - - not_null - - name: debt - description: "Vault debt" - data_type: numeric - tests: - - not_null - - name: contract_address - description: "Address of the contract" - data_type: text - tests: - - not_null diff --git a/transformers/synthetix/models/raw/eth/mainnet/schema.yml b/transformers/synthetix/models/raw/eth/mainnet/schema.yml deleted file mode 100644 index 9a2e05c3..00000000 --- a/transformers/synthetix/models/raw/eth/mainnet/schema.yml +++ /dev/null @@ -1,19 +0,0 @@ -version: 2 -models: - - name: blocks_eth_mainnet - description: Block numbers and timestamps - tests: - - dbt_utils.recency: - datepart: hour - field: ts - interval: 1 - columns: - - name: ts - description: UTC timestamp - data_type: timestamp with time zone - - name: block_number - description: Block height - data_type: integer - tests: - - not_null - - unique diff --git a/transformers/synthetix/models/raw/optimism/mainnet/schema.yml b/transformers/synthetix/models/raw/optimism/mainnet/schema.yml deleted file mode 100644 index 680021bc..00000000 --- a/transformers/synthetix/models/raw/optimism/mainnet/schema.yml +++ /dev/null @@ -1,141 +0,0 @@ -version: 2 -model: null -models: - - name: v2_perp_delayed_order_submitted_optimism_mainnet - columns: - - name: id - data_type: character varying - - name: transaction_hash - data_type: text - - name: block_timestamp - data_type: timestamp with time zone - - name: block_number - data_type: integer - - name: contract - data_type: text - - name: market - data_type: text - - name: event_name - data_type: text - - name: account - data_type: text - - name: commit_deposit - data_type: numeric - - name: keeper_deposit - data_type: numeric - - name: executable_at_time - data_type: numeric - - name: intention_time - data_type: numeric - - name: target_round_id - data_type: numeric - - name: is_offchain - data_type: boolean - - name: size_delta - data_type: numeric - - name: tracking_code - data_type: text - - name: v2_perp_funding_recomputed_optimism_mainnet - columns: - - name: id - data_type: character varying - - name: transaction_hash - data_type: text - - name: block_timestamp - data_type: timestamp with time zone - - name: block_number - data_type: integer - - name: contract - data_type: text - - name: market - data_type: text - - name: event_name - data_type: text - - name: index - data_type: numeric - - name: funding - data_type: numeric - - name: funding_rate - data_type: numeric - - name: v2_perp_margin_transferred_optimism_mainnet - columns: - - name: id - data_type: character varying - - name: transaction_hash - data_type: text - - name: block_timestamp - data_type: timestamp with time zone - - name: block_number - data_type: integer - - name: contract - data_type: text - - name: market - data_type: text - - name: event_name - data_type: text - - name: account - data_type: text - - name: margin_delta - data_type: numeric - - name: v2_perp_position_liquidated_optimism_mainnet - columns: - - name: id - data_type: character varying - - name: transaction_hash - data_type: text - - name: block_number - data_type: integer - - name: block_timestamp - data_type: timestamp with time zone - - name: contract - data_type: text - - name: market - data_type: text - - name: event_name - data_type: text - - name: account - data_type: text - - name: liquidator - data_type: text - - name: stakers_fee - data_type: numeric - - name: liquidator_fee - data_type: numeric - - name: flagger_fee - data_type: numeric - - name: total_fee - data_type: numeric - - name: price - data_type: numeric - - name: v2_perp_position_modified_optimism_mainnet - columns: - - name: id - data_type: character varying - - name: transaction_hash - data_type: text - - name: contract - data_type: text - - name: block_timestamp - data_type: timestamp with time zone - - name: block_number - data_type: integer - - name: market - data_type: text - - name: event_name - data_type: text - - name: account - data_type: text - - name: funding_index - data_type: numeric - - name: last_price - data_type: numeric - - name: trade_size - data_type: numeric - - name: size - data_type: numeric - - name: margin - data_type: numeric - - name: fee - data_type: numeric - - name: skew - data_type: numeric diff --git a/transformers/synthetix/models/raw/optimism/mainnet/v2_perp_delayed_order_submitted_optimism_mainnet.sql b/transformers/synthetix/models/raw/optimism/mainnet/v2_perp_delayed_order_submitted_optimism_mainnet.sql deleted file mode 100644 index 55d99409..00000000 --- a/transformers/synthetix/models/raw/optimism/mainnet/v2_perp_delayed_order_submitted_optimism_mainnet.sql +++ /dev/null @@ -1,40 +0,0 @@ -{{ config( - materialized = 'incremental', - unique_key = 'id', - post_hook = [ "create index if not exists idx_id on {{ this }} (id)", "create index if not exists idx_block_number on {{ this }} (block_number)", "create index if not exists idx_block_timestamp on {{ this }} (block_timestamp)", "create index if not exists idx_market on {{ this }} (market)", "create index if not exists idx_contract on {{ this }} (contract)", "create index if not exists idx_account on {{ this }} (account)" ] -) }} - -with events as ( - {{ get_v2_event_data('optimism', 'mainnet', 'delayed_order_submitted') }} -- noqa -) - -select -- noqa: ST06 - id, - transaction_hash, - block_timestamp, - block_number, - contract, - upper(market) as market, - event_name, - account, - commit_deposit, - keeper_deposit, - executable_at_time, - intention_time, - target_round_id, - is_offchain, - size_delta, - tracking_code -from - events -where - {% if is_incremental() %} - block_number > ( - select coalesce(max(block_number), 0) as b - from {{ this }} - ) - {% else %} - true - {% endif %} -order by - id diff --git a/transformers/synthetix/models/raw/optimism/mainnet/v2_perp_funding_recomputed_optimism_mainnet.sql b/transformers/synthetix/models/raw/optimism/mainnet/v2_perp_funding_recomputed_optimism_mainnet.sql deleted file mode 100644 index b638c52c..00000000 --- a/transformers/synthetix/models/raw/optimism/mainnet/v2_perp_funding_recomputed_optimism_mainnet.sql +++ /dev/null @@ -1,34 +0,0 @@ -{{ config( - materialized = 'incremental', - unique_key = 'id', - post_hook = [ "create index if not exists idx_id on {{ this }} (id)", "create index if not exists idx_block_timestamp on {{ this }} (block_timestamp)", "create index if not exists idx_block_number on {{ this }} (block_number)", "create index if not exists idx_market on {{ this }} (market)" ] -) }} - -with events as ( - {{ get_v2_event_data('optimism', 'mainnet', 'funding_recomputed') }} -- noqa -) - -select -- noqa: ST06 - id, - transaction_hash, - block_timestamp, - block_number, - contract, - upper(market) as market, - event_name, - index, - funding, - funding_rate -from - events -where - {% if is_incremental() %} - block_number > ( - select coalesce(max(block_number), 0) as b - from {{ this }} - ) - {% else %} - true - {% endif %} -order by - id diff --git a/transformers/synthetix/models/raw/optimism/mainnet/v2_perp_margin_transferred_optimism_mainnet.sql b/transformers/synthetix/models/raw/optimism/mainnet/v2_perp_margin_transferred_optimism_mainnet.sql deleted file mode 100644 index d1598fdf..00000000 --- a/transformers/synthetix/models/raw/optimism/mainnet/v2_perp_margin_transferred_optimism_mainnet.sql +++ /dev/null @@ -1,33 +0,0 @@ -{{ config( - materialized = 'incremental', - unique_key = 'id', - post_hook = [ "create index if not exists idx_id on {{ this }} (id)", "create index if not exists idx_block_timestamp on {{ this }} (block_timestamp)", "create index if not exists idx_block_number on {{ this }} (block_number)", "create index if not exists idx_market on {{ this }} (market)" ] -) }} - -with events as ( - {{ get_v2_event_data('optimism', 'mainnet', 'margin_transferred') }} -- noqa -) - -select - id, - transaction_hash, - block_timestamp, - block_number, - contract, - upper(market) as market, - event_name, - account, - {{ convert_wei('margin_delta') }} as margin_delta -from - events -where - {% if is_incremental() %} - block_number > ( - select coalesce(max(block_number), 0) as b - from {{ this }} - ) - {% else %} - true - {% endif %} -order by - id diff --git a/transformers/synthetix/models/raw/optimism/mainnet/v2_perp_position_liquidated_optimism_mainnet.sql b/transformers/synthetix/models/raw/optimism/mainnet/v2_perp_position_liquidated_optimism_mainnet.sql deleted file mode 100644 index 58c6feee..00000000 --- a/transformers/synthetix/models/raw/optimism/mainnet/v2_perp_position_liquidated_optimism_mainnet.sql +++ /dev/null @@ -1,71 +0,0 @@ -{{ config( - materialized = 'incremental', - unique_key = 'id', - post_hook = [ "create index if not exists idx_id on {{ this }} (id)", "create index if not exists idx_block_timestamp on {{ this }} (block_timestamp)", "create index if not exists idx_block_number on {{ this }} (block_number)", "create index if not exists idx_market on {{ this }} (market)" ] -) }} - -with legacy_events as ( - {{ get_v2_event_data('optimism', 'mainnet', 'position_liquidated1') }} -- noqa -), - -current_events as ( - {{ get_v2_event_data('optimism', 'mainnet', 'position_liquidated0') }} -- noqa -) - -select - id, - transaction_hash, - block_number, - block_timestamp, - contract, - upper(market) as market, - event_name, - account, - liquidator, - stakers_fee, - liquidator_fee, - flagger_fee, - stakers_fee + liquidator_fee + flagger_fee as total_fee, - price -from - current_events -where - {% if is_incremental() %} - block_number > ( - select coalesce(max(block_number), 0) as b - from {{ this }} - ) - {% else %} - true - {% endif %} - -union all - -select - id, - transaction_hash, - block_number, - block_timestamp, - contract, - upper(market) as market, - event_name, - account, - liquidator, - fee as stakers_fee, - 0 as liquidator_fee, - 0 as flagger_fee, - fee as total_fee, - price -from - legacy_events -where - {% if is_incremental() %} - block_number > ( - select coalesce(max(block_number), 0) as b - from {{ this }} - ) - {% else %} - true - {% endif %} -order by - id diff --git a/transformers/synthetix/models/raw/optimism/mainnet/v2_perp_position_modified_optimism_mainnet.sql b/transformers/synthetix/models/raw/optimism/mainnet/v2_perp_position_modified_optimism_mainnet.sql deleted file mode 100644 index 7bc93d95..00000000 --- a/transformers/synthetix/models/raw/optimism/mainnet/v2_perp_position_modified_optimism_mainnet.sql +++ /dev/null @@ -1,65 +0,0 @@ -{{ config( - materialized = 'incremental', - unique_key = 'id', - post_hook = [ "create index if not exists idx_id on {{ this }} (id)", "create index if not exists idx_block_number on {{ this }} (block_number)", "create index if not exists idx_block_timestamp on {{ this }} (block_timestamp)", "create index if not exists idx_market on {{ this }} (market)", "create index if not exists idx_contract on {{ this }} (contract)", "create index if not exists idx_account on {{ this }} (account)" ] -) }} - -with legacy_events as ( - {{ get_v2_event_data('optimism', 'mainnet', 'position_modified1') }} -- noqa -), - -current_events as ( - {{ get_v2_event_data('optimism', 'mainnet', 'position_modified0') }} -- noqa -) - -select * -from ( - select - id, - transaction_hash, - contract, - block_timestamp, - block_number, - upper(market) as market, - event_name, - account, - funding_index, - last_price, - trade_size, - "size", - margin, - fee, - skew - from - current_events - union all - select - id, - transaction_hash, - contract, - block_timestamp, - block_number, - upper(market) as market, - event_name, - account, - funding_index, - last_price, - trade_size, - "size", - margin, - fee, - null as skew - from - legacy_events -) as events -where - {% if is_incremental() %} - block_number > ( - select coalesce(max(block_number), 0) as b - from {{ this }} - ) - {% else %} - true - {% endif %} -order by - id diff --git a/transformers/synthetix/models/raw/snax/mainnet/ambassador_vote_recorded_snax_mainnet.sql b/transformers/synthetix/models/raw/snax/mainnet/ambassador_vote_recorded_snax_mainnet.sql deleted file mode 100644 index dabcb164..00000000 --- a/transformers/synthetix/models/raw/snax/mainnet/ambassador_vote_recorded_snax_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'snax', - 'mainnet', - 'ambassador_governance_proxy', - 'vote_recorded' -) }} diff --git a/transformers/synthetix/models/raw/snax/mainnet/ambassador_vote_withdrawn_snax_mainnet.sql b/transformers/synthetix/models/raw/snax/mainnet/ambassador_vote_withdrawn_snax_mainnet.sql deleted file mode 100644 index ef2a3cf4..00000000 --- a/transformers/synthetix/models/raw/snax/mainnet/ambassador_vote_withdrawn_snax_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'snax', - 'mainnet', - 'ambassador_governance_proxy', - 'vote_withdrawn' -) }} diff --git a/transformers/synthetix/models/raw/snax/mainnet/blocks_snax_mainnet.sql b/transformers/synthetix/models/raw/snax/mainnet/blocks_snax_mainnet.sql deleted file mode 100644 index 0f451b57..00000000 --- a/transformers/synthetix/models/raw/snax/mainnet/blocks_snax_mainnet.sql +++ /dev/null @@ -1,10 +0,0 @@ -select distinct - "timestamp" as ts, - CAST( - "number" as INTEGER - ) as block_number -from - {{ source( - 'raw_snax_mainnet', - 'block' - ) }} diff --git a/transformers/synthetix/models/raw/snax/mainnet/schema.yml b/transformers/synthetix/models/raw/snax/mainnet/schema.yml deleted file mode 100644 index ebd7fd26..00000000 --- a/transformers/synthetix/models/raw/snax/mainnet/schema.yml +++ /dev/null @@ -1,364 +0,0 @@ -version: 2 -model: null -models: - - name: blocks_snax_mainnet - columns: - - name: ts - description: UTC timestamp - data_type: timestamp with time zone - - name: block_number - description: Block height - data_type: integer - tests: - - not_null - - unique - - name: spartan_vote_recorded_snax_mainnet - description: Records of voting events on the Spartan Council governance proxy - columns: - - name: id - description: Unique identifier for the event - data_type: string - tests: - - not_null - - unique - - name: event_name - description: Name of the event - data_type: string - tests: - - not_null - - accepted_values: - values: ["VoteRecorded"] - - name: chain_id - description: Identifier of the blockchain network - data_type: string - tests: - - not_null - - name: block_timestamp - description: UTC timestamp of the block containing the event - data_type: timestamp with time zone - tests: - - not_null - - name: voter - description: Ethereum address of the voter - data_type: string - tests: - - not_null - - name: epoch_id - description: Identifier of the voting epoch - data_type: string - tests: - - not_null - - name: transaction_hash - description: Hash of the transaction containing the vote - data_type: string - tests: - - not_null - - unique - - name: candidates - description: Array of candidate addresses voted for - data_type: array - tests: - - not_null - - name: block_number - description: Block height where the vote was recorded - data_type: integer - tests: - - not_null - - name: voting_power - description: Voting power used in this vote - data_type: string - tests: - - not_null - - name: contract - description: Address of the contract handling the vote - data_type: string - tests: - - not_null - - name: spartan_vote_withdrawn_snax_mainnet - description: Records of votes withdrawn from the Spartan Council governance proxy - columns: - - name: id - description: Unique identifier for the vote withdrawal event - data_type: string - tests: - - not_null - - unique - - name: event_name - description: Name of the event (always 'VoteWithdrawn' for this table) - data_type: string - tests: - - not_null - - accepted_values: - values: ["VoteWithdrawn"] - - name: chain_id - description: Identifier of the blockchain network - data_type: string - tests: - - not_null - - accepted_values: - values: ["2192", "10", "1", "8453", "42161"] - - name: block_timestamp - description: UTC timestamp of the block containing the vote withdrawal event - data_type: timestamp with time zone - tests: - - not_null - - name: voter - description: Ethereum address of the voter who withdrew their vote - data_type: string - tests: - - not_null - - name: epoch_id - description: Identifier of the voting epoch in which the vote was withdrawn - data_type: string - tests: - - not_null - - name: transaction_hash - description: Hash of the transaction containing the vote withdrawal - data_type: string - tests: - - not_null - - unique - - name: block_number - description: Block height where the vote withdrawal was recorded - data_type: integer - tests: - - not_null - - name: contract - description: Address of the contract handling the vote withdrawal - data_type: string - tests: - - not_null - - - name: treasury_vote_recorded_snax_mainnet - description: Records of voting events on the Treasury Council governance proxy - columns: - - name: id - description: Unique identifier for the event - data_type: string - tests: - - not_null - - unique - - name: event_name - description: Name of the event - data_type: string - tests: - - not_null - - accepted_values: - values: ["VoteRecorded"] - - name: chain_id - description: Identifier of the blockchain network - data_type: string - tests: - - not_null - - name: block_timestamp - description: UTC timestamp of the block containing the event - data_type: timestamp with time zone - tests: - - not_null - - name: voter - description: Ethereum address of the voter - data_type: string - tests: - - not_null - - name: epoch_id - description: Identifier of the voting epoch - data_type: string - tests: - - not_null - - name: transaction_hash - description: Hash of the transaction containing the vote - data_type: string - tests: - - not_null - - unique - - name: candidates - description: Array of candidate addresses voted for - data_type: array - tests: - - not_null - - name: block_number - description: Block height where the vote was recorded - data_type: integer - tests: - - not_null - - name: voting_power - description: Voting power used in this vote - data_type: string - tests: - - not_null - - name: contract - description: Address of the contract handling the vote - data_type: string - tests: - - not_null - - name: treasury_vote_withdrawn_snax_mainnet - description: Records of votes withdrawn from the Treasury Council governance proxy - columns: - - name: id - description: Unique identifier for the vote withdrawal event - data_type: string - tests: - - not_null - - unique - - name: event_name - description: Name of the event (always 'VoteWithdrawn' for this table) - data_type: string - tests: - - not_null - - accepted_values: - values: ["VoteWithdrawn"] - - name: chain_id - description: Identifier of the blockchain network - data_type: string - tests: - - not_null - - accepted_values: - values: ["2192", "10", "1", "8453", "42161"] - - name: block_timestamp - description: UTC timestamp of the block containing the vote withdrawal event - data_type: timestamp with time zone - tests: - - not_null - - name: voter - description: Ethereum address of the voter who withdrew their vote - data_type: string - tests: - - not_null - - name: epoch_id - description: Identifier of the voting epoch in which the vote was withdrawn - data_type: string - tests: - - not_null - - name: transaction_hash - description: Hash of the transaction containing the vote withdrawal - data_type: string - tests: - - not_null - - unique - - name: block_number - description: Block height where the vote withdrawal was recorded - data_type: integer - tests: - - not_null - - name: contract - description: Address of the contract handling the vote withdrawal - data_type: string - tests: - - not_null - - - name: ambassador_vote_recorded_snax_mainnet - description: Records of voting events on the Ambassador Council governance proxy - columns: - - name: id - description: Unique identifier for the event - data_type: string - tests: - - not_null - - unique - - name: event_name - description: Name of the event - data_type: string - tests: - - not_null - - accepted_values: - values: ["VoteRecorded"] - - name: chain_id - description: Identifier of the blockchain network - data_type: string - tests: - - not_null - - name: block_timestamp - description: UTC timestamp of the block containing the event - data_type: timestamp with time zone - tests: - - not_null - - name: voter - description: Ethereum address of the voter - data_type: string - tests: - - not_null - - name: epoch_id - description: Identifier of the voting epoch - data_type: string - tests: - - not_null - - name: transaction_hash - description: Hash of the transaction containing the vote - data_type: string - tests: - - not_null - - unique - - name: candidates - description: Array of candidate addresses voted for - data_type: array - tests: - - not_null - - name: block_number - description: Block height where the vote was recorded - data_type: integer - tests: - - not_null - - name: voting_power - description: Voting power used in this vote - data_type: string - tests: - - not_null - - name: contract - description: Address of the contract handling the vote - data_type: string - tests: - - not_null - - name: ambassador_vote_withdrawn_snax_mainnet - description: Records of votes withdrawn from the Ambassador Council governance proxy - columns: - - name: id - description: Unique identifier for the vote withdrawal event - data_type: string - tests: - - not_null - - unique - - name: event_name - description: Name of the event (always 'VoteWithdrawn' for this table) - data_type: string - tests: - - not_null - - accepted_values: - values: ["VoteWithdrawn"] - - name: chain_id - description: Identifier of the blockchain network - data_type: string - tests: - - not_null - - accepted_values: - values: ["2192", "10", "1", "8453", "42161"] - - name: block_timestamp - description: UTC timestamp of the block containing the vote withdrawal event - data_type: timestamp with time zone - tests: - - not_null - - name: voter - description: Ethereum address of the voter who withdrew their vote - data_type: string - tests: - - not_null - - name: epoch_id - description: Identifier of the voting epoch in which the vote was withdrawn - data_type: string - tests: - - not_null - - name: transaction_hash - description: Hash of the transaction containing the vote withdrawal - data_type: string - tests: - - not_null - - unique - - name: block_number - description: Block height where the vote withdrawal was recorded - data_type: integer - tests: - - not_null - - name: contract - description: Address of the contract handling the vote withdrawal - data_type: string - tests: - - not_null diff --git a/transformers/synthetix/models/raw/snax/mainnet/spartan_vote_recorded_snax_mainnet.sql b/transformers/synthetix/models/raw/snax/mainnet/spartan_vote_recorded_snax_mainnet.sql deleted file mode 100644 index 27ad01e8..00000000 --- a/transformers/synthetix/models/raw/snax/mainnet/spartan_vote_recorded_snax_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'snax', - 'mainnet', - 'spartan_governance_proxy', - 'vote_recorded' -) }} diff --git a/transformers/synthetix/models/raw/snax/mainnet/spartan_vote_withdrawn_snax_mainnet.sql b/transformers/synthetix/models/raw/snax/mainnet/spartan_vote_withdrawn_snax_mainnet.sql deleted file mode 100644 index 09cd639e..00000000 --- a/transformers/synthetix/models/raw/snax/mainnet/spartan_vote_withdrawn_snax_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'snax', - 'mainnet', - 'spartan_governance_proxy', - 'vote_withdrawn' -) }} diff --git a/transformers/synthetix/models/raw/snax/mainnet/treasury_vote_recorded_snax_mainnet.sql b/transformers/synthetix/models/raw/snax/mainnet/treasury_vote_recorded_snax_mainnet.sql deleted file mode 100644 index eb10dd18..00000000 --- a/transformers/synthetix/models/raw/snax/mainnet/treasury_vote_recorded_snax_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'snax', - 'mainnet', - 'treasury_governance_proxy', - 'vote_recorded' -) }} diff --git a/transformers/synthetix/models/raw/snax/mainnet/treasury_vote_withdrawn_snax_mainnet.sql b/transformers/synthetix/models/raw/snax/mainnet/treasury_vote_withdrawn_snax_mainnet.sql deleted file mode 100644 index 4764c1ef..00000000 --- a/transformers/synthetix/models/raw/snax/mainnet/treasury_vote_withdrawn_snax_mainnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'snax', - 'mainnet', - 'treasury_governance_proxy', - 'vote_withdrawn' -) }} diff --git a/transformers/synthetix/models/raw/snax/testnet/blocks_snax_testnet.sql b/transformers/synthetix/models/raw/snax/testnet/blocks_snax_testnet.sql deleted file mode 100644 index 972ab341..00000000 --- a/transformers/synthetix/models/raw/snax/testnet/blocks_snax_testnet.sql +++ /dev/null @@ -1,10 +0,0 @@ -select distinct - "timestamp" as ts, - CAST( - "number" as INTEGER - ) as block_number -from - {{ source( - 'raw_snax_testnet', - 'block' - ) }} diff --git a/transformers/synthetix/models/raw/snax/testnet/gov_vote_recorded_snax_testnet.sql b/transformers/synthetix/models/raw/snax/testnet/gov_vote_recorded_snax_testnet.sql deleted file mode 100644 index 55f22d25..00000000 --- a/transformers/synthetix/models/raw/snax/testnet/gov_vote_recorded_snax_testnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'snax', - 'testnet', - 'governance_proxy', - 'vote_recorded' -) }} diff --git a/transformers/synthetix/models/raw/snax/testnet/gov_vote_withdrawn_snax_testnet.sql b/transformers/synthetix/models/raw/snax/testnet/gov_vote_withdrawn_snax_testnet.sql deleted file mode 100644 index adc4db7e..00000000 --- a/transformers/synthetix/models/raw/snax/testnet/gov_vote_withdrawn_snax_testnet.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ get_event_data( - 'snax', - 'testnet', - 'governance_proxy', - 'vote_withdrawn' -) }} diff --git a/transformers/synthetix/models/raw/snax/testnet/schema.yml b/transformers/synthetix/models/raw/snax/testnet/schema.yml deleted file mode 100644 index acbf6efc..00000000 --- a/transformers/synthetix/models/raw/snax/testnet/schema.yml +++ /dev/null @@ -1,128 +0,0 @@ -version: 2 -model: null -models: - - name: blocks_snax_testnet - columns: - - name: ts - description: UTC timestamp - data_type: timestamp with time zone - - name: block_number - description: Block height - data_type: integer - tests: - - not_null - - unique - - name: gov_vote_recorded_snax_testnet - description: Records of voting events - columns: - - name: id - description: Unique identifier for the event - data_type: string - tests: - - not_null - - unique - - name: event_name - description: Name of the event - data_type: string - tests: - - not_null - - accepted_values: - values: ["VoteRecorded"] - - name: chain_id - description: Identifier of the blockchain network - data_type: string - tests: - - not_null - - name: block_timestamp - description: UTC timestamp of the block containing the event - data_type: timestamp with time zone - tests: - - not_null - - name: voter - description: Ethereum address of the voter - data_type: string - tests: - - not_null - - name: epoch_id - description: Identifier of the voting epoch - data_type: string - tests: - - not_null - - name: transaction_hash - description: Hash of the transaction containing the vote - data_type: string - tests: - - not_null - - unique - - name: candidates - description: Array of candidate addresses voted for - data_type: array - tests: - - not_null - - name: block_number - description: Block height where the vote was recorded - data_type: integer - tests: - - not_null - - name: voting_power - description: Voting power used in this vote - data_type: string - tests: - - not_null - - name: contract - description: Address of the contract handling the vote - data_type: string - tests: - - not_null - - name: gov_vote_withdrawn_snax_testnet - description: Records of vote withdrawal events on the SNAX testnet blockchain - columns: - - name: id - description: Unique identifier for the vote withdrawal event - data_type: string - tests: - - not_null - - unique - - name: event_name - description: Name of the event (always 'VoteWithdrawn' for this table) - data_type: string - tests: - - not_null - - accepted_values: - values: ["VoteWithdrawn"] - - name: chain_id - description: Identifier of the blockchain network - data_type: string - tests: - - not_null - - name: block_timestamp - description: UTC timestamp of the block containing the vote withdrawal event - data_type: timestamp with time zone - tests: - - not_null - - name: voter - description: Ethereum address of the voter who withdrew their vote - data_type: string - tests: - - not_null - - name: epoch_id - description: Identifier of the voting epoch in which the vote was withdrawn - data_type: string - tests: - - not_null - - name: transaction_hash - description: Hash of the transaction containing the vote withdrawal - data_type: string - tests: - - not_null - - unique - - name: block_number - description: Block height where the vote withdrawal was recorded - data_type: integer - tests: - - not_null - - name: contract - description: Address of the contract handling the vote withdrawal - data_type: string - tests: - - not_null diff --git a/transformers/synthetix/models/raw/sources.yml b/transformers/synthetix/models/raw/sources.yml index 1199aa4c..19a758c4 100644 --- a/transformers/synthetix/models/raw/sources.yml +++ b/transformers/synthetix/models/raw/sources.yml @@ -1,1179 +1,50 @@ version: 2 sources: - - name: raw_eth_mainnet - database: analytics - schema: raw_eth_mainnet - tables: - - name: block - - - name: core_proxy_event_account_created - - name: core_proxy_event_delegation_updated - - name: core_proxy_event_deposited - - name: core_proxy_event_withdrawn - - name: core_proxy_event_liquidation - - name: core_proxy_event_market_registered - - name: core_proxy_event_pool_created - - name: core_proxy_event_rewards_claimed - - name: core_proxy_event_rewards_distributed - - name: core_proxy_event_usd_burned - - name: core_proxy_event_usd_minted - - name: core_proxy_event_vault_liquidation - - name: core_proxy_event_market_collateral_deposited - - name: core_proxy_event_market_collateral_withdrawn - - name: core_proxy_event_market_usd_deposited - - name: core_proxy_event_market_usd_withdrawn - - name: legacy_market_proxy_event_account_migrated - - - name: core_get_vault_collateral - - name: core_get_vault_debt - - name: blocks_parquet - - - name: raw_base_sepolia - database: analytics - schema: raw_base_sepolia - tables: - - name: block - - - name: perps_market_proxy_event_account_created - - name: perps_market_proxy_event_account_liquidation_attempt - - name: perps_market_proxy_event_collateral_modified - - name: perps_market_proxy_event_market_created - - name: perps_market_proxy_event_market_updated - - name: perps_market_proxy_legacy_event_market_updated - - name: perps_market_proxy_event_order_committed - - name: perps_market_proxy_legacy_event_order_committed - - name: perps_market_proxy_event_order_settled - - name: perps_market_proxy_event_position_liquidated - - name: perps_market_proxy_event_previous_order_expired - - name: perps_market_proxy_event_interest_rate_updated - - name: perps_market_proxy_event_interest_charged - - - name: spot_market_proxy_event_order_committed - - name: spot_market_proxy_event_order_settled - - name: spot_market_proxy_event_order_cancelled - - name: spot_market_proxy_event_synth_registered - - name: spot_market_proxy_event_synth_bought - - name: spot_market_proxy_event_synth_sold - - name: spot_market_proxy_event_synth_wrapped - - name: spot_market_proxy_event_synth_unwrapped - - - name: core_proxy_event_account_created - - name: core_proxy_event_delegation_updated - - name: core_proxy_event_deposited - - name: core_proxy_event_withdrawn - - name: core_proxy_event_liquidation - - name: core_proxy_event_market_registered - - name: core_proxy_event_pool_created - - name: core_proxy_event_rewards_claimed - - name: core_proxy_event_rewards_distributed - - name: core_proxy_event_usd_burned - - name: core_proxy_event_usd_minted - - name: core_proxy_event_vault_liquidation - - name: core_proxy_event_market_collateral_deposited - - name: core_proxy_event_market_collateral_withdrawn - - name: core_proxy_event_market_usd_deposited - - name: core_proxy_event_market_usd_withdrawn - - name: core_proxy_legacy_event_market_usd_deposited - - name: core_proxy_legacy_event_market_usd_withdrawn - - - name: buyback_snx_event_buyback_processed - - - name: core_get_vault_collateral - - name: core_get_vault_debt - - name: blocks_parquet - - - name: raw_arbitrum_sepolia - database: analytics - schema: raw_arbitrum_sepolia - tables: - - name: block - - - name: perps_market_proxy_event_account_created - - name: perps_market_proxy_event_account_liquidation_attempt - - name: perps_market_proxy_event_collateral_modified - - name: perps_market_proxy_event_market_created - - name: perps_market_proxy_event_market_updated - - name: perps_market_proxy_legacy_event_market_updated - - name: perps_market_proxy_event_order_committed - - name: perps_market_proxy_legacy_event_order_committed - - name: perps_market_proxy_event_order_settled - - name: perps_market_proxy_event_position_liquidated - - name: perps_market_proxy_event_previous_order_expired - - name: perps_market_proxy_event_interest_rate_updated - - name: perps_market_proxy_event_interest_charged - - - name: spot_market_proxy_event_order_committed - - name: spot_market_proxy_event_order_settled - - name: spot_market_proxy_event_order_cancelled - - name: spot_market_proxy_event_synth_registered - - name: spot_market_proxy_event_synth_bought - - name: spot_market_proxy_event_synth_sold - - name: spot_market_proxy_event_synth_wrapped - - name: spot_market_proxy_event_synth_unwrapped - - - name: core_proxy_event_account_created - - name: core_proxy_event_delegation_updated - - name: core_proxy_event_deposited - - name: core_proxy_event_withdrawn - - name: core_proxy_event_liquidation - - name: core_proxy_event_market_registered - - name: core_proxy_event_pool_created - - name: core_proxy_event_rewards_claimed - - name: core_proxy_event_rewards_distributed - - name: core_proxy_event_usd_burned - - name: core_proxy_event_usd_minted - - name: core_proxy_event_vault_liquidation - - name: core_proxy_event_market_collateral_deposited - - name: core_proxy_event_market_collateral_withdrawn - - name: core_proxy_event_market_usd_deposited - - name: core_proxy_event_market_usd_withdrawn - - - name: core_get_vault_collateral - - name: core_get_vault_debt - - name: blocks_parquet - - name: raw_arbitrum_mainnet - database: analytics - schema: raw_arbitrum_mainnet - tables: - - name: block - - - name: perps_market_proxy_event_account_created - - name: perps_market_proxy_event_account_liquidation_attempt - - name: perps_market_proxy_event_collateral_modified - - name: perps_market_proxy_event_market_created - - name: perps_market_proxy_event_market_updated - - name: perps_market_proxy_legacy_event_market_updated - - name: perps_market_proxy_event_order_committed - - name: perps_market_proxy_legacy_event_order_committed - - name: perps_market_proxy_event_order_settled - - name: perps_market_proxy_event_position_liquidated - - name: perps_market_proxy_event_previous_order_expired - - name: perps_market_proxy_event_interest_rate_updated - - name: perps_market_proxy_event_interest_charged + database: arbitrum_mainnet + schema: arbitrum_mainnet + tables: + - name: synthetix_block + + - name: synthetix_perps_market_proxy_event_account_created + - name: synthetix_perps_market_proxy_event_account_liquidation_attempt + - name: synthetix_perps_market_proxy_event_collateral_modified + - name: synthetix_perps_market_proxy_event_market_created + - name: synthetix_perps_market_proxy_event_market_updated + - name: synthetix_perps_market_proxy_event_order_committed + - name: synthetix_perps_market_proxy_event_order_settled + - name: synthetix_perps_market_proxy_event_position_liquidated + - name: synthetix_perps_market_proxy_event_previous_order_expired + - name: synthetix_perps_market_proxy_event_interest_rate_updated + - name: synthetix_perps_market_proxy_event_interest_charged + + - name: synthetix_spot_market_proxy_event_order_committed + - name: synthetix_spot_market_proxy_event_order_settled + - name: synthetix_spot_market_proxy_event_order_cancelled + - name: synthetix_spot_market_proxy_event_synth_registered + - name: synthetix_spot_market_proxy_event_synth_bought + - name: synthetix_spot_market_proxy_event_synth_sold + - name: synthetix_spot_market_proxy_event_synth_wrapped + - name: synthetix_spot_market_proxy_event_synth_unwrapped + + - name: synthetix_core_proxy_event_account_created + - name: synthetix_core_proxy_event_delegation_updated + - name: synthetix_core_proxy_event_deposited + - name: synthetix_core_proxy_event_withdrawn + - name: synthetix_core_proxy_event_liquidation + - name: synthetix_core_proxy_event_market_registered + - name: synthetix_core_proxy_event_pool_created + - name: synthetix_core_proxy_event_rewards_claimed + - name: synthetix_core_proxy_event_rewards_distributed + - name: synthetix_core_proxy_event_usd_burned + - name: synthetix_core_proxy_event_usd_minted + - name: synthetix_core_proxy_event_vault_liquidation + - name: synthetix_core_proxy_event_market_collateral_deposited + - name: synthetix_core_proxy_event_market_collateral_withdrawn + - name: synthetix_core_proxy_event_market_usd_deposited + - name: synthetix_core_proxy_event_market_usd_withdrawn - - name: spot_market_proxy_event_order_committed - - name: spot_market_proxy_event_order_settled - - name: spot_market_proxy_event_order_cancelled - - name: spot_market_proxy_event_synth_registered - - name: spot_market_proxy_event_synth_bought - - name: spot_market_proxy_event_synth_sold - - name: spot_market_proxy_event_synth_wrapped - - name: spot_market_proxy_event_synth_unwrapped - - - name: core_proxy_event_account_created - - name: core_proxy_event_delegation_updated - - name: core_proxy_event_deposited - - name: core_proxy_event_withdrawn - - name: core_proxy_event_liquidation - - name: core_proxy_event_market_registered - - name: core_proxy_event_pool_created - - name: core_proxy_event_rewards_claimed - - name: core_proxy_event_rewards_distributed - - name: core_proxy_event_usd_burned - - name: core_proxy_event_usd_minted - - name: core_proxy_event_vault_liquidation - - name: core_proxy_event_market_collateral_deposited - - name: core_proxy_event_market_collateral_withdrawn - - name: core_proxy_event_market_usd_deposited - - name: core_proxy_event_market_usd_withdrawn - - - name: core_get_vault_collateral - - name: core_get_vault_debt - name: blocks_parquet - - - name: raw_base_mainnet - database: analytics - schema: raw_base_mainnet - tables: - - name: block - - - name: perps_market_proxy_event_account_created - - name: perps_market_proxy_event_account_liquidation_attempt - - name: perps_market_proxy_event_collateral_modified - - name: perps_market_proxy_event_market_created - - name: perps_market_proxy_event_market_updated - - name: perps_market_proxy_legacy_event_market_updated - - name: perps_market_proxy_event_order_committed - - name: perps_market_proxy_legacy_event_order_committed - - name: perps_market_proxy_event_order_settled - - name: perps_market_proxy_event_position_liquidated - - name: perps_market_proxy_event_previous_order_expired - - name: perps_market_proxy_event_interest_rate_updated - - name: perps_market_proxy_event_interest_charged - - - name: spot_market_proxy_event_order_committed - - name: spot_market_proxy_event_order_settled - - name: spot_market_proxy_event_order_cancelled - - name: spot_market_proxy_event_synth_registered - - name: spot_market_proxy_event_synth_bought - - name: spot_market_proxy_event_synth_sold - - name: spot_market_proxy_event_synth_wrapped - - name: spot_market_proxy_event_synth_unwrapped - - - name: core_proxy_event_account_created - - name: core_proxy_event_delegation_updated - - name: core_proxy_event_deposited - - name: core_proxy_event_withdrawn - - name: core_proxy_event_liquidation - - name: core_proxy_event_market_registered - - name: core_proxy_event_pool_created - - name: core_proxy_event_rewards_claimed - - name: core_proxy_event_rewards_distributed - - name: core_proxy_event_usd_burned - - name: core_proxy_event_usd_minted - - name: core_proxy_event_vault_liquidation - - name: core_proxy_event_market_collateral_deposited - - name: core_proxy_event_market_collateral_withdrawn - - name: core_proxy_event_market_usd_deposited - - name: core_proxy_event_market_usd_withdrawn - - name: core_proxy_legacy_event_market_usd_deposited - - name: core_proxy_legacy_event_market_usd_withdrawn - - - name: buyback_snx_legacy_event_buyback_processed - - name: buyback_snx_event_buyback_processed - - - name: core_get_vault_collateral - - name: core_get_vault_debt - - name: blocks_parquet - - - name: raw_optimism_mainnet - database: analytics - schema: raw_optimism_mainnet - tables: - - name: block - - - name: spot_market_proxy_event_order_committed - - name: spot_market_proxy_event_order_settled - - name: spot_market_proxy_event_order_cancelled - - name: spot_market_proxy_event_synth_registered - - name: spot_market_proxy_event_synth_bought - - name: spot_market_proxy_event_synth_sold - - name: spot_market_proxy_event_synth_wrapped - - name: spot_market_proxy_event_synth_unwrapped - - - name: core_proxy_event_account_created - - name: core_proxy_event_delegation_updated - - name: core_proxy_event_deposited - - name: core_proxy_event_withdrawn - - name: core_proxy_event_liquidation - - name: core_proxy_event_market_registered - - name: core_proxy_event_pool_created - - name: core_proxy_event_rewards_claimed - - name: core_proxy_event_rewards_distributed - - name: core_proxy_event_usd_burned - - name: core_proxy_event_usd_minted - - name: core_proxy_event_vault_liquidation - - name: core_proxy_event_market_collateral_deposited - - name: core_proxy_event_market_collateral_withdrawn - - # Perps V2 - - name: perps_v21_inch_event_delayed_order_removed - - name: perps_v21_inch_event_delayed_order_submitted - - name: perps_v21_inch_event_funding_recomputed - - name: perps_v21_inch_event_margin_transferred - - name: perps_v21_inch_event_perps_tracking - - name: perps_v21_inch_event_position_flagged - - name: perps_v21_inch_event_position_liquidated0 - - name: perps_v21_inch_event_position_liquidated1 - - name: perps_v21_inch_event_position_modified0 - - name: perps_v21_inch_event_position_modified1 - - name: perps_v2_aave_event_delayed_order_removed - - name: perps_v2_aave_event_delayed_order_submitted - - name: perps_v2_aave_event_funding_recomputed - - name: perps_v2_aave_event_margin_transferred - - name: perps_v2_aave_event_perps_tracking - - name: perps_v2_aave_event_position_flagged - - name: perps_v2_aave_event_position_liquidated0 - - name: perps_v2_aave_event_position_liquidated1 - - name: perps_v2_aave_event_position_modified0 - - name: perps_v2_aave_event_position_modified1 - - name: perps_v2_ada_event_delayed_order_removed - - name: perps_v2_ada_event_delayed_order_submitted - - name: perps_v2_ada_event_funding_recomputed - - name: perps_v2_ada_event_margin_transferred - - name: perps_v2_ada_event_perps_tracking - - name: perps_v2_ada_event_position_flagged - - name: perps_v2_ada_event_position_liquidated0 - - name: perps_v2_ada_event_position_liquidated1 - - name: perps_v2_ada_event_position_modified0 - - name: perps_v2_ada_event_position_modified1 - - name: perps_v2_algo_event_delayed_order_removed - - name: perps_v2_algo_event_delayed_order_submitted - - name: perps_v2_algo_event_funding_recomputed - - name: perps_v2_algo_event_margin_transferred - - name: perps_v2_algo_event_perps_tracking - - name: perps_v2_algo_event_position_flagged - - name: perps_v2_algo_event_position_liquidated0 - - name: perps_v2_algo_event_position_liquidated1 - - name: perps_v2_algo_event_position_modified0 - - name: perps_v2_algo_event_position_modified1 - - name: perps_v2_ankr_event_delayed_order_removed - - name: perps_v2_ankr_event_delayed_order_submitted - - name: perps_v2_ankr_event_funding_recomputed - - name: perps_v2_ankr_event_margin_transferred - - name: perps_v2_ankr_event_perps_tracking - - name: perps_v2_ankr_event_position_flagged - - name: perps_v2_ankr_event_position_liquidated0 - - name: perps_v2_ankr_event_position_liquidated1 - - name: perps_v2_ankr_event_position_modified0 - - name: perps_v2_ankr_event_position_modified1 - - name: perps_v2_ape_event_delayed_order_removed - - name: perps_v2_ape_event_delayed_order_submitted - - name: perps_v2_ape_event_funding_recomputed - - name: perps_v2_ape_event_margin_transferred - - name: perps_v2_ape_event_perps_tracking - - name: perps_v2_ape_event_position_flagged - - name: perps_v2_ape_event_position_liquidated0 - - name: perps_v2_ape_event_position_liquidated1 - - name: perps_v2_ape_event_position_modified0 - - name: perps_v2_ape_event_position_modified1 - - name: perps_v2_apt_event_delayed_order_removed - - name: perps_v2_apt_event_delayed_order_submitted - - name: perps_v2_apt_event_funding_recomputed - - name: perps_v2_apt_event_margin_transferred - - name: perps_v2_apt_event_perps_tracking - - name: perps_v2_apt_event_position_flagged - - name: perps_v2_apt_event_position_liquidated0 - - name: perps_v2_apt_event_position_liquidated1 - - name: perps_v2_apt_event_position_modified0 - - name: perps_v2_apt_event_position_modified1 - - name: perps_v2_arb_event_delayed_order_removed - - name: perps_v2_arb_event_delayed_order_submitted - - name: perps_v2_arb_event_funding_recomputed - - name: perps_v2_arb_event_margin_transferred - - name: perps_v2_arb_event_perps_tracking - - name: perps_v2_arb_event_position_flagged - - name: perps_v2_arb_event_position_liquidated0 - - name: perps_v2_arb_event_position_liquidated1 - - name: perps_v2_arb_event_position_modified0 - - name: perps_v2_arb_event_position_modified1 - - name: perps_v2_atom_event_delayed_order_removed - - name: perps_v2_atom_event_delayed_order_submitted - - name: perps_v2_atom_event_funding_recomputed - - name: perps_v2_atom_event_margin_transferred - - name: perps_v2_atom_event_perps_tracking - - name: perps_v2_atom_event_position_flagged - - name: perps_v2_atom_event_position_liquidated0 - - name: perps_v2_atom_event_position_liquidated1 - - name: perps_v2_atom_event_position_modified0 - - name: perps_v2_atom_event_position_modified1 - - name: perps_v2_aud_event_delayed_order_removed - - name: perps_v2_aud_event_delayed_order_submitted - - name: perps_v2_aud_event_funding_recomputed - - name: perps_v2_aud_event_margin_transferred - - name: perps_v2_aud_event_perps_tracking - - name: perps_v2_aud_event_position_flagged - - name: perps_v2_aud_event_position_liquidated0 - - name: perps_v2_aud_event_position_liquidated1 - - name: perps_v2_aud_event_position_modified0 - - name: perps_v2_aud_event_position_modified1 - - name: perps_v2_avax_event_delayed_order_removed - - name: perps_v2_avax_event_delayed_order_submitted - - name: perps_v2_avax_event_funding_recomputed - - name: perps_v2_avax_event_margin_transferred - - name: perps_v2_avax_event_perps_tracking - - name: perps_v2_avax_event_position_flagged - - name: perps_v2_avax_event_position_liquidated0 - - name: perps_v2_avax_event_position_liquidated1 - - name: perps_v2_avax_event_position_modified0 - - name: perps_v2_avax_event_position_modified1 - - name: perps_v2_axs_event_delayed_order_removed - - name: perps_v2_axs_event_delayed_order_submitted - - name: perps_v2_axs_event_funding_recomputed - - name: perps_v2_axs_event_margin_transferred - - name: perps_v2_axs_event_perps_tracking - - name: perps_v2_axs_event_position_flagged - - name: perps_v2_axs_event_position_liquidated0 - - name: perps_v2_axs_event_position_liquidated1 - - name: perps_v2_axs_event_position_modified0 - - name: perps_v2_axs_event_position_modified1 - - name: perps_v2_bal_event_delayed_order_removed - - name: perps_v2_bal_event_delayed_order_submitted - - name: perps_v2_bal_event_funding_recomputed - - name: perps_v2_bal_event_margin_transferred - - name: perps_v2_bal_event_perps_tracking - - name: perps_v2_bal_event_position_flagged - - name: perps_v2_bal_event_position_liquidated0 - - name: perps_v2_bal_event_position_liquidated1 - - name: perps_v2_bal_event_position_modified0 - - name: perps_v2_bal_event_position_modified1 - - name: perps_v2_bch_event_delayed_order_removed - - name: perps_v2_bch_event_delayed_order_submitted - - name: perps_v2_bch_event_funding_recomputed - - name: perps_v2_bch_event_margin_transferred - - name: perps_v2_bch_event_perps_tracking - - name: perps_v2_bch_event_position_flagged - - name: perps_v2_bch_event_position_liquidated0 - - name: perps_v2_bch_event_position_liquidated1 - - name: perps_v2_bch_event_position_modified0 - - name: perps_v2_bch_event_position_modified1 - - name: perps_v2_blur_event_delayed_order_removed - - name: perps_v2_blur_event_delayed_order_submitted - - name: perps_v2_blur_event_funding_recomputed - - name: perps_v2_blur_event_margin_transferred - - name: perps_v2_blur_event_perps_tracking - - name: perps_v2_blur_event_position_flagged - - name: perps_v2_blur_event_position_liquidated0 - - name: perps_v2_blur_event_position_liquidated1 - - name: perps_v2_blur_event_position_modified0 - - name: perps_v2_blur_event_position_modified1 - - name: perps_v2_bnb_event_delayed_order_removed - - name: perps_v2_bnb_event_delayed_order_submitted - - name: perps_v2_bnb_event_funding_recomputed - - name: perps_v2_bnb_event_margin_transferred - - name: perps_v2_bnb_event_perps_tracking - - name: perps_v2_bnb_event_position_flagged - - name: perps_v2_bnb_event_position_liquidated0 - - name: perps_v2_bnb_event_position_liquidated1 - - name: perps_v2_bnb_event_position_modified0 - - name: perps_v2_bnb_event_position_modified1 - - name: perps_v2_bonk_event_delayed_order_removed - - name: perps_v2_bonk_event_delayed_order_submitted - - name: perps_v2_bonk_event_funding_recomputed - - name: perps_v2_bonk_event_margin_transferred - - name: perps_v2_bonk_event_perps_tracking - - name: perps_v2_bonk_event_position_flagged - - name: perps_v2_bonk_event_position_liquidated0 - - name: perps_v2_bonk_event_position_liquidated1 - - name: perps_v2_bonk_event_position_modified0 - - name: perps_v2_bonk_event_position_modified1 - - name: perps_v2_btc_event_delayed_order_removed - - name: perps_v2_btc_event_delayed_order_submitted - - name: perps_v2_btc_event_funding_recomputed - - name: perps_v2_btc_event_margin_transferred - - name: perps_v2_btc_event_perps_tracking - - name: perps_v2_btc_event_position_flagged - - name: perps_v2_btc_event_position_liquidated0 - - name: perps_v2_btc_event_position_liquidated1 - - name: perps_v2_btc_event_position_modified0 - - name: perps_v2_btc_event_position_modified1 - - name: perps_v2_celo_event_delayed_order_removed - - name: perps_v2_celo_event_delayed_order_submitted - - name: perps_v2_celo_event_funding_recomputed - - name: perps_v2_celo_event_margin_transferred - - name: perps_v2_celo_event_perps_tracking - - name: perps_v2_celo_event_position_flagged - - name: perps_v2_celo_event_position_liquidated0 - - name: perps_v2_celo_event_position_liquidated1 - - name: perps_v2_celo_event_position_modified0 - - name: perps_v2_celo_event_position_modified1 - - name: perps_v2_comp_event_delayed_order_removed - - name: perps_v2_comp_event_delayed_order_submitted - - name: perps_v2_comp_event_funding_recomputed - - name: perps_v2_comp_event_margin_transferred - - name: perps_v2_comp_event_perps_tracking - - name: perps_v2_comp_event_position_flagged - - name: perps_v2_comp_event_position_liquidated0 - - name: perps_v2_comp_event_position_liquidated1 - - name: perps_v2_comp_event_position_modified0 - - name: perps_v2_comp_event_position_modified1 - - name: perps_v2_crv_event_delayed_order_removed - - name: perps_v2_crv_event_delayed_order_submitted - - name: perps_v2_crv_event_funding_recomputed - - name: perps_v2_crv_event_margin_transferred - - name: perps_v2_crv_event_perps_tracking - - name: perps_v2_crv_event_position_flagged - - name: perps_v2_crv_event_position_liquidated0 - - name: perps_v2_crv_event_position_liquidated1 - - name: perps_v2_crv_event_position_modified0 - - name: perps_v2_crv_event_position_modified1 - - name: perps_v2_doge_event_delayed_order_removed - - name: perps_v2_doge_event_delayed_order_submitted - - name: perps_v2_doge_event_funding_recomputed - - name: perps_v2_doge_event_margin_transferred - - name: perps_v2_doge_event_perps_tracking - - name: perps_v2_doge_event_position_flagged - - name: perps_v2_doge_event_position_liquidated0 - - name: perps_v2_doge_event_position_liquidated1 - - name: perps_v2_doge_event_position_modified0 - - name: perps_v2_doge_event_position_modified1 - - name: perps_v2_dot_event_delayed_order_removed - - name: perps_v2_dot_event_delayed_order_submitted - - name: perps_v2_dot_event_funding_recomputed - - name: perps_v2_dot_event_margin_transferred - - name: perps_v2_dot_event_perps_tracking - - name: perps_v2_dot_event_position_flagged - - name: perps_v2_dot_event_position_liquidated0 - - name: perps_v2_dot_event_position_liquidated1 - - name: perps_v2_dot_event_position_modified0 - - name: perps_v2_dot_event_position_modified1 - - name: perps_v2_dydx_event_delayed_order_removed - - name: perps_v2_dydx_event_delayed_order_submitted - - name: perps_v2_dydx_event_funding_recomputed - - name: perps_v2_dydx_event_margin_transferred - - name: perps_v2_dydx_event_perps_tracking - - name: perps_v2_dydx_event_position_flagged - - name: perps_v2_dydx_event_position_liquidated0 - - name: perps_v2_dydx_event_position_liquidated1 - - name: perps_v2_dydx_event_position_modified0 - - name: perps_v2_dydx_event_position_modified1 - - name: perps_v2_enj_event_delayed_order_removed - - name: perps_v2_enj_event_delayed_order_submitted - - name: perps_v2_enj_event_funding_recomputed - - name: perps_v2_enj_event_margin_transferred - - name: perps_v2_enj_event_perps_tracking - - name: perps_v2_enj_event_position_flagged - - name: perps_v2_enj_event_position_liquidated0 - - name: perps_v2_enj_event_position_liquidated1 - - name: perps_v2_enj_event_position_modified0 - - name: perps_v2_enj_event_position_modified1 - - name: perps_v2_eos_event_delayed_order_removed - - name: perps_v2_eos_event_delayed_order_submitted - - name: perps_v2_eos_event_funding_recomputed - - name: perps_v2_eos_event_margin_transferred - - name: perps_v2_eos_event_perps_tracking - - name: perps_v2_eos_event_position_flagged - - name: perps_v2_eos_event_position_liquidated0 - - name: perps_v2_eos_event_position_liquidated1 - - name: perps_v2_eos_event_position_modified0 - - name: perps_v2_eos_event_position_modified1 - - name: perps_v2_etc_event_delayed_order_removed - - name: perps_v2_etc_event_delayed_order_submitted - - name: perps_v2_etc_event_funding_recomputed - - name: perps_v2_etc_event_margin_transferred - - name: perps_v2_etc_event_perps_tracking - - name: perps_v2_etc_event_position_flagged - - name: perps_v2_etc_event_position_liquidated0 - - name: perps_v2_etc_event_position_liquidated1 - - name: perps_v2_etc_event_position_modified0 - - name: perps_v2_etc_event_position_modified1 - - name: perps_v2_eth_event_delayed_order_removed - - name: perps_v2_eth_event_delayed_order_submitted - - name: perps_v2_eth_event_funding_recomputed - - name: perps_v2_eth_event_margin_transferred - - name: perps_v2_eth_event_perps_tracking - - name: perps_v2_eth_event_position_flagged - - name: perps_v2_eth_event_position_liquidated0 - - name: perps_v2_eth_event_position_liquidated1 - - name: perps_v2_eth_event_position_modified0 - - name: perps_v2_eth_event_position_modified1 - - name: perps_v2_ethbtc_event_delayed_order_removed - - name: perps_v2_ethbtc_event_delayed_order_submitted - - name: perps_v2_ethbtc_event_funding_recomputed - - name: perps_v2_ethbtc_event_margin_transferred - - name: perps_v2_ethbtc_event_perps_tracking - - name: perps_v2_ethbtc_event_position_flagged - - name: perps_v2_ethbtc_event_position_liquidated0 - - name: perps_v2_ethbtc_event_position_liquidated1 - - name: perps_v2_ethbtc_event_position_modified0 - - name: perps_v2_ethbtc_event_position_modified1 - - name: perps_v2_eur_event_delayed_order_removed - - name: perps_v2_eur_event_delayed_order_submitted - - name: perps_v2_eur_event_funding_recomputed - - name: perps_v2_eur_event_margin_transferred - - name: perps_v2_eur_event_perps_tracking - - name: perps_v2_eur_event_position_flagged - - name: perps_v2_eur_event_position_liquidated0 - - name: perps_v2_eur_event_position_liquidated1 - - name: perps_v2_eur_event_position_modified0 - - name: perps_v2_eur_event_position_modified1 - - name: perps_v2_fet_event_delayed_order_removed - - name: perps_v2_fet_event_delayed_order_submitted - - name: perps_v2_fet_event_funding_recomputed - - name: perps_v2_fet_event_margin_transferred - - name: perps_v2_fet_event_perps_tracking - - name: perps_v2_fet_event_position_flagged - - name: perps_v2_fet_event_position_liquidated0 - - name: perps_v2_fet_event_position_liquidated1 - - name: perps_v2_fet_event_position_modified0 - - name: perps_v2_fet_event_position_modified1 - - name: perps_v2_fil_event_delayed_order_removed - - name: perps_v2_fil_event_delayed_order_submitted - - name: perps_v2_fil_event_funding_recomputed - - name: perps_v2_fil_event_margin_transferred - - name: perps_v2_fil_event_perps_tracking - - name: perps_v2_fil_event_position_flagged - - name: perps_v2_fil_event_position_liquidated0 - - name: perps_v2_fil_event_position_liquidated1 - - name: perps_v2_fil_event_position_modified0 - - name: perps_v2_fil_event_position_modified1 - - name: perps_v2_floki_event_delayed_order_removed - - name: perps_v2_floki_event_delayed_order_submitted - - name: perps_v2_floki_event_funding_recomputed - - name: perps_v2_floki_event_margin_transferred - - name: perps_v2_floki_event_perps_tracking - - name: perps_v2_floki_event_position_flagged - - name: perps_v2_floki_event_position_liquidated0 - - name: perps_v2_floki_event_position_liquidated1 - - name: perps_v2_floki_event_position_modified0 - - name: perps_v2_floki_event_position_modified1 - - name: perps_v2_flow_event_delayed_order_removed - - name: perps_v2_flow_event_delayed_order_submitted - - name: perps_v2_flow_event_funding_recomputed - - name: perps_v2_flow_event_margin_transferred - - name: perps_v2_flow_event_perps_tracking - - name: perps_v2_flow_event_position_flagged - - name: perps_v2_flow_event_position_liquidated0 - - name: perps_v2_flow_event_position_liquidated1 - - name: perps_v2_flow_event_position_modified0 - - name: perps_v2_flow_event_position_modified1 - - name: perps_v2_ftm_event_delayed_order_removed - - name: perps_v2_ftm_event_delayed_order_submitted - - name: perps_v2_ftm_event_funding_recomputed - - name: perps_v2_ftm_event_margin_transferred - - name: perps_v2_ftm_event_perps_tracking - - name: perps_v2_ftm_event_position_flagged - - name: perps_v2_ftm_event_position_liquidated0 - - name: perps_v2_ftm_event_position_liquidated1 - - name: perps_v2_ftm_event_position_modified0 - - name: perps_v2_ftm_event_position_modified1 - - name: perps_v2_fxs_event_delayed_order_removed - - name: perps_v2_fxs_event_delayed_order_submitted - - name: perps_v2_fxs_event_funding_recomputed - - name: perps_v2_fxs_event_margin_transferred - - name: perps_v2_fxs_event_perps_tracking - - name: perps_v2_fxs_event_position_flagged - - name: perps_v2_fxs_event_position_liquidated0 - - name: perps_v2_fxs_event_position_liquidated1 - - name: perps_v2_fxs_event_position_modified0 - - name: perps_v2_fxs_event_position_modified1 - - name: perps_v2_gbp_event_delayed_order_removed - - name: perps_v2_gbp_event_delayed_order_submitted - - name: perps_v2_gbp_event_funding_recomputed - - name: perps_v2_gbp_event_margin_transferred - - name: perps_v2_gbp_event_perps_tracking - - name: perps_v2_gbp_event_position_flagged - - name: perps_v2_gbp_event_position_liquidated0 - - name: perps_v2_gbp_event_position_liquidated1 - - name: perps_v2_gbp_event_position_modified0 - - name: perps_v2_gbp_event_position_modified1 - - name: perps_v2_gmx_event_delayed_order_removed - - name: perps_v2_gmx_event_delayed_order_submitted - - name: perps_v2_gmx_event_funding_recomputed - - name: perps_v2_gmx_event_margin_transferred - - name: perps_v2_gmx_event_perps_tracking - - name: perps_v2_gmx_event_position_flagged - - name: perps_v2_gmx_event_position_liquidated0 - - name: perps_v2_gmx_event_position_liquidated1 - - name: perps_v2_gmx_event_position_modified0 - - name: perps_v2_gmx_event_position_modified1 - - name: perps_v2_grt_event_delayed_order_removed - - name: perps_v2_grt_event_delayed_order_submitted - - name: perps_v2_grt_event_funding_recomputed - - name: perps_v2_grt_event_margin_transferred - - name: perps_v2_grt_event_perps_tracking - - name: perps_v2_grt_event_position_flagged - - name: perps_v2_grt_event_position_liquidated0 - - name: perps_v2_grt_event_position_liquidated1 - - name: perps_v2_grt_event_position_modified0 - - name: perps_v2_grt_event_position_modified1 - - name: perps_v2_icp_event_delayed_order_removed - - name: perps_v2_icp_event_delayed_order_submitted - - name: perps_v2_icp_event_funding_recomputed - - name: perps_v2_icp_event_margin_transferred - - name: perps_v2_icp_event_perps_tracking - - name: perps_v2_icp_event_position_flagged - - name: perps_v2_icp_event_position_liquidated0 - - name: perps_v2_icp_event_position_liquidated1 - - name: perps_v2_icp_event_position_modified0 - - name: perps_v2_icp_event_position_modified1 - - name: perps_v2_imx_event_delayed_order_removed - - name: perps_v2_imx_event_delayed_order_submitted - - name: perps_v2_imx_event_funding_recomputed - - name: perps_v2_imx_event_margin_transferred - - name: perps_v2_imx_event_perps_tracking - - name: perps_v2_imx_event_position_flagged - - name: perps_v2_imx_event_position_liquidated0 - - name: perps_v2_imx_event_position_liquidated1 - - name: perps_v2_imx_event_position_modified0 - - name: perps_v2_imx_event_position_modified1 - - name: perps_v2_inj_event_delayed_order_removed - - name: perps_v2_inj_event_delayed_order_submitted - - name: perps_v2_inj_event_funding_recomputed - - name: perps_v2_inj_event_margin_transferred - - name: perps_v2_inj_event_perps_tracking - - name: perps_v2_inj_event_position_flagged - - name: perps_v2_inj_event_position_liquidated0 - - name: perps_v2_inj_event_position_liquidated1 - - name: perps_v2_inj_event_position_modified0 - - name: perps_v2_inj_event_position_modified1 - - name: perps_v2_knc_event_delayed_order_removed - - name: perps_v2_knc_event_delayed_order_submitted - - name: perps_v2_knc_event_funding_recomputed - - name: perps_v2_knc_event_margin_transferred - - name: perps_v2_knc_event_perps_tracking - - name: perps_v2_knc_event_position_flagged - - name: perps_v2_knc_event_position_liquidated0 - - name: perps_v2_knc_event_position_liquidated1 - - name: perps_v2_knc_event_position_modified0 - - name: perps_v2_knc_event_position_modified1 - - name: perps_v2_ldo_event_delayed_order_removed - - name: perps_v2_ldo_event_delayed_order_submitted - - name: perps_v2_ldo_event_funding_recomputed - - name: perps_v2_ldo_event_margin_transferred - - name: perps_v2_ldo_event_perps_tracking - - name: perps_v2_ldo_event_position_flagged - - name: perps_v2_ldo_event_position_liquidated0 - - name: perps_v2_ldo_event_position_liquidated1 - - name: perps_v2_ldo_event_position_modified0 - - name: perps_v2_ldo_event_position_modified1 - - name: perps_v2_link_event_delayed_order_removed - - name: perps_v2_link_event_delayed_order_submitted - - name: perps_v2_link_event_funding_recomputed - - name: perps_v2_link_event_margin_transferred - - name: perps_v2_link_event_perps_tracking - - name: perps_v2_link_event_position_flagged - - name: perps_v2_link_event_position_liquidated0 - - name: perps_v2_link_event_position_liquidated1 - - name: perps_v2_link_event_position_modified0 - - name: perps_v2_link_event_position_modified1 - - name: perps_v2_ltc_event_delayed_order_removed - - name: perps_v2_ltc_event_delayed_order_submitted - - name: perps_v2_ltc_event_funding_recomputed - - name: perps_v2_ltc_event_margin_transferred - - name: perps_v2_ltc_event_perps_tracking - - name: perps_v2_ltc_event_position_flagged - - name: perps_v2_ltc_event_position_liquidated0 - - name: perps_v2_ltc_event_position_liquidated1 - - name: perps_v2_ltc_event_position_modified0 - - name: perps_v2_ltc_event_position_modified1 - - name: perps_v2_matic_event_delayed_order_removed - - name: perps_v2_matic_event_delayed_order_submitted - - name: perps_v2_matic_event_funding_recomputed - - name: perps_v2_matic_event_margin_transferred - - name: perps_v2_matic_event_perps_tracking - - name: perps_v2_matic_event_position_flagged - - name: perps_v2_matic_event_position_liquidated0 - - name: perps_v2_matic_event_position_liquidated1 - - name: perps_v2_matic_event_position_modified0 - - name: perps_v2_matic_event_position_modified1 - - name: perps_v2_mav_event_delayed_order_removed - - name: perps_v2_mav_event_delayed_order_submitted - - name: perps_v2_mav_event_funding_recomputed - - name: perps_v2_mav_event_margin_transferred - - name: perps_v2_mav_event_perps_tracking - - name: perps_v2_mav_event_position_flagged - - name: perps_v2_mav_event_position_liquidated0 - - name: perps_v2_mav_event_position_liquidated1 - - name: perps_v2_mav_event_position_modified0 - - name: perps_v2_mav_event_position_modified1 - - name: perps_v2_meme_event_delayed_order_removed - - name: perps_v2_meme_event_delayed_order_submitted - - name: perps_v2_meme_event_funding_recomputed - - name: perps_v2_meme_event_margin_transferred - - name: perps_v2_meme_event_perps_tracking - - name: perps_v2_meme_event_position_flagged - - name: perps_v2_meme_event_position_liquidated0 - - name: perps_v2_meme_event_position_liquidated1 - - name: perps_v2_meme_event_position_modified0 - - name: perps_v2_meme_event_position_modified1 - - name: perps_v2_mkr_event_delayed_order_removed - - name: perps_v2_mkr_event_delayed_order_submitted - - name: perps_v2_mkr_event_funding_recomputed - - name: perps_v2_mkr_event_margin_transferred - - name: perps_v2_mkr_event_perps_tracking - - name: perps_v2_mkr_event_position_flagged - - name: perps_v2_mkr_event_position_liquidated0 - - name: perps_v2_mkr_event_position_liquidated1 - - name: perps_v2_mkr_event_position_modified0 - - name: perps_v2_mkr_event_position_modified1 - - name: perps_v2_near_event_delayed_order_removed - - name: perps_v2_near_event_delayed_order_submitted - - name: perps_v2_near_event_funding_recomputed - - name: perps_v2_near_event_margin_transferred - - name: perps_v2_near_event_perps_tracking - - name: perps_v2_near_event_position_flagged - - name: perps_v2_near_event_position_liquidated0 - - name: perps_v2_near_event_position_liquidated1 - - name: perps_v2_near_event_position_modified0 - - name: perps_v2_near_event_position_modified1 - - name: perps_v2_one_event_delayed_order_removed - - name: perps_v2_one_event_delayed_order_submitted - - name: perps_v2_one_event_funding_recomputed - - name: perps_v2_one_event_margin_transferred - - name: perps_v2_one_event_perps_tracking - - name: perps_v2_one_event_position_flagged - - name: perps_v2_one_event_position_liquidated0 - - name: perps_v2_one_event_position_liquidated1 - - name: perps_v2_one_event_position_modified0 - - name: perps_v2_one_event_position_modified1 - - name: perps_v2_op_event_delayed_order_removed - - name: perps_v2_op_event_delayed_order_submitted - - name: perps_v2_op_event_funding_recomputed - - name: perps_v2_op_event_margin_transferred - - name: perps_v2_op_event_perps_tracking - - name: perps_v2_op_event_position_flagged - - name: perps_v2_op_event_position_liquidated0 - - name: perps_v2_op_event_position_liquidated1 - - name: perps_v2_op_event_position_modified0 - - name: perps_v2_op_event_position_modified1 - - name: perps_v2_pepe_event_delayed_order_removed - - name: perps_v2_pepe_event_delayed_order_submitted - - name: perps_v2_pepe_event_funding_recomputed - - name: perps_v2_pepe_event_margin_transferred - - name: perps_v2_pepe_event_perps_tracking - - name: perps_v2_pepe_event_position_flagged - - name: perps_v2_pepe_event_position_liquidated0 - - name: perps_v2_pepe_event_position_liquidated1 - - name: perps_v2_pepe_event_position_modified0 - - name: perps_v2_pepe_event_position_modified1 - - name: perps_v2_perp_event_delayed_order_removed - - name: perps_v2_perp_event_delayed_order_submitted - - name: perps_v2_perp_event_funding_recomputed - - name: perps_v2_perp_event_margin_transferred - - name: perps_v2_perp_event_perps_tracking - - name: perps_v2_perp_event_position_flagged - - name: perps_v2_perp_event_position_liquidated0 - - name: perps_v2_perp_event_position_liquidated1 - - name: perps_v2_perp_event_position_modified0 - - name: perps_v2_perp_event_position_modified1 - - name: perps_v2_pyth_event_delayed_order_removed - - name: perps_v2_pyth_event_delayed_order_submitted - - name: perps_v2_pyth_event_funding_recomputed - - name: perps_v2_pyth_event_margin_transferred - - name: perps_v2_pyth_event_perps_tracking - - name: perps_v2_pyth_event_position_flagged - - name: perps_v2_pyth_event_position_liquidated0 - - name: perps_v2_pyth_event_position_liquidated1 - - name: perps_v2_pyth_event_position_modified0 - - name: perps_v2_pyth_event_position_modified1 - - name: perps_v2_rndr_event_delayed_order_removed - - name: perps_v2_rndr_event_delayed_order_submitted - - name: perps_v2_rndr_event_funding_recomputed - - name: perps_v2_rndr_event_margin_transferred - - name: perps_v2_rndr_event_perps_tracking - - name: perps_v2_rndr_event_position_flagged - - name: perps_v2_rndr_event_position_liquidated0 - - name: perps_v2_rndr_event_position_liquidated1 - - name: perps_v2_rndr_event_position_modified0 - - name: perps_v2_rndr_event_position_modified1 - - name: perps_v2_rpl_event_delayed_order_removed - - name: perps_v2_rpl_event_delayed_order_submitted - - name: perps_v2_rpl_event_funding_recomputed - - name: perps_v2_rpl_event_margin_transferred - - name: perps_v2_rpl_event_perps_tracking - - name: perps_v2_rpl_event_position_flagged - - name: perps_v2_rpl_event_position_liquidated0 - - name: perps_v2_rpl_event_position_liquidated1 - - name: perps_v2_rpl_event_position_modified0 - - name: perps_v2_rpl_event_position_modified1 - - name: perps_v2_rune_event_delayed_order_removed - - name: perps_v2_rune_event_delayed_order_submitted - - name: perps_v2_rune_event_funding_recomputed - - name: perps_v2_rune_event_margin_transferred - - name: perps_v2_rune_event_perps_tracking - - name: perps_v2_rune_event_position_flagged - - name: perps_v2_rune_event_position_liquidated0 - - name: perps_v2_rune_event_position_liquidated1 - - name: perps_v2_rune_event_position_modified0 - - name: perps_v2_rune_event_position_modified1 - - name: perps_v2_sei_event_delayed_order_removed - - name: perps_v2_sei_event_delayed_order_submitted - - name: perps_v2_sei_event_funding_recomputed - - name: perps_v2_sei_event_margin_transferred - - name: perps_v2_sei_event_perps_tracking - - name: perps_v2_sei_event_position_flagged - - name: perps_v2_sei_event_position_liquidated0 - - name: perps_v2_sei_event_position_liquidated1 - - name: perps_v2_sei_event_position_modified0 - - name: perps_v2_sei_event_position_modified1 - - name: perps_v2_shib_event_delayed_order_removed - - name: perps_v2_shib_event_delayed_order_submitted - - name: perps_v2_shib_event_funding_recomputed - - name: perps_v2_shib_event_margin_transferred - - name: perps_v2_shib_event_perps_tracking - - name: perps_v2_shib_event_position_flagged - - name: perps_v2_shib_event_position_liquidated0 - - name: perps_v2_shib_event_position_liquidated1 - - name: perps_v2_shib_event_position_modified0 - - name: perps_v2_shib_event_position_modified1 - - name: perps_v2_sol_event_delayed_order_removed - - name: perps_v2_sol_event_delayed_order_submitted - - name: perps_v2_sol_event_funding_recomputed - - name: perps_v2_sol_event_margin_transferred - - name: perps_v2_sol_event_perps_tracking - - name: perps_v2_sol_event_position_flagged - - name: perps_v2_sol_event_position_liquidated0 - - name: perps_v2_sol_event_position_liquidated1 - - name: perps_v2_sol_event_position_modified0 - - name: perps_v2_sol_event_position_modified1 - - name: perps_v2_steth_event_delayed_order_removed - - name: perps_v2_steth_event_delayed_order_submitted - - name: perps_v2_steth_event_funding_recomputed - - name: perps_v2_steth_event_margin_transferred - - name: perps_v2_steth_event_perps_tracking - - name: perps_v2_steth_event_position_flagged - - name: perps_v2_steth_event_position_liquidated0 - - name: perps_v2_steth_event_position_liquidated1 - - name: perps_v2_steth_event_position_modified0 - - name: perps_v2_steth_event_position_modified1 - - name: perps_v2_stetheth_event_delayed_order_removed - - name: perps_v2_stetheth_event_delayed_order_submitted - - name: perps_v2_stetheth_event_funding_recomputed - - name: perps_v2_stetheth_event_margin_transferred - - name: perps_v2_stetheth_event_perps_tracking - - name: perps_v2_stetheth_event_position_flagged - - name: perps_v2_stetheth_event_position_liquidated0 - - name: perps_v2_stetheth_event_position_liquidated1 - - name: perps_v2_stetheth_event_position_modified0 - - name: perps_v2_stetheth_event_position_modified1 - - name: perps_v2_sui_event_delayed_order_removed - - name: perps_v2_sui_event_delayed_order_submitted - - name: perps_v2_sui_event_funding_recomputed - - name: perps_v2_sui_event_margin_transferred - - name: perps_v2_sui_event_perps_tracking - - name: perps_v2_sui_event_position_flagged - - name: perps_v2_sui_event_position_liquidated0 - - name: perps_v2_sui_event_position_liquidated1 - - name: perps_v2_sui_event_position_modified0 - - name: perps_v2_sui_event_position_modified1 - - name: perps_v2_sushi_event_delayed_order_removed - - name: perps_v2_sushi_event_delayed_order_submitted - - name: perps_v2_sushi_event_funding_recomputed - - name: perps_v2_sushi_event_margin_transferred - - name: perps_v2_sushi_event_perps_tracking - - name: perps_v2_sushi_event_position_flagged - - name: perps_v2_sushi_event_position_liquidated0 - - name: perps_v2_sushi_event_position_liquidated1 - - name: perps_v2_sushi_event_position_modified0 - - name: perps_v2_sushi_event_position_modified1 - - name: perps_v2_tia_event_delayed_order_removed - - name: perps_v2_tia_event_delayed_order_submitted - - name: perps_v2_tia_event_funding_recomputed - - name: perps_v2_tia_event_margin_transferred - - name: perps_v2_tia_event_perps_tracking - - name: perps_v2_tia_event_position_flagged - - name: perps_v2_tia_event_position_liquidated0 - - name: perps_v2_tia_event_position_liquidated1 - - name: perps_v2_tia_event_position_modified0 - - name: perps_v2_tia_event_position_modified1 - - name: perps_v2_trb_event_delayed_order_removed - - name: perps_v2_trb_event_delayed_order_submitted - - name: perps_v2_trb_event_funding_recomputed - - name: perps_v2_trb_event_margin_transferred - - name: perps_v2_trb_event_perps_tracking - - name: perps_v2_trb_event_position_flagged - - name: perps_v2_trb_event_position_liquidated0 - - name: perps_v2_trb_event_position_liquidated1 - - name: perps_v2_trb_event_position_modified0 - - name: perps_v2_trb_event_position_modified1 - - name: perps_v2_trx_event_delayed_order_removed - - name: perps_v2_trx_event_delayed_order_submitted - - name: perps_v2_trx_event_funding_recomputed - - name: perps_v2_trx_event_margin_transferred - - name: perps_v2_trx_event_perps_tracking - - name: perps_v2_trx_event_position_flagged - - name: perps_v2_trx_event_position_liquidated0 - - name: perps_v2_trx_event_position_liquidated1 - - name: perps_v2_trx_event_position_modified0 - - name: perps_v2_trx_event_position_modified1 - - name: perps_v2_uma_event_delayed_order_removed - - name: perps_v2_uma_event_delayed_order_submitted - - name: perps_v2_uma_event_funding_recomputed - - name: perps_v2_uma_event_margin_transferred - - name: perps_v2_uma_event_perps_tracking - - name: perps_v2_uma_event_position_flagged - - name: perps_v2_uma_event_position_liquidated0 - - name: perps_v2_uma_event_position_liquidated1 - - name: perps_v2_uma_event_position_modified0 - - name: perps_v2_uma_event_position_modified1 - - name: perps_v2_uni_event_delayed_order_removed - - name: perps_v2_uni_event_delayed_order_submitted - - name: perps_v2_uni_event_funding_recomputed - - name: perps_v2_uni_event_margin_transferred - - name: perps_v2_uni_event_perps_tracking - - name: perps_v2_uni_event_position_flagged - - name: perps_v2_uni_event_position_liquidated0 - - name: perps_v2_uni_event_position_liquidated1 - - name: perps_v2_uni_event_position_modified0 - - name: perps_v2_uni_event_position_modified1 - - name: perps_v2_usdt_event_delayed_order_removed - - name: perps_v2_usdt_event_delayed_order_submitted - - name: perps_v2_usdt_event_funding_recomputed - - name: perps_v2_usdt_event_margin_transferred - - name: perps_v2_usdt_event_perps_tracking - - name: perps_v2_usdt_event_position_flagged - - name: perps_v2_usdt_event_position_liquidated0 - - name: perps_v2_usdt_event_position_liquidated1 - - name: perps_v2_usdt_event_position_modified0 - - name: perps_v2_usdt_event_position_modified1 - - name: perps_v2_wld_event_delayed_order_removed - - name: perps_v2_wld_event_delayed_order_submitted - - name: perps_v2_wld_event_funding_recomputed - - name: perps_v2_wld_event_margin_transferred - - name: perps_v2_wld_event_perps_tracking - - name: perps_v2_wld_event_position_flagged - - name: perps_v2_wld_event_position_liquidated0 - - name: perps_v2_wld_event_position_liquidated1 - - name: perps_v2_wld_event_position_modified0 - - name: perps_v2_wld_event_position_modified1 - - name: perps_v2_xag_event_delayed_order_removed - - name: perps_v2_xag_event_delayed_order_submitted - - name: perps_v2_xag_event_funding_recomputed - - name: perps_v2_xag_event_margin_transferred - - name: perps_v2_xag_event_perps_tracking - - name: perps_v2_xag_event_position_flagged - - name: perps_v2_xag_event_position_liquidated0 - - name: perps_v2_xag_event_position_liquidated1 - - name: perps_v2_xag_event_position_modified0 - - name: perps_v2_xag_event_position_modified1 - - name: perps_v2_xau_event_delayed_order_removed - - name: perps_v2_xau_event_delayed_order_submitted - - name: perps_v2_xau_event_funding_recomputed - - name: perps_v2_xau_event_margin_transferred - - name: perps_v2_xau_event_perps_tracking - - name: perps_v2_xau_event_position_flagged - - name: perps_v2_xau_event_position_liquidated0 - - name: perps_v2_xau_event_position_liquidated1 - - name: perps_v2_xau_event_position_modified0 - - name: perps_v2_xau_event_position_modified1 - - name: perps_v2_xlm_event_delayed_order_removed - - name: perps_v2_xlm_event_delayed_order_submitted - - name: perps_v2_xlm_event_funding_recomputed - - name: perps_v2_xlm_event_margin_transferred - - name: perps_v2_xlm_event_perps_tracking - - name: perps_v2_xlm_event_position_flagged - - name: perps_v2_xlm_event_position_liquidated0 - - name: perps_v2_xlm_event_position_liquidated1 - - name: perps_v2_xlm_event_position_modified0 - - name: perps_v2_xlm_event_position_modified1 - - name: perps_v2_xmr_event_delayed_order_removed - - name: perps_v2_xmr_event_delayed_order_submitted - - name: perps_v2_xmr_event_funding_recomputed - - name: perps_v2_xmr_event_margin_transferred - - name: perps_v2_xmr_event_perps_tracking - - name: perps_v2_xmr_event_position_flagged - - name: perps_v2_xmr_event_position_liquidated0 - - name: perps_v2_xmr_event_position_liquidated1 - - name: perps_v2_xmr_event_position_modified0 - - name: perps_v2_xmr_event_position_modified1 - - name: perps_v2_xrp_event_delayed_order_removed - - name: perps_v2_xrp_event_delayed_order_submitted - - name: perps_v2_xrp_event_funding_recomputed - - name: perps_v2_xrp_event_margin_transferred - - name: perps_v2_xrp_event_perps_tracking - - name: perps_v2_xrp_event_position_flagged - - name: perps_v2_xrp_event_position_liquidated0 - - name: perps_v2_xrp_event_position_liquidated1 - - name: perps_v2_xrp_event_position_modified0 - - name: perps_v2_xrp_event_position_modified1 - - name: perps_v2_xtz_event_delayed_order_removed - - name: perps_v2_xtz_event_delayed_order_submitted - - name: perps_v2_xtz_event_funding_recomputed - - name: perps_v2_xtz_event_margin_transferred - - name: perps_v2_xtz_event_perps_tracking - - name: perps_v2_xtz_event_position_flagged - - name: perps_v2_xtz_event_position_liquidated0 - - name: perps_v2_xtz_event_position_liquidated1 - - name: perps_v2_xtz_event_position_modified0 - - name: perps_v2_xtz_event_position_modified1 - - name: perps_v2_yfi_event_delayed_order_removed - - name: perps_v2_yfi_event_delayed_order_submitted - - name: perps_v2_yfi_event_funding_recomputed - - name: perps_v2_yfi_event_margin_transferred - - name: perps_v2_yfi_event_perps_tracking - - name: perps_v2_yfi_event_position_flagged - - name: perps_v2_yfi_event_position_liquidated0 - - name: perps_v2_yfi_event_position_liquidated1 - - name: perps_v2_yfi_event_position_modified0 - - name: perps_v2_yfi_event_position_modified1 - - name: perps_v2_zec_event_delayed_order_removed - - name: perps_v2_zec_event_delayed_order_submitted - - name: perps_v2_zec_event_funding_recomputed - - name: perps_v2_zec_event_margin_transferred - - name: perps_v2_zec_event_perps_tracking - - name: perps_v2_zec_event_position_flagged - - name: perps_v2_zec_event_position_liquidated0 - - name: perps_v2_zec_event_position_liquidated1 - - name: perps_v2_zec_event_position_modified0 - - name: perps_v2_zec_event_position_modified1 - - name: perps_v2_zil_event_delayed_order_removed - - name: perps_v2_zil_event_delayed_order_submitted - - name: perps_v2_zil_event_funding_recomputed - - name: perps_v2_zil_event_margin_transferred - - name: perps_v2_zil_event_perps_tracking - - name: perps_v2_zil_event_position_flagged - - name: perps_v2_zil_event_position_liquidated0 - - name: perps_v2_zil_event_position_liquidated1 - - name: perps_v2_zil_event_position_modified0 - - name: perps_v2_zil_event_position_modified1 - - name: perps_v2_zrx_event_delayed_order_removed - - name: perps_v2_zrx_event_delayed_order_submitted - - name: perps_v2_zrx_event_funding_recomputed - - name: perps_v2_zrx_event_margin_transferred - - name: perps_v2_zrx_event_perps_tracking - - name: perps_v2_zrx_event_position_flagged - - name: perps_v2_zrx_event_position_liquidated0 - - name: perps_v2_zrx_event_position_liquidated1 - - name: perps_v2_zrx_event_position_modified0 - - name: perps_v2_zrx_event_position_modified1 - - name: perps_v2_ordi_event_delayed_order_removed - - name: perps_v2_ordi_event_delayed_order_submitted - - name: perps_v2_ordi_event_funding_recomputed - - name: perps_v2_ordi_event_margin_transferred - - name: perps_v2_ordi_event_perps_tracking - - name: perps_v2_ordi_event_position_flagged - - name: perps_v2_ordi_event_position_liquidated0 - - name: perps_v2_ordi_event_position_liquidated1 - - name: perps_v2_ordi_event_position_modified0 - - name: perps_v2_ordi_event_position_modified1 - - name: perps_v2_cvx_event_delayed_order_removed - - name: perps_v2_cvx_event_delayed_order_submitted - - name: perps_v2_cvx_event_funding_recomputed - - name: perps_v2_cvx_event_margin_transferred - - name: perps_v2_cvx_event_perps_tracking - - name: perps_v2_cvx_event_position_flagged - - name: perps_v2_cvx_event_position_liquidated0 - - name: perps_v2_cvx_event_position_liquidated1 - - name: perps_v2_cvx_event_position_modified0 - - name: perps_v2_cvx_event_position_modified1 - - name: perps_v2_jup_event_delayed_order_removed - - name: perps_v2_jup_event_delayed_order_submitted - - name: perps_v2_jup_event_funding_recomputed - - name: perps_v2_jup_event_margin_transferred - - name: perps_v2_jup_event_perps_tracking - - name: perps_v2_jup_event_position_flagged - - name: perps_v2_jup_event_position_liquidated0 - - name: perps_v2_jup_event_position_liquidated1 - - name: perps_v2_jup_event_position_modified0 - - name: perps_v2_jup_event_position_modified1 - - name: perps_v2_jto_event_delayed_order_removed - - name: perps_v2_jto_event_delayed_order_submitted - - name: perps_v2_jto_event_funding_recomputed - - name: perps_v2_jto_event_margin_transferred - - name: perps_v2_jto_event_perps_tracking - - name: perps_v2_jto_event_position_flagged - - name: perps_v2_jto_event_position_liquidated0 - - name: perps_v2_jto_event_position_liquidated1 - - name: perps_v2_jto_event_position_modified0 - - name: perps_v2_jto_event_position_modified1 - - name: perps_v2_strk_event_delayed_order_removed - - name: perps_v2_strk_event_delayed_order_submitted - - name: perps_v2_strk_event_funding_recomputed - - name: perps_v2_strk_event_margin_transferred - - name: perps_v2_strk_event_perps_tracking - - name: perps_v2_strk_event_position_flagged - - name: perps_v2_strk_event_position_liquidated0 - - name: perps_v2_strk_event_position_liquidated1 - - name: perps_v2_strk_event_position_modified0 - - name: perps_v2_strk_event_position_modified1 - - name: perps_v2_pendle_event_delayed_order_removed - - name: perps_v2_pendle_event_delayed_order_submitted - - name: perps_v2_pendle_event_funding_recomputed - - name: perps_v2_pendle_event_margin_transferred - - name: perps_v2_pendle_event_perps_tracking - - name: perps_v2_pendle_event_position_flagged - - name: perps_v2_pendle_event_position_liquidated0 - - name: perps_v2_pendle_event_position_liquidated1 - - name: perps_v2_pendle_event_position_modified0 - - name: perps_v2_pendle_event_position_modified1 - - - name: raw_snax_testnet - tables: - - name: block - - name: governance_proxy_event_vote_recorded - - name: governance_proxy_event_vote_withdrawn - - - name: raw_snax_mainnet - tables: - - name: block - - name: spartan_governance_proxy_event_vote_recorded - - name: spartan_governance_proxy_event_vote_withdrawn - - name: treasury_governance_proxy_event_vote_recorded - - - name: treasury_governance_proxy_event_vote_withdrawn - - name: ambassador_governance_proxy_event_vote_recorded - - - name: ambassador_governance_proxy_event_vote_withdrawn + - name: get_vault_collateral + - name: get_vault_debt \ No newline at end of file From 422bcd2acc8c6f861b193ee85abc3f30b3e7d76d Mon Sep 17 00:00:00 2001 From: marcus-snx Date: Mon, 9 Dec 2024 23:55:42 +0200 Subject: [PATCH 07/21] Update dbt project config file --- transformers/synthetix/dbt_project.yml | 60 +------------------------- 1 file changed, 2 insertions(+), 58 deletions(-) diff --git a/transformers/synthetix/dbt_project.yml b/transformers/synthetix/dbt_project.yml index df4f60f1..be43f9bd 100644 --- a/transformers/synthetix/dbt_project.yml +++ b/transformers/synthetix/dbt_project.yml @@ -117,67 +117,11 @@ tests: models: synthetix: - raw: - eth: - +enabled: "{{ target.name != 'prod-op' }}" - mainnet: - +tags: "eth_mainnet" - +schema: raw_eth_mainnet - base: - +enabled: "{{ target.name != 'prod-op' }}" - mainnet: - +tags: "base_mainnet" - +schema: raw_base_mainnet - sepolia: - +tags: "base_sepolia" - +schema: raw_base_sepolia - arbitrum: - +enabled: "{{ target.name != 'prod-op' }}" - mainnet: - +tags: "arbitrum_mainnet" - +schema: raw_arbitrum_mainnet - sepolia: - +tags: "arbitrum_sepolia" - +schema: raw_arbitrum_sepolia - optimism: - +enabled: "{{ target.name == 'prod-op' or target.name == 'dev' }}" - mainnet: - +tags: "optimism_mainnet" - +schema: raw_optimism_mainnet - snax: - +enabled: "{{ target.name != 'prod-op' }}" - testnet: - +tags: "snax_testnet" - +schema: raw_snax_testnet - mainnet: - +tags: "snax_mainnet" - +schema: raw_snax_mainnet - marts: - eth: - +enabled: "{{ target.name != 'prod-op' }}" - mainnet: - +tags: "eth_mainnet" - +schema: eth_mainnet - base: - +enabled: "{{ target.name != 'prod-op' }}" - mainnet: - +tags: "base_mainnet" - +schema: base_mainnet - sepolia: - +tags: "base_sepolia" - +schema: base_sepolia + core: arbitrum: +enabled: "{{ target.name != 'prod-op' }}" mainnet: +tags: "arbitrum_mainnet" - +schema: arbitrum_mainnet - sepolia: - +tags: "arbitrum_sepolia" - +schema: arbitrum_sepolia - optimism: - +enabled: "{{ target.name == 'prod-op' or target.name == 'dev' }}" - mainnet: - +tags: "optimism_mainnet" - +schema: optimism_mainnet + +schema: core_arbitrum_mainnet seeds: +schema: seeds From 1a573e72ee721cddf639b1bdb19282f45fbe75b4 Mon Sep 17 00:00:00 2001 From: marcus-snx Date: Mon, 9 Dec 2024 23:55:48 +0200 Subject: [PATCH 08/21] Update schema --- .../{raw => core}/arbitrum/mainnet/blocks_arbitrum_mainnet.sql | 0 .../mainnet/core/core_account_created_arbitrum_mainnet.sql | 0 .../mainnet/core/core_delegation_updated_arbitrum_mainnet.sql | 0 .../arbitrum/mainnet/core/core_deposited_arbitrum_mainnet.sql | 0 .../arbitrum/mainnet/core/core_liquidation_arbitrum_mainnet.sql | 0 .../mainnet/core/core_market_registered_arbitrum_mainnet.sql | 0 .../mainnet/core/core_market_updated_arbitrum_mainnet.sql | 0 .../arbitrum/mainnet/core/core_pool_created_arbitrum_mainnet.sql | 0 .../mainnet/core/core_rewards_claimed_arbitrum_mainnet.sql | 0 .../mainnet/core/core_rewards_distributed_arbitrum_mainnet.sql | 0 .../arbitrum/mainnet/core/core_usd_burned_arbitrum_mainnet.sql | 0 .../arbitrum/mainnet/core/core_usd_minted_arbitrum_mainnet.sql | 0 .../mainnet/core/core_vault_collateral_arbitrum_mainnet.sql | 0 .../arbitrum/mainnet/core/core_vault_debt_arbitrum_mainnet.sql | 0 .../mainnet/core/core_vault_liquidation_arbitrum_mainnet.sql | 0 .../arbitrum/mainnet/core/core_withdrawn_arbitrum_mainnet.sql | 0 .../models/{raw => core}/arbitrum/mainnet/core/schema.yml | 0 .../mainnet/perp/perp_account_created_arbitrum_mainnet.sql | 0 .../perp/perp_account_liquidation_attempt_arbitrum_mainnet.sql | 0 .../mainnet/perp/perp_collateral_modified_arbitrum_mainnet.sql | 0 .../mainnet/perp/perp_interest_charged_arbitrum_mainnet.sql | 0 .../mainnet/perp/perp_interest_rate_updated_arbitrum_mainnet.sql | 0 .../mainnet/perp/perp_market_created_arbitrum_mainnet.sql | 0 .../mainnet/perp/perp_market_updated_arbitrum_mainnet.sql | 0 .../mainnet/perp/perp_order_committed_arbitrum_mainnet.sql | 0 .../arbitrum/mainnet/perp/perp_order_settled_arbitrum_mainnet.sql | 0 .../mainnet/perp/perp_position_liquidated_arbitrum_mainnet.sql | 0 .../mainnet/perp/perp_previous_order_expired_arbitrum_mainnet.sql | 0 .../models/{raw => core}/arbitrum/mainnet/perp/schema.yml | 0 .../synthetix/models/{raw => core}/arbitrum/mainnet/schema.yml | 0 .../models/{raw => core}/arbitrum/mainnet/spot/schema.yml | 0 .../mainnet/spot/spot_order_cancelled_arbitrum_mainnet.sql | 0 .../mainnet/spot/spot_order_committed_arbitrum_mainnet.sql | 0 .../arbitrum/mainnet/spot/spot_order_settled_arbitrum_mainnet.sql | 0 .../arbitrum/mainnet/spot/spot_synth_bought_arbitrum_mainnet.sql | 0 .../mainnet/spot/spot_synth_registered_arbitrum_mainnet.sql | 0 .../arbitrum/mainnet/spot/spot_synth_sold_arbitrum_mainnet.sql | 0 .../mainnet/spot/spot_synth_unwrapped_arbitrum_mainnet.sql | 0 .../arbitrum/mainnet/spot/spot_synth_wrapped_arbitrum_mainnet.sql | 0 transformers/synthetix/models/{raw => core}/sources.yml | 0 40 files changed, 0 insertions(+), 0 deletions(-) rename transformers/synthetix/models/{raw => core}/arbitrum/mainnet/blocks_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/{raw => core}/arbitrum/mainnet/core/core_account_created_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/{raw => core}/arbitrum/mainnet/core/core_delegation_updated_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/{raw => core}/arbitrum/mainnet/core/core_deposited_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/{raw => core}/arbitrum/mainnet/core/core_liquidation_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/{raw => core}/arbitrum/mainnet/core/core_market_registered_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/{raw => core}/arbitrum/mainnet/core/core_market_updated_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/{raw => core}/arbitrum/mainnet/core/core_pool_created_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/{raw => core}/arbitrum/mainnet/core/core_rewards_claimed_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/{raw => core}/arbitrum/mainnet/core/core_rewards_distributed_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/{raw => core}/arbitrum/mainnet/core/core_usd_burned_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/{raw => core}/arbitrum/mainnet/core/core_usd_minted_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/{raw => core}/arbitrum/mainnet/core/core_vault_collateral_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/{raw => core}/arbitrum/mainnet/core/core_vault_debt_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/{raw => core}/arbitrum/mainnet/core/core_vault_liquidation_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/{raw => core}/arbitrum/mainnet/core/core_withdrawn_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/{raw => core}/arbitrum/mainnet/core/schema.yml (100%) rename transformers/synthetix/models/{raw => core}/arbitrum/mainnet/perp/perp_account_created_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/{raw => core}/arbitrum/mainnet/perp/perp_account_liquidation_attempt_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/{raw => core}/arbitrum/mainnet/perp/perp_collateral_modified_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/{raw => core}/arbitrum/mainnet/perp/perp_interest_charged_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/{raw => core}/arbitrum/mainnet/perp/perp_interest_rate_updated_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/{raw => core}/arbitrum/mainnet/perp/perp_market_created_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/{raw => core}/arbitrum/mainnet/perp/perp_market_updated_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/{raw => core}/arbitrum/mainnet/perp/perp_order_committed_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/{raw => core}/arbitrum/mainnet/perp/perp_order_settled_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/{raw => core}/arbitrum/mainnet/perp/perp_position_liquidated_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/{raw => core}/arbitrum/mainnet/perp/perp_previous_order_expired_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/{raw => core}/arbitrum/mainnet/perp/schema.yml (100%) rename transformers/synthetix/models/{raw => core}/arbitrum/mainnet/schema.yml (100%) rename transformers/synthetix/models/{raw => core}/arbitrum/mainnet/spot/schema.yml (100%) rename transformers/synthetix/models/{raw => core}/arbitrum/mainnet/spot/spot_order_cancelled_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/{raw => core}/arbitrum/mainnet/spot/spot_order_committed_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/{raw => core}/arbitrum/mainnet/spot/spot_order_settled_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/{raw => core}/arbitrum/mainnet/spot/spot_synth_bought_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/{raw => core}/arbitrum/mainnet/spot/spot_synth_registered_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/{raw => core}/arbitrum/mainnet/spot/spot_synth_sold_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/{raw => core}/arbitrum/mainnet/spot/spot_synth_unwrapped_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/{raw => core}/arbitrum/mainnet/spot/spot_synth_wrapped_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/{raw => core}/sources.yml (100%) diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/blocks_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/blocks_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/raw/arbitrum/mainnet/blocks_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/blocks_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_account_created_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/core/core_account_created_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/raw/arbitrum/mainnet/core/core_account_created_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/core/core_account_created_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_delegation_updated_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/core/core_delegation_updated_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/raw/arbitrum/mainnet/core/core_delegation_updated_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/core/core_delegation_updated_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_deposited_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/core/core_deposited_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/raw/arbitrum/mainnet/core/core_deposited_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/core/core_deposited_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_liquidation_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/core/core_liquidation_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/raw/arbitrum/mainnet/core/core_liquidation_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/core/core_liquidation_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_market_registered_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/core/core_market_registered_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/raw/arbitrum/mainnet/core/core_market_registered_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/core/core_market_registered_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_market_updated_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/core/core_market_updated_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/raw/arbitrum/mainnet/core/core_market_updated_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/core/core_market_updated_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_pool_created_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/core/core_pool_created_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/raw/arbitrum/mainnet/core/core_pool_created_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/core/core_pool_created_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_rewards_claimed_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/core/core_rewards_claimed_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/raw/arbitrum/mainnet/core/core_rewards_claimed_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/core/core_rewards_claimed_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_rewards_distributed_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/core/core_rewards_distributed_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/raw/arbitrum/mainnet/core/core_rewards_distributed_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/core/core_rewards_distributed_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_usd_burned_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/core/core_usd_burned_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/raw/arbitrum/mainnet/core/core_usd_burned_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/core/core_usd_burned_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_usd_minted_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/core/core_usd_minted_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/raw/arbitrum/mainnet/core/core_usd_minted_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/core/core_usd_minted_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_vault_collateral_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/core/core_vault_collateral_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/raw/arbitrum/mainnet/core/core_vault_collateral_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/core/core_vault_collateral_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_vault_debt_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/core/core_vault_debt_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/raw/arbitrum/mainnet/core/core_vault_debt_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/core/core_vault_debt_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_vault_liquidation_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/core/core_vault_liquidation_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/raw/arbitrum/mainnet/core/core_vault_liquidation_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/core/core_vault_liquidation_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/core/core_withdrawn_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/core/core_withdrawn_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/raw/arbitrum/mainnet/core/core_withdrawn_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/core/core_withdrawn_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/core/schema.yml b/transformers/synthetix/models/core/arbitrum/mainnet/core/schema.yml similarity index 100% rename from transformers/synthetix/models/raw/arbitrum/mainnet/core/schema.yml rename to transformers/synthetix/models/core/arbitrum/mainnet/core/schema.yml diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_account_created_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_account_created_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_account_created_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_account_created_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_account_liquidation_attempt_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_account_liquidation_attempt_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_account_liquidation_attempt_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_account_liquidation_attempt_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_collateral_modified_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_collateral_modified_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_collateral_modified_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_collateral_modified_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_interest_charged_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_interest_charged_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_interest_charged_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_interest_charged_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_interest_rate_updated_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_interest_rate_updated_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_interest_rate_updated_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_interest_rate_updated_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_market_created_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_market_created_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_market_created_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_market_created_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_market_updated_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_market_updated_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_market_updated_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_market_updated_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_order_committed_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_order_committed_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_order_committed_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_order_committed_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_order_settled_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_order_settled_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_order_settled_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_order_settled_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_position_liquidated_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_position_liquidated_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_position_liquidated_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_position_liquidated_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_previous_order_expired_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_previous_order_expired_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/raw/arbitrum/mainnet/perp/perp_previous_order_expired_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_previous_order_expired_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/perp/schema.yml b/transformers/synthetix/models/core/arbitrum/mainnet/perp/schema.yml similarity index 100% rename from transformers/synthetix/models/raw/arbitrum/mainnet/perp/schema.yml rename to transformers/synthetix/models/core/arbitrum/mainnet/perp/schema.yml diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/schema.yml b/transformers/synthetix/models/core/arbitrum/mainnet/schema.yml similarity index 100% rename from transformers/synthetix/models/raw/arbitrum/mainnet/schema.yml rename to transformers/synthetix/models/core/arbitrum/mainnet/schema.yml diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/spot/schema.yml b/transformers/synthetix/models/core/arbitrum/mainnet/spot/schema.yml similarity index 100% rename from transformers/synthetix/models/raw/arbitrum/mainnet/spot/schema.yml rename to transformers/synthetix/models/core/arbitrum/mainnet/spot/schema.yml diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_order_cancelled_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/spot/spot_order_cancelled_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_order_cancelled_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/spot/spot_order_cancelled_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_order_committed_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/spot/spot_order_committed_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_order_committed_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/spot/spot_order_committed_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_order_settled_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/spot/spot_order_settled_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_order_settled_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/spot/spot_order_settled_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_synth_bought_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/spot/spot_synth_bought_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_synth_bought_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/spot/spot_synth_bought_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_synth_registered_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/spot/spot_synth_registered_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_synth_registered_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/spot/spot_synth_registered_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_synth_sold_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/spot/spot_synth_sold_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_synth_sold_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/spot/spot_synth_sold_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_synth_unwrapped_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/spot/spot_synth_unwrapped_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_synth_unwrapped_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/spot/spot_synth_unwrapped_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_synth_wrapped_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/spot/spot_synth_wrapped_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/raw/arbitrum/mainnet/spot/spot_synth_wrapped_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/spot/spot_synth_wrapped_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/raw/sources.yml b/transformers/synthetix/models/core/sources.yml similarity index 100% rename from transformers/synthetix/models/raw/sources.yml rename to transformers/synthetix/models/core/sources.yml From 8ca72da0332b1679db27bd19dcb3c834a35652f6 Mon Sep 17 00:00:00 2001 From: marcus-snx Date: Tue, 10 Dec 2024 00:39:47 +0200 Subject: [PATCH 09/21] Add hierarchy to db name --- indexers/main.py | 2 +- indexers/utils/clickhouse_schema.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/indexers/main.py b/indexers/main.py index 3e790e62..636cc74d 100644 --- a/indexers/main.py +++ b/indexers/main.py @@ -152,7 +152,7 @@ def load_network_config(path): user="default", settings={"allow_experimental_json_type": 1}, ) - client.command(f"CREATE DATABASE IF NOT EXISTS {network_name}") + client.command(f"CREATE DATABASE IF NOT EXISTS raw_{network_name}") # Get contracts from SDK or ABI files contracts = [] diff --git a/indexers/utils/clickhouse_schema.py b/indexers/utils/clickhouse_schema.py index 50510d2b..b1e7edd8 100644 --- a/indexers/utils/clickhouse_schema.py +++ b/indexers/utils/clickhouse_schema.py @@ -52,7 +52,7 @@ def map_to_clickhouse_type(sol_type): def generate_clickhouse_schema(event_name, fields, network_name, protocol_name): query = [ - f"CREATE TABLE IF NOT EXISTS {network_name}.{protocol_name}_{event_name} (", + f"CREATE TABLE IF NOT EXISTS raw_{network_name}.{protocol_name}_{event_name} (", " `id` String,", " `block_number` UInt64,", " `block_timestamp` DateTime64(3, 'UTC'),", @@ -111,7 +111,7 @@ def process_abi_schemas(client, abi, path, contract_name, network_name, protocol save_clickhouse_schema(path=path, event_name=event_name, schema=schema) block_schema = ( - f"CREATE TABLE IF NOT EXISTS {network_name}.{protocol_name}_block (\n" + f"CREATE TABLE IF NOT EXISTS raw_{network_name}.{protocol_name}_block (\n" " `number` UInt64,\n" " `timestamp` DateTime64(3, 'UTC')\n" ") ENGINE = MergeTree() ORDER BY tuple();" From d9a7023326d552a122b8f0e4f1584822211b01e0 Mon Sep 17 00:00:00 2001 From: marcus-snx Date: Tue, 10 Dec 2024 00:39:58 +0200 Subject: [PATCH 10/21] Refactor listener --- indexers/scripts/listener.py | 69 +++++++++++++++--------------------- 1 file changed, 29 insertions(+), 40 deletions(-) diff --git a/indexers/scripts/listener.py b/indexers/scripts/listener.py index 105643e8..90e8d405 100644 --- a/indexers/scripts/listener.py +++ b/indexers/scripts/listener.py @@ -19,42 +19,12 @@ def convert_case(name): return snake_case -def create_table( - client: Client, - network: str, - protocol: str, - event: str, -): - table_name = f"{network}.{protocol}_{convert_case(event)}" - file_path = f"{CLICKHOUSE_INTERNAL_PATH}/{network}/{protocol}/{event}/*.parquet" - query = ( - f"create table if not exists {table_name} " - f"engine = MergeTree order by tuple() as " - f"select * from file('{file_path}', 'Parquet')" - ) - try: - client.command(query) - except Exception as e: - print(f"Error creating table {table_name}: {e}") - - -def insert_data( - client: Client, network: str, protocol: str, event: str, block_range: str -): - table_name = f"{network}.{protocol}_{convert_case(event)}" - file_path = f"{CLICKHOUSE_INTERNAL_PATH}/{network}/{protocol}/{event}/{event}_{block_range}.parquet" - query = f"insert into {table_name} select * from file('{file_path}', 'Parquet')" - try: - client.command(query) - except Exception as e: - print(f"Error inserting data into {table_name}: {e}") - - class FolderEventHandler(FileSystemEventHandler): def __init__(self): super().__init__() self.source_path = Path(f"{RAW_DATA_PATH}") self.target_path = Path(f"{CLEAN_DATA_PATH}") + self.clickhouse_path = Path(f"{CLICKHOUSE_INTERNAL_PATH}") if not self.source_path.exists(): print(f"Creating source path {self.source_path}") self.source_path.mkdir(parents=True, exist_ok=True) @@ -76,6 +46,7 @@ def _clean_parquet(self, path: str): block_range = path.name protocol_name = path.parent.name network_name = path.parent.parent.name + db_name = f"raw_{network_name}" # Initialize counters empty_files = 0 @@ -89,25 +60,25 @@ def _clean_parquet(self, path: str): self.target_path / f"{network_name}" / f"{protocol_name}" / event_name ) output_file = event_dir / f"{event_name}_{block_range}.parquet" + output_file.parent.mkdir(parents=True, exist_ok=True) + + # Move file to target directory df = pd.read_parquet(parquet_file) if df.empty: empty_files += 1 continue df.columns = [convert_case(col) for col in df.columns] - output_file.parent.mkdir(parents=True, exist_ok=True) df.to_parquet(output_file, index=False) written_files += 1 - # import data into clickhouse - if not self.client.command( - f"exists {network_name}.{protocol_name}_{event_name}" - ): - create_table(self.client, network_name, protocol_name, event_name) + # Import data into clickhouse + table_name = f"{protocol_name}_{event_name}" + clickhouse_file_path = f"{self.clickhouse_path}/{network_name}/{protocol_name}/{event_name}/{event_name}_{block_range}.parquet" + if not self.client.command(f"exists {db_name}.{table_name}"): + self._create_table_from_file(db_name, table_name, clickhouse_file_path) tables_created += 1 else: - insert_data( - self.client, network_name, protocol_name, event_name, block_range - ) + self._insert_data_from_file(db_name, table_name, clickhouse_file_path) data_insertions += 1 print( @@ -116,6 +87,24 @@ def _clean_parquet(self, path: str): f"tables created {tables_created}, data insertions {data_insertions}" ) + def _create_table_from_file(self, db_name: str, table_name: str, file_path: str): + query = ( + f"create table if not exists {db_name}.{table_name} " + f"engine = MergeTree order by tuple() as " + f"select * from file('{file_path}', 'Parquet')" + ) + try: + self.client.command(query) + except Exception as e: + print(f"Error creating table {db_name}.{table_name}: {e}") + + def _insert_data_from_file(self, db_name: str, table_name: str, file_path: str): + query = f"insert into {db_name}.{table_name} select * from file('{file_path}', 'Parquet')" + try: + self.client.command(query) + except Exception as e: + print(f"Error inserting data into {db_name}.{table_name}: {e}") + def main(): event_handler = FolderEventHandler() From 81f9ce23b8b8538191a31409a11b6776dbc0c4d7 Mon Sep 17 00:00:00 2001 From: marcus-snx Date: Tue, 10 Dec 2024 00:40:05 +0200 Subject: [PATCH 11/21] Fix models --- ...ore_vault_liquidation_arbitrum_mainnet.sql | 1 + .../core/arbitrum/mainnet/core/schema.yml | 30 +++++++++---------- .../core/arbitrum/mainnet/spot/schema.yml | 16 +++++----- .../spot_order_cancelled_arbitrum_mainnet.sql | 4 ++- .../synthetix/models/core/sources.yml | 4 +-- transformers/synthetix/profiles/profiles.yml | 1 - 6 files changed, 29 insertions(+), 27 deletions(-) diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/core/core_vault_liquidation_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/core/core_vault_liquidation_arbitrum_mainnet.sql index 4f1c05fd..e9df2c3b 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/core/core_vault_liquidation_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/core/core_vault_liquidation_arbitrum_mainnet.sql @@ -16,6 +16,7 @@ select contract, event_name, sender, + liquidation_data, cast(pool_id as UInt128) as pool_id, cast(collateral_type as text) as collateral_type, cast(liquidate_as_account_id as UInt128) as liquidate_as_account_id diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/core/schema.yml b/transformers/synthetix/models/core/arbitrum/mainnet/core/schema.yml index 6e1b9df3..cfbff994 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/core/schema.yml +++ b/transformers/synthetix/models/core/arbitrum/mainnet/core/schema.yml @@ -1,6 +1,6 @@ version: 2 models: - - name: core_account_created_arbitrum_sepolia + - name: core_account_created_arbitrum_mainnet description: AccountCreated events from the CoreProxy contract columns: - name: owner @@ -49,7 +49,7 @@ models: data_type: text tests: - not_null - - name: core_delegation_updated_arbitrum_sepolia + - name: core_delegation_updated_arbitrum_mainnet description: DelegationUpdated events from the CoreProxy contract columns: - name: contract @@ -122,7 +122,7 @@ models: - not_null - accepted_values: values: ["DelegationUpdated"] - - name: core_deposited_arbitrum_sepolia + - name: core_deposited_arbitrum_mainnet description: Deposited events from the CoreProxy contract columns: - name: collateral_type @@ -181,7 +181,7 @@ models: - dbt_utils.accepted_range: min_value: 0 inclusive: true - - name: core_withdrawn_arbitrum_sepolia + - name: core_withdrawn_arbitrum_mainnet description: Withdrawn events from the CoreProxy contract columns: - name: block_timestamp @@ -243,7 +243,7 @@ models: - not_null - accepted_values: values: ["Withdrawn"] - - name: core_liquidation_arbitrum_sepolia + - name: core_liquidation_arbitrum_mainnet description: Liquidation events from the CoreProxy contract columns: - name: pool_id @@ -311,7 +311,7 @@ models: - dbt_utils.accepted_range: min_value: 0 inclusive: true - - name: core_market_updated_arbitrum_sepolia + - name: core_market_updated_arbitrum_mainnet description: > Combination of MarketCollateralDeposited, MarketCollateralWithdrawn, MarketUsdDeposited, MarketUsdWithdrawn events from the CoreProxy contract @@ -393,7 +393,7 @@ models: - dbt_utils.accepted_range: min_value: 0 inclusive: true - - name: core_market_registered_arbitrum_sepolia + - name: core_market_registered_arbitrum_mainnet description: MarketRegistered events from the CoreProxy contract columns: - name: market @@ -445,7 +445,7 @@ models: data_type: text tests: - not_null - - name: core_pool_created_arbitrum_sepolia + - name: core_pool_created_arbitrum_mainnet description: "PoolCreated events from the CoreProxy contract" columns: - name: contract @@ -499,7 +499,7 @@ models: - dbt_utils.accepted_range: min_value: 0 inclusive: true - - name: core_rewards_claimed_arbitrum_sepolia + - name: core_rewards_claimed_arbitrum_mainnet description: RewardsClaimed events from the CoreProxy contract columns: - name: transaction_hash @@ -569,7 +569,7 @@ models: data_type: integer tests: - not_null - - name: core_rewards_distributed_arbitrum_sepolia + - name: core_rewards_distributed_arbitrum_mainnet description: RewardsDistributed events from the CoreProxy contract columns: - name: id @@ -647,7 +647,7 @@ models: - dbt_utils.accepted_range: min_value: 0 inclusive: true - - name: core_usd_burned_arbitrum_sepolia + - name: core_usd_burned_arbitrum_mainnet description: UsdBurned events from the CoreProxy contract columns: - name: amount @@ -717,7 +717,7 @@ models: data_type: timestamp with time zone tests: - not_null - - name: core_usd_minted_arbitrum_sepolia + - name: core_usd_minted_arbitrum_mainnet description: UsdMinted events from the CoreProxy contract columns: - name: pool_id @@ -787,7 +787,7 @@ models: data_type: text tests: - not_null - - name: core_vault_liquidation_arbitrum_sepolia + - name: core_vault_liquidation_arbitrum_mainnet description: VaultLiquidation events from the CoreProxy contract columns: - name: transaction_hash @@ -852,7 +852,7 @@ models: data_type: text tests: - not_null - - name: core_vault_collateral_arbitrum_sepolia + - name: core_vault_collateral_arbitrum_mainnet columns: - name: ts description: "Block timestamp" @@ -898,7 +898,7 @@ models: data_type: text tests: - not_null - - name: core_vault_debt_arbitrum_sepolia + - name: core_vault_debt_arbitrum_mainnet columns: - name: ts description: "Block timestamp" diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/spot/schema.yml b/transformers/synthetix/models/core/arbitrum/mainnet/spot/schema.yml index 1ba3db7a..734ea75e 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/spot/schema.yml +++ b/transformers/synthetix/models/core/arbitrum/mainnet/spot/schema.yml @@ -1,6 +1,6 @@ version: 2 models: - - name: spot_order_committed_arbitrum_sepolia + - name: spot_order_committed_arbitrum_mainnet description: OrderCommitted events from the SpotMarketProxy contract columns: - name: id @@ -70,7 +70,7 @@ models: data_type: integer tests: - not_null - - name: spot_order_settled_arbitrum_sepolia + - name: spot_order_settled_arbitrum_mainnet description: OrderSettled events from the SpotMarketProxy contract columns: - name: final_order_amount @@ -153,7 +153,7 @@ models: - not_null - accepted_values: values: ["OrderSettled"] - - name: spot_order_cancelled_arbitrum_sepolia + - name: spot_order_cancelled_arbitrum_mainnet description: OrderCancelled events from the SpotMarketProxy contract columns: - name: id @@ -208,7 +208,7 @@ models: data_type: integer tests: - not_null - - name: spot_synth_registered_arbitrum_sepolia + - name: spot_synth_registered_arbitrum_mainnet description: SynthRegistered events from the SpotMarketProxy contract columns: - name: id @@ -257,7 +257,7 @@ models: data_type: text tests: - not_null - - name: spot_synth_bought_arbitrum_sepolia + - name: spot_synth_bought_arbitrum_mainnet description: SynthBought events from the SpotMarketProxy contract columns: - name: collected_fees @@ -327,7 +327,7 @@ models: - not_null - accepted_values: values: ["SynthBought"] - - name: spot_synth_sold_arbitrum_sepolia + - name: spot_synth_sold_arbitrum_mainnet description: SynthSold events from the SpotMarketProxy contract columns: - name: event_name @@ -403,7 +403,7 @@ models: data_type: text tests: - not_null - - name: spot_synth_wrapped_arbitrum_sepolia + - name: spot_synth_wrapped_arbitrum_mainnet description: SynthWrapped events from the SpotMarketProxy contract columns: - name: fees @@ -460,7 +460,7 @@ models: - dbt_utils.accepted_range: min_value: 0 inclusive: true - - name: spot_synth_unwrapped_arbitrum_sepolia + - name: spot_synth_unwrapped_arbitrum_mainnet description: SynthUnwrapped events from the SpotMarketProxy contract columns: - name: block_timestamp diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/spot/spot_order_cancelled_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/spot/spot_order_cancelled_arbitrum_mainnet.sql index a46045b7..81530151 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/spot/spot_order_cancelled_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/spot/spot_order_cancelled_arbitrum_mainnet.sql @@ -16,5 +16,7 @@ select contract, event_name, sender, - async_order_claim + async_order_claim, + market_id, + async_order_id from spot_order_cancelled \ No newline at end of file diff --git a/transformers/synthetix/models/core/sources.yml b/transformers/synthetix/models/core/sources.yml index 19a758c4..5f94d485 100644 --- a/transformers/synthetix/models/core/sources.yml +++ b/transformers/synthetix/models/core/sources.yml @@ -2,8 +2,8 @@ version: 2 sources: - name: raw_arbitrum_mainnet - database: arbitrum_mainnet - schema: arbitrum_mainnet + database: raw_arbitrum_mainnet + schema: raw_arbitrum_mainnet tables: - name: synthetix_block diff --git a/transformers/synthetix/profiles/profiles.yml b/transformers/synthetix/profiles/profiles.yml index 8eae66dc..a3126395 100644 --- a/transformers/synthetix/profiles/profiles.yml +++ b/transformers/synthetix/profiles/profiles.yml @@ -3,7 +3,6 @@ clickhouse: outputs: prod: type: clickhouse - schema: prod host: clickhouse port: 8123 user: default From 09bb8a25ea850e335a186336e1a2489632de9633 Mon Sep 17 00:00:00 2001 From: marcus-snx Date: Thu, 12 Dec 2024 20:13:13 +0200 Subject: [PATCH 12/21] Fix packaging version --- indexers/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indexers/pyproject.toml b/indexers/pyproject.toml index 30659766..85aaff46 100644 --- a/indexers/pyproject.toml +++ b/indexers/pyproject.toml @@ -10,7 +10,7 @@ dependencies = [ "pandas>=2.2.3", "python-dotenv>=1.0.1", "pyyaml>=6.0.2", - "synthetix>=0.1.21", + "synthetix>=0.1.22", ] [tool.uv] From b7670a2c00e6a2b7c8e6ce7fd6abb3aafe2b68ba Mon Sep 17 00:00:00 2001 From: marcus-snx Date: Thu, 12 Dec 2024 20:13:27 +0200 Subject: [PATCH 13/21] Fix indexer main script --- indexers/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indexers/main.py b/indexers/main.py index 636cc74d..4cbc596a 100644 --- a/indexers/main.py +++ b/indexers/main.py @@ -175,7 +175,7 @@ def load_network_config(path): client=client, ) contracts.append({"name": name, "address": address}) - elif "contracts_from_abi" in custom_config: + if "contracts_from_abi" in custom_config: contracts_from_abi = custom_config["contracts_from_abi"] for contract in contracts_from_abi: name = contract["name"] From 42aed1441010db63a633e82c49c63f61ab5f784d Mon Sep 17 00:00:00 2001 From: marcus-snx Date: Thu, 12 Dec 2024 20:13:35 +0200 Subject: [PATCH 14/21] Update patches --- .../@subsquid+squid-gen-evm+2.0.0.patch | 58 ++++++++++++++++++- 1 file changed, 55 insertions(+), 3 deletions(-) diff --git a/indexers/patches/@subsquid+squid-gen-evm+2.0.0.patch b/indexers/patches/@subsquid+squid-gen-evm+2.0.0.patch index b3926516..8d3615d8 100644 --- a/indexers/patches/@subsquid+squid-gen-evm+2.0.0.patch +++ b/indexers/patches/@subsquid+squid-gen-evm+2.0.0.patch @@ -35,11 +35,43 @@ index 2839b6f..d1e7826 100644 this.out.line(`})`); return this.out.write(); } +diff --git a/node_modules/@subsquid/squid-gen-evm/lib/handlers.d.ts b/node_modules/@subsquid/squid-gen-evm/lib/handlers.d.ts +index 236fa01..28058ed 100644 +--- a/node_modules/@subsquid/squid-gen-evm/lib/handlers.d.ts ++++ b/node_modules/@subsquid/squid-gen-evm/lib/handlers.d.ts +@@ -10,6 +10,8 @@ export declare class HandlersCodegen { + constructor(outDir: OutDir, options: { + contract: SquidContract; + dataTarget: DataTarget; ++ events: boolean; ++ functions: boolean; + }); + generate(): void; + private printImports; diff --git a/node_modules/@subsquid/squid-gen-evm/lib/handlers.js b/node_modules/@subsquid/squid-gen-evm/lib/handlers.js -index 59ace5e..3c5a187 100644 +index 59ace5e..64b8493 100644 --- a/node_modules/@subsquid/squid-gen-evm/lib/handlers.js +++ b/node_modules/@subsquid/squid-gen-evm/lib/handlers.js -@@ -64,7 +64,7 @@ class HandlersCodegen { +@@ -41,12 +41,15 @@ class HandlersCodegen { + out.line(`import {toJSON} from '@subsquid/util-internal-json'`); + } + out.line(`import type {Store} from '${(0, squid_gen_utils_1.resolveModule)(out.file, path_1.default.resolve(`src`, `db`))}'`); +- out.line(`import {${handlerType}} from '${(0, squid_gen_utils_1.resolveModule)(out.file, path_1.default.resolve(`src`, `abi`, this.options.contract.spec))}'`); +- if (handlerType === 'functions') { ++ const hasFunctions = Object.keys(this.options.contract.functions || {}).length > 0; ++ const hasEvents = Object.keys(this.options.contract.events || {}).length > 0; ++ if (hasFunctions && handlerType === 'functions') { ++ out.line(`import {${handlerType}} from '${(0, squid_gen_utils_1.resolveModule)(out.file, path_1.default.resolve(`src`, `abi`, this.options.contract.spec))}'`); + this.getFunctionTargetPrinter().printImports(); + out.line(`import {Transaction} from '${(0, squid_gen_utils_1.resolveModule)(out.file, path_1.default.resolve(`src`, `processor`))}'`); + } +- else { ++ else if (hasEvents && handlerType === 'events') { ++ out.line(`import {${handlerType}} from '${(0, squid_gen_utils_1.resolveModule)(out.file, path_1.default.resolve(`src`, `abi`, this.options.contract.spec))}'`); + this.getEventTargetPrinter().printImports(); + out.line(`import {Log} from '${(0, squid_gen_utils_1.resolveModule)(out.file, path_1.default.resolve(`src`, `processor`))}'`); + } +@@ -64,7 +67,7 @@ class HandlersCodegen { `log.id`, `log.block.height`, `new Date(log.block.timestamp)`, @@ -48,7 +80,7 @@ index 59ace5e..3c5a187 100644 `log.address`, `'${e}'`, ...fragment.params.slice(6).map((p) => { -@@ -72,6 +72,9 @@ class HandlersCodegen { +@@ -72,6 +75,9 @@ class HandlersCodegen { this.useJSON(); return `toJSON(e.${p.originalName ?? p.name})`; } @@ -58,6 +90,26 @@ index 59ace5e..3c5a187 100644 else { return `e.${p.originalName ?? p.name}`; } +diff --git a/node_modules/@subsquid/squid-gen-evm/lib/mappings.js b/node_modules/@subsquid/squid-gen-evm/lib/mappings.js +index 2c135a7..9105868 100644 +--- a/node_modules/@subsquid/squid-gen-evm/lib/mappings.js ++++ b/node_modules/@subsquid/squid-gen-evm/lib/mappings.js +@@ -45,7 +45,14 @@ class MappingCodegen { + } + this.out.line(`import {Store} from '${(0, squid_gen_utils_1.resolveModule)(this.out.file, path_1.default.resolve(`src`, `db`))}'`); + this.getTargetPrinter().printImports(); +- this.out.line(`import {functions, events} from '${(0, squid_gen_utils_1.resolveModule)(this.out.file, path_1.default.resolve(`src`, `abi`, this.options.contract.spec))}'`); ++ const hasFunctions = Object.keys(this.options.contract.functions || {}).length > 0; ++ const hasEvents = Object.keys(this.options.contract.events || {}).length > 0; ++ if (hasFunctions) { ++ this.out.line(`import {functions} from '${(0, squid_gen_utils_1.resolveModule)(this.out.file, path_1.default.resolve(`src`, `abi`, this.options.contract.spec))}'`); ++ } ++ if (hasEvents) { ++ this.out.line(`import {events} from '${(0, squid_gen_utils_1.resolveModule)(this.out.file, path_1.default.resolve(`src`, `abi`, this.options.contract.spec))}'`); ++ } + this.out.line(`import * as eventHandlers from '${(0, squid_gen_utils_1.resolveModule)(this.out.file, path_1.default.resolve(`src`, `handlers`, `${this.options.contract.name}_events`))}'`); + this.out.line(`import * as functionHandlers from '${(0, squid_gen_utils_1.resolveModule)(this.out.file, path_1.default.resolve(`src`, `handlers`, `${this.options.contract.name}_functions`))}'`); + if (this.util.size > 0) { diff --git a/node_modules/@subsquid/squid-gen-evm/lib/processor.js b/node_modules/@subsquid/squid-gen-evm/lib/processor.js index f6c72a1..b8c16a2 100644 --- a/node_modules/@subsquid/squid-gen-evm/lib/processor.js From b6ee11eb0ae9769f8dd58209c0699277dc97b68e Mon Sep 17 00:00:00 2001 From: marcus-snx Date: Thu, 12 Dec 2024 20:13:57 +0200 Subject: [PATCH 15/21] Add base mainnet models --- transformers/synthetix/dbt_project.yml | 5 + .../mainnet/blocks_arbitrum_mainnet.sql | 21 - .../synthetix/blocks_arbitrum_mainnet.sql | 44 + .../core_account_created_arbitrum_mainnet.sql | 0 ...re_delegation_updated_arbitrum_mainnet.sql | 0 .../core/core_deposited_arbitrum_mainnet.sql | 0 .../core_liquidation_arbitrum_mainnet.sql | 0 ...ore_market_registered_arbitrum_mainnet.sql | 0 .../core_market_updated_arbitrum_mainnet.sql | 0 .../core_pool_created_arbitrum_mainnet.sql | 0 .../core_rewards_claimed_arbitrum_mainnet.sql | 0 ...e_rewards_distributed_arbitrum_mainnet.sql | 0 .../core/core_usd_burned_arbitrum_mainnet.sql | 0 .../core/core_usd_minted_arbitrum_mainnet.sql | 0 ...core_vault_collateral_arbitrum_mainnet.sql | 0 .../core/core_vault_debt_arbitrum_mainnet.sql | 0 ...ore_vault_liquidation_arbitrum_mainnet.sql | 0 .../core/core_withdrawn_arbitrum_mainnet.sql | 0 .../mainnet/{ => synthetix}/core/schema.yml | 0 .../perp_account_created_arbitrum_mainnet.sql | 0 ...t_liquidation_attempt_arbitrum_mainnet.sql | 0 ...p_collateral_modified_arbitrum_mainnet.sql | 0 ...perp_interest_charged_arbitrum_mainnet.sql | 0 ...interest_rate_updated_arbitrum_mainnet.sql | 0 .../perp_market_created_arbitrum_mainnet.sql | 0 .../perp_market_updated_arbitrum_mainnet.sql | 0 .../perp_order_committed_arbitrum_mainnet.sql | 0 .../perp_order_settled_arbitrum_mainnet.sql | 0 ...p_position_liquidated_arbitrum_mainnet.sql | 0 ...revious_order_expired_arbitrum_mainnet.sql | 0 .../mainnet/{ => synthetix}/perp/schema.yml | 0 .../mainnet/{ => synthetix}/schema.yml | 0 .../mainnet/{ => synthetix}/spot/schema.yml | 0 .../spot_order_cancelled_arbitrum_mainnet.sql | 0 .../spot_order_committed_arbitrum_mainnet.sql | 0 .../spot_order_settled_arbitrum_mainnet.sql | 0 .../spot_synth_bought_arbitrum_mainnet.sql | 0 ...spot_synth_registered_arbitrum_mainnet.sql | 0 .../spot/spot_synth_sold_arbitrum_mainnet.sql | 0 .../spot_synth_unwrapped_arbitrum_mainnet.sql | 0 .../spot_synth_wrapped_arbitrum_mainnet.sql | 0 .../mainnet/synthetix/blocks_base_mainnet.sql | 44 + .../buyback_processed_base_mainnet.sql | 45 + .../base/mainnet/synthetix/buyback/schema.yml | 57 ++ .../core_account_created_base_mainnet.sql | 20 + .../core_delegation_updated_base_mainnet.sql | 25 + .../core/core_deposited_base_mainnet.sql | 22 + .../core/core_liquidation_base_mainnet.sql | 24 + .../core_market_registered_base_mainnet.sql | 21 + .../core/core_market_updated_base_mainnet.sql | 107 ++ .../core/core_pool_created_base_mainnet.sql | 21 + .../core_rewards_claimed_base_mainnet.sql | 23 + .../core_rewards_distributed_base_mainnet.sql | 24 + .../core/core_usd_burned_base_mainnet.sql | 23 + .../core/core_usd_minted_base_mainnet.sql | 23 + .../core_vault_collateral_base_mainnet.sql | 36 + .../core/core_vault_debt_base_mainnet.sql | 32 + .../core_vault_liquidation_base_mainnet.sql | 23 + .../core/core_withdrawn_base_mainnet.sql | 22 + .../base/mainnet/synthetix/core/schema.yml | 935 ++++++++++++++++++ .../perp_account_created_base_mainnet.sql | 20 + ...count_liquidation_attempt_base_mainnet.sql | 21 + .../perp_collateral_modified_base_mainnet.sql | 22 + .../perp_interest_charged_base_mainnet.sql | 20 + ...erp_interest_rate_updated_base_mainnet.sql | 20 + .../perp/perp_market_created_base_mainnet.sql | 21 + .../perp/perp_market_updated_base_mainnet.sql | 56 ++ .../perp_order_committed_base_mainnet.sql | 61 ++ .../perp/perp_order_settled_base_mainnet.sql | 31 + .../perp_position_liquidated_base_mainnet.sql | 22 + ...rp_previous_order_expired_base_mainnet.sql | 24 + .../base/mainnet/synthetix/perp/schema.yml | 669 +++++++++++++ .../core/base/mainnet/synthetix/schema.yml | 19 + .../base/mainnet/synthetix/spot/schema.yml | 525 ++++++++++ .../spot_order_cancelled_base_mainnet.sql | 22 + .../spot_order_committed_base_mainnet.sql | 24 + .../spot/spot_order_settled_base_mainnet.sql | 26 + .../spot/spot_synth_bought_base_mainnet.sql | 24 + .../spot_synth_registered_base_mainnet.sql | 20 + .../spot/spot_synth_sold_base_mainnet.sql | 24 + .../spot_synth_unwrapped_base_mainnet.sql | 22 + .../spot/spot_synth_wrapped_base_mainnet.sql | 22 + .../synthetix/models/core/sources.yml | 55 ++ transformers/synthetix/profiles/profiles.yml | 1 + 84 files changed, 3347 insertions(+), 21 deletions(-) delete mode 100644 transformers/synthetix/models/core/arbitrum/mainnet/blocks_arbitrum_mainnet.sql create mode 100644 transformers/synthetix/models/core/arbitrum/mainnet/synthetix/blocks_arbitrum_mainnet.sql rename transformers/synthetix/models/core/arbitrum/mainnet/{ => synthetix}/core/core_account_created_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/core/arbitrum/mainnet/{ => synthetix}/core/core_delegation_updated_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/core/arbitrum/mainnet/{ => synthetix}/core/core_deposited_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/core/arbitrum/mainnet/{ => synthetix}/core/core_liquidation_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/core/arbitrum/mainnet/{ => synthetix}/core/core_market_registered_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/core/arbitrum/mainnet/{ => synthetix}/core/core_market_updated_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/core/arbitrum/mainnet/{ => synthetix}/core/core_pool_created_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/core/arbitrum/mainnet/{ => synthetix}/core/core_rewards_claimed_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/core/arbitrum/mainnet/{ => synthetix}/core/core_rewards_distributed_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/core/arbitrum/mainnet/{ => synthetix}/core/core_usd_burned_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/core/arbitrum/mainnet/{ => synthetix}/core/core_usd_minted_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/core/arbitrum/mainnet/{ => synthetix}/core/core_vault_collateral_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/core/arbitrum/mainnet/{ => synthetix}/core/core_vault_debt_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/core/arbitrum/mainnet/{ => synthetix}/core/core_vault_liquidation_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/core/arbitrum/mainnet/{ => synthetix}/core/core_withdrawn_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/core/arbitrum/mainnet/{ => synthetix}/core/schema.yml (100%) rename transformers/synthetix/models/core/arbitrum/mainnet/{ => synthetix}/perp/perp_account_created_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/core/arbitrum/mainnet/{ => synthetix}/perp/perp_account_liquidation_attempt_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/core/arbitrum/mainnet/{ => synthetix}/perp/perp_collateral_modified_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/core/arbitrum/mainnet/{ => synthetix}/perp/perp_interest_charged_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/core/arbitrum/mainnet/{ => synthetix}/perp/perp_interest_rate_updated_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/core/arbitrum/mainnet/{ => synthetix}/perp/perp_market_created_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/core/arbitrum/mainnet/{ => synthetix}/perp/perp_market_updated_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/core/arbitrum/mainnet/{ => synthetix}/perp/perp_order_committed_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/core/arbitrum/mainnet/{ => synthetix}/perp/perp_order_settled_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/core/arbitrum/mainnet/{ => synthetix}/perp/perp_position_liquidated_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/core/arbitrum/mainnet/{ => synthetix}/perp/perp_previous_order_expired_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/core/arbitrum/mainnet/{ => synthetix}/perp/schema.yml (100%) rename transformers/synthetix/models/core/arbitrum/mainnet/{ => synthetix}/schema.yml (100%) rename transformers/synthetix/models/core/arbitrum/mainnet/{ => synthetix}/spot/schema.yml (100%) rename transformers/synthetix/models/core/arbitrum/mainnet/{ => synthetix}/spot/spot_order_cancelled_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/core/arbitrum/mainnet/{ => synthetix}/spot/spot_order_committed_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/core/arbitrum/mainnet/{ => synthetix}/spot/spot_order_settled_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/core/arbitrum/mainnet/{ => synthetix}/spot/spot_synth_bought_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/core/arbitrum/mainnet/{ => synthetix}/spot/spot_synth_registered_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/core/arbitrum/mainnet/{ => synthetix}/spot/spot_synth_sold_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/core/arbitrum/mainnet/{ => synthetix}/spot/spot_synth_unwrapped_arbitrum_mainnet.sql (100%) rename transformers/synthetix/models/core/arbitrum/mainnet/{ => synthetix}/spot/spot_synth_wrapped_arbitrum_mainnet.sql (100%) create mode 100644 transformers/synthetix/models/core/base/mainnet/synthetix/blocks_base_mainnet.sql create mode 100644 transformers/synthetix/models/core/base/mainnet/synthetix/buyback/buyback_processed_base_mainnet.sql create mode 100644 transformers/synthetix/models/core/base/mainnet/synthetix/buyback/schema.yml create mode 100644 transformers/synthetix/models/core/base/mainnet/synthetix/core/core_account_created_base_mainnet.sql create mode 100644 transformers/synthetix/models/core/base/mainnet/synthetix/core/core_delegation_updated_base_mainnet.sql create mode 100644 transformers/synthetix/models/core/base/mainnet/synthetix/core/core_deposited_base_mainnet.sql create mode 100644 transformers/synthetix/models/core/base/mainnet/synthetix/core/core_liquidation_base_mainnet.sql create mode 100644 transformers/synthetix/models/core/base/mainnet/synthetix/core/core_market_registered_base_mainnet.sql create mode 100644 transformers/synthetix/models/core/base/mainnet/synthetix/core/core_market_updated_base_mainnet.sql create mode 100644 transformers/synthetix/models/core/base/mainnet/synthetix/core/core_pool_created_base_mainnet.sql create mode 100644 transformers/synthetix/models/core/base/mainnet/synthetix/core/core_rewards_claimed_base_mainnet.sql create mode 100644 transformers/synthetix/models/core/base/mainnet/synthetix/core/core_rewards_distributed_base_mainnet.sql create mode 100644 transformers/synthetix/models/core/base/mainnet/synthetix/core/core_usd_burned_base_mainnet.sql create mode 100644 transformers/synthetix/models/core/base/mainnet/synthetix/core/core_usd_minted_base_mainnet.sql create mode 100644 transformers/synthetix/models/core/base/mainnet/synthetix/core/core_vault_collateral_base_mainnet.sql create mode 100644 transformers/synthetix/models/core/base/mainnet/synthetix/core/core_vault_debt_base_mainnet.sql create mode 100644 transformers/synthetix/models/core/base/mainnet/synthetix/core/core_vault_liquidation_base_mainnet.sql create mode 100644 transformers/synthetix/models/core/base/mainnet/synthetix/core/core_withdrawn_base_mainnet.sql create mode 100644 transformers/synthetix/models/core/base/mainnet/synthetix/core/schema.yml create mode 100644 transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_account_created_base_mainnet.sql create mode 100644 transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_account_liquidation_attempt_base_mainnet.sql create mode 100644 transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_collateral_modified_base_mainnet.sql create mode 100644 transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_interest_charged_base_mainnet.sql create mode 100644 transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_interest_rate_updated_base_mainnet.sql create mode 100644 transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_market_created_base_mainnet.sql create mode 100644 transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_market_updated_base_mainnet.sql create mode 100644 transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_order_committed_base_mainnet.sql create mode 100644 transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_order_settled_base_mainnet.sql create mode 100644 transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_position_liquidated_base_mainnet.sql create mode 100644 transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_previous_order_expired_base_mainnet.sql create mode 100644 transformers/synthetix/models/core/base/mainnet/synthetix/perp/schema.yml create mode 100644 transformers/synthetix/models/core/base/mainnet/synthetix/schema.yml create mode 100644 transformers/synthetix/models/core/base/mainnet/synthetix/spot/schema.yml create mode 100644 transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_order_cancelled_base_mainnet.sql create mode 100644 transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_order_committed_base_mainnet.sql create mode 100644 transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_order_settled_base_mainnet.sql create mode 100644 transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_bought_base_mainnet.sql create mode 100644 transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_registered_base_mainnet.sql create mode 100644 transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_sold_base_mainnet.sql create mode 100644 transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_unwrapped_base_mainnet.sql create mode 100644 transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_wrapped_base_mainnet.sql diff --git a/transformers/synthetix/dbt_project.yml b/transformers/synthetix/dbt_project.yml index be43f9bd..efe97757 100644 --- a/transformers/synthetix/dbt_project.yml +++ b/transformers/synthetix/dbt_project.yml @@ -123,5 +123,10 @@ models: mainnet: +tags: "arbitrum_mainnet" +schema: core_arbitrum_mainnet + base: + +enabled: "{{ target.name != 'prod-op' }}" + mainnet: + +tags: "base_mainnet" + +schema: core_base_mainnet seeds: +schema: seeds diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/blocks_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/blocks_arbitrum_mainnet.sql deleted file mode 100644 index ae1ea2ff..00000000 --- a/transformers/synthetix/models/core/arbitrum/mainnet/blocks_arbitrum_mainnet.sql +++ /dev/null @@ -1,21 +0,0 @@ -with indexer_blocks as ( - select - timestamp as ts, - CAST( - number as INTEGER - ) as block_number - from - {{ source( - 'raw_arbitrum_mainnet', - 'synthetix_block' - ) }} -) - - -select - block_number, - MIN(ts) as ts -from - indexer_blocks -group by - block_number diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/blocks_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/blocks_arbitrum_mainnet.sql new file mode 100644 index 00000000..a1fbd9ed --- /dev/null +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/blocks_arbitrum_mainnet.sql @@ -0,0 +1,44 @@ +with indexer_blocks as ( + select + timestamp as ts, + CAST( + number as INTEGER + ) as block_number + from + {{ source( + 'raw_arbitrum_mainnet', + 'synthetix_block' + ) }} +), + +parquet_blocks as ( + select + FROM_UNIXTIME(timestamp) as ts, + CAST( + block_number as INTEGER + ) as block_number + from + {{ source( + 'raw_arbitrum_mainnet', + 'blocks_parquet' + ) }} +), + +combined_blocks as ( + select * + from + indexer_blocks + + union all + select * + from + parquet_blocks +) + +select + block_number, + MIN(ts) as ts +from + combined_blocks +group by + block_number \ No newline at end of file diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/core/core_account_created_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_account_created_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/core/arbitrum/mainnet/core/core_account_created_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_account_created_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/core/core_delegation_updated_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_delegation_updated_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/core/arbitrum/mainnet/core/core_delegation_updated_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_delegation_updated_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/core/core_deposited_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_deposited_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/core/arbitrum/mainnet/core/core_deposited_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_deposited_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/core/core_liquidation_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_liquidation_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/core/arbitrum/mainnet/core/core_liquidation_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_liquidation_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/core/core_market_registered_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_market_registered_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/core/arbitrum/mainnet/core/core_market_registered_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_market_registered_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/core/core_market_updated_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_market_updated_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/core/arbitrum/mainnet/core/core_market_updated_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_market_updated_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/core/core_pool_created_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_pool_created_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/core/arbitrum/mainnet/core/core_pool_created_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_pool_created_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/core/core_rewards_claimed_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_rewards_claimed_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/core/arbitrum/mainnet/core/core_rewards_claimed_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_rewards_claimed_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/core/core_rewards_distributed_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_rewards_distributed_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/core/arbitrum/mainnet/core/core_rewards_distributed_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_rewards_distributed_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/core/core_usd_burned_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_usd_burned_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/core/arbitrum/mainnet/core/core_usd_burned_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_usd_burned_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/core/core_usd_minted_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_usd_minted_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/core/arbitrum/mainnet/core/core_usd_minted_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_usd_minted_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/core/core_vault_collateral_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_vault_collateral_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/core/arbitrum/mainnet/core/core_vault_collateral_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_vault_collateral_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/core/core_vault_debt_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_vault_debt_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/core/arbitrum/mainnet/core/core_vault_debt_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_vault_debt_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/core/core_vault_liquidation_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_vault_liquidation_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/core/arbitrum/mainnet/core/core_vault_liquidation_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_vault_liquidation_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/core/core_withdrawn_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_withdrawn_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/core/arbitrum/mainnet/core/core_withdrawn_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_withdrawn_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/core/schema.yml b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/schema.yml similarity index 100% rename from transformers/synthetix/models/core/arbitrum/mainnet/core/schema.yml rename to transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/schema.yml diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_account_created_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_account_created_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_account_created_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_account_created_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_account_liquidation_attempt_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_account_liquidation_attempt_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_account_liquidation_attempt_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_account_liquidation_attempt_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_collateral_modified_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_collateral_modified_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_collateral_modified_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_collateral_modified_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_interest_charged_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_interest_charged_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_interest_charged_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_interest_charged_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_interest_rate_updated_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_interest_rate_updated_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_interest_rate_updated_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_interest_rate_updated_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_market_created_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_market_created_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_market_created_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_market_created_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_market_updated_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_market_updated_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_market_updated_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_market_updated_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_order_committed_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_order_committed_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_order_committed_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_order_committed_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_order_settled_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_order_settled_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_order_settled_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_order_settled_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_position_liquidated_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_position_liquidated_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_position_liquidated_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_position_liquidated_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_previous_order_expired_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_previous_order_expired_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/core/arbitrum/mainnet/perp/perp_previous_order_expired_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_previous_order_expired_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/perp/schema.yml b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/schema.yml similarity index 100% rename from transformers/synthetix/models/core/arbitrum/mainnet/perp/schema.yml rename to transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/schema.yml diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/schema.yml b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/schema.yml similarity index 100% rename from transformers/synthetix/models/core/arbitrum/mainnet/schema.yml rename to transformers/synthetix/models/core/arbitrum/mainnet/synthetix/schema.yml diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/spot/schema.yml b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/schema.yml similarity index 100% rename from transformers/synthetix/models/core/arbitrum/mainnet/spot/schema.yml rename to transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/schema.yml diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/spot/spot_order_cancelled_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_order_cancelled_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/core/arbitrum/mainnet/spot/spot_order_cancelled_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_order_cancelled_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/spot/spot_order_committed_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_order_committed_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/core/arbitrum/mainnet/spot/spot_order_committed_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_order_committed_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/spot/spot_order_settled_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_order_settled_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/core/arbitrum/mainnet/spot/spot_order_settled_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_order_settled_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/spot/spot_synth_bought_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_bought_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/core/arbitrum/mainnet/spot/spot_synth_bought_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_bought_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/spot/spot_synth_registered_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_registered_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/core/arbitrum/mainnet/spot/spot_synth_registered_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_registered_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/spot/spot_synth_sold_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_sold_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/core/arbitrum/mainnet/spot/spot_synth_sold_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_sold_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/spot/spot_synth_unwrapped_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_unwrapped_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/core/arbitrum/mainnet/spot/spot_synth_unwrapped_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_unwrapped_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/spot/spot_synth_wrapped_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_wrapped_arbitrum_mainnet.sql similarity index 100% rename from transformers/synthetix/models/core/arbitrum/mainnet/spot/spot_synth_wrapped_arbitrum_mainnet.sql rename to transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_wrapped_arbitrum_mainnet.sql diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/blocks_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/blocks_base_mainnet.sql new file mode 100644 index 00000000..840547cc --- /dev/null +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/blocks_base_mainnet.sql @@ -0,0 +1,44 @@ +with indexer_blocks as ( + select + timestamp as ts, + CAST( + number as INTEGER + ) as block_number + from + {{ source( + 'raw_base_mainnet', + 'synthetix_block' + ) }} +), + +parquet_blocks as ( + select + FROM_UNIXTIME(timestamp) as ts, + CAST( + block_number as INTEGER + ) as block_number + from + {{ source( + 'raw_base_mainnet', + 'blocks_parquet' + ) }} +), + +combined_blocks as ( + select * + from + indexer_blocks + + union all + select * + from + parquet_blocks +) + +select + block_number, + MIN(ts) as ts +from + combined_blocks +group by + block_number \ No newline at end of file diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/buyback/buyback_processed_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/buyback/buyback_processed_base_mainnet.sql new file mode 100644 index 00000000..724857ce --- /dev/null +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/buyback/buyback_processed_base_mainnet.sql @@ -0,0 +1,45 @@ +with legacy_events as ( + {{ get_event_data( + 'base', + 'mainnet', + 'synthetix', + 'buyback_snx_legacy', + 'buyback_processed' + ) }} +), + +current_events as ( + {{ get_event_data( + 'base', + 'mainnet', + 'synthetix', + 'buyback_snx', + 'buyback_processed' + ) }} +) + +select + id, + block_number, + block_timestamp, + transaction_hash, + event_name, + contract, + buyer, + cast(snx as UInt256) as snx, + cast(usd as UInt256) as usd +from + legacy_events +union all +select + id, + block_number, + block_timestamp, + transaction_hash, + event_name, + contract, + buyer, + cast(snx as UInt256) as snx, + cast(usd as UInt256) as usd +from + current_events diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/buyback/schema.yml b/transformers/synthetix/models/core/base/mainnet/synthetix/buyback/schema.yml new file mode 100644 index 00000000..782cddac --- /dev/null +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/buyback/schema.yml @@ -0,0 +1,57 @@ +models: + - name: buyback_processed_base_mainnet + columns: + - name: id + description: "ID of the event record" + data_type: string + tests: + - not_null + - unique + - name: block_number + description: "Block number" + data_type: uint64 + tests: + - not_null + - name: block_timestamp + description: "Block timestamp" + data_type: timestamp with time zone + tests: + - not_null + - name: transaction_hash + description: "Transaction hash" + data_type: string + tests: + - not_null + - name: event_name + description: "Event name" + data_type: string + tests: + - not_null + - accepted_values: + values: ["BuybackProcessed"] + - name: contract + description: "Address of the contract" + data_type: string + tests: + - not_null + - name: buyer + description: "Address of the buyer" + data_type: string + tests: + - not_null + - name: snx + description: "Amount in SNX" + data_type: uint256 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: usd + description: "Value in USD" + data_type: uint256 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true \ No newline at end of file diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_account_created_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_account_created_base_mainnet.sql new file mode 100644 index 00000000..92bcf003 --- /dev/null +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_account_created_base_mainnet.sql @@ -0,0 +1,20 @@ +with core_account_created as ( + {{ get_event_data( + 'base', + 'mainnet', + 'synthetix', + 'core_proxy', + 'account_created' + ) }} +) + +select + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + id, + cast(account_id as UInt128) as account_id, + owner +from core_account_created diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_delegation_updated_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_delegation_updated_base_mainnet.sql new file mode 100644 index 00000000..fe236439 --- /dev/null +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_delegation_updated_base_mainnet.sql @@ -0,0 +1,25 @@ +with delegation_updated as ( + {{ get_event_data( + 'base', + 'mainnet', + 'synthetix', + 'core_proxy', + 'delegation_updated' + ) }} +) + +select + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + id, + sender, + cast(account_id as UInt128) as account_id, + cast(pool_id as UInt128) as pool_id, + collateral_type, + cast(amount as UInt256) as amount, + cast(leverage as UInt256) as leverage +from + delegation_updated \ No newline at end of file diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_deposited_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_deposited_base_mainnet.sql new file mode 100644 index 00000000..66e0351c --- /dev/null +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_deposited_base_mainnet.sql @@ -0,0 +1,22 @@ +with core_deposited as ( + {{ get_event_data( + 'base', + 'mainnet', + 'synthetix', + 'core_proxy', + 'deposited' + ) }} +) + +select + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + id, + sender, + cast(account_id as UInt128) as account_id, + collateral_type, + cast(token_amount as UInt256) as token_amount +from core_deposited \ No newline at end of file diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_liquidation_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_liquidation_base_mainnet.sql new file mode 100644 index 00000000..79f1862a --- /dev/null +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_liquidation_base_mainnet.sql @@ -0,0 +1,24 @@ +with core_liquidation as ( + {{ get_event_data( + 'base', + 'mainnet', + 'synthetix', + 'core_proxy', + 'liquidation' + ) }} +) + +select + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + id, + sender, + liquidation_data, + cast(account_id as UInt128) as account_id, + cast(pool_id as UInt128) as pool_id, + collateral_type, + cast(liquidate_as_account_id as UInt128) as liquidate_as_account_id +from core_liquidation \ No newline at end of file diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_market_registered_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_market_registered_base_mainnet.sql new file mode 100644 index 00000000..80e43a37 --- /dev/null +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_market_registered_base_mainnet.sql @@ -0,0 +1,21 @@ +with core_market_registered as ( + {{ get_event_data( + 'base', + 'mainnet', + 'synthetix', + 'core_proxy', + 'market_registered' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + sender, + market, + cast(market_id as UInt128) as market_id +from core_market_registered diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_market_updated_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_market_updated_base_mainnet.sql new file mode 100644 index 00000000..8227beda --- /dev/null +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_market_updated_base_mainnet.sql @@ -0,0 +1,107 @@ +with events as ( + select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + sender, + collateral_type, + cast(market_id as UInt128) as market_id, + cast(net_issuance as Int128) as net_issuance, + cast(deposited_collateral_value as UInt256) as deposited_collateral_value, + cast(credit_capacity as Int128) as credit_capacity, + cast(token_amount as UInt256) as token_amount + from + ( + {{ get_event_data( + 'base', + 'mainnet', + 'synthetix', + 'core_proxy', + 'market_collateral_deposited' + ) }} + ) as collateral_deposited -- noqa: AL05 + union all + select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + sender, + collateral_type, + cast(market_id as UInt128) as market_id, + cast(net_issuance as Int128) as net_issuance, + cast(deposited_collateral_value as UInt256) as deposited_collateral_value, + cast(credit_capacity as Int128) as credit_capacity, + cast(token_amount as UInt256) as token_amount + from + ( + {{ get_event_data( + 'base', + 'mainnet', + 'synthetix', + 'core_proxy', + 'market_collateral_withdrawn' + ) }} + ) as collateral_withdrawn -- noqa: AL05 + union all + select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + target as sender, + 'USD' as collateral_type, + cast(market_id as UInt128) as market_id, + cast(net_issuance as Int128) as net_issuance, + cast(deposited_collateral_value as UInt256) as deposited_collateral_value, + cast(credit_capacity as Int128) as credit_capacity, + cast(amount as UInt256) as token_amount + from + ( + {{ get_event_data( + 'base', + 'mainnet', + 'synthetix', + 'core_proxy', + 'market_usd_deposited' + ) }} + ) as usd_deposited -- noqa: AL05 + union all + select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + target as sender, + 'USD' as collateral_type, + cast(market_id as UInt128) as market_id, + cast(net_issuance as Int128) as net_issuance, + cast(deposited_collateral_value as UInt256) as deposited_collateral_value, + cast(credit_capacity as Int128) as credit_capacity, + cast(amount as UInt256) as token_amount + from + ( + {{ get_event_data( + 'base', + 'mainnet', + 'synthetix', + 'core_proxy', + 'market_usd_withdrawn' + ) }} + ) as usd_withdrawn -- noqa: AL05 +) + +select * +from + events +order by + block_timestamp \ No newline at end of file diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_pool_created_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_pool_created_base_mainnet.sql new file mode 100644 index 00000000..0838c9e3 --- /dev/null +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_pool_created_base_mainnet.sql @@ -0,0 +1,21 @@ +with core_pool_created as ( + {{ get_event_data( + 'base', + 'mainnet', + 'synthetix', + 'core_proxy', + 'pool_created' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + sender, + owner, + cast(pool_id as UInt128) as pool_id +from core_pool_created diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_rewards_claimed_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_rewards_claimed_base_mainnet.sql new file mode 100644 index 00000000..ace886e3 --- /dev/null +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_rewards_claimed_base_mainnet.sql @@ -0,0 +1,23 @@ +with core_rewards_claimed as ( + {{ get_event_data( + 'base', + 'mainnet', + 'synthetix', + 'core_proxy', + 'rewards_claimed' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + cast(account_id as UInt128) as account_id, + cast(pool_id as UInt128) as pool_id, + collateral_type, + distributor, + cast(amount as UInt256) as amount +from core_rewards_claimed \ No newline at end of file diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_rewards_distributed_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_rewards_distributed_base_mainnet.sql new file mode 100644 index 00000000..1ababfa5 --- /dev/null +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_rewards_distributed_base_mainnet.sql @@ -0,0 +1,24 @@ +with core_rewards_distributed as ( + {{ get_event_data( + 'base', + 'mainnet', + 'synthetix', + 'core_proxy', + 'rewards_distributed' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + cast(pool_id as UInt128) as pool_id, + collateral_type, + distributor, + cast(amount as UInt256) as amount, + cast(start as UInt256) as start, + cast(duration as UInt256) as duration +from core_rewards_distributed \ No newline at end of file diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_usd_burned_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_usd_burned_base_mainnet.sql new file mode 100644 index 00000000..439529e2 --- /dev/null +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_usd_burned_base_mainnet.sql @@ -0,0 +1,23 @@ +with core_usd_burned as ( + {{ get_event_data( + 'base', + 'mainnet', + 'synthetix', + 'core_proxy', + 'usd_burned' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + sender, + cast(account_id as UInt128) as account_id, + cast(pool_id as UInt128) as pool_id, + collateral_type, + cast(amount as UInt256) as amount +from core_usd_burned diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_usd_minted_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_usd_minted_base_mainnet.sql new file mode 100644 index 00000000..45ff5bbc --- /dev/null +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_usd_minted_base_mainnet.sql @@ -0,0 +1,23 @@ +with core_usd_minted as ( + {{ get_event_data( + 'base', + 'mainnet', + 'synthetix', + 'core_proxy', + 'usd_minted' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + sender, + cast(account_id as UInt128) as account_id, + cast(pool_id as UInt128) as pool_id, + collateral_type, + cast(amount as UInt256) as amount +from core_usd_minted \ No newline at end of file diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_vault_collateral_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_vault_collateral_base_mainnet.sql new file mode 100644 index 00000000..306935d5 --- /dev/null +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_vault_collateral_base_mainnet.sql @@ -0,0 +1,36 @@ +with base as ( + select + block_number, + contract_address, + chain_id, + cast(pool_id as Int128) as pool_id, + collateral_type, + cast( + amount as UInt256 + ) as amount, + cast( + value as UInt256 + ) as collateral_value + from + {{ source( + 'raw_base_mainnet', + 'get_vault_collateral' + ) }} + where + amount is not null +) + +select + from_unixtime(blocks.timestamp) as ts, + cast( + blocks.block_number as integer + ) as block_number, + base.contract_address, + base.pool_id, + base.collateral_type, + {{ convert_wei('base.amount') }} as amount, + {{ convert_wei('base.collateral_value') }} as collateral_value +from + base +inner join {{ source('raw_base_mainnet', 'blocks_parquet') }} as blocks + on base.block_number = blocks.block_number diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_vault_debt_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_vault_debt_base_mainnet.sql new file mode 100644 index 00000000..e3dbedeb --- /dev/null +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_vault_debt_base_mainnet.sql @@ -0,0 +1,32 @@ +with base as ( + select + block_number, + contract_address, + chain_id, + cast(pool_id as Int128) as pool_id, + collateral_type, + cast( + value_1 as Int256 + ) as debt + from + {{ source( + 'raw_base_mainnet', + 'get_vault_debt' + ) }} + where + value_1 is not null +) + +select + from_unixtime(blocks.timestamp) as ts, + cast( + blocks.block_number as integer + ) as block_number, + base.contract_address, + base.pool_id, + base.collateral_type, + {{ convert_wei('base.debt') }} as debt +from + base +inner join {{ source('raw_base_mainnet', 'blocks_parquet') }} as blocks + on base.block_number = blocks.block_number diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_vault_liquidation_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_vault_liquidation_base_mainnet.sql new file mode 100644 index 00000000..0019fb74 --- /dev/null +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_vault_liquidation_base_mainnet.sql @@ -0,0 +1,23 @@ +with core_vault_liquidation as ( + {{ get_event_data( + 'base', + 'mainnet', + 'synthetix', + 'core_proxy', + 'vault_liquidation' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + sender, + liquidation_data, + cast(pool_id as UInt128) as pool_id, + cast(collateral_type as text) as collateral_type, + cast(liquidate_as_account_id as UInt128) as liquidate_as_account_id +from core_vault_liquidation \ No newline at end of file diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_withdrawn_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_withdrawn_base_mainnet.sql new file mode 100644 index 00000000..c8ea00b8 --- /dev/null +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_withdrawn_base_mainnet.sql @@ -0,0 +1,22 @@ +with core_withdrawn as ( + {{ get_event_data( + 'base', + 'mainnet', + 'synthetix', + 'core_proxy', + 'withdrawn' + ) }} +) + +select + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + id, + sender, + cast(account_id as UInt128) as account_id, + collateral_type, + cast(token_amount as UInt256) as token_amount +from core_withdrawn diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/schema.yml b/transformers/synthetix/models/core/base/mainnet/synthetix/core/schema.yml new file mode 100644 index 00000000..c4b38dcd --- /dev/null +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/schema.yml @@ -0,0 +1,935 @@ +version: 2 +models: + - name: core_account_created_base_mainnet + description: AccountCreated events from the CoreProxy contract + columns: + - name: owner + description: "Address of the account owner" + data_type: text + tests: + - not_null + - name: account_id + description: "ID of the account" + data_type: uint128 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: id + description: "ID of the event record" + data_type: text + tests: + - not_null + - unique + - name: transaction_hash + description: "Transaction hash" + data_type: text + tests: + - not_null + - name: block_number + description: "Block number" + data_type: text + tests: + - not_null + - name: block_timestamp + description: "Block timestamp" + data_type: timestamp with time zone + tests: + - not_null + - name: event_name + description: "Event name" + data_type: text + tests: + - not_null + - accepted_values: + values: ["AccountCreated"] + - name: contract + description: "Address of the contract" + data_type: text + tests: + - not_null + - name: core_delegation_updated_base_mainnet + description: DelegationUpdated events from the CoreProxy contract + columns: + - name: contract + description: "Address of the contract" + data_type: text + tests: + - not_null + - name: id + description: "ID of the event record" + data_type: text + tests: + - not_null + - unique + - name: account_id + description: "ID of the account" + data_type: text + tests: + - not_null + - name: collateral_type + description: "Type of delegated collateral" + data_type: text + tests: + - not_null + - name: pool_id + description: "ID of the pool" + data_type: uint128 + tests: + - not_null + - name: sender + description: "Address of the delegator" + data_type: text + tests: + - not_null + - name: block_timestamp + description: "Block timestamp" + data_type: timestamp with time zone + tests: + - not_null + - name: block_number + description: "Block number" + data_type: integer + tests: + - not_null + - name: leverage + description: "Leverage" + data_type: uint256 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 1000000000000000000 + max_value: 1000000000000000000 + inclusive: true + - name: transaction_hash + description: "Transaction hash" + data_type: text + tests: + - not_null + - name: amount + description: "Amount delegated" + data_type: uint256 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: event_name + description: "Event name" + data_type: text + tests: + - not_null + - accepted_values: + values: ["DelegationUpdated"] + - name: core_deposited_base_mainnet + description: Deposited events from the CoreProxy contract + columns: + - name: collateral_type + description: "Type of delegated collateral" + data_type: text + tests: + - not_null + - name: id + description: "ID of the event record" + data_type: text + tests: + - not_null + - unique + - name: contract + description: "Address of the contract" + data_type: text + tests: + - not_null + - name: event_name + description: "Event name" + data_type: text + tests: + - not_null + - accepted_values: + values: ["Deposited"] + - name: transaction_hash + description: "Transaction hash" + data_type: text + tests: + - not_null + - name: account_id + description: "ID of the account" + data_type: uint128 + tests: + - not_null + - name: sender + description: "Address of the depositor" + data_type: text + tests: + - not_null + - name: block_timestamp + description: "Block timestamp" + data_type: timestamp with time zone + tests: + - not_null + - name: block_number + description: "Block number" + data_type: integer + tests: + - not_null + - name: token_amount + description: "Token amount deposited" + data_type: uint256 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: core_withdrawn_base_mainnet + description: Withdrawn events from the CoreProxy contract + columns: + - name: block_timestamp + description: "Block timestamp" + data_type: timestamp with time zone + tests: + - not_null + - name: contract + description: "Address of the contract" + data_type: text + tests: + - not_null + - name: block_number + description: "Block number" + data_type: integer + tests: + - not_null + - name: transaction_hash + description: "Transaction hash" + data_type: text + tests: + - not_null + - name: token_amount + description: "Token amount withdrawn" + data_type: uint256 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: collateral_type + description: "Type of delegated collateral" + data_type: text + tests: + - not_null + - name: account_id + description: "ID of the account" + data_type: uint128 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: id + description: "ID of the event record" + data_type: character varying + tests: + - not_null + - unique + - name: sender + description: "Address of the withdrawer" + data_type: text + tests: + - not_null + - name: event_name + description: "Event name" + data_type: text + tests: + - not_null + - accepted_values: + values: ["Withdrawn"] + - name: core_liquidation_base_mainnet + description: Liquidation events from the CoreProxy contract + columns: + - name: pool_id + description: "ID of the pool" + data_type: uint128 + tests: + - not_null + - name: block_timestamp + description: "Block timestamp" + data_type: timestamp with time zone + tests: + - not_null + - name: block_number + description: "Block number" + data_type: integer + tests: + - not_null + - name: id + description: "ID of the event record" + data_type: text + tests: + - not_null + - unique + - name: contract + description: "Address of the contract" + data_type: text + tests: + - not_null + - name: event_name + description: "Event name" + data_type: text + tests: + - not_null + - accepted_values: + values: ["Liquidation"] + - name: collateral_type + description: "Type of delegated collateral" + data_type: text + tests: + - not_null + - name: sender + description: "Address of the liquidator" + data_type: text + tests: + - not_null + - name: liquidation_data + data_type: array + - name: account_id + description: "ID of the account" + data_type: uint128 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: transaction_hash + description: "Transaction hash" + data_type: text + tests: + - not_null + - name: liquidate_as_account_id + data_type: uint128 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: core_market_updated_base_mainnet + description: > + Combination of MarketCollateralDeposited, MarketCollateralWithdrawn, + MarketUsdDeposited, MarketUsdWithdrawn events from the CoreProxy contract + columns: + - name: id + description: "ID of the event record" + data_type: text + tests: + - not_null + - unique + - name: block_timestamp + description: "Block timestamp" + data_type: timestamp with time zone + tests: + - not_null + - name: block_number + description: "Block number" + data_type: integer + tests: + - not_null + - name: transaction_hash + description: "Transaction hash" + data_type: text + tests: + - not_null + - name: contract + description: "Address of the contract" + data_type: text + tests: + - not_null + - name: event_name + description: "Event name" + data_type: text + tests: + - not_null + - accepted_values: + values: ["MarketCollateralWithdrawn", "MarketCollateralDeposited", "MarketUsdWithdrawn", "MarketUsdDeposited"] + - name: market_id + description: "ID of the market" + data_type: uint128 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: net_issuance + description: "Net issuance" + data_type: int128 + tests: + - not_null + - name: deposited_collateral_value + description: "Deposited collateral value" + data_type: uint256 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: sender + description: "Address of the event initiator" + data_type: text + tests: + - not_null + - name: collateral_type + description: "Type of delegated collateral" + data_type: text + tests: + - not_null + - name: credit_capacity + description: "Credit capacity" + data_type: int128 + tests: + - not_null + - name: token_amount + description: "Token amount" + data_type: uint256 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: core_market_registered_base_mainnet + description: MarketRegistered events from the CoreProxy contract + columns: + - name: market + description: "Market address" + data_type: text + tests: + - not_null + - name: market_id + description: "Market ID" + data_type: numeric + tests: + - not_null + - unique + - name: id + description: "ID of the event record" + data_type: text + tests: + - not_null + - unique + - name: block_timestamp + description: "Block timestamp" + data_type: timestamp with time zone + tests: + - not_null + - name: contract + description: "Address of the contract" + data_type: text + tests: + - not_null + - name: transaction_hash + description: "Transaction hash" + data_type: text + tests: + - not_null + - name: block_number + description: "Block number" + data_type: integer + tests: + - not_null + - name: event_name + description: "Event name" + data_type: text + tests: + - not_null + - accepted_values: + values: ["MarketRegistered"] + - name: sender + description: "Address of the event initiator" + data_type: text + tests: + - not_null + - name: core_pool_created_base_mainnet + description: "PoolCreated events from the CoreProxy contract" + columns: + - name: contract + description: "Address of the contract" + data_type: text + tests: + - not_null + - name: sender + description: "Address of the event initiator" + data_type: text + tests: + - not_null + - name: block_timestamp + description: "Block timestamp" + data_type: timestamp with time zone + tests: + - not_null + - name: id + description: "ID of the event record" + data_type: text + tests: + - not_null + - unique + - name: block_number + description: "Block number" + data_type: integer + tests: + - not_null + - name: transaction_hash + description: "Transaction hash" + data_type: text + tests: + - not_null + - name: event_name + description: "Event name" + data_type: text + tests: + - not_null + - accepted_values: + values: ["PoolCreated"] + - name: owner + description: "Address of the pool owner" + data_type: text + tests: + - not_null + - name: pool_id + description: "ID of the pool" + data_type: uint128 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: core_rewards_claimed_base_mainnet + description: RewardsClaimed events from the CoreProxy contract + columns: + - name: transaction_hash + description: "Transaction hash" + data_type: text + tests: + - not_null + - name: account_id + description: "ID of the account" + data_type: uint128 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: collateral_type + description: "Type of delegated collateral" + data_type: text + tests: + - not_null + - name: event_name + description: "Event name" + data_type: text + tests: + - not_null + - accepted_values: + values: ["RewardsClaimed"] + - name: contract + description: "Address of the contract" + data_type: text + tests: + - not_null + - name: amount + description: "Amount delegated" + data_type: uint256 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: distributor + description: "Address of the distributor" + data_type: text + tests: + - not_null + - name: block_timestamp + description: "Block timestamp" + data_type: timestamp with time zone + tests: + - not_null + - name: id + description: "ID of the event record" + data_type: text + tests: + - not_null + - unique + - name: pool_id + description: "ID of the pool" + data_type: uint128 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: block_number + description: "Block number" + data_type: integer + tests: + - not_null + - name: core_rewards_distributed_base_mainnet + description: RewardsDistributed events from the CoreProxy contract + columns: + - name: id + description: "ID of the event record" + data_type: text + tests: + - not_null + - unique + - name: event_name + description: "Event name" + data_type: text + tests: + - not_null + - accepted_values: + values: ["RewardsDistributed"] + - name: amount + description: "Amount claimed" + data_type: uint256 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: start + description: "UNIX timestamp" + data_type: uint256 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: contract + description: "Address of the contract" + data_type: text + tests: + - not_null + - name: block_timestamp + description: "Block timestamp" + data_type: timestamp with time zone + tests: + - not_null + - name: transaction_hash + description: "Transaction hash" + data_type: text + tests: + - not_null + - name: collateral_type + description: "Type of delegated collateral" + data_type: text + tests: + - not_null + - name: block_number + description: "Block number" + data_type: integer + tests: + - not_null + - name: duration + description: "Duration in seconds" + data_type: uint256 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: distributor + description: "Address of the distributor" + data_type: text + tests: + - not_null + - name: pool_id + description: "ID of the pool" + data_type: uint128 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: core_usd_burned_base_mainnet + description: UsdBurned events from the CoreProxy contract + columns: + - name: amount + description: "Amount burned" + data_type: uint256 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: pool_id + description: "ID of the pool" + data_type: uint128 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: event_name + description: "Event name" + data_type: text + tests: + - not_null + - accepted_values: + values: ["UsdBurned"] + - name: id + description: "ID of the event record" + data_type: text + tests: + - not_null + - unique + - name: block_number + description: "Block number" + data_type: integer + tests: + - not_null + - name: account_id + description: "ID of the account" + data_type: uint128 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: sender + description: "Address of the event initiator" + data_type: text + tests: + - not_null + - name: transaction_hash + description: "Transaction hash" + data_type: text + tests: + - not_null + - name: contract + description: "Address of the contract" + data_type: text + tests: + - not_null + - name: collateral_type + description: "Type of delegated collateral" + data_type: text + tests: + - not_null + - name: block_timestamp + description: "Block timestamp" + data_type: timestamp with time zone + tests: + - not_null + - name: core_usd_minted_base_mainnet + description: UsdMinted events from the CoreProxy contract + columns: + - name: pool_id + description: "ID of the pool" + data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: block_timestamp + description: "Block timestamp" + data_type: timestamp with time zone + tests: + - not_null + - name: account_id + description: "ID of the account" + data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: collateral_type + description: "Type of delegated collateral" + data_type: text + tests: + - not_null + - name: block_number + description: "Block number" + data_type: integer + tests: + - not_null + - name: id + description: "ID of the event record" + data_type: character varying + tests: + - not_null + - unique + - name: sender + description: "Address of the event initiator" + data_type: text + tests: + - not_null + - name: amount + description: "Amount minted" + data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: event_name + description: "Event name" + data_type: text + tests: + - not_null + - accepted_values: + values: ["UsdMinted"] + - name: transaction_hash + description: "Transaction hash" + data_type: text + tests: + - not_null + - name: contract + description: "Address of the contract" + data_type: text + tests: + - not_null + - name: core_vault_liquidation_base_mainnet + description: VaultLiquidation events from the CoreProxy contract + columns: + - name: transaction_hash + description: "Transaction hash" + data_type: text + tests: + - not_null + - name: collateral_type + description: "Type of delegated collateral" + data_type: text + tests: + - not_null + - name: pool_id + description: "ID of the pool" + data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: event_name + description: "Event name" + data_type: text + tests: + - not_null + - accepted_values: + values: ["VaultLiquidation"] + - name: id + description: "ID of the event record" + data_type: character varying + tests: + - not_null + - unique + - name: block_timestamp + description: "Block timestamp" + data_type: timestamp with time zone + tests: + - not_null + - name: liquidate_as_account_id + data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: liquidation_data + data_type: jsonb + tests: + - not_null + - name: contract + description: "Address of the contract" + data_type: text + tests: + - not_null + - name: block_number + description: "Block number" + data_type: integer + tests: + - not_null + - name: sender + description: "Address of the event initiator" + data_type: text + tests: + - not_null + - name: core_vault_collateral_base_mainnet + columns: + - name: ts + description: "Block timestamp" + data_type: timestamp with time zone + tests: + - not_null + - name: block_number + description: "Block number" + data_type: integer + tests: + - not_null + - name: pool_id + description: "ID of the pool" + data_type: integer + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: collateral_type + description: "Type of delegated collateral" + data_type: character varying + tests: + - not_null + - name: amount + description: "Collateral amount" + data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: collateral_value + description: "Vault collateral value" + data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: contract_address + description: "Address of the contract" + data_type: text + tests: + - not_null + - name: core_vault_debt_base_mainnet + columns: + - name: ts + description: "Block timestamp" + data_type: timestamp with time zone + tests: + - not_null + - name: block_number + description: "Block number" + data_type: integer + tests: + - not_null + - name: pool_id + description: "ID of the pool" + data_type: integer + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: collateral_type + description: "Type of delegated collateral" + data_type: character varying + tests: + - not_null + - name: debt + description: "Vault debt" + data_type: int256 + tests: + - not_null + - name: contract_address + description: "Address of the contract" + data_type: text + tests: + - not_null \ No newline at end of file diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_account_created_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_account_created_base_mainnet.sql new file mode 100644 index 00000000..d08ab804 --- /dev/null +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_account_created_base_mainnet.sql @@ -0,0 +1,20 @@ +with perps_account_created as ( + {{ get_event_data( + 'base', + 'mainnet', + 'synthetix', + 'perps_market_proxy', + 'account_created' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + owner, + cast(account_id as UInt128) as account_id +from perps_account_created diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_account_liquidation_attempt_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_account_liquidation_attempt_base_mainnet.sql new file mode 100644 index 00000000..78057e20 --- /dev/null +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_account_liquidation_attempt_base_mainnet.sql @@ -0,0 +1,21 @@ +with perps_account_liquidation_attempt as ( + {{ get_event_data( + 'base', + 'mainnet', + 'synthetix', + 'perps_market_proxy', + 'account_liquidation_attempt' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + cast(account_id as UInt128) as account_id, + cast(reward as UInt256) as reward, + full_liquidation +from perps_account_liquidation_attempt \ No newline at end of file diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_collateral_modified_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_collateral_modified_base_mainnet.sql new file mode 100644 index 00000000..db664074 --- /dev/null +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_collateral_modified_base_mainnet.sql @@ -0,0 +1,22 @@ +with perps_collateral_modified as ( + {{ get_event_data( + 'base', + 'mainnet', + 'synthetix', + 'perps_market_proxy', + 'collateral_modified' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + cast(account_id as UInt128) as account_id, + cast(collateral_id as UInt128) as collateral_id, + cast(amount_delta as Int256) as amount_delta, + sender +from perps_collateral_modified \ No newline at end of file diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_interest_charged_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_interest_charged_base_mainnet.sql new file mode 100644 index 00000000..f2cbf404 --- /dev/null +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_interest_charged_base_mainnet.sql @@ -0,0 +1,20 @@ +with perps_interest_charged as ( + {{ get_event_data( + 'base', + 'mainnet', + 'synthetix', + 'perps_market_proxy', + 'interest_charged' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + cast(account_id as UInt128) as account_id, + cast(interest as UInt256) as interest +from perps_interest_charged \ No newline at end of file diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_interest_rate_updated_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_interest_rate_updated_base_mainnet.sql new file mode 100644 index 00000000..a71995c3 --- /dev/null +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_interest_rate_updated_base_mainnet.sql @@ -0,0 +1,20 @@ +with perps_interest_rate_updated as ( + {{ get_event_data( + 'base', + 'mainnet', + 'synthetix', + 'perps_market_proxy', + 'interest_rate_updated' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + cast(super_market_id as UInt128) as super_market_id, + cast(interest_rate as UInt128) as interest_rate +from perps_interest_rate_updated \ No newline at end of file diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_market_created_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_market_created_base_mainnet.sql new file mode 100644 index 00000000..21cfeba8 --- /dev/null +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_market_created_base_mainnet.sql @@ -0,0 +1,21 @@ +with perps_market_created as ( + {{ get_event_data( + 'base', + 'mainnet', + 'synthetix', + 'perps_market_proxy', + 'market_created' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + market_name, + market_symbol, + cast(perps_market_id as UInt128) as perps_market_id +from perps_market_created \ No newline at end of file diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_market_updated_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_market_updated_base_mainnet.sql new file mode 100644 index 00000000..592cf978 --- /dev/null +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_market_updated_base_mainnet.sql @@ -0,0 +1,56 @@ +with legacy_events as ( + {{ get_event_data( + 'base', + 'mainnet', + 'synthetix', + 'perps_market_proxy_legacy', + 'market_updated' + ) }} +), + +current_events as ( + {{ get_event_data( + 'base', + 'mainnet', + 'synthetix', + 'perps_market_proxy', + 'market_updated' + ) }} +) + + +select + id, + block_number, + block_timestamp, + transaction_hash, + contract, + event_name, + cast(market_id as UInt128) as market_id, + cast(price as UInt256) as price, + cast(skew as Int256) as skew, + cast(size as UInt256) as size, + cast(size_delta as Int256) as size_delta, + cast(current_funding_rate as Int256) as current_funding_rate, + cast(current_funding_velocity as Int256) as current_funding_velocity, + 0 as interest_rate +from + legacy_events +union all +select + id, + block_number, + block_timestamp, + transaction_hash, + contract, + event_name, + cast(market_id as UInt128) as market_id, + cast(price as UInt256) as price, + cast(skew as Int256) as skew, + cast(size as UInt256) as size, + cast(size_delta as Int256) as size_delta, + cast(current_funding_rate as Int256) as current_funding_rate, + cast(current_funding_velocity as Int256) as current_funding_velocity, + cast(interest_rate as UInt128) as interest_rate +from + current_events \ No newline at end of file diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_order_committed_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_order_committed_base_mainnet.sql new file mode 100644 index 00000000..55799a19 --- /dev/null +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_order_committed_base_mainnet.sql @@ -0,0 +1,61 @@ +with legacy_events as ( + {{ get_event_data( + 'base', + 'mainnet', + 'synthetix', + 'perps_market_proxy_legacy', + 'order_committed' + ) }} +), + +current_events as ( + {{ get_event_data( + 'base', + 'mainnet', + 'synthetix', + 'perps_market_proxy', + 'order_committed' + ) }} +) + +select + id, + block_number, + block_timestamp, + transaction_hash, + contract, + event_name, + cast(market_id as UInt128) as market_id, + cast(account_id as UInt128) as account_id, + cast(commitment_time as UInt256) as commitment_time, + cast(expiration_time as UInt256) as expiration_time, + cast(settlement_time as UInt256) as settlement_time, + cast(null as Nullable(UInt256)) as expected_price_time, + cast(acceptable_price as UInt256) as acceptable_price, + cast(order_type as UInt8) as order_type, + cast(size_delta as Int128) as size_delta, + sender, + {{ convert_hex('tracking_code') }} as tracking_code +from + legacy_events +union all +select + id, + block_number, + block_timestamp, + transaction_hash, + contract, + event_name, + cast(market_id as UInt128) as market_id, + cast(account_id as UInt128) as account_id, + cast(commitment_time as UInt256) as commitment_time, + cast(expiration_time as UInt256) as expiration_time, + cast(settlement_time as UInt256) as settlement_time, + cast(expected_price_time as Nullable(UInt256)) as expected_price_time, + cast(acceptable_price as UInt256) as acceptable_price, + cast(order_type as UInt8) as order_type, + cast(size_delta as Int128) as size_delta, + sender, + {{ convert_hex('tracking_code') }} as tracking_code +from + current_events \ No newline at end of file diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_order_settled_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_order_settled_base_mainnet.sql new file mode 100644 index 00000000..cfe5bbfe --- /dev/null +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_order_settled_base_mainnet.sql @@ -0,0 +1,31 @@ +with perps_order_settled as ( + {{ get_event_data( + 'base', + 'mainnet', + 'synthetix', + 'perps_market_proxy', + 'order_settled' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + cast(market_id as UInt128) as market_id, + cast(account_id as UInt128) as account_id, + cast(fill_price as UInt256) as fill_price, + cast(pnl as Int256) as pnl, + cast(accrued_funding as Int256) as accrued_funding, + cast(size_delta as Int128) as size_delta, + cast(new_size as Int128) as new_size, + cast(total_fees as UInt256) as total_fees, + cast(referral_fees as UInt256) as referral_fees, + cast(collected_fees as UInt256) as collected_fees, + cast(settlement_reward as UInt256) as settlement_reward, + {{ convert_hex('tracking_code') }} as tracking_code, + settler +from perps_order_settled \ No newline at end of file diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_position_liquidated_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_position_liquidated_base_mainnet.sql new file mode 100644 index 00000000..c2704761 --- /dev/null +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_position_liquidated_base_mainnet.sql @@ -0,0 +1,22 @@ +with perps_position_liquidated as ( + {{ get_event_data( + 'base', + 'mainnet', + 'synthetix', + 'perps_market_proxy', + 'position_liquidated' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + cast(account_id as UInt128) as account_id, + cast(market_id as UInt128) as market_id, + cast(amount_liquidated as UInt256) as amount_liquidated, + cast(current_position_size as Int128) as current_position_size +from perps_position_liquidated \ No newline at end of file diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_previous_order_expired_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_previous_order_expired_base_mainnet.sql new file mode 100644 index 00000000..3f5b3bd4 --- /dev/null +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_previous_order_expired_base_mainnet.sql @@ -0,0 +1,24 @@ +with perps_previous_order_expired as ( + {{ get_event_data( + 'base', + 'mainnet', + 'synthetix', + 'perps_market_proxy', + 'previous_order_expired' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + cast(market_id as UInt128) as market_id, + cast(account_id as UInt128) as account_id, + cast(size_delta as Int128) as size_delta, + cast(acceptable_price as UInt256) as acceptable_price, + cast(commitment_time as UInt256) as commitment_time, + {{ convert_hex('tracking_code') }} as tracking_code +from perps_previous_order_expired \ No newline at end of file diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/schema.yml b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/schema.yml new file mode 100644 index 00000000..f004d2c1 --- /dev/null +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/schema.yml @@ -0,0 +1,669 @@ +version: 2 +models: + - name: perp_account_created_base_mainnet + description: AccountCreated events from the PerpsMarketProxy contract + columns: + - name: id + description: "ID of the event record" + data_type: text + tests: + - unique + - not_null + - name: event_name + description: "Event name" + data_type: text + tests: + - not_null + - accepted_values: + values: ["AccountCreated"] + - name: block_number + description: "Block number" + data_type: integer + tests: + - not_null + - name: block_timestamp + description: "Block timestamp" + data_type: timestamp with time zone + tests: + - not_null + - name: owner + description: "Address of the pool owner" + data_type: text + tests: + - not_null + - name: account_id + description: "ID of the account" + data_type: uint128 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: transaction_hash + description: "Transaction hash" + data_type: text + tests: + - not_null + - name: contract + description: "Address of the contract" + data_type: text + tests: + - not_null + - name: perp_order_committed_base_mainnet + description: OrderCommitted events from the PerpsMarketProxy contract + columns: + - name: id + description: "ID of the event record" + data_type: text + tests: + - unique + - not_null + - name: block_number + description: "Block number" + data_type: integer + tests: + - not_null + - name: block_timestamp + description: "Block timestamp" + data_type: timestamp with time zone + tests: + - not_null + - name: transaction_hash + description: "Transaction hash" + data_type: text + tests: + - not_null + - name: contract + description: "Address of the contract" + data_type: text + tests: + - not_null + - name: event_name + description: "Event name" + data_type: text + tests: + - not_null + - accepted_values: + values: ["OrderCommitted"] + - name: market_id + description: "ID of the market" + data_type: uint128 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: account_id + description: "ID of the account" + data_type: uint128 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: commitment_time + data_type: uint256 + - name: expiration_time + data_type: uint256 + - name: settlement_time + data_type: uint256 + - name: expected_price_time + data_type: uint256 + - name: acceptable_price + data_type: uint256 + - name: order_type + data_type: uint8 + - name: size_delta + data_type: int128 + - name: sender + data_type: text + - name: tracking_code + data_type: text + - name: perp_order_settled_base_mainnet + description: OrderSettled events from the PerpsMarketProxy contract + columns: + - name: contract + description: "Address of the contract" + data_type: text + tests: + - not_null + - name: fill_price + data_type: uint256 + - name: event_name + description: "Event name" + data_type: text + tests: + - not_null + - accepted_values: + values: ["OrderSettled"] + - name: settlement_reward + data_type: uint256 + - name: settler + data_type: text + - name: tracking_code + data_type: text + - name: total_fees + data_type: uint256 + - name: pnl + data_type: int256 + - name: account_id + description: "ID of the account" + data_type: uint128 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: market_id + description: "ID of the market" + data_type: uint128 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: collected_fees + description: "Amount of fees collected" + data_type: uint256 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: size_delta + data_type: int128 + - name: transaction_hash + description: "Transaction hash" + data_type: text + tests: + - not_null + - name: block_timestamp + description: "Block timestamp" + data_type: timestamp with time zone + tests: + - not_null + - name: block_number + description: "Block number" + data_type: integer + tests: + - not_null + - name: accrued_funding + data_type: int256 + - name: referral_fees + data_type: uint256 + - name: new_size + data_type: int128 + - name: id + description: "ID of the event record" + data_type: text + tests: + - unique + - not_null + - name: perp_market_updated_base_mainnet + description: MarketUpdated events from the PerpsMarketProxy contract + columns: + - name: id + description: "ID of the event record" + data_type: text + tests: + - unique + - not_null + - name: block_number + description: "Block number" + data_type: integer + tests: + - not_null + - name: block_timestamp + description: "Block timestamp" + data_type: timestamp with time zone + tests: + - not_null + - name: transaction_hash + description: "Transaction hash" + data_type: text + tests: + - not_null + - name: contract + description: "Address of the contract" + data_type: text + tests: + - not_null + - name: event_name + description: "Event name" + data_type: text + tests: + - not_null + - accepted_values: + values: ["MarketUpdated"] + - name: market_id + description: "Id of the market used for the trade." + data_type: uint128 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: price + description: "Price at the time of this event." + data_type: uint256 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: skew + description: "Market skew at the time of the trade. Positive values mean more longs." + data_type: int256 + - name: size + description: "Size of the entire market after settlement." + data_type: uint256 + - name: size_delta + description: "Change in market size during this update." + data_type: int256 + - name: current_funding_rate + description: "The current funding rate of this market (0.001 = 0.1% per day)" + data_type: int256 + - name: current_funding_velocity + description: "The current rate of change of the funding rate (0.001 = +0.1% per day)" + data_type: int256 + - name: interest_rate + description: "Current supermarket interest rate based on updated market OI." + data_type: uint128 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: perp_position_liquidated_base_mainnet + description: PositionLiquidated events from the PerpsMarketProxy contract + columns: + - name: account_id + description: "ID of the account" + data_type: uint128 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: market_id + description: "ID of the market" + data_type: uint128 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: id + description: "ID of the event record" + data_type: text + tests: + - unique + - not_null + - name: transaction_hash + description: "Transaction hash" + data_type: text + tests: + - not_null + - name: current_position_size + description: "Current position size" + data_type: int128 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: event_name + description: "Event name" + data_type: text + tests: + - not_null + - accepted_values: + values: ["PositionLiquidated"] + - name: block_number + description: "Block number" + data_type: integer + tests: + - not_null + - name: amount_liquidated + description: "Amount liquidated" + data_type: uint256 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: contract + description: "Address of the contract" + data_type: text + tests: + - not_null + - name: block_timestamp + description: "Block timestamp" + data_type: timestamp with time zone + tests: + - not_null + - name: perp_account_liquidation_attempt_base_mainnet + description: AccountLiquidationAttempt events from the PerpsMarketProxy contract + columns: + - name: id + description: "ID of the event record" + data_type: text + tests: + - unique + - not_null + - name: account_id + description: "ID of the account" + data_type: uint128 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: block_number + description: "Block number" + data_type: integer + tests: + - not_null + - name: reward + description: "Reward" + data_type: uint256 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: block_timestamp + description: "Block timestamp" + data_type: timestamp with time zone + tests: + - not_null + - name: contract + description: "Address of the contract" + data_type: text + tests: + - not_null + - name: event_name + description: "Event name" + data_type: text + tests: + - not_null + - accepted_values: + values: ["AccountLiquidationAttempt"] + - name: transaction_hash + description: "Transaction hash" + data_type: text + tests: + - not_null + - name: full_liquidation + description: "Whether it is a full or partial liquidation" + data_type: boolean + tests: + - not_null + - name: perp_collateral_modified_base_mainnet + description: CollateralModified events from the PerpsMarketProxy contract + columns: + - name: block_timestamp + description: "Block timestamp" + data_type: timestamp with time zone + tests: + - not_null + - name: contract + description: "Address of the contract" + data_type: text + tests: + - not_null + - name: event_name + description: "Event name" + data_type: text + tests: + - not_null + - accepted_values: + values: ["CollateralModified"] + - name: block_number + description: "Block number" + data_type: integer + tests: + - not_null + - name: amount_delta + data_type: int256 + - name: collateral_id + description: "ID of the synth market" + data_type: uint128 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: id + description: "ID of the event record" + data_type: text + tests: + - unique + - not_null + - name: sender + description: "Sender address" + data_type: text + tests: + - not_null + - name: account_id + description: "ID of the account" + data_type: uint128 + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: transaction_hash + description: "Transaction hash" + data_type: text + tests: + - not_null + - name: perp_previous_order_expired_base_mainnet + description: PreviousOrderExpired events from the PerpsMarketProxy contract + columns: + - name: block_timestamp + description: "Block timestamp" + data_type: timestamp with time zone + tests: + - not_null + - name: tracking_code + description: "Tracking code" + data_type: text + - name: id + description: "ID of the event record" + tests: + - unique + - not_null + - name: size_delta + data_type: numeric + - name: block_number + description: "Block number" + data_type: integer + tests: + - not_null + - name: market_id + description: "ID of the market" + data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: event_name + description: "Event name" + data_type: text + tests: + - not_null + - accepted_values: + values: ["PreviousOrderExpired"] + - name: commitment_time + data_type: numeric + - name: transaction_hash + description: "Transaction hash" + data_type: text + tests: + - not_null + - name: account_id + description: "ID of the account" + data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: acceptable_price + data_type: numeric + - name: contract + description: "Address of the contract" + data_type: text + tests: + - not_null + - name: perp_market_created_base_mainnet + description: MarketCreated events from the PerpsMarketProxy contract + columns: + - name: market_name + description: "Market name" + data_type: text + tests: + - not_null + - name: id + description: "ID of the event record" + tests: + - unique + - not_null + - name: market_symbol + description: "Market symbol" + data_type: text + tests: + - not_null + - name: event_name + description: "Event name" + data_type: text + tests: + - not_null + - accepted_values: + values: ["MarketCreated"] + - name: block_number + description: "Block number" + data_type: integer + tests: + - not_null + - name: block_timestamp + description: "Block timestamp" + data_type: timestamp with time zone + tests: + - not_null + - name: contract + description: "Address of the contract" + data_type: text + tests: + - not_null + - name: perps_market_id + description: "ID of the perps market" + data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: transaction_hash + description: "Transaction hash" + data_type: text + tests: + - not_null + - name: perp_interest_charged_base_mainnet + description: InterestCharged events from the PerpsMarketProxy contract + columns: + - name: event_name + description: "Event name" + data_type: text + tests: + - not_null + - accepted_values: + values: ["InterestCharged"] + - name: contract + description: "Address of the contract" + data_type: text + tests: + - not_null + - name: transaction_hash + description: "Transaction hash" + data_type: text + tests: + - not_null + - name: block_timestamp + description: "Block timestamp" + data_type: timestamp with time zone + tests: + - not_null + - name: id + description: "ID of the event record" + tests: + - unique + - not_null + - name: block_number + description: "Block number" + data_type: integer + tests: + - not_null + - name: interest + data_type: numeric + - name: account_id + description: "ID of the account" + data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: perp_interest_rate_updated_base_mainnet + description: InterestRateUpdated events from the PerpsMarketProxy contract + columns: + - name: block_timestamp + description: "Block timestamp" + data_type: timestamp with time zone + tests: + - not_null + - name: event_name + description: "Event name" + data_type: text + tests: + - not_null + - accepted_values: + values: ["InterestRateUpdated"] + - name: transaction_hash + description: "Transaction hash" + data_type: text + tests: + - not_null + - name: interest_rate + description: "Interest rate" + data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: block_number + description: "Block number" + data_type: integer + tests: + - not_null + - name: id + description: "ID of the event record" + tests: + - unique + - not_null + - name: contract + description: "Address of the contract" + data_type: text + tests: + - not_null + - name: super_market_id + description: "ID of the super market" + data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true \ No newline at end of file diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/schema.yml b/transformers/synthetix/models/core/base/mainnet/synthetix/schema.yml new file mode 100644 index 00000000..a56c30ab --- /dev/null +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/schema.yml @@ -0,0 +1,19 @@ +version: 2 +models: + - name: blocks_base_mainnet + description: Block numbers and timestamps + tests: + - dbt_utils.recency: + datepart: hour + field: ts + interval: 1 + columns: + - name: ts + description: UTC timestamp + data_type: timestamp with time zone + - name: block_number + description: Block height + data_type: integer + tests: + - not_null + - unique diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/spot/schema.yml b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/schema.yml new file mode 100644 index 00000000..9538eaec --- /dev/null +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/schema.yml @@ -0,0 +1,525 @@ +version: 2 +models: + - name: spot_order_committed_base_mainnet + description: OrderCommitted events from the SpotMarketProxy contract + columns: + - name: id + description: "ID of the event record" + data_type: character varying + tests: + - not_null + - unique + - name: event_name + description: "Event name" + data_type: text + tests: + - not_null + - accepted_values: + values: ["OrderCommitted"] + - name: sender + description: "Address of the delegator" + data_type: text + tests: + - not_null + - name: block_timestamp + description: "Block timestamp" + data_type: timestamp with time zone + tests: + - not_null + - name: referrer + description: "Address of the referrer" + data_type: text + tests: + - not_null + - name: amount_provided + description: "Amount provided" + data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: async_order_id + description: "Async order ID" + data_type: numeric + - name: transaction_hash + description: "Transaction hash" + data_type: text + tests: + - not_null + - name: contract + description: "Address of the contract" + data_type: text + tests: + - not_null + - name: market_id + description: "ID of the market" + data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: block_number + description: "Block number" + data_type: integer + tests: + - not_null + - name: order_type + description: "Type of order" + data_type: integer + tests: + - not_null + - name: spot_order_settled_base_mainnet + description: OrderSettled events from the SpotMarketProxy contract + columns: + - name: final_order_amount + description: "Final order amount" + data_type: numeric + tests: + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: settler + description: "Address of the settler" + data_type: text + tests: + - not_null + - name: block_number + description: "Block number" + data_type: integer + tests: + - not_null + - name: transaction_hash + description: "Transaction hash" + data_type: text + tests: + - not_null + - name: block_timestamp + description: "Block timestamp" + data_type: timestamp with time zone + tests: + - not_null + - name: id + description: "ID of the event record" + data_type: character varying + tests: + - not_null + - unique + - name: async_order_id + description: "Async order ID" + data_type: numeric + - name: order_type + description: "Type of order" + data_type: integer + tests: + - not_null + - name: contract + description: "Address of the contract" + data_type: text + tests: + - not_null + - name: price + description: "Synth price" + data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: market_id + description: "ID of the market" + data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: collected_fees + description: "Amount of fees collected" + data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: fees + description: "Fees data" + data_type: jsonb + - name: event_name + description: "Event name" + data_type: text + tests: + - not_null + - accepted_values: + values: ["OrderSettled"] + - name: spot_order_cancelled_base_mainnet + description: OrderCancelled events from the SpotMarketProxy contract + columns: + - name: id + description: "ID of the event record" + data_type: character varying + tests: + - not_null + - unique + - name: async_order_claim + description: "Async order clain" + data_type: jsonb + - name: block_timestamp + description: "Block timestamp" + data_type: timestamp with time zone + tests: + - not_null + - name: transaction_hash + description: "Transaction hash" + data_type: text + tests: + - not_null + - name: sender + description: "Address of the delegator" + data_type: text + tests: + - not_null + - name: contract + description: "Address of the contract" + data_type: text + tests: + - not_null + - name: event_name + description: "Event name" + data_type: text + tests: + - not_null + - accepted_values: + values: ["OrderCancelled"] + - name: async_order_id + description: "Async order ID" + data_type: numeric + - name: market_id + description: "ID of the market" + data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: block_number + description: "Block number" + data_type: integer + tests: + - not_null + - name: spot_synth_registered_base_mainnet + description: SynthRegistered events from the SpotMarketProxy contract + columns: + - name: id + description: "ID of the event record" + data_type: character varying + tests: + - not_null + - unique + - name: block_timestamp + description: "Block timestamp" + data_type: timestamp with time zone + tests: + - not_null + - name: synth_market_id + description: "ID of the synth market" + data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: block_number + description: "Block number" + data_type: integer + tests: + - not_null + - name: contract + description: "Address of the contract" + data_type: text + tests: + - not_null + - name: synth_token_address + description: "Address of the synth token" + data_type: text + tests: + - not_null + - name: event_name + description: "Event name" + data_type: text + tests: + - not_null + - accepted_values: + values: ["SynthRegistered"] + - name: transaction_hash + description: "Transaction hash" + data_type: text + tests: + - not_null + - name: spot_synth_bought_base_mainnet + description: SynthBought events from the SpotMarketProxy contract + columns: + - name: collected_fees + description: "Amount of fees collected" + data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: transaction_hash + description: "Transaction hash" + data_type: text + tests: + - not_null + - name: synth_market_id + description: "ID of the synth market" + data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: block_number + description: "Block number" + data_type: integer + tests: + - not_null + - name: block_timestamp + description: "Block timestamp" + data_type: timestamp with time zone + tests: + - not_null + - name: id + description: "ID of the event record" + data_type: character varying + tests: + - not_null + - unique + - name: price + description: "Synth price" + data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: contract + description: "Address of the contract" + data_type: text + tests: + - not_null + - name: referrer + description: "Address of the referrer" + data_type: text + tests: + - not_null + - name: fees + description: "Fees data" + data_type: jsonb + - name: synth_returned + data_type: numeric + - name: event_name + description: "Event name" + data_type: text + tests: + - not_null + - accepted_values: + values: ["SynthBought"] + - name: spot_synth_sold_base_mainnet + description: SynthSold events from the SpotMarketProxy contract + columns: + - name: event_name + description: "Event name" + data_type: text + tests: + - not_null + - accepted_values: + values: ["SynthSold"] + - name: transaction_hash + description: "Transaction hash" + data_type: text + tests: + - not_null + - name: collected_fees + description: "Amount of fees collected" + data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: block_timestamp + description: "Block timestamp" + data_type: timestamp with time zone + tests: + - not_null + - name: referrer + description: "Address of the referrer" + data_type: text + tests: + - not_null + - name: fees + description: "Fees data" + data_type: jsonb + - name: block_number + description: "Block number" + data_type: integer + tests: + - not_null + - name: price + description: "Synth price" + data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: amount_returned + description: "Amount returned" + data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: synth_market_id + description: "ID of the synth market" + data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: id + description: "ID of the event record" + data_type: character varying + tests: + - not_null + - unique + - name: contract + description: "Address of the contract" + data_type: text + tests: + - not_null + - name: spot_synth_wrapped_base_mainnet + description: SynthWrapped events from the SpotMarketProxy contract + columns: + - name: fees + description: "Fees data" + data_type: jsonb + - name: id + description: "ID of the event record" + data_type: character varying + tests: + - not_null + - unique + - name: transaction_hash + description: "Transaction hash" + data_type: text + tests: + - not_null + - name: synth_market_id + description: "ID of the synth market" + data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: contract + description: "Address of the contract" + data_type: text + tests: + - not_null + - name: event_name + description: "Event name" + data_type: text + tests: + - not_null + - accepted_values: + values: ["SynthWrapped"] + - name: block_timestamp + description: "Block timestamp" + data_type: timestamp with time zone + tests: + - not_null + - name: block_number + description: "Block number" + data_type: integer + tests: + - not_null + - name: amount_wrapped + data_type: numeric + - name: fees_collected + description: "Amount of fees collected" + data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: spot_synth_unwrapped_base_mainnet + description: SynthUnwrapped events from the SpotMarketProxy contract + columns: + - name: block_timestamp + description: "Block timestamp" + data_type: timestamp with time zone + tests: + - not_null + - name: amount_unwrapped + description: "Amount of synth unwrapped" + data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: fees_collected + description: "Amount of fees collected" + data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: event_name + description: "Event name" + data_type: text + tests: + - not_null + - accepted_values: + values: ["SynthUnwrapped"] + - name: fees + description: "Fees data" + data_type: jsonb + - name: block_number + description: "Block number" + data_type: integer + tests: + - not_null + - name: transaction_hash + description: "Transaction hash" + data_type: text + tests: + - not_null + - name: contract + description: "Address of the contract" + data_type: text + tests: + - not_null + - name: id + description: "ID of the event record" + data_type: character varying + tests: + - not_null + - unique + - name: synth_market_id + description: "ID of the synth market" + data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true \ No newline at end of file diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_order_cancelled_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_order_cancelled_base_mainnet.sql new file mode 100644 index 00000000..f8ad741f --- /dev/null +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_order_cancelled_base_mainnet.sql @@ -0,0 +1,22 @@ +with spot_order_cancelled as ( + {{ get_event_data( + 'base', + 'mainnet', + 'synthetix', + 'spot_market_proxy', + 'order_cancelled' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + sender, + async_order_claim, + market_id, + async_order_id +from spot_order_cancelled \ No newline at end of file diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_order_committed_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_order_committed_base_mainnet.sql new file mode 100644 index 00000000..53f5db98 --- /dev/null +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_order_committed_base_mainnet.sql @@ -0,0 +1,24 @@ +with spot_order_committed as ( + {{ get_event_data( + 'base', + 'mainnet', + 'synthetix', + 'spot_market_proxy', + 'order_committed' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + cast(market_id as UInt128) as market_id, + cast(order_type as UInt8) as order_type, + cast(amount_provided as UInt256) as amount_provided, + cast(async_order_id as UInt128) as async_order_id, + sender, + referrer +from spot_order_committed \ No newline at end of file diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_order_settled_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_order_settled_base_mainnet.sql new file mode 100644 index 00000000..79658f28 --- /dev/null +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_order_settled_base_mainnet.sql @@ -0,0 +1,26 @@ +with spot_order_settled as ( + {{ get_event_data( + 'base', + 'mainnet', + 'synthetix', + 'spot_market_proxy', + 'order_settled' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + cast(market_id as UInt128) as market_id, + cast(async_order_id as UInt128) as async_order_id, + cast(final_order_amount as UInt256) as final_order_amount, + fees, + cast(collected_fees as UInt256) as collected_fees, + settler, + cast(price as UInt256) as price, + cast(order_type as UInt8) as order_type +from spot_order_settled \ No newline at end of file diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_bought_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_bought_base_mainnet.sql new file mode 100644 index 00000000..4ee909c5 --- /dev/null +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_bought_base_mainnet.sql @@ -0,0 +1,24 @@ +with spot_synth_bought as ( + {{ get_event_data( + 'base', + 'mainnet', + 'synthetix', + 'spot_market_proxy', + 'synth_bought' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + cast(synth_market_id as UInt128) as synth_market_id, + cast(synth_returned as UInt256) as synth_returned, + fees, + cast(collected_fees as UInt256) as collected_fees, + referrer, + cast(price as UInt256) as price +from spot_synth_bought diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_registered_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_registered_base_mainnet.sql new file mode 100644 index 00000000..ac8d44b5 --- /dev/null +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_registered_base_mainnet.sql @@ -0,0 +1,20 @@ +with spot_synth_registered as ( + {{ get_event_data( + 'base', + 'mainnet', + 'synthetix', + 'spot_market_proxy', + 'synth_registered' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + cast(synth_market_id as UInt128) as synth_market_id, + synth_token_address +from spot_synth_registered \ No newline at end of file diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_sold_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_sold_base_mainnet.sql new file mode 100644 index 00000000..88ca6476 --- /dev/null +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_sold_base_mainnet.sql @@ -0,0 +1,24 @@ +with spot_synth_sold as ( + {{ get_event_data( + 'base', + 'mainnet', + 'synthetix', + 'spot_market_proxy', + 'synth_sold' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + cast(synth_market_id as UInt128) as synth_market_id, + cast(amount_returned as UInt256) as amount_returned, + fees, + cast(collected_fees as UInt256) as collected_fees, + referrer, + cast(price as UInt256) as price +from spot_synth_sold \ No newline at end of file diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_unwrapped_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_unwrapped_base_mainnet.sql new file mode 100644 index 00000000..c3e8938c --- /dev/null +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_unwrapped_base_mainnet.sql @@ -0,0 +1,22 @@ +with spot_synth_unwrapped as ( + {{ get_event_data( + 'base', + 'mainnet', + 'synthetix', + 'spot_market_proxy', + 'synth_unwrapped' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + cast(synth_market_id as UInt128) as synth_market_id, + cast(amount_unwrapped as UInt256) as amount_unwrapped, + fees, + cast(fees_collected as UInt256) as fees_collected +from spot_synth_unwrapped diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_wrapped_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_wrapped_base_mainnet.sql new file mode 100644 index 00000000..66bbd038 --- /dev/null +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_wrapped_base_mainnet.sql @@ -0,0 +1,22 @@ +with spot_synth_wrapped as ( + {{ get_event_data( + 'base', + 'mainnet', + 'synthetix', + 'spot_market_proxy', + 'synth_wrapped' + ) }} +) + +select + id, + block_timestamp, + block_number, + transaction_hash, + contract, + event_name, + cast(synth_market_id as UInt256) as synth_market_id, + cast(amount_wrapped as UInt256) as amount_wrapped, + fees, + cast(fees_collected as UInt256) as fees_collected +from spot_synth_wrapped diff --git a/transformers/synthetix/models/core/sources.yml b/transformers/synthetix/models/core/sources.yml index 5f94d485..0343dd64 100644 --- a/transformers/synthetix/models/core/sources.yml +++ b/transformers/synthetix/models/core/sources.yml @@ -45,6 +45,61 @@ sources: - name: synthetix_core_proxy_event_market_usd_deposited - name: synthetix_core_proxy_event_market_usd_withdrawn + - name: blocks_parquet + - name: get_vault_collateral + - name: get_vault_debt + + - name: raw_base_mainnet + database: raw_base_mainnet + schema: raw_base_mainnet + tables: + - name: synthetix_block + + - name: synthetix_buyback_snx_event_buyback_processed + - name: synthetix_buyback_snx_legacy_event_buyback_processed + + - name: synthetix_perps_market_proxy_event_account_created + - name: synthetix_perps_market_proxy_event_account_liquidation_attempt + - name: synthetix_perps_market_proxy_event_collateral_modified + - name: synthetix_perps_market_proxy_event_market_created + - name: synthetix_perps_market_proxy_event_market_updated + - name: synthetix_perps_market_proxy_legacy_event_market_updated + - name: synthetix_perps_market_proxy_event_order_committed + - name: synthetix_perps_market_proxy_legacy_event_order_committed + - name: synthetix_perps_market_proxy_event_order_settled + - name: synthetix_perps_market_proxy_event_position_liquidated + - name: synthetix_perps_market_proxy_event_previous_order_expired + - name: synthetix_perps_market_proxy_event_interest_rate_updated + - name: synthetix_perps_market_proxy_event_interest_charged + + - name: synthetix_spot_market_proxy_event_order_committed + - name: synthetix_spot_market_proxy_event_order_settled + - name: synthetix_spot_market_proxy_event_order_cancelled + - name: synthetix_spot_market_proxy_event_synth_registered + - name: synthetix_spot_market_proxy_event_synth_bought + - name: synthetix_spot_market_proxy_event_synth_sold + - name: synthetix_spot_market_proxy_event_synth_wrapped + - name: synthetix_spot_market_proxy_event_synth_unwrapped + + - name: synthetix_core_proxy_event_account_created + - name: synthetix_core_proxy_event_delegation_updated + - name: synthetix_core_proxy_event_deposited + - name: synthetix_core_proxy_event_withdrawn + - name: synthetix_core_proxy_event_liquidation + - name: synthetix_core_proxy_event_market_registered + - name: synthetix_core_proxy_event_pool_created + - name: synthetix_core_proxy_event_rewards_claimed + - name: synthetix_core_proxy_event_rewards_distributed + - name: synthetix_core_proxy_event_usd_burned + - name: synthetix_core_proxy_event_usd_minted + - name: synthetix_core_proxy_event_vault_liquidation + - name: synthetix_core_proxy_event_market_collateral_deposited + - name: synthetix_core_proxy_event_market_collateral_withdrawn + - name: synthetix_core_proxy_event_market_usd_deposited + - name: synthetix_core_proxy_legacy_event_market_usd_deposited + - name: synthetix_core_proxy_event_market_usd_withdrawn + - name: synthetix_core_proxy_legacy_event_market_usd_withdrawn + - name: blocks_parquet - name: get_vault_collateral - name: get_vault_debt \ No newline at end of file diff --git a/transformers/synthetix/profiles/profiles.yml b/transformers/synthetix/profiles/profiles.yml index a3126395..6c498e54 100644 --- a/transformers/synthetix/profiles/profiles.yml +++ b/transformers/synthetix/profiles/profiles.yml @@ -8,6 +8,7 @@ clickhouse: user: default password: "" dbname: default + schema: prod custom_settings: allow_experimental_json_type: 1 From 060282f3ee1691db8ceb604a461c626207d89531 Mon Sep 17 00:00:00 2001 From: marcus-snx Date: Thu, 12 Dec 2024 23:57:14 +0200 Subject: [PATCH 16/21] Fix linting --- transformers/synthetix/.sqlfluff | 3 +++ .../synthetix/blocks_arbitrum_mainnet.sql | 2 +- .../core_account_created_arbitrum_mainnet.sql | 2 +- ...ore_delegation_updated_arbitrum_mainnet.sql | 4 ++-- .../core/core_deposited_arbitrum_mainnet.sql | 4 ++-- .../core/core_liquidation_arbitrum_mainnet.sql | 4 ++-- ...core_market_registered_arbitrum_mainnet.sql | 2 +- .../core_market_updated_arbitrum_mainnet.sql | 16 ++++++++++++---- .../core_pool_created_arbitrum_mainnet.sql | 2 +- .../core_rewards_claimed_arbitrum_mainnet.sql | 4 ++-- ...re_rewards_distributed_arbitrum_mainnet.sql | 4 ++-- .../core/core_usd_burned_arbitrum_mainnet.sql | 2 +- .../core/core_usd_minted_arbitrum_mainnet.sql | 4 ++-- ...core_vault_liquidation_arbitrum_mainnet.sql | 4 ++-- .../core/core_withdrawn_arbitrum_mainnet.sql | 2 +- .../perp_account_created_arbitrum_mainnet.sql | 2 +- ...nt_liquidation_attempt_arbitrum_mainnet.sql | 4 ++-- ...rp_collateral_modified_arbitrum_mainnet.sql | 4 ++-- .../perp_interest_charged_arbitrum_mainnet.sql | 4 ++-- ..._interest_rate_updated_arbitrum_mainnet.sql | 4 ++-- .../perp_market_created_arbitrum_mainnet.sql | 4 ++-- .../perp_market_updated_arbitrum_mainnet.sql | 4 ++-- .../perp_order_committed_arbitrum_mainnet.sql | 4 ++-- .../perp_order_settled_arbitrum_mainnet.sql | 4 ++-- ...rp_position_liquidated_arbitrum_mainnet.sql | 4 ++-- ...previous_order_expired_arbitrum_mainnet.sql | 4 ++-- .../spot_order_cancelled_arbitrum_mainnet.sql | 4 ++-- .../spot_order_committed_arbitrum_mainnet.sql | 4 ++-- .../spot_order_settled_arbitrum_mainnet.sql | 4 ++-- .../spot_synth_bought_arbitrum_mainnet.sql | 2 +- .../spot_synth_registered_arbitrum_mainnet.sql | 4 ++-- .../spot/spot_synth_sold_arbitrum_mainnet.sql | 4 ++-- .../spot_synth_unwrapped_arbitrum_mainnet.sql | 2 +- .../spot_synth_wrapped_arbitrum_mainnet.sql | 2 +- .../mainnet/synthetix/blocks_base_mainnet.sql | 2 +- .../buyback/buyback_processed_base_mainnet.sql | 4 ++-- .../core/core_account_created_base_mainnet.sql | 2 +- .../core_delegation_updated_base_mainnet.sql | 4 ++-- .../core/core_deposited_base_mainnet.sql | 4 ++-- .../core/core_liquidation_base_mainnet.sql | 4 ++-- .../core_market_registered_base_mainnet.sql | 2 +- .../core/core_market_updated_base_mainnet.sql | 18 +++++++++++++----- .../core/core_pool_created_base_mainnet.sql | 2 +- .../core/core_rewards_claimed_base_mainnet.sql | 4 ++-- .../core_rewards_distributed_base_mainnet.sql | 4 ++-- .../core/core_usd_burned_base_mainnet.sql | 2 +- .../core/core_usd_minted_base_mainnet.sql | 4 ++-- .../core_vault_liquidation_base_mainnet.sql | 4 ++-- .../core/core_withdrawn_base_mainnet.sql | 2 +- .../perp/perp_account_created_base_mainnet.sql | 2 +- ...ccount_liquidation_attempt_base_mainnet.sql | 4 ++-- .../perp_collateral_modified_base_mainnet.sql | 4 ++-- .../perp_interest_charged_base_mainnet.sql | 4 ++-- ...perp_interest_rate_updated_base_mainnet.sql | 4 ++-- .../perp/perp_market_created_base_mainnet.sql | 4 ++-- .../perp/perp_market_updated_base_mainnet.sql | 6 +++--- .../perp/perp_order_committed_base_mainnet.sql | 6 +++--- .../perp/perp_order_settled_base_mainnet.sql | 4 ++-- .../perp_position_liquidated_base_mainnet.sql | 4 ++-- ...erp_previous_order_expired_base_mainnet.sql | 4 ++-- .../spot/spot_order_cancelled_base_mainnet.sql | 4 ++-- .../spot/spot_order_committed_base_mainnet.sql | 4 ++-- .../spot/spot_order_settled_base_mainnet.sql | 4 ++-- .../spot/spot_synth_bought_base_mainnet.sql | 2 +- .../spot_synth_registered_base_mainnet.sql | 4 ++-- .../spot/spot_synth_sold_base_mainnet.sql | 4 ++-- .../spot/spot_synth_unwrapped_base_mainnet.sql | 2 +- .../spot/spot_synth_wrapped_base_mainnet.sql | 2 +- 68 files changed, 140 insertions(+), 121 deletions(-) diff --git a/transformers/synthetix/.sqlfluff b/transformers/synthetix/.sqlfluff index c86ca6df..a2b1ffe3 100644 --- a/transformers/synthetix/.sqlfluff +++ b/transformers/synthetix/.sqlfluff @@ -28,6 +28,9 @@ allow_scalar = False [sqlfluff:rules:capitalisation.identifiers] extended_capitalisation_policy = lower +[sqlfluff:rules:capitalisation.types] +extended_capitalisation_policy = pascal + [sqlfluff:rules:capitalisation.functions] capitalisation_policy = lower diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/blocks_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/blocks_arbitrum_mainnet.sql index a1fbd9ed..d05370fe 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/blocks_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/blocks_arbitrum_mainnet.sql @@ -41,4 +41,4 @@ select from combined_blocks group by - block_number \ No newline at end of file + block_number diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_account_created_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_account_created_arbitrum_mainnet.sql index ae44b709..c8ae31bc 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_account_created_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_account_created_arbitrum_mainnet.sql @@ -1,5 +1,5 @@ with core_account_created as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'arbitrum', 'mainnet', 'synthetix', diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_delegation_updated_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_delegation_updated_arbitrum_mainnet.sql index 16f89c81..2d6910b4 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_delegation_updated_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_delegation_updated_arbitrum_mainnet.sql @@ -1,5 +1,5 @@ with delegation_updated as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'arbitrum', 'mainnet', 'synthetix', @@ -22,4 +22,4 @@ select cast(amount as UInt256) as amount, cast(leverage as UInt256) as leverage from - delegation_updated \ No newline at end of file + delegation_updated diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_deposited_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_deposited_arbitrum_mainnet.sql index c6bd6bb2..88f5626e 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_deposited_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_deposited_arbitrum_mainnet.sql @@ -1,5 +1,5 @@ with core_deposited as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'arbitrum', 'mainnet', 'synthetix', @@ -19,4 +19,4 @@ select cast(account_id as UInt128) as account_id, collateral_type, cast(token_amount as UInt256) as token_amount -from core_deposited \ No newline at end of file +from core_deposited diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_liquidation_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_liquidation_arbitrum_mainnet.sql index b5c138da..b9c759fb 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_liquidation_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_liquidation_arbitrum_mainnet.sql @@ -1,5 +1,5 @@ with core_liquidation as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'arbitrum', 'mainnet', 'synthetix', @@ -21,4 +21,4 @@ select cast(pool_id as UInt128) as pool_id, collateral_type, cast(liquidate_as_account_id as UInt128) as liquidate_as_account_id -from core_liquidation \ No newline at end of file +from core_liquidation diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_market_registered_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_market_registered_arbitrum_mainnet.sql index 87885bfe..d5056259 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_market_registered_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_market_registered_arbitrum_mainnet.sql @@ -1,5 +1,5 @@ with core_market_registered as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'arbitrum', 'mainnet', 'synthetix', diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_market_updated_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_market_updated_arbitrum_mainnet.sql index 598f9bf0..fae0376b 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_market_updated_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_market_updated_arbitrum_mainnet.sql @@ -10,7 +10,9 @@ with events as ( collateral_type, cast(market_id as UInt128) as market_id, cast(net_issuance as Int128) as net_issuance, - cast(deposited_collateral_value as UInt256) as deposited_collateral_value, + cast( + deposited_collateral_value as UInt256 + ) as deposited_collateral_value, cast(credit_capacity as Int128) as credit_capacity, cast(token_amount as UInt256) as token_amount from @@ -35,7 +37,9 @@ with events as ( collateral_type, cast(market_id as UInt128) as market_id, cast(net_issuance as Int128) as net_issuance, - cast(deposited_collateral_value as UInt256) as deposited_collateral_value, + cast( + deposited_collateral_value as UInt256 + ) as deposited_collateral_value, cast(credit_capacity as Int128) as credit_capacity, cast(token_amount as UInt256) as token_amount from @@ -60,7 +64,9 @@ with events as ( 'USD' as collateral_type, cast(market_id as UInt128) as market_id, cast(net_issuance as Int128) as net_issuance, - cast(deposited_collateral_value as UInt256) as deposited_collateral_value, + cast( + deposited_collateral_value as UInt256 + ) as deposited_collateral_value, cast(credit_capacity as Int128) as credit_capacity, cast(amount as UInt256) as token_amount from @@ -85,7 +91,9 @@ with events as ( 'USD' as collateral_type, cast(market_id as UInt128) as market_id, cast(net_issuance as Int128) as net_issuance, - cast(deposited_collateral_value as UInt256) as deposited_collateral_value, + cast( + deposited_collateral_value as UInt256 + ) as deposited_collateral_value, cast(credit_capacity as Int128) as credit_capacity, cast(amount as UInt256) as token_amount from diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_pool_created_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_pool_created_arbitrum_mainnet.sql index 24495b73..50900539 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_pool_created_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_pool_created_arbitrum_mainnet.sql @@ -1,5 +1,5 @@ with core_pool_created as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'arbitrum', 'mainnet', 'synthetix', diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_rewards_claimed_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_rewards_claimed_arbitrum_mainnet.sql index 4623ba7f..f1ac5a77 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_rewards_claimed_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_rewards_claimed_arbitrum_mainnet.sql @@ -1,5 +1,5 @@ with core_rewards_claimed as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'arbitrum', 'mainnet', 'synthetix', @@ -20,4 +20,4 @@ select collateral_type, distributor, cast(amount as UInt256) as amount -from core_rewards_claimed \ No newline at end of file +from core_rewards_claimed diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_rewards_distributed_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_rewards_distributed_arbitrum_mainnet.sql index 6fe569cc..1ebca472 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_rewards_distributed_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_rewards_distributed_arbitrum_mainnet.sql @@ -1,5 +1,5 @@ with core_rewards_distributed as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'arbitrum', 'mainnet', 'synthetix', @@ -21,4 +21,4 @@ select cast(amount as UInt256) as amount, cast(start as UInt256) as start, cast(duration as UInt256) as duration -from core_rewards_distributed \ No newline at end of file +from core_rewards_distributed diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_usd_burned_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_usd_burned_arbitrum_mainnet.sql index fcd922e4..23d04bca 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_usd_burned_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_usd_burned_arbitrum_mainnet.sql @@ -1,5 +1,5 @@ with core_usd_burned as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'arbitrum', 'mainnet', 'synthetix', diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_usd_minted_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_usd_minted_arbitrum_mainnet.sql index 51428080..80de871b 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_usd_minted_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_usd_minted_arbitrum_mainnet.sql @@ -1,5 +1,5 @@ with core_usd_minted as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'arbitrum', 'mainnet', 'synthetix', @@ -20,4 +20,4 @@ select cast(pool_id as UInt128) as pool_id, collateral_type, cast(amount as UInt256) as amount -from core_usd_minted \ No newline at end of file +from core_usd_minted diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_vault_liquidation_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_vault_liquidation_arbitrum_mainnet.sql index e9df2c3b..f86b1ebc 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_vault_liquidation_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_vault_liquidation_arbitrum_mainnet.sql @@ -1,5 +1,5 @@ with core_vault_liquidation as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'arbitrum', 'mainnet', 'synthetix', @@ -20,4 +20,4 @@ select cast(pool_id as UInt128) as pool_id, cast(collateral_type as text) as collateral_type, cast(liquidate_as_account_id as UInt128) as liquidate_as_account_id -from core_vault_liquidation \ No newline at end of file +from core_vault_liquidation diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_withdrawn_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_withdrawn_arbitrum_mainnet.sql index a89c44c3..28ffb995 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_withdrawn_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_withdrawn_arbitrum_mainnet.sql @@ -1,5 +1,5 @@ with core_withdrawn as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'arbitrum', 'mainnet', 'synthetix', diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_account_created_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_account_created_arbitrum_mainnet.sql index 4f799913..acdf9373 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_account_created_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_account_created_arbitrum_mainnet.sql @@ -1,5 +1,5 @@ with perps_account_created as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'arbitrum', 'mainnet', 'synthetix', diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_account_liquidation_attempt_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_account_liquidation_attempt_arbitrum_mainnet.sql index 2ff04fe9..3b0e6e58 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_account_liquidation_attempt_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_account_liquidation_attempt_arbitrum_mainnet.sql @@ -1,5 +1,5 @@ with perps_account_liquidation_attempt as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'arbitrum', 'mainnet', 'synthetix', @@ -18,4 +18,4 @@ select cast(account_id as UInt128) as account_id, cast(reward as UInt256) as reward, full_liquidation -from perps_account_liquidation_attempt \ No newline at end of file +from perps_account_liquidation_attempt diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_collateral_modified_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_collateral_modified_arbitrum_mainnet.sql index 9706b5c1..ddea7d8b 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_collateral_modified_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_collateral_modified_arbitrum_mainnet.sql @@ -1,5 +1,5 @@ with perps_collateral_modified as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'arbitrum', 'mainnet', 'synthetix', @@ -19,4 +19,4 @@ select cast(collateral_id as UInt128) as collateral_id, cast(amount_delta as Int256) as amount_delta, sender -from perps_collateral_modified \ No newline at end of file +from perps_collateral_modified diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_interest_charged_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_interest_charged_arbitrum_mainnet.sql index e905a76c..d57289ad 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_interest_charged_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_interest_charged_arbitrum_mainnet.sql @@ -1,5 +1,5 @@ with perps_interest_charged as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'arbitrum', 'mainnet', 'synthetix', @@ -17,4 +17,4 @@ select event_name, cast(account_id as UInt128) as account_id, cast(interest as UInt256) as interest -from perps_interest_charged \ No newline at end of file +from perps_interest_charged diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_interest_rate_updated_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_interest_rate_updated_arbitrum_mainnet.sql index 66da02eb..85c836d6 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_interest_rate_updated_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_interest_rate_updated_arbitrum_mainnet.sql @@ -1,5 +1,5 @@ with perps_interest_rate_updated as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'arbitrum', 'mainnet', 'synthetix', @@ -17,4 +17,4 @@ select event_name, cast(super_market_id as UInt128) as super_market_id, cast(interest_rate as UInt128) as interest_rate -from perps_interest_rate_updated \ No newline at end of file +from perps_interest_rate_updated diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_market_created_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_market_created_arbitrum_mainnet.sql index 91118827..d211c010 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_market_created_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_market_created_arbitrum_mainnet.sql @@ -1,5 +1,5 @@ with perps_market_created as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'arbitrum', 'mainnet', 'synthetix', @@ -18,4 +18,4 @@ select market_name, market_symbol, cast(perps_market_id as UInt128) as perps_market_id -from perps_market_created \ No newline at end of file +from perps_market_created diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_market_updated_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_market_updated_arbitrum_mainnet.sql index 03dcefd2..1db8e162 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_market_updated_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_market_updated_arbitrum_mainnet.sql @@ -1,5 +1,5 @@ with perps_market_updated as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'arbitrum', 'mainnet', 'synthetix', @@ -24,4 +24,4 @@ select cast(current_funding_velocity as Int256) as current_funding_velocity, cast(interest_rate as UInt128) as interest_rate from - perps_market_updated \ No newline at end of file + perps_market_updated diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_order_committed_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_order_committed_arbitrum_mainnet.sql index 15c07532..f3820f19 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_order_committed_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_order_committed_arbitrum_mainnet.sql @@ -1,5 +1,5 @@ with perps_order_committed as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'arbitrum', 'mainnet', 'synthetix', @@ -27,4 +27,4 @@ select sender, {{ convert_hex('tracking_code') }} as tracking_code from - perps_order_committed \ No newline at end of file + perps_order_committed diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_order_settled_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_order_settled_arbitrum_mainnet.sql index fee1cc7e..a895dfad 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_order_settled_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_order_settled_arbitrum_mainnet.sql @@ -1,5 +1,5 @@ with perps_order_settled as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'arbitrum', 'mainnet', 'synthetix', @@ -28,4 +28,4 @@ select cast(settlement_reward as UInt256) as settlement_reward, {{ convert_hex('tracking_code') }} as tracking_code, settler -from perps_order_settled \ No newline at end of file +from perps_order_settled diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_position_liquidated_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_position_liquidated_arbitrum_mainnet.sql index bd078778..ef84609d 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_position_liquidated_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_position_liquidated_arbitrum_mainnet.sql @@ -1,5 +1,5 @@ with perps_position_liquidated as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'arbitrum', 'mainnet', 'synthetix', @@ -19,4 +19,4 @@ select cast(market_id as UInt128) as market_id, cast(amount_liquidated as UInt256) as amount_liquidated, cast(current_position_size as Int128) as current_position_size -from perps_position_liquidated \ No newline at end of file +from perps_position_liquidated diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_previous_order_expired_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_previous_order_expired_arbitrum_mainnet.sql index 91ef62b9..c050f40a 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_previous_order_expired_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_previous_order_expired_arbitrum_mainnet.sql @@ -1,5 +1,5 @@ with perps_previous_order_expired as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'arbitrum', 'mainnet', 'synthetix', @@ -21,4 +21,4 @@ select cast(acceptable_price as UInt256) as acceptable_price, cast(commitment_time as UInt256) as commitment_time, {{ convert_hex('tracking_code') }} as tracking_code -from perps_previous_order_expired \ No newline at end of file +from perps_previous_order_expired diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_order_cancelled_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_order_cancelled_arbitrum_mainnet.sql index 81530151..83103f9c 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_order_cancelled_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_order_cancelled_arbitrum_mainnet.sql @@ -1,5 +1,5 @@ with spot_order_cancelled as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'arbitrum', 'mainnet', 'synthetix', @@ -19,4 +19,4 @@ select async_order_claim, market_id, async_order_id -from spot_order_cancelled \ No newline at end of file +from spot_order_cancelled diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_order_committed_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_order_committed_arbitrum_mainnet.sql index 14b13888..e4345fd0 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_order_committed_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_order_committed_arbitrum_mainnet.sql @@ -1,5 +1,5 @@ with spot_order_committed as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'arbitrum', 'mainnet', 'synthetix', @@ -21,4 +21,4 @@ select cast(async_order_id as UInt128) as async_order_id, sender, referrer -from spot_order_committed \ No newline at end of file +from spot_order_committed diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_order_settled_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_order_settled_arbitrum_mainnet.sql index d9e30d1b..5d57b1f9 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_order_settled_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_order_settled_arbitrum_mainnet.sql @@ -1,5 +1,5 @@ with spot_order_settled as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'arbitrum', 'mainnet', 'synthetix', @@ -23,4 +23,4 @@ select settler, cast(price as UInt256) as price, cast(order_type as UInt8) as order_type -from spot_order_settled \ No newline at end of file +from spot_order_settled diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_bought_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_bought_arbitrum_mainnet.sql index 32ec73a6..ce0c419b 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_bought_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_bought_arbitrum_mainnet.sql @@ -1,5 +1,5 @@ with spot_synth_bought as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'arbitrum', 'mainnet', 'synthetix', diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_registered_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_registered_arbitrum_mainnet.sql index fa32b5ec..1b0d769b 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_registered_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_registered_arbitrum_mainnet.sql @@ -1,5 +1,5 @@ with spot_synth_registered as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'arbitrum', 'mainnet', 'synthetix', @@ -17,4 +17,4 @@ select event_name, cast(synth_market_id as UInt128) as synth_market_id, synth_token_address -from spot_synth_registered \ No newline at end of file +from spot_synth_registered diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_sold_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_sold_arbitrum_mainnet.sql index e7c91724..558a7f44 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_sold_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_sold_arbitrum_mainnet.sql @@ -1,5 +1,5 @@ with spot_synth_sold as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'arbitrum', 'mainnet', 'synthetix', @@ -21,4 +21,4 @@ select cast(collected_fees as UInt256) as collected_fees, referrer, cast(price as UInt256) as price -from spot_synth_sold \ No newline at end of file +from spot_synth_sold diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_unwrapped_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_unwrapped_arbitrum_mainnet.sql index 1c21752a..57151930 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_unwrapped_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_unwrapped_arbitrum_mainnet.sql @@ -1,5 +1,5 @@ with spot_synth_unwrapped as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'arbitrum', 'mainnet', 'synthetix', diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_wrapped_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_wrapped_arbitrum_mainnet.sql index a5ab2bf6..27ebfcfd 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_wrapped_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_wrapped_arbitrum_mainnet.sql @@ -1,5 +1,5 @@ with spot_synth_wrapped as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'arbitrum', 'mainnet', 'synthetix', diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/blocks_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/blocks_base_mainnet.sql index 840547cc..fd14977e 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/blocks_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/blocks_base_mainnet.sql @@ -41,4 +41,4 @@ select from combined_blocks group by - block_number \ No newline at end of file + block_number diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/buyback/buyback_processed_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/buyback/buyback_processed_base_mainnet.sql index 724857ce..4dd32d8c 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/buyback/buyback_processed_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/buyback/buyback_processed_base_mainnet.sql @@ -1,5 +1,5 @@ with legacy_events as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'base', 'mainnet', 'synthetix', @@ -9,7 +9,7 @@ with legacy_events as ( ), current_events as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'base', 'mainnet', 'synthetix', diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_account_created_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_account_created_base_mainnet.sql index 92bcf003..15aab1f6 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_account_created_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_account_created_base_mainnet.sql @@ -1,5 +1,5 @@ with core_account_created as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'base', 'mainnet', 'synthetix', diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_delegation_updated_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_delegation_updated_base_mainnet.sql index fe236439..eb466d61 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_delegation_updated_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_delegation_updated_base_mainnet.sql @@ -1,5 +1,5 @@ with delegation_updated as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'base', 'mainnet', 'synthetix', @@ -22,4 +22,4 @@ select cast(amount as UInt256) as amount, cast(leverage as UInt256) as leverage from - delegation_updated \ No newline at end of file + delegation_updated diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_deposited_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_deposited_base_mainnet.sql index 66e0351c..6af26866 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_deposited_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_deposited_base_mainnet.sql @@ -1,5 +1,5 @@ with core_deposited as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'base', 'mainnet', 'synthetix', @@ -19,4 +19,4 @@ select cast(account_id as UInt128) as account_id, collateral_type, cast(token_amount as UInt256) as token_amount -from core_deposited \ No newline at end of file +from core_deposited diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_liquidation_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_liquidation_base_mainnet.sql index 79f1862a..3bd72e6a 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_liquidation_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_liquidation_base_mainnet.sql @@ -1,5 +1,5 @@ with core_liquidation as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'base', 'mainnet', 'synthetix', @@ -21,4 +21,4 @@ select cast(pool_id as UInt128) as pool_id, collateral_type, cast(liquidate_as_account_id as UInt128) as liquidate_as_account_id -from core_liquidation \ No newline at end of file +from core_liquidation diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_market_registered_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_market_registered_base_mainnet.sql index 80e43a37..7b450449 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_market_registered_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_market_registered_base_mainnet.sql @@ -1,5 +1,5 @@ with core_market_registered as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'base', 'mainnet', 'synthetix', diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_market_updated_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_market_updated_base_mainnet.sql index 8227beda..ddfc57a7 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_market_updated_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_market_updated_base_mainnet.sql @@ -10,7 +10,9 @@ with events as ( collateral_type, cast(market_id as UInt128) as market_id, cast(net_issuance as Int128) as net_issuance, - cast(deposited_collateral_value as UInt256) as deposited_collateral_value, + cast( + deposited_collateral_value as UInt256 + ) as deposited_collateral_value, cast(credit_capacity as Int128) as credit_capacity, cast(token_amount as UInt256) as token_amount from @@ -35,7 +37,9 @@ with events as ( collateral_type, cast(market_id as UInt128) as market_id, cast(net_issuance as Int128) as net_issuance, - cast(deposited_collateral_value as UInt256) as deposited_collateral_value, + cast( + deposited_collateral_value as UInt256 + ) as deposited_collateral_value, cast(credit_capacity as Int128) as credit_capacity, cast(token_amount as UInt256) as token_amount from @@ -60,7 +64,9 @@ with events as ( 'USD' as collateral_type, cast(market_id as UInt128) as market_id, cast(net_issuance as Int128) as net_issuance, - cast(deposited_collateral_value as UInt256) as deposited_collateral_value, + cast( + deposited_collateral_value as UInt256 + ) as deposited_collateral_value, cast(credit_capacity as Int128) as credit_capacity, cast(amount as UInt256) as token_amount from @@ -85,7 +91,9 @@ with events as ( 'USD' as collateral_type, cast(market_id as UInt128) as market_id, cast(net_issuance as Int128) as net_issuance, - cast(deposited_collateral_value as UInt256) as deposited_collateral_value, + cast( + deposited_collateral_value as UInt256 + ) as deposited_collateral_value, cast(credit_capacity as Int128) as credit_capacity, cast(amount as UInt256) as token_amount from @@ -104,4 +112,4 @@ select * from events order by - block_timestamp \ No newline at end of file + block_timestamp diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_pool_created_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_pool_created_base_mainnet.sql index 0838c9e3..757669e6 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_pool_created_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_pool_created_base_mainnet.sql @@ -1,5 +1,5 @@ with core_pool_created as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'base', 'mainnet', 'synthetix', diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_rewards_claimed_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_rewards_claimed_base_mainnet.sql index ace886e3..3e817471 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_rewards_claimed_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_rewards_claimed_base_mainnet.sql @@ -1,5 +1,5 @@ with core_rewards_claimed as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'base', 'mainnet', 'synthetix', @@ -20,4 +20,4 @@ select collateral_type, distributor, cast(amount as UInt256) as amount -from core_rewards_claimed \ No newline at end of file +from core_rewards_claimed diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_rewards_distributed_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_rewards_distributed_base_mainnet.sql index 1ababfa5..b5e0837f 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_rewards_distributed_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_rewards_distributed_base_mainnet.sql @@ -1,5 +1,5 @@ with core_rewards_distributed as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'base', 'mainnet', 'synthetix', @@ -21,4 +21,4 @@ select cast(amount as UInt256) as amount, cast(start as UInt256) as start, cast(duration as UInt256) as duration -from core_rewards_distributed \ No newline at end of file +from core_rewards_distributed diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_usd_burned_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_usd_burned_base_mainnet.sql index 439529e2..260232a2 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_usd_burned_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_usd_burned_base_mainnet.sql @@ -1,5 +1,5 @@ with core_usd_burned as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'base', 'mainnet', 'synthetix', diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_usd_minted_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_usd_minted_base_mainnet.sql index 45ff5bbc..aa195815 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_usd_minted_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_usd_minted_base_mainnet.sql @@ -1,5 +1,5 @@ with core_usd_minted as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'base', 'mainnet', 'synthetix', @@ -20,4 +20,4 @@ select cast(pool_id as UInt128) as pool_id, collateral_type, cast(amount as UInt256) as amount -from core_usd_minted \ No newline at end of file +from core_usd_minted diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_vault_liquidation_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_vault_liquidation_base_mainnet.sql index 0019fb74..c3a8c940 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_vault_liquidation_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_vault_liquidation_base_mainnet.sql @@ -1,5 +1,5 @@ with core_vault_liquidation as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'base', 'mainnet', 'synthetix', @@ -20,4 +20,4 @@ select cast(pool_id as UInt128) as pool_id, cast(collateral_type as text) as collateral_type, cast(liquidate_as_account_id as UInt128) as liquidate_as_account_id -from core_vault_liquidation \ No newline at end of file +from core_vault_liquidation diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_withdrawn_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_withdrawn_base_mainnet.sql index c8ea00b8..edc2f589 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_withdrawn_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_withdrawn_base_mainnet.sql @@ -1,5 +1,5 @@ with core_withdrawn as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'base', 'mainnet', 'synthetix', diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_account_created_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_account_created_base_mainnet.sql index d08ab804..bcbeab19 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_account_created_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_account_created_base_mainnet.sql @@ -1,5 +1,5 @@ with perps_account_created as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'base', 'mainnet', 'synthetix', diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_account_liquidation_attempt_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_account_liquidation_attempt_base_mainnet.sql index 78057e20..050032c6 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_account_liquidation_attempt_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_account_liquidation_attempt_base_mainnet.sql @@ -1,5 +1,5 @@ with perps_account_liquidation_attempt as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'base', 'mainnet', 'synthetix', @@ -18,4 +18,4 @@ select cast(account_id as UInt128) as account_id, cast(reward as UInt256) as reward, full_liquidation -from perps_account_liquidation_attempt \ No newline at end of file +from perps_account_liquidation_attempt diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_collateral_modified_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_collateral_modified_base_mainnet.sql index db664074..24a85791 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_collateral_modified_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_collateral_modified_base_mainnet.sql @@ -1,5 +1,5 @@ with perps_collateral_modified as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'base', 'mainnet', 'synthetix', @@ -19,4 +19,4 @@ select cast(collateral_id as UInt128) as collateral_id, cast(amount_delta as Int256) as amount_delta, sender -from perps_collateral_modified \ No newline at end of file +from perps_collateral_modified diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_interest_charged_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_interest_charged_base_mainnet.sql index f2cbf404..19e28ae4 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_interest_charged_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_interest_charged_base_mainnet.sql @@ -1,5 +1,5 @@ with perps_interest_charged as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'base', 'mainnet', 'synthetix', @@ -17,4 +17,4 @@ select event_name, cast(account_id as UInt128) as account_id, cast(interest as UInt256) as interest -from perps_interest_charged \ No newline at end of file +from perps_interest_charged diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_interest_rate_updated_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_interest_rate_updated_base_mainnet.sql index a71995c3..8628bc45 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_interest_rate_updated_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_interest_rate_updated_base_mainnet.sql @@ -1,5 +1,5 @@ with perps_interest_rate_updated as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'base', 'mainnet', 'synthetix', @@ -17,4 +17,4 @@ select event_name, cast(super_market_id as UInt128) as super_market_id, cast(interest_rate as UInt128) as interest_rate -from perps_interest_rate_updated \ No newline at end of file +from perps_interest_rate_updated diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_market_created_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_market_created_base_mainnet.sql index 21cfeba8..9c2801fa 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_market_created_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_market_created_base_mainnet.sql @@ -1,5 +1,5 @@ with perps_market_created as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'base', 'mainnet', 'synthetix', @@ -18,4 +18,4 @@ select market_name, market_symbol, cast(perps_market_id as UInt128) as perps_market_id -from perps_market_created \ No newline at end of file +from perps_market_created diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_market_updated_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_market_updated_base_mainnet.sql index 592cf978..15dfca8b 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_market_updated_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_market_updated_base_mainnet.sql @@ -1,5 +1,5 @@ with legacy_events as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'base', 'mainnet', 'synthetix', @@ -9,7 +9,7 @@ with legacy_events as ( ), current_events as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'base', 'mainnet', 'synthetix', @@ -53,4 +53,4 @@ select cast(current_funding_velocity as Int256) as current_funding_velocity, cast(interest_rate as UInt128) as interest_rate from - current_events \ No newline at end of file + current_events diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_order_committed_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_order_committed_base_mainnet.sql index 55799a19..f4855ef0 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_order_committed_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_order_committed_base_mainnet.sql @@ -1,5 +1,5 @@ with legacy_events as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'base', 'mainnet', 'synthetix', @@ -9,7 +9,7 @@ with legacy_events as ( ), current_events as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'base', 'mainnet', 'synthetix', @@ -58,4 +58,4 @@ select sender, {{ convert_hex('tracking_code') }} as tracking_code from - current_events \ No newline at end of file + current_events diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_order_settled_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_order_settled_base_mainnet.sql index cfe5bbfe..a390d620 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_order_settled_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_order_settled_base_mainnet.sql @@ -1,5 +1,5 @@ with perps_order_settled as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'base', 'mainnet', 'synthetix', @@ -28,4 +28,4 @@ select cast(settlement_reward as UInt256) as settlement_reward, {{ convert_hex('tracking_code') }} as tracking_code, settler -from perps_order_settled \ No newline at end of file +from perps_order_settled diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_position_liquidated_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_position_liquidated_base_mainnet.sql index c2704761..ce5e53ea 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_position_liquidated_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_position_liquidated_base_mainnet.sql @@ -1,5 +1,5 @@ with perps_position_liquidated as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'base', 'mainnet', 'synthetix', @@ -19,4 +19,4 @@ select cast(market_id as UInt128) as market_id, cast(amount_liquidated as UInt256) as amount_liquidated, cast(current_position_size as Int128) as current_position_size -from perps_position_liquidated \ No newline at end of file +from perps_position_liquidated diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_previous_order_expired_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_previous_order_expired_base_mainnet.sql index 3f5b3bd4..3a29b656 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_previous_order_expired_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_previous_order_expired_base_mainnet.sql @@ -1,5 +1,5 @@ with perps_previous_order_expired as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'base', 'mainnet', 'synthetix', @@ -21,4 +21,4 @@ select cast(acceptable_price as UInt256) as acceptable_price, cast(commitment_time as UInt256) as commitment_time, {{ convert_hex('tracking_code') }} as tracking_code -from perps_previous_order_expired \ No newline at end of file +from perps_previous_order_expired diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_order_cancelled_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_order_cancelled_base_mainnet.sql index f8ad741f..e051d15a 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_order_cancelled_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_order_cancelled_base_mainnet.sql @@ -1,5 +1,5 @@ with spot_order_cancelled as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'base', 'mainnet', 'synthetix', @@ -19,4 +19,4 @@ select async_order_claim, market_id, async_order_id -from spot_order_cancelled \ No newline at end of file +from spot_order_cancelled diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_order_committed_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_order_committed_base_mainnet.sql index 53f5db98..f33695e8 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_order_committed_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_order_committed_base_mainnet.sql @@ -1,5 +1,5 @@ with spot_order_committed as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'base', 'mainnet', 'synthetix', @@ -21,4 +21,4 @@ select cast(async_order_id as UInt128) as async_order_id, sender, referrer -from spot_order_committed \ No newline at end of file +from spot_order_committed diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_order_settled_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_order_settled_base_mainnet.sql index 79658f28..80e3deff 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_order_settled_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_order_settled_base_mainnet.sql @@ -1,5 +1,5 @@ with spot_order_settled as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'base', 'mainnet', 'synthetix', @@ -23,4 +23,4 @@ select settler, cast(price as UInt256) as price, cast(order_type as UInt8) as order_type -from spot_order_settled \ No newline at end of file +from spot_order_settled diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_bought_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_bought_base_mainnet.sql index 4ee909c5..55cc3781 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_bought_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_bought_base_mainnet.sql @@ -1,5 +1,5 @@ with spot_synth_bought as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'base', 'mainnet', 'synthetix', diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_registered_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_registered_base_mainnet.sql index ac8d44b5..c8bcc9fb 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_registered_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_registered_base_mainnet.sql @@ -1,5 +1,5 @@ with spot_synth_registered as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'base', 'mainnet', 'synthetix', @@ -17,4 +17,4 @@ select event_name, cast(synth_market_id as UInt128) as synth_market_id, synth_token_address -from spot_synth_registered \ No newline at end of file +from spot_synth_registered diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_sold_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_sold_base_mainnet.sql index 88ca6476..d0ae9b65 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_sold_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_sold_base_mainnet.sql @@ -1,5 +1,5 @@ with spot_synth_sold as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'base', 'mainnet', 'synthetix', @@ -21,4 +21,4 @@ select cast(collected_fees as UInt256) as collected_fees, referrer, cast(price as UInt256) as price -from spot_synth_sold \ No newline at end of file +from spot_synth_sold diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_unwrapped_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_unwrapped_base_mainnet.sql index c3e8938c..f952474a 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_unwrapped_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_unwrapped_base_mainnet.sql @@ -1,5 +1,5 @@ with spot_synth_unwrapped as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'base', 'mainnet', 'synthetix', diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_wrapped_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_wrapped_base_mainnet.sql index 66bbd038..05f52b2c 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_wrapped_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_wrapped_base_mainnet.sql @@ -1,5 +1,5 @@ with spot_synth_wrapped as ( - {{ get_event_data( + {{ get_event_data( -- noqa 'base', 'mainnet', 'synthetix', From 405124957b426bdeead71b26153ac0ecedfec09e Mon Sep 17 00:00:00 2001 From: marcus-snx Date: Thu, 12 Dec 2024 23:58:44 +0200 Subject: [PATCH 17/21] Fix linting --- .../synthetix/core/core_market_updated_arbitrum_mainnet.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_market_updated_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_market_updated_arbitrum_mainnet.sql index fae0376b..24e1fcd4 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_market_updated_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_market_updated_arbitrum_mainnet.sql @@ -112,4 +112,4 @@ select * from events order by - block_timestamp \ No newline at end of file + block_timestamp From 9f8b1da3e0d1b615f83d25fdcba18e9c3abcadbe Mon Sep 17 00:00:00 2001 From: marcus-snx Date: Fri, 13 Dec 2024 19:46:53 +0200 Subject: [PATCH 18/21] Fix template sqlfluff ignore --- .../core_account_created_arbitrum_mainnet.sql | 8 +---- ...re_delegation_updated_arbitrum_mainnet.sql | 8 +---- .../core/core_deposited_arbitrum_mainnet.sql | 8 +---- .../core_liquidation_arbitrum_mainnet.sql | 8 +---- ...ore_market_registered_arbitrum_mainnet.sql | 8 +---- .../core_market_updated_arbitrum_mainnet.sql | 32 +++---------------- .../core_pool_created_arbitrum_mainnet.sql | 8 +---- .../core_rewards_claimed_arbitrum_mainnet.sql | 8 +---- ...e_rewards_distributed_arbitrum_mainnet.sql | 10 ++---- .../core/core_usd_burned_arbitrum_mainnet.sql | 8 +---- .../core/core_usd_minted_arbitrum_mainnet.sql | 8 +---- ...ore_vault_liquidation_arbitrum_mainnet.sql | 10 ++---- .../core/core_withdrawn_arbitrum_mainnet.sql | 8 +---- .../perp_account_created_arbitrum_mainnet.sql | 8 +---- ...t_liquidation_attempt_arbitrum_mainnet.sql | 8 +---- ...p_collateral_modified_arbitrum_mainnet.sql | 8 +---- ...perp_interest_charged_arbitrum_mainnet.sql | 8 +---- ...interest_rate_updated_arbitrum_mainnet.sql | 8 +---- .../perp_market_created_arbitrum_mainnet.sql | 8 +---- .../perp_market_updated_arbitrum_mainnet.sql | 8 +---- .../perp_order_committed_arbitrum_mainnet.sql | 8 +---- .../perp_order_settled_arbitrum_mainnet.sql | 8 +---- ...p_position_liquidated_arbitrum_mainnet.sql | 8 +---- ...revious_order_expired_arbitrum_mainnet.sql | 8 +---- .../spot_order_cancelled_arbitrum_mainnet.sql | 8 +---- .../spot_order_committed_arbitrum_mainnet.sql | 8 +---- .../spot_order_settled_arbitrum_mainnet.sql | 8 +---- .../spot_synth_bought_arbitrum_mainnet.sql | 8 +---- ...spot_synth_registered_arbitrum_mainnet.sql | 8 +---- .../spot/spot_synth_sold_arbitrum_mainnet.sql | 8 +---- .../spot_synth_unwrapped_arbitrum_mainnet.sql | 8 +---- .../spot_synth_wrapped_arbitrum_mainnet.sql | 8 +---- .../buyback_processed_base_mainnet.sql | 16 ++-------- .../core_account_created_base_mainnet.sql | 8 +---- .../core_delegation_updated_base_mainnet.sql | 8 +---- .../core/core_deposited_base_mainnet.sql | 8 +---- .../core/core_liquidation_base_mainnet.sql | 8 +---- .../core_market_registered_base_mainnet.sql | 8 +---- .../core/core_market_updated_base_mainnet.sql | 32 +++---------------- .../core/core_pool_created_base_mainnet.sql | 8 +---- .../core_rewards_claimed_base_mainnet.sql | 8 +---- .../core_rewards_distributed_base_mainnet.sql | 10 ++---- .../core/core_usd_burned_base_mainnet.sql | 8 +---- .../core/core_usd_minted_base_mainnet.sql | 8 +---- .../core_vault_liquidation_base_mainnet.sql | 10 ++---- .../core/core_withdrawn_base_mainnet.sql | 8 +---- .../perp_account_created_base_mainnet.sql | 8 +---- ...count_liquidation_attempt_base_mainnet.sql | 8 +---- .../perp_collateral_modified_base_mainnet.sql | 8 +---- .../perp_interest_charged_base_mainnet.sql | 8 +---- ...erp_interest_rate_updated_base_mainnet.sql | 8 +---- .../perp/perp_market_created_base_mainnet.sql | 8 +---- .../perp/perp_market_updated_base_mainnet.sql | 16 ++-------- .../perp_order_committed_base_mainnet.sql | 20 +++--------- .../perp/perp_order_settled_base_mainnet.sql | 8 +---- .../perp_position_liquidated_base_mainnet.sql | 8 +---- ...rp_previous_order_expired_base_mainnet.sql | 8 +---- .../spot_order_cancelled_base_mainnet.sql | 8 +---- .../spot_order_committed_base_mainnet.sql | 8 +---- .../spot/spot_order_settled_base_mainnet.sql | 8 +---- .../spot/spot_synth_bought_base_mainnet.sql | 8 +---- .../spot_synth_registered_base_mainnet.sql | 8 +---- .../spot/spot_synth_sold_base_mainnet.sql | 8 +---- .../spot_synth_unwrapped_base_mainnet.sql | 8 +---- .../spot/spot_synth_wrapped_base_mainnet.sql | 8 +---- 65 files changed, 80 insertions(+), 524 deletions(-) diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_account_created_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_account_created_arbitrum_mainnet.sql index c8ae31bc..8f102e9f 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_account_created_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_account_created_arbitrum_mainnet.sql @@ -1,11 +1,5 @@ with core_account_created as ( - {{ get_event_data( -- noqa - 'arbitrum', - 'mainnet', - 'synthetix', - 'core_proxy', - 'account_created' - ) }} + {{ get_event_data('arbitrum', 'mainnet', 'synthetix', 'core_proxy', 'account_created') }} --noqa ) select diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_delegation_updated_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_delegation_updated_arbitrum_mainnet.sql index 2d6910b4..f7b5a185 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_delegation_updated_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_delegation_updated_arbitrum_mainnet.sql @@ -1,11 +1,5 @@ with delegation_updated as ( - {{ get_event_data( -- noqa - 'arbitrum', - 'mainnet', - 'synthetix', - 'core_proxy', - 'delegation_updated' - ) }} + {{ get_event_data('arbitrum', 'mainnet', 'synthetix', 'core_proxy', 'delegation_updated') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_deposited_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_deposited_arbitrum_mainnet.sql index 88f5626e..5a56dea8 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_deposited_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_deposited_arbitrum_mainnet.sql @@ -1,11 +1,5 @@ with core_deposited as ( - {{ get_event_data( -- noqa - 'arbitrum', - 'mainnet', - 'synthetix', - 'core_proxy', - 'deposited' - ) }} + {{ get_event_data('arbitrum', 'mainnet', 'synthetix', 'core_proxy', 'deposited') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_liquidation_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_liquidation_arbitrum_mainnet.sql index b9c759fb..957c4eca 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_liquidation_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_liquidation_arbitrum_mainnet.sql @@ -1,11 +1,5 @@ with core_liquidation as ( - {{ get_event_data( -- noqa - 'arbitrum', - 'mainnet', - 'synthetix', - 'core_proxy', - 'liquidation' - ) }} + {{ get_event_data('arbitrum', 'mainnet', 'synthetix', 'core_proxy', 'liquidation') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_market_registered_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_market_registered_arbitrum_mainnet.sql index d5056259..6b94569c 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_market_registered_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_market_registered_arbitrum_mainnet.sql @@ -1,11 +1,5 @@ with core_market_registered as ( - {{ get_event_data( -- noqa - 'arbitrum', - 'mainnet', - 'synthetix', - 'core_proxy', - 'market_registered' - ) }} + {{ get_event_data('arbitrum', 'mainnet', 'synthetix', 'core_proxy', 'market_registered') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_market_updated_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_market_updated_arbitrum_mainnet.sql index 24e1fcd4..281cb2ec 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_market_updated_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_market_updated_arbitrum_mainnet.sql @@ -17,13 +17,7 @@ with events as ( cast(token_amount as UInt256) as token_amount from ( - {{ get_event_data( - 'arbitrum', - 'mainnet', - 'synthetix', - 'core_proxy', - 'market_collateral_deposited' - ) }} + {{ get_event_data('arbitrum', 'mainnet', 'synthetix', 'core_proxy', 'market_collateral_deposited') }} -- noqa ) as collateral_deposited -- noqa: AL05 union all select @@ -44,13 +38,7 @@ with events as ( cast(token_amount as UInt256) as token_amount from ( - {{ get_event_data( - 'arbitrum', - 'mainnet', - 'synthetix', - 'core_proxy', - 'market_collateral_withdrawn' - ) }} + {{ get_event_data('arbitrum', 'mainnet', 'synthetix', 'core_proxy', 'market_collateral_withdrawn') }} -- noqa ) as collateral_withdrawn -- noqa: AL05 union all select @@ -71,13 +59,7 @@ with events as ( cast(amount as UInt256) as token_amount from ( - {{ get_event_data( - 'arbitrum', - 'mainnet', - 'synthetix', - 'core_proxy', - 'market_usd_deposited' - ) }} + {{ get_event_data('arbitrum', 'mainnet', 'synthetix', 'core_proxy', 'market_usd_deposited') }} -- noqa ) as usd_deposited -- noqa: AL05 union all select @@ -98,13 +80,7 @@ with events as ( cast(amount as UInt256) as token_amount from ( - {{ get_event_data( - 'arbitrum', - 'mainnet', - 'synthetix', - 'core_proxy', - 'market_usd_withdrawn' - ) }} + {{ get_event_data('arbitrum', 'mainnet', 'synthetix', 'core_proxy', 'market_usd_withdrawn') }} -- noqa ) as usd_withdrawn -- noqa: AL05 ) diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_pool_created_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_pool_created_arbitrum_mainnet.sql index 50900539..242bf809 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_pool_created_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_pool_created_arbitrum_mainnet.sql @@ -1,11 +1,5 @@ with core_pool_created as ( - {{ get_event_data( -- noqa - 'arbitrum', - 'mainnet', - 'synthetix', - 'core_proxy', - 'pool_created' - ) }} + {{ get_event_data('arbitrum', 'mainnet', 'synthetix', 'core_proxy', 'pool_created') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_rewards_claimed_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_rewards_claimed_arbitrum_mainnet.sql index f1ac5a77..1ee3ca98 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_rewards_claimed_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_rewards_claimed_arbitrum_mainnet.sql @@ -1,11 +1,5 @@ with core_rewards_claimed as ( - {{ get_event_data( -- noqa - 'arbitrum', - 'mainnet', - 'synthetix', - 'core_proxy', - 'rewards_claimed' - ) }} + {{ get_event_data('arbitrum', 'mainnet', 'synthetix', 'core_proxy', 'rewards_claimed') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_rewards_distributed_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_rewards_distributed_arbitrum_mainnet.sql index 1ebca472..e48c6551 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_rewards_distributed_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_rewards_distributed_arbitrum_mainnet.sql @@ -1,11 +1,5 @@ with core_rewards_distributed as ( - {{ get_event_data( -- noqa - 'arbitrum', - 'mainnet', - 'synthetix', - 'core_proxy', - 'rewards_distributed' - ) }} + {{ get_event_data('arbitrum', 'mainnet', 'synthetix', 'core_proxy', 'rewards_distributed') }} -- noqa ) select @@ -19,6 +13,6 @@ select collateral_type, distributor, cast(amount as UInt256) as amount, - cast(start as UInt256) as start, + cast(start as UInt256) as start, -- noqa cast(duration as UInt256) as duration from core_rewards_distributed diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_usd_burned_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_usd_burned_arbitrum_mainnet.sql index 23d04bca..b0fa80a2 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_usd_burned_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_usd_burned_arbitrum_mainnet.sql @@ -1,11 +1,5 @@ with core_usd_burned as ( - {{ get_event_data( -- noqa - 'arbitrum', - 'mainnet', - 'synthetix', - 'core_proxy', - 'usd_burned' - ) }} + {{ get_event_data('arbitrum', 'mainnet', 'synthetix', 'core_proxy', 'usd_burned') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_usd_minted_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_usd_minted_arbitrum_mainnet.sql index 80de871b..fd0ca15d 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_usd_minted_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_usd_minted_arbitrum_mainnet.sql @@ -1,11 +1,5 @@ with core_usd_minted as ( - {{ get_event_data( -- noqa - 'arbitrum', - 'mainnet', - 'synthetix', - 'core_proxy', - 'usd_minted' - ) }} + {{ get_event_data('arbitrum', 'mainnet', 'synthetix', 'core_proxy', 'usd_minted') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_vault_liquidation_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_vault_liquidation_arbitrum_mainnet.sql index f86b1ebc..b2d72fe3 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_vault_liquidation_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_vault_liquidation_arbitrum_mainnet.sql @@ -1,11 +1,5 @@ with core_vault_liquidation as ( - {{ get_event_data( -- noqa - 'arbitrum', - 'mainnet', - 'synthetix', - 'core_proxy', - 'vault_liquidation' - ) }} + {{ get_event_data('arbitrum', 'mainnet', 'synthetix', 'core_proxy', 'vault_liquidation') }} -- noqa ) select @@ -18,6 +12,6 @@ select sender, liquidation_data, cast(pool_id as UInt128) as pool_id, - cast(collateral_type as text) as collateral_type, + cast(collateral_type as String) as collateral_type, cast(liquidate_as_account_id as UInt128) as liquidate_as_account_id from core_vault_liquidation diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_withdrawn_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_withdrawn_arbitrum_mainnet.sql index 28ffb995..fbc021c4 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_withdrawn_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/core/core_withdrawn_arbitrum_mainnet.sql @@ -1,11 +1,5 @@ with core_withdrawn as ( - {{ get_event_data( -- noqa - 'arbitrum', - 'mainnet', - 'synthetix', - 'core_proxy', - 'withdrawn' - ) }} + {{ get_event_data('arbitrum', 'mainnet', 'synthetix', 'core_proxy', 'withdrawn') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_account_created_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_account_created_arbitrum_mainnet.sql index acdf9373..cb253df0 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_account_created_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_account_created_arbitrum_mainnet.sql @@ -1,11 +1,5 @@ with perps_account_created as ( - {{ get_event_data( -- noqa - 'arbitrum', - 'mainnet', - 'synthetix', - 'perps_market_proxy', - 'account_created' - ) }} + {{ get_event_data('arbitrum', 'mainnet', 'synthetix', 'perps_market_proxy', 'account_created') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_account_liquidation_attempt_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_account_liquidation_attempt_arbitrum_mainnet.sql index 3b0e6e58..c556da93 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_account_liquidation_attempt_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_account_liquidation_attempt_arbitrum_mainnet.sql @@ -1,11 +1,5 @@ with perps_account_liquidation_attempt as ( - {{ get_event_data( -- noqa - 'arbitrum', - 'mainnet', - 'synthetix', - 'perps_market_proxy', - 'account_liquidation_attempt' - ) }} + {{ get_event_data('arbitrum', 'mainnet', 'synthetix', 'perps_market_proxy', 'account_liquidation_attempt') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_collateral_modified_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_collateral_modified_arbitrum_mainnet.sql index ddea7d8b..35d1b301 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_collateral_modified_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_collateral_modified_arbitrum_mainnet.sql @@ -1,11 +1,5 @@ with perps_collateral_modified as ( - {{ get_event_data( -- noqa - 'arbitrum', - 'mainnet', - 'synthetix', - 'perps_market_proxy', - 'collateral_modified' - ) }} + {{ get_event_data('arbitrum', 'mainnet', 'synthetix', 'perps_market_proxy', 'collateral_modified') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_interest_charged_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_interest_charged_arbitrum_mainnet.sql index d57289ad..31eae8ac 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_interest_charged_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_interest_charged_arbitrum_mainnet.sql @@ -1,11 +1,5 @@ with perps_interest_charged as ( - {{ get_event_data( -- noqa - 'arbitrum', - 'mainnet', - 'synthetix', - 'perps_market_proxy', - 'interest_charged' - ) }} + {{ get_event_data('arbitrum', 'mainnet', 'synthetix', 'perps_market_proxy', 'interest_charged') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_interest_rate_updated_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_interest_rate_updated_arbitrum_mainnet.sql index 85c836d6..5f5be5fe 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_interest_rate_updated_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_interest_rate_updated_arbitrum_mainnet.sql @@ -1,11 +1,5 @@ with perps_interest_rate_updated as ( - {{ get_event_data( -- noqa - 'arbitrum', - 'mainnet', - 'synthetix', - 'perps_market_proxy', - 'interest_rate_updated' - ) }} + {{ get_event_data('arbitrum', 'mainnet', 'synthetix', 'perps_market_proxy', 'interest_rate_updated') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_market_created_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_market_created_arbitrum_mainnet.sql index d211c010..c95c77cb 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_market_created_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_market_created_arbitrum_mainnet.sql @@ -1,11 +1,5 @@ with perps_market_created as ( - {{ get_event_data( -- noqa - 'arbitrum', - 'mainnet', - 'synthetix', - 'perps_market_proxy', - 'market_created' - ) }} + {{ get_event_data('arbitrum', 'mainnet', 'synthetix', 'perps_market_proxy', 'market_created') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_market_updated_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_market_updated_arbitrum_mainnet.sql index 1db8e162..28278537 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_market_updated_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_market_updated_arbitrum_mainnet.sql @@ -1,11 +1,5 @@ with perps_market_updated as ( - {{ get_event_data( -- noqa - 'arbitrum', - 'mainnet', - 'synthetix', - 'perps_market_proxy', - 'market_updated' - ) }} + {{ get_event_data('arbitrum', 'mainnet', 'synthetix', 'perps_market_proxy', 'market_updated') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_order_committed_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_order_committed_arbitrum_mainnet.sql index f3820f19..369b7b39 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_order_committed_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_order_committed_arbitrum_mainnet.sql @@ -1,11 +1,5 @@ with perps_order_committed as ( - {{ get_event_data( -- noqa - 'arbitrum', - 'mainnet', - 'synthetix', - 'perps_market_proxy', - 'order_committed' - ) }} + {{ get_event_data('arbitrum', 'mainnet', 'synthetix', 'perps_market_proxy', 'order_committed') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_order_settled_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_order_settled_arbitrum_mainnet.sql index a895dfad..51819fd9 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_order_settled_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_order_settled_arbitrum_mainnet.sql @@ -1,11 +1,5 @@ with perps_order_settled as ( - {{ get_event_data( -- noqa - 'arbitrum', - 'mainnet', - 'synthetix', - 'perps_market_proxy', - 'order_settled' - ) }} + {{ get_event_data('arbitrum', 'mainnet', 'synthetix', 'perps_market_proxy', 'order_settled') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_position_liquidated_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_position_liquidated_arbitrum_mainnet.sql index ef84609d..257b75aa 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_position_liquidated_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_position_liquidated_arbitrum_mainnet.sql @@ -1,11 +1,5 @@ with perps_position_liquidated as ( - {{ get_event_data( -- noqa - 'arbitrum', - 'mainnet', - 'synthetix', - 'perps_market_proxy', - 'position_liquidated' - ) }} + {{ get_event_data('arbitrum', 'mainnet', 'synthetix', 'perps_market_proxy', 'position_liquidated') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_previous_order_expired_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_previous_order_expired_arbitrum_mainnet.sql index c050f40a..77a15df7 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_previous_order_expired_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/perp/perp_previous_order_expired_arbitrum_mainnet.sql @@ -1,11 +1,5 @@ with perps_previous_order_expired as ( - {{ get_event_data( -- noqa - 'arbitrum', - 'mainnet', - 'synthetix', - 'perps_market_proxy', - 'previous_order_expired' - ) }} + {{ get_event_data('arbitrum', 'mainnet', 'synthetix', 'perps_market_proxy', 'previous_order_expired') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_order_cancelled_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_order_cancelled_arbitrum_mainnet.sql index 83103f9c..26ca9ee0 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_order_cancelled_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_order_cancelled_arbitrum_mainnet.sql @@ -1,11 +1,5 @@ with spot_order_cancelled as ( - {{ get_event_data( -- noqa - 'arbitrum', - 'mainnet', - 'synthetix', - 'spot_market_proxy', - 'order_cancelled' - ) }} + {{ get_event_data('arbitrum', 'mainnet', 'synthetix', 'spot_market_proxy', 'order_cancelled') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_order_committed_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_order_committed_arbitrum_mainnet.sql index e4345fd0..8a551248 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_order_committed_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_order_committed_arbitrum_mainnet.sql @@ -1,11 +1,5 @@ with spot_order_committed as ( - {{ get_event_data( -- noqa - 'arbitrum', - 'mainnet', - 'synthetix', - 'spot_market_proxy', - 'order_committed' - ) }} + {{ get_event_data('arbitrum', 'mainnet', 'synthetix', 'spot_market_proxy', 'order_committed') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_order_settled_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_order_settled_arbitrum_mainnet.sql index 5d57b1f9..bc500d3f 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_order_settled_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_order_settled_arbitrum_mainnet.sql @@ -1,11 +1,5 @@ with spot_order_settled as ( - {{ get_event_data( -- noqa - 'arbitrum', - 'mainnet', - 'synthetix', - 'spot_market_proxy', - 'order_settled' - ) }} + {{ get_event_data('arbitrum', 'mainnet', 'synthetix', 'spot_market_proxy', 'order_settled') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_bought_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_bought_arbitrum_mainnet.sql index ce0c419b..e84b91bd 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_bought_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_bought_arbitrum_mainnet.sql @@ -1,11 +1,5 @@ with spot_synth_bought as ( - {{ get_event_data( -- noqa - 'arbitrum', - 'mainnet', - 'synthetix', - 'spot_market_proxy', - 'synth_bought' - ) }} + {{ get_event_data('arbitrum', 'mainnet', 'synthetix', 'spot_market_proxy', 'synth_bought') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_registered_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_registered_arbitrum_mainnet.sql index 1b0d769b..eaf23c35 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_registered_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_registered_arbitrum_mainnet.sql @@ -1,11 +1,5 @@ with spot_synth_registered as ( - {{ get_event_data( -- noqa - 'arbitrum', - 'mainnet', - 'synthetix', - 'spot_market_proxy', - 'synth_registered' - ) }} + {{ get_event_data('arbitrum', 'mainnet', 'synthetix', 'spot_market_proxy', 'synth_registered') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_sold_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_sold_arbitrum_mainnet.sql index 558a7f44..33481f30 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_sold_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_sold_arbitrum_mainnet.sql @@ -1,11 +1,5 @@ with spot_synth_sold as ( - {{ get_event_data( -- noqa - 'arbitrum', - 'mainnet', - 'synthetix', - 'spot_market_proxy', - 'synth_sold' - ) }} + {{ get_event_data('arbitrum', 'mainnet', 'synthetix', 'spot_market_proxy', 'synth_sold') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_unwrapped_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_unwrapped_arbitrum_mainnet.sql index 57151930..926f3013 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_unwrapped_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_unwrapped_arbitrum_mainnet.sql @@ -1,11 +1,5 @@ with spot_synth_unwrapped as ( - {{ get_event_data( -- noqa - 'arbitrum', - 'mainnet', - 'synthetix', - 'spot_market_proxy', - 'synth_unwrapped' - ) }} + {{ get_event_data('arbitrum', 'mainnet', 'synthetix', 'spot_market_proxy', 'synth_unwrapped') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_wrapped_arbitrum_mainnet.sql b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_wrapped_arbitrum_mainnet.sql index 27ebfcfd..19b23a98 100644 --- a/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_wrapped_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/core/arbitrum/mainnet/synthetix/spot/spot_synth_wrapped_arbitrum_mainnet.sql @@ -1,11 +1,5 @@ with spot_synth_wrapped as ( - {{ get_event_data( -- noqa - 'arbitrum', - 'mainnet', - 'synthetix', - 'spot_market_proxy', - 'synth_wrapped' - ) }} + {{ get_event_data('arbitrum', 'mainnet', 'synthetix', 'spot_market_proxy', 'synth_wrapped') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/buyback/buyback_processed_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/buyback/buyback_processed_base_mainnet.sql index 4dd32d8c..e4128790 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/buyback/buyback_processed_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/buyback/buyback_processed_base_mainnet.sql @@ -1,21 +1,9 @@ with legacy_events as ( - {{ get_event_data( -- noqa - 'base', - 'mainnet', - 'synthetix', - 'buyback_snx_legacy', - 'buyback_processed' - ) }} + {{ get_event_data('base', 'mainnet', 'synthetix', 'buyback_snx_legacy', 'buyback_processed') }} -- noqa ), current_events as ( - {{ get_event_data( -- noqa - 'base', - 'mainnet', - 'synthetix', - 'buyback_snx', - 'buyback_processed' - ) }} + {{ get_event_data('base', 'mainnet', 'synthetix', 'buyback_snx', 'buyback_processed') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_account_created_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_account_created_base_mainnet.sql index 15aab1f6..e83b59c9 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_account_created_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_account_created_base_mainnet.sql @@ -1,11 +1,5 @@ with core_account_created as ( - {{ get_event_data( -- noqa - 'base', - 'mainnet', - 'synthetix', - 'core_proxy', - 'account_created' - ) }} + {{ get_event_data('base', 'mainnet', 'synthetix', 'core_proxy', 'account_created') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_delegation_updated_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_delegation_updated_base_mainnet.sql index eb466d61..979315c0 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_delegation_updated_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_delegation_updated_base_mainnet.sql @@ -1,11 +1,5 @@ with delegation_updated as ( - {{ get_event_data( -- noqa - 'base', - 'mainnet', - 'synthetix', - 'core_proxy', - 'delegation_updated' - ) }} + {{ get_event_data('base', 'mainnet', 'synthetix', 'core_proxy', 'delegation_updated') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_deposited_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_deposited_base_mainnet.sql index 6af26866..c5e6035f 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_deposited_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_deposited_base_mainnet.sql @@ -1,11 +1,5 @@ with core_deposited as ( - {{ get_event_data( -- noqa - 'base', - 'mainnet', - 'synthetix', - 'core_proxy', - 'deposited' - ) }} + {{ get_event_data('base', 'mainnet', 'synthetix', 'core_proxy', 'deposited') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_liquidation_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_liquidation_base_mainnet.sql index 3bd72e6a..d93a8433 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_liquidation_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_liquidation_base_mainnet.sql @@ -1,11 +1,5 @@ with core_liquidation as ( - {{ get_event_data( -- noqa - 'base', - 'mainnet', - 'synthetix', - 'core_proxy', - 'liquidation' - ) }} + {{ get_event_data('base', 'mainnet', 'synthetix', 'core_proxy', 'liquidation') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_market_registered_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_market_registered_base_mainnet.sql index 7b450449..d4b76cfa 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_market_registered_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_market_registered_base_mainnet.sql @@ -1,11 +1,5 @@ with core_market_registered as ( - {{ get_event_data( -- noqa - 'base', - 'mainnet', - 'synthetix', - 'core_proxy', - 'market_registered' - ) }} + {{ get_event_data('base', 'mainnet', 'synthetix', 'core_proxy', 'market_registered') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_market_updated_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_market_updated_base_mainnet.sql index ddfc57a7..6556ddae 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_market_updated_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_market_updated_base_mainnet.sql @@ -17,13 +17,7 @@ with events as ( cast(token_amount as UInt256) as token_amount from ( - {{ get_event_data( - 'base', - 'mainnet', - 'synthetix', - 'core_proxy', - 'market_collateral_deposited' - ) }} + {{ get_event_data('base', 'mainnet', 'synthetix', 'core_proxy', 'market_collateral_deposited') }} -- noqa ) as collateral_deposited -- noqa: AL05 union all select @@ -44,13 +38,7 @@ with events as ( cast(token_amount as UInt256) as token_amount from ( - {{ get_event_data( - 'base', - 'mainnet', - 'synthetix', - 'core_proxy', - 'market_collateral_withdrawn' - ) }} + {{ get_event_data('base', 'mainnet', 'synthetix', 'core_proxy', 'market_collateral_withdrawn') }} -- noqa ) as collateral_withdrawn -- noqa: AL05 union all select @@ -71,13 +59,7 @@ with events as ( cast(amount as UInt256) as token_amount from ( - {{ get_event_data( - 'base', - 'mainnet', - 'synthetix', - 'core_proxy', - 'market_usd_deposited' - ) }} + {{ get_event_data('base', 'mainnet', 'synthetix', 'core_proxy', 'market_usd_deposited') }} -- noqa ) as usd_deposited -- noqa: AL05 union all select @@ -98,13 +80,7 @@ with events as ( cast(amount as UInt256) as token_amount from ( - {{ get_event_data( - 'base', - 'mainnet', - 'synthetix', - 'core_proxy', - 'market_usd_withdrawn' - ) }} + {{ get_event_data('base', 'mainnet', 'synthetix', 'core_proxy', 'market_usd_withdrawn') }} -- noqa ) as usd_withdrawn -- noqa: AL05 ) diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_pool_created_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_pool_created_base_mainnet.sql index 757669e6..3a70a5a9 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_pool_created_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_pool_created_base_mainnet.sql @@ -1,11 +1,5 @@ with core_pool_created as ( - {{ get_event_data( -- noqa - 'base', - 'mainnet', - 'synthetix', - 'core_proxy', - 'pool_created' - ) }} + {{ get_event_data('base', 'mainnet', 'synthetix', 'core_proxy', 'pool_created') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_rewards_claimed_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_rewards_claimed_base_mainnet.sql index 3e817471..47e9a1fe 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_rewards_claimed_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_rewards_claimed_base_mainnet.sql @@ -1,11 +1,5 @@ with core_rewards_claimed as ( - {{ get_event_data( -- noqa - 'base', - 'mainnet', - 'synthetix', - 'core_proxy', - 'rewards_claimed' - ) }} + {{ get_event_data('base', 'mainnet', 'synthetix', 'core_proxy', 'rewards_claimed') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_rewards_distributed_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_rewards_distributed_base_mainnet.sql index b5e0837f..e683d5ae 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_rewards_distributed_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_rewards_distributed_base_mainnet.sql @@ -1,11 +1,5 @@ with core_rewards_distributed as ( - {{ get_event_data( -- noqa - 'base', - 'mainnet', - 'synthetix', - 'core_proxy', - 'rewards_distributed' - ) }} + {{ get_event_data('base', 'mainnet', 'synthetix', 'core_proxy', 'rewards_distributed') }} -- noqa ) select @@ -19,6 +13,6 @@ select collateral_type, distributor, cast(amount as UInt256) as amount, - cast(start as UInt256) as start, + cast(start as UInt256) as start, -- noqa cast(duration as UInt256) as duration from core_rewards_distributed diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_usd_burned_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_usd_burned_base_mainnet.sql index 260232a2..68ea1cac 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_usd_burned_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_usd_burned_base_mainnet.sql @@ -1,11 +1,5 @@ with core_usd_burned as ( - {{ get_event_data( -- noqa - 'base', - 'mainnet', - 'synthetix', - 'core_proxy', - 'usd_burned' - ) }} + {{ get_event_data('base', 'mainnet', 'synthetix', 'core_proxy', 'usd_burned') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_usd_minted_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_usd_minted_base_mainnet.sql index aa195815..451446f0 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_usd_minted_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_usd_minted_base_mainnet.sql @@ -1,11 +1,5 @@ with core_usd_minted as ( - {{ get_event_data( -- noqa - 'base', - 'mainnet', - 'synthetix', - 'core_proxy', - 'usd_minted' - ) }} + {{ get_event_data('base', 'mainnet', 'synthetix', 'core_proxy', 'usd_minted') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_vault_liquidation_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_vault_liquidation_base_mainnet.sql index c3a8c940..9dd621cb 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_vault_liquidation_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_vault_liquidation_base_mainnet.sql @@ -1,11 +1,5 @@ with core_vault_liquidation as ( - {{ get_event_data( -- noqa - 'base', - 'mainnet', - 'synthetix', - 'core_proxy', - 'vault_liquidation' - ) }} + {{ get_event_data('base', 'mainnet', 'synthetix', 'core_proxy', 'vault_liquidation') }} -- noqa ) select @@ -18,6 +12,6 @@ select sender, liquidation_data, cast(pool_id as UInt128) as pool_id, - cast(collateral_type as text) as collateral_type, + cast(collateral_type as String) as collateral_type, cast(liquidate_as_account_id as UInt128) as liquidate_as_account_id from core_vault_liquidation diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_withdrawn_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_withdrawn_base_mainnet.sql index edc2f589..b678eba9 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_withdrawn_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/core/core_withdrawn_base_mainnet.sql @@ -1,11 +1,5 @@ with core_withdrawn as ( - {{ get_event_data( -- noqa - 'base', - 'mainnet', - 'synthetix', - 'core_proxy', - 'withdrawn' - ) }} + {{ get_event_data('base', 'mainnet', 'synthetix', 'core_proxy', 'withdrawn') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_account_created_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_account_created_base_mainnet.sql index bcbeab19..d1061667 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_account_created_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_account_created_base_mainnet.sql @@ -1,11 +1,5 @@ with perps_account_created as ( - {{ get_event_data( -- noqa - 'base', - 'mainnet', - 'synthetix', - 'perps_market_proxy', - 'account_created' - ) }} + {{ get_event_data('base', 'mainnet', 'synthetix', 'perps_market_proxy', 'account_created') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_account_liquidation_attempt_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_account_liquidation_attempt_base_mainnet.sql index 050032c6..b57d9f36 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_account_liquidation_attempt_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_account_liquidation_attempt_base_mainnet.sql @@ -1,11 +1,5 @@ with perps_account_liquidation_attempt as ( - {{ get_event_data( -- noqa - 'base', - 'mainnet', - 'synthetix', - 'perps_market_proxy', - 'account_liquidation_attempt' - ) }} + {{ get_event_data('base', 'mainnet', 'synthetix', 'perps_market_proxy', 'account_liquidation_attempt') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_collateral_modified_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_collateral_modified_base_mainnet.sql index 24a85791..24490f5d 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_collateral_modified_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_collateral_modified_base_mainnet.sql @@ -1,11 +1,5 @@ with perps_collateral_modified as ( - {{ get_event_data( -- noqa - 'base', - 'mainnet', - 'synthetix', - 'perps_market_proxy', - 'collateral_modified' - ) }} + {{ get_event_data('base', 'mainnet', 'synthetix', 'perps_market_proxy', 'collateral_modified') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_interest_charged_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_interest_charged_base_mainnet.sql index 19e28ae4..c13a4571 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_interest_charged_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_interest_charged_base_mainnet.sql @@ -1,11 +1,5 @@ with perps_interest_charged as ( - {{ get_event_data( -- noqa - 'base', - 'mainnet', - 'synthetix', - 'perps_market_proxy', - 'interest_charged' - ) }} + {{ get_event_data('base', 'mainnet', 'synthetix', 'perps_market_proxy', 'interest_charged') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_interest_rate_updated_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_interest_rate_updated_base_mainnet.sql index 8628bc45..a5551c91 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_interest_rate_updated_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_interest_rate_updated_base_mainnet.sql @@ -1,11 +1,5 @@ with perps_interest_rate_updated as ( - {{ get_event_data( -- noqa - 'base', - 'mainnet', - 'synthetix', - 'perps_market_proxy', - 'interest_rate_updated' - ) }} + {{ get_event_data('base', 'mainnet', 'synthetix', 'perps_market_proxy', 'interest_rate_updated') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_market_created_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_market_created_base_mainnet.sql index 9c2801fa..697142ee 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_market_created_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_market_created_base_mainnet.sql @@ -1,11 +1,5 @@ with perps_market_created as ( - {{ get_event_data( -- noqa - 'base', - 'mainnet', - 'synthetix', - 'perps_market_proxy', - 'market_created' - ) }} + {{ get_event_data('base', 'mainnet', 'synthetix', 'perps_market_proxy', 'market_created') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_market_updated_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_market_updated_base_mainnet.sql index 15dfca8b..780784a2 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_market_updated_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_market_updated_base_mainnet.sql @@ -1,21 +1,9 @@ with legacy_events as ( - {{ get_event_data( -- noqa - 'base', - 'mainnet', - 'synthetix', - 'perps_market_proxy_legacy', - 'market_updated' - ) }} + {{ get_event_data('base', 'mainnet', 'synthetix', 'perps_market_proxy_legacy', 'market_updated') }} -- noqa ), current_events as ( - {{ get_event_data( -- noqa - 'base', - 'mainnet', - 'synthetix', - 'perps_market_proxy', - 'market_updated' - ) }} + {{ get_event_data('base', 'mainnet', 'synthetix', 'perps_market_proxy', 'market_updated') }} -- noqa ) diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_order_committed_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_order_committed_base_mainnet.sql index f4855ef0..d131f64f 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_order_committed_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_order_committed_base_mainnet.sql @@ -1,21 +1,9 @@ with legacy_events as ( - {{ get_event_data( -- noqa - 'base', - 'mainnet', - 'synthetix', - 'perps_market_proxy_legacy', - 'order_committed' - ) }} + {{ get_event_data('base', 'mainnet', 'synthetix', 'perps_market_proxy_legacy', 'order_committed') }} -- noqa ), current_events as ( - {{ get_event_data( -- noqa - 'base', - 'mainnet', - 'synthetix', - 'perps_market_proxy', - 'order_committed' - ) }} + {{ get_event_data('base', 'mainnet', 'synthetix', 'perps_market_proxy', 'order_committed') }} -- noqa ) select @@ -30,7 +18,7 @@ select cast(commitment_time as UInt256) as commitment_time, cast(expiration_time as UInt256) as expiration_time, cast(settlement_time as UInt256) as settlement_time, - cast(null as Nullable(UInt256)) as expected_price_time, + cast(null as Nullable(UInt256)) as expected_price_time, -- noqa cast(acceptable_price as UInt256) as acceptable_price, cast(order_type as UInt8) as order_type, cast(size_delta as Int128) as size_delta, @@ -51,7 +39,7 @@ select cast(commitment_time as UInt256) as commitment_time, cast(expiration_time as UInt256) as expiration_time, cast(settlement_time as UInt256) as settlement_time, - cast(expected_price_time as Nullable(UInt256)) as expected_price_time, + cast(expected_price_time as Nullable(UInt256)) as expected_price_time, -- noqa cast(acceptable_price as UInt256) as acceptable_price, cast(order_type as UInt8) as order_type, cast(size_delta as Int128) as size_delta, diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_order_settled_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_order_settled_base_mainnet.sql index a390d620..40e7e5b5 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_order_settled_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_order_settled_base_mainnet.sql @@ -1,11 +1,5 @@ with perps_order_settled as ( - {{ get_event_data( -- noqa - 'base', - 'mainnet', - 'synthetix', - 'perps_market_proxy', - 'order_settled' - ) }} + {{ get_event_data('base', 'mainnet', 'synthetix', 'perps_market_proxy', 'order_settled') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_position_liquidated_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_position_liquidated_base_mainnet.sql index ce5e53ea..49c5fc56 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_position_liquidated_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_position_liquidated_base_mainnet.sql @@ -1,11 +1,5 @@ with perps_position_liquidated as ( - {{ get_event_data( -- noqa - 'base', - 'mainnet', - 'synthetix', - 'perps_market_proxy', - 'position_liquidated' - ) }} + {{ get_event_data('base', 'mainnet', 'synthetix', 'perps_market_proxy', 'position_liquidated') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_previous_order_expired_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_previous_order_expired_base_mainnet.sql index 3a29b656..2cc239b7 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_previous_order_expired_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/perp/perp_previous_order_expired_base_mainnet.sql @@ -1,11 +1,5 @@ with perps_previous_order_expired as ( - {{ get_event_data( -- noqa - 'base', - 'mainnet', - 'synthetix', - 'perps_market_proxy', - 'previous_order_expired' - ) }} + {{ get_event_data('base', 'mainnet', 'synthetix', 'perps_market_proxy', 'previous_order_expired') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_order_cancelled_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_order_cancelled_base_mainnet.sql index e051d15a..f8491c7c 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_order_cancelled_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_order_cancelled_base_mainnet.sql @@ -1,11 +1,5 @@ with spot_order_cancelled as ( - {{ get_event_data( -- noqa - 'base', - 'mainnet', - 'synthetix', - 'spot_market_proxy', - 'order_cancelled' - ) }} + {{ get_event_data('base', 'mainnet', 'synthetix', 'spot_market_proxy', 'order_cancelled') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_order_committed_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_order_committed_base_mainnet.sql index f33695e8..fc20d283 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_order_committed_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_order_committed_base_mainnet.sql @@ -1,11 +1,5 @@ with spot_order_committed as ( - {{ get_event_data( -- noqa - 'base', - 'mainnet', - 'synthetix', - 'spot_market_proxy', - 'order_committed' - ) }} + {{ get_event_data('base', 'mainnet', 'synthetix', 'spot_market_proxy', 'order_committed') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_order_settled_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_order_settled_base_mainnet.sql index 80e3deff..6e53a300 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_order_settled_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_order_settled_base_mainnet.sql @@ -1,11 +1,5 @@ with spot_order_settled as ( - {{ get_event_data( -- noqa - 'base', - 'mainnet', - 'synthetix', - 'spot_market_proxy', - 'order_settled' - ) }} + {{ get_event_data('base', 'mainnet', 'synthetix', 'spot_market_proxy', 'order_settled') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_bought_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_bought_base_mainnet.sql index 55cc3781..a95d2977 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_bought_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_bought_base_mainnet.sql @@ -1,11 +1,5 @@ with spot_synth_bought as ( - {{ get_event_data( -- noqa - 'base', - 'mainnet', - 'synthetix', - 'spot_market_proxy', - 'synth_bought' - ) }} + {{ get_event_data('base', 'mainnet', 'synthetix', 'spot_market_proxy', 'synth_bought') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_registered_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_registered_base_mainnet.sql index c8bcc9fb..aba87f35 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_registered_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_registered_base_mainnet.sql @@ -1,11 +1,5 @@ with spot_synth_registered as ( - {{ get_event_data( -- noqa - 'base', - 'mainnet', - 'synthetix', - 'spot_market_proxy', - 'synth_registered' - ) }} + {{ get_event_data('base', 'mainnet', 'synthetix', 'spot_market_proxy', 'synth_registered') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_sold_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_sold_base_mainnet.sql index d0ae9b65..738cb048 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_sold_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_sold_base_mainnet.sql @@ -1,11 +1,5 @@ with spot_synth_sold as ( - {{ get_event_data( -- noqa - 'base', - 'mainnet', - 'synthetix', - 'spot_market_proxy', - 'synth_sold' - ) }} + {{ get_event_data('base', 'mainnet', 'synthetix', 'spot_market_proxy', 'synth_sold') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_unwrapped_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_unwrapped_base_mainnet.sql index f952474a..de9a55b5 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_unwrapped_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_unwrapped_base_mainnet.sql @@ -1,11 +1,5 @@ with spot_synth_unwrapped as ( - {{ get_event_data( -- noqa - 'base', - 'mainnet', - 'synthetix', - 'spot_market_proxy', - 'synth_unwrapped' - ) }} + {{ get_event_data('base', 'mainnet', 'synthetix', 'spot_market_proxy', 'synth_unwrapped') }} -- noqa ) select diff --git a/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_wrapped_base_mainnet.sql b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_wrapped_base_mainnet.sql index 05f52b2c..291d11e1 100644 --- a/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_wrapped_base_mainnet.sql +++ b/transformers/synthetix/models/core/base/mainnet/synthetix/spot/spot_synth_wrapped_base_mainnet.sql @@ -1,11 +1,5 @@ with spot_synth_wrapped as ( - {{ get_event_data( -- noqa - 'base', - 'mainnet', - 'synthetix', - 'spot_market_proxy', - 'synth_wrapped' - ) }} + {{ get_event_data('base', 'mainnet', 'synthetix', 'spot_market_proxy', 'synth_wrapped') }} -- noqa ) select From a4ef500278b7d9c25c6678673a66c7c7b019f0e2 Mon Sep 17 00:00:00 2001 From: Troy Date: Tue, 17 Dec 2024 21:05:17 +0000 Subject: [PATCH 19/21] add cannon config to arbitrum --- indexers/networks/arbitrum_mainnet/network_config.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/indexers/networks/arbitrum_mainnet/network_config.yaml b/indexers/networks/arbitrum_mainnet/network_config.yaml index 2a5258e2..8f9feb55 100644 --- a/indexers/networks/arbitrum_mainnet/network_config.yaml +++ b/indexers/networks/arbitrum_mainnet/network_config.yaml @@ -18,11 +18,15 @@ configs: package: perpsFactory - name: PerpsAccountProxy package: perpsFactory + cannon_config: + package: "synthetix-omnibus" + version: "latest" + preset: "main" curve: range: from: 236000000 contracts_from_abi: - name: CurveUsdx - address: '0x096A8865367686290639bc50bF8D85C0110d9Fea' + address: "0x096A8865367686290639bc50bF8D85C0110d9Fea" abi: ./abi/CurvePool.json From 1e4dc56ab0f4fe157427fd5ebd5d30981a5346da Mon Sep 17 00:00:00 2001 From: Troy Date: Tue, 17 Dec 2024 21:05:39 +0000 Subject: [PATCH 20/21] update docker image --- indexers/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/indexers/Dockerfile b/indexers/Dockerfile index 8d60c161..a4e541f5 100644 --- a/indexers/Dockerfile +++ b/indexers/Dockerfile @@ -6,7 +6,8 @@ WORKDIR /app COPY package*.json ./ COPY patches/ ./patches/ -RUN apt-get update && apt-get install -y build-essential && npm ci && apt-get remove -y build-essential +RUN apt-get update && apt-get install -y build-essential clang +RUN npm ci COPY pyproject.toml uv.lock ./ RUN uv sync --frozen --no-dev From 9a536c875027dc8dc02afff23c8cf324d353409e Mon Sep 17 00:00:00 2001 From: marcus-snx Date: Wed, 18 Dec 2024 19:38:28 +0200 Subject: [PATCH 21/21] Fix main script --- indexers/main.py | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/indexers/main.py b/indexers/main.py index 4cbc596a..0025ad0d 100644 --- a/indexers/main.py +++ b/indexers/main.py @@ -121,19 +121,6 @@ def load_network_config(path): # Load custom config custom_config = config_file["configs"][protocol_name] - # Initialize Synthetix SDK (with optional Cannon config) - if "cannon_config" in custom_config: - snx = Synthetix( - provider_rpc=rpc_endpoint, - network_id=network_id, - cannon_config=custom_config["cannon_config"], - ) - else: - snx = Synthetix( - provider_rpc=rpc_endpoint, - network_id=network_id, - ) - # Set block range based on config. block_range = {} if args.block_from is not None: @@ -157,7 +144,20 @@ def load_network_config(path): # Get contracts from SDK or ABI files contracts = [] schemas_path = f"{SCHEMAS_BASE_PATH}/{network_name}/{protocol_name}" + if "contracts_from_sdk" in custom_config: + # Initialize Synthetix SDK (with optional Cannon config) + if "cannon_config" in custom_config: + snx = Synthetix( + provider_rpc=rpc_endpoint, + network_id=network_id, + cannon_config=custom_config["cannon_config"], + ) + else: + snx = Synthetix( + provider_rpc=rpc_endpoint, + network_id=network_id, + ) contracts_from_sdk = custom_config["contracts_from_sdk"] for contract in contracts_from_sdk: name = contract["name"] @@ -192,8 +192,8 @@ def load_network_config(path): client=client, ) contracts.append({"name": name, "address": contract["address"]}) - else: - message = "No contracts found in network config" + if not contracts: + message = "No contracts found" raise Exception(message) # Create squidgen generator config @@ -209,6 +209,4 @@ def load_network_config(path): ) write_yaml(squidgen_config, "squidgen.yaml") - snx.logger.info( - f"squidgen.yaml and ABI files have been generated for {args.network_name}" - ) + print(f"squidgen.yaml and ABI files have been generated for {args.network_name}")