Skip to content

Commit

Permalink
Merge branch 'duneanalytics:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpartida authored Oct 3, 2024
2 parents d1e5f14 + bd7f463 commit 2da4fee
Show file tree
Hide file tree
Showing 243 changed files with 7,560 additions and 1,080 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ logs as (
, block_number
, block_time
, tx_hash
, tx_from
, tx_to
, index
, contract_address
, topic0
Expand Down Expand Up @@ -250,6 +252,8 @@ select
, block_number
, block_time
, tx_hash
, tx_from
, tx_to
, tx_success
, call_from
, call_to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ select
block_number
, block_time
, tx_hash
, tx_from
, tx_to
, index
, contract_address
, topic0
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ models:
description: "The list of minted fantasy.top card token ids"
- name: burned_ids
description: "The list of burned fantasy.top card token ids"
- name: traded_ids
description: "The list of traded fantasy.top card token ids"
- name: traded_with
description: "Who was on the other side of this executed trade"
- name: tx_from
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ SELECT m.evt_block_time AS block_time
, m.firstTokenId+90, m.firstTokenId+91, m.firstTokenId+92, m.firstTokenId+93, m.firstTokenId+94, m.firstTokenId+95, m.firstTokenId+96, m.firstTokenId+97, m.firstTokenId+98, m.firstTokenId+99
], x -> x <= lastTokenId) AS minted_ids
, NULL AS burned_ids
, NULL AS traded_ids
, NULL AS traded_with
, m.evt_tx_from AS tx_from
, m.evt_tx_to AS tx_to
Expand Down Expand Up @@ -93,6 +94,7 @@ SELECT evt_block_time AS block_time
, CAST(cardinality(burntTokenIds) AS double) AS cards_burned
, ARRAY[mintedTokenId] AS minted_ids
, burntTokenIds AS burned_ids
, NULL AS traded_ids
, NULL AS traded_with
, evt_tx_from AS tx_from
, evt_tx_to AS tx_to
Expand Down Expand Up @@ -125,6 +127,7 @@ SELECT evt_block_time AS block_time
, CAST(cardinality(burntTokenIds) AS double) AS cards_burned
, mintedTokenIds AS minted_ids
, burntTokenIds AS burned_ids
, NULL AS traded_ids
, NULL AS traded_with
, evt_tx_from AS tx_from
, evt_tx_to AS tx_to
Expand Down Expand Up @@ -157,6 +160,7 @@ SELECT nftt.block_time
, CAST(0 AS double) AS cards_burned
, NULL AS minted_ids
, NULL AS burned_ids
, nftt.token_id AS traded_ids
, CASE WHEN nftt.trade_category='Buy' THEN nftt.seller ELSE nftt.buyer END AS traded_with
, nftt.tx_from
, nftt.tx_to
Expand All @@ -178,7 +182,7 @@ INNER JOIN {{ source('blast', 'transactions') }} txs ON txs.block_number=nftt.bl
AND txs.hash=nftt.tx_hash
LEFT JOIN {{source('nft_blast', 'wash_trades')}} wt ON wt.project = 'fantasy'
AND wt.block_number=nftt.block_number
AND wt.tx_hash=nftt.tx_hash
AND nftt.unique_trade_id=wt.unique_trade_id
WHERE nftt.blockchain = 'blast'
AND nftt.project = 'fantasy'

Expand All @@ -196,6 +200,7 @@ SELECT block_time
, CAST(0 AS double) AS cards_burned
, NULL AS minted_ids
, NULL AS burned_ids
, NULL AS traded_ids
, NULL AS traded_with
, tx_from
, tx_to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,12 @@ models:
description: The change in initial collateral amount.
tests:
- not_null
- name: trigger_price
description: The price that triggers the order execution.
tests:
- not_null
- name: acceptable_price
description: The minimum acceptable price for order execution.
tests:
- not_null
- &trigger_price_raw
name: trigger_price_raw
description: The price that triggers the order execution.
- &acceptable_price_raw
name: acceptable_price_raw
description: The minimum acceptable price for order execution.
- name: execution_fee
description: The fee paid for executing the order in native tokens
tests:
Expand All @@ -142,15 +140,17 @@ models:
description: The gas limit set for callback functions.
tests:
- not_null
- name: min_output_amount
- &min_output_amount_raw
name: min_output_amount_raw
description: The minimum amount of output tokens expected from the order, based on the markets in the swap path.
tests:
- not_null
- name: updated_at_block
description: The block number at which the order was last updated.
tests:
- not_null
- name: updated_at_time
- not_null
- &updated_at_time
name: updated_at_time
description: The timestamp when the order was last updated.
- &is_long
name: is_long
Expand All @@ -161,7 +161,8 @@ models:
description: Boolean indicating if the native token should be unwrapped.
- name: is_frozen
description: Boolean indicating if the order is frozen.
- name: key
- &key
name: key
description: The unique identifier for the order, stored as a bytes32 value.
tests:
- not_null
Expand Down Expand Up @@ -196,11 +197,7 @@ models:
tests:
- not_null
- *msg_sender
- name: key
description: The key associated with the executed order. Extracted as a bytes32 value.
tests:
- not_null
- unique
- *key
- name: account
description: The address associated with the order
- name: secondary_order_type
Expand Down Expand Up @@ -243,11 +240,7 @@ models:
tests:
- not_null
- *msg_sender
- name: key
description: The key associated with the cancelled order. Extracted as a bytes32 value
tests:
- not_null
- unique
- *key
- name: account
description: The address associated with the order
- name: reason_bytes
Expand Down Expand Up @@ -818,4 +811,98 @@ models:
- *is_increase
- *order_key
- *position_key
- *referral_code
- *referral_code


