Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into addresses_info
Browse files Browse the repository at this point in the history
  • Loading branch information
hildobby committed Oct 3, 2024
2 parents b858dae + bd7f463 commit 569d50d
Show file tree
Hide file tree
Showing 382 changed files with 14,367 additions and 2,620 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ dbt_macros/dune/create_views_of_dependencies.sql
dbt_macros/dune/alter_table_locations.sql
scripts/integration_test/test_diffs_tokens/*
.vs
dbt_subprojects/manifests/*


# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down Expand Up @@ -146,3 +148,4 @@ logs/
!target/manifest.json
!target/run_results.json
!target/sources.json

Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ filtered_daily_agg_balances as (
END as balance,
erc20_tokens.symbol as token_symbol,
token_id
from {{ref('tokens_'~blockchain~'_balances_daily_agg_base')}} b
from {{source('tokens_'~blockchain,'balances_daily_agg_base')}} b
{% if address_list is not none %}
inner join (select distinct address from {{address_list}}) f1
on f1.address = b.address
Expand Down
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 All @@ -55,5 +57,13 @@ models:
description: "The amount of tokens involved in the transaction"
- name: price_usd
description: "The USD price of the fungibles used in the transaction"
- name: heroes_revenue
description: "The revenue generated for heroes"
- name: heroes_revenue_usd
description: "The revenue generated for heroes in USD"
- name: to_fantasy_treasury
description: "The amount going to fantasy's treasury excluding direct hero rewards"
- name: to_fantasy_treasury_usd
description: "The amount in USD going to fantasy's treasury excluding direct hero rewards"
- name: tactics_bought
description: "The amount of tactics tickets bought"
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 All @@ -68,6 +69,10 @@ SELECT m.evt_block_time AS block_time
, 0x4300000000000000000000000000000000000004 AS token_address
, m.price/POWER(10, 18) AS token_amount
, m.price/POWER(10, 18)*pu.price AS price_usd
, 0.1*m.price/POWER(10, 18) AS heroes_revenue
, 0.1*m.price/POWER(10, 18)*pu.price AS heroes_revenue_usd
, 0.9*m.price/POWER(10, 18) AS to_fantasy_treasury
, 0.9*m.price/POWER(10, 18)*pu.price AS to_fantasy_treasury_usd
, 0 AS tactics_bought
FROM {{ source('fantasy_blast', 'Minter_evt_Mint')}} m
INNER JOIN fantasy_configs c ON m.mintConfigId=c.config_id
Expand All @@ -89,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 All @@ -100,6 +106,10 @@ SELECT evt_block_time AS block_time
, CAST(NULL AS varbinary) AS token_address
, 0 AS token_amount
, 0 AS price_usd
, 0 AS heroes_revenue
, 0 AS heroes_revenue_usd
, 0 AS to_fantasy_treasury
, 0 AS to_fantasy_treasury_usd
, 0 AS tactics_bought
FROM {{ source('fantasy_blast', 'Minter_evt_LevelUp')}}

Expand All @@ -117,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 All @@ -128,6 +139,10 @@ SELECT evt_block_time AS block_time
, CAST(NULL AS varbinary) AS token_address
, 0 AS token_amount
, 0 AS price_usd
, 0 AS heroes_revenue
, 0 AS heroes_revenue_usd
, 0 AS to_fantasy_treasury
, 0 AS to_fantasy_treasury_usd
, 0 AS tactics_bought
FROM {{ source('fantasy_blast', 'Minter_evt_BurnToDraw')}}

Expand All @@ -145,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 @@ -156,13 +172,17 @@ SELECT nftt.block_time
, nftt.currency_contract AS token_address
, nftt.amount_original AS token_amount
, nftt.amount_usd AS price_usd
, royalty_fee_amount AS heroes_revenue
, royalty_fee_amount_usd AS heroes_revenue_usd
, platform_fee_amount AS to_fantasy_treasury
, platform_fee_amount_usd AS to_fantasy_treasury_usd
, 0 AS tactics_bought
FROM {{ source('nft', 'trades') }} nftt
INNER JOIN {{ source('blast', 'transactions') }} txs ON txs.block_number=nftt.block_number
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 @@ -180,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 All @@ -191,6 +212,10 @@ SELECT block_time
, contract_address AS token_address
, amount AS token_amount
, amount_usd AS price_usd
, 0.015*amount AS heroes_revenue
, 0.015*amount_usd AS heroes_revenue_usd
, 0.06*amount AS to_fantasy_treasury
, 0.06*amount_usd AS to_fantasy_treasury_usd
, ROUND(amount_usd/19.99) AS tactics_bought
FROM {{ source('tokens_blast', 'transfers') }} tt
WHERE block_number >= 4917909
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
Loading

0 comments on commit 569d50d

Please sign in to comment.