- name: gmx_v2_arbitrum_order_frozen
meta:
blockchain: arbitrum
sector: dex
project: gmx
contributors: ai_data_master, gmx-io
config:
tags: ['arbitrum', 'gmx', 'event', 'order_frozen']
description: |
Extracts and decodes the `OrderFrozen` event log data from the Arbitrum blockchain.
This model processes log entries related to frozen orders, extracting key variables such as
account addresses, event keys, and strings representing the reason for the order being frozen.
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- tx_hash
- key

columns:
- *blockchain
- *block_time
- *block_date
- *block_number
- *tx_hash
- *index
- *contract_address
- *tx_from
- *tx_to
- name: event_name
description: The type of event recorded, always 'OrderFrozen' for this model
tests:
- not_null
- *msg_sender
- name: key
description: The key associated with the frozen order. Extracted as a bytes32 value
tests:
- not_null
- name: account
description: The address associated with the order
- name: reason_bytes
description: The reason for the order being frozen in byte format.
tests:
- not_null
- name: reason
description: The reason for the order being frozen in string format.
tests:
- not_null


- name: gmx_v2_arbitrum_order_updated
meta:
blockchain: arbitrum
sector: dex
project: gmx
contributors: ai_data_master, gmx-io
config:
tags: ['arbitrum', 'gmx', 'event', 'order_updated']
description: |
Extracts and decodes the `OrderUpdated` event log data from the Arbitrum blockchain.
This model processes log entries related to updated orders, extracting key variables such as
account addresses, event keys, and strings representing the reason for cancellation.
columns:
- *blockchain
- *block_time
- *block_date
- *block_number
- *tx_hash
- *index
- *contract_address
- *tx_from
- *tx_to
- name: event_name
description: The type of event recorded, always 'OrderUpdated' for this model.
tests:
- not_null
- *msg_sender
- name: key
description: The key associated with the updated order. Extracted as a bytes32 value
tests:
- not_null
- name: market
description: The market in which the order was updated.
tests:
- not_null
- name: account
description: The address associated with the order.
- *size_delta_usd
- *trigger_price_raw
- *acceptable_price_raw
- *min_output_amount_raw
- *updated_at_time
Original file line number Diff line number Diff line change
Expand Up @@ -266,16 +266,16 @@ WITH evt_data_1 AS (
size_delta_usd / POWER(10, 30) AS size_delta_usd,
initial_collateral_delta_amount / POWER(10, collateral_token_decimals) AS initial_collateral_delta_amount,
CASE
WHEN index_token_decimals IS NULL THEN trigger_price / POWER(10, 30)
WHEN index_token_decimals IS NULL THEN NULL
ELSE trigger_price / POWER(10, 30 - index_token_decimals)
END AS trigger_price,
END AS trigger_price_raw,
CASE
WHEN index_token_decimals IS NULL THEN acceptable_price / POWER(10, 30)
WHEN index_token_decimals IS NULL THEN NULL
ELSE acceptable_price / POWER(10, 30 - index_token_decimals)
END AS acceptable_price,
END AS acceptable_price_raw,
execution_fee / POWER(10, 18) AS execution_fee,
callback_gas_limit,
min_output_amount AS min_output_amount,
min_output_amount AS min_output_amount_raw,

updated_at_block,
CASE
Expand Down
Loading

0 comments on commit 2da4fee

Please sign in to comment.