Skip to content

Commit 2fb24a4

Browse files
authored
nft transactions to nft events (#1279)
After giving it some more thought and implementing the first version of it, I actually think nft.transactions shoul be changed to nft.events. Events correspond better to the tables built on top of it (nft.mints/burns/trades), and transactions have a very precise meaning for EVM blockchains. We could actually do an nft.transactions abstraction that would only give info about transaction value/gas fees at the transaction level (not the log/transfer level) later on. Brief comments on the purpose of your changes: *For Dune Engine V2* I've checked that: * [x] I tested the query on dune.com after compiling the model with dbt compile (compiled queries are written to the target directory) * [x] I used "refs" to reference other models in this repo and "sources" to reference raw or decoded tables * [x] if adding a new model, I added a test * [x] the filename is unique and ends with .sql * [x] each sql file is a select statement and has only one view, table or function defined * [x] column names are `lowercase_snake_cased` When you are ready for a review, tag duneanalytics/data-experience. We will re-open your forked pull request as an internal pull request. Then your spells will run in dbt and the logs will be avaiable in Github Actions DBT Slim CI. This job will only run the models and tests changed by your PR compared to the production project.
1 parent 76de6e0 commit 2fb24a4

21 files changed

+48
-48
lines changed

spellbook/macros/alter_table_properties.sql

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ ALTER VIEW balances_ethereum.erc1155_latest SET TBLPROPERTIES('dune.public'='tru
8282
'dune.data_explorer.contributors'='["soispoke"]');
8383
{% endset %}
8484

85-
{% set opensea_transactions %}
86-
ALTER TABLE opensea.transactions SET TBLPROPERTIES('dune.public'='true',
85+
{% set opensea_events %}
86+
ALTER TABLE opensea.events SET TBLPROPERTIES('dune.public'='true',
8787
'dune.data_explorer.blockchains'='["ethereum","solana"]',
8888
'dune.data_explorer.category'='abstraction',
8989
'dune.data_explorer.abstraction.type'='project',
@@ -128,8 +128,8 @@ ALTER VIEW opensea.fees SET TBLPROPERTIES('dune.public'='true',
128128
{% endset %}
129129

130130

131-
{% set magiceden_transactions %}
132-
ALTER TABLE magiceden.transactions SET TBLPROPERTIES('dune.public'='true',
131+
{% set magiceden_events %}
132+
ALTER TABLE magiceden.events SET TBLPROPERTIES('dune.public'='true',
133133
'dune.data_explorer.blockchains'='["solana"]',
134134
'dune.data_explorer.category'='abstraction',
135135
'dune.data_explorer.abstraction.type'='project',
@@ -155,8 +155,8 @@ ALTER VIEW magiceden.mints SET TBLPROPERTIES('dune.public'='true',
155155
'dune.data_explorer.contributors'='["soispoke"]');
156156
{% endset %}
157157

158-
{% set nft_transactions %}
159-
ALTER TABLE nft.transactions SET TBLPROPERTIES('dune.public'='true',
158+
{% set nft_events %}
159+
ALTER TABLE nft.events SET TBLPROPERTIES('dune.public'='true',
160160
'dune.data_explorer.blockchains'='["ethereum","solana"]',
161161
'dune.data_explorer.category'='abstraction',
162162
'dune.data_explorer.abstraction.type'='sector',
@@ -290,15 +290,15 @@ ALTER VIEW ens.view_renewals SET TBLPROPERTIES('dune.public'='true',
290290
{% do run_query(balances_ethereum_erc1155_day) %}
291291
{% do run_query(balances_ethereum_erc1155_hour) %}
292292
{% do run_query(balances_ethereum_erc1155_latest) %}
293-
{% do run_query(opensea_transactions) %}
293+
{% do run_query(opensea_events) %}
294294
{% do run_query(opensea_trades) %}
295295
{% do run_query(opensea_mints) %}
296296
{% do run_query(opensea_burns) %}
297297
{% do run_query(opensea_fees) %}
298-
{% do run_query(magiceden_transactions) %}
298+
{% do run_query(magiceden_events) %}
299299
{% do run_query(magiceden_trades) %}
300300
{% do run_query(magiceden_mints) %}
301-
{% do run_query(nft_transactions) %}
301+
{% do run_query(nft_events) %}
302302
{% do run_query(nft_trades) %}
303303
{% do run_query(nft_mints) %}
304304
{% do run_query(nft_burns) %}

spellbook/models/magiceden/magiceden_transactions.sql renamed to spellbook/models/magiceden/magiceden_events.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ NULL::string as royalty_fee_percentage,
4343
NULL::double as royalty_fee_receive_address,
4444
NULL::double as royalty_fee_currency_symbol,
4545
unique_trade_id
46-
FROM {{ ref('magiceden_solana_transactions') }}
46+
FROM {{ ref('magiceden_solana_events') }}
4747

4848
{% if is_incremental() %}
4949
-- this filter will only be applied on an incremental run

spellbook/models/magiceden/magiceden_schema.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
version: 2
22

33
models:
4-
- name: magiceden_transactions
4+
- name: magiceden_events
55
meta:
66
blockchain: solana
77
project: magiceden
88
contributors: soispoke
99
config:
10-
tags: ['magiceden','solana','transactions']
10+
tags: ['magiceden','solana','events']
1111
description: >
12-
Magic Eden transactions
12+
Magic Eden events
1313
columns:
1414
- &blockchain
1515
name: blockchain

spellbook/models/magiceden/solana/magiceden_solana_transactions.sql renamed to spellbook/models/magiceden/solana/magiceden_solana_events.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{ config(
2-
alias ='transactions',
2+
alias ='events',
33
materialized ='incremental',
44
file_format ='delta',
55
incremental_strategy='merge',

spellbook/models/magiceden/solana/magiceden_solana_mints.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
)
44
}}
55

6-
SELECT * FROM {{ ref('magiceden_solana_transactions') }}
6+
SELECT * FROM {{ ref('magiceden_solana_events') }}
77
WHERE evt_type = 'Mint'

spellbook/models/magiceden/solana/magiceden_solana_schema.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
version: 2
22

33
models:
4-
- name: magiceden_solana_transactions
4+
- name: magiceden_solana_events
55
meta:
66
blockchain: solana
77
project: magiceden
88
contributors: soispoke
99
config:
10-
tags: ['magiceden','solana','transactions']
10+
tags: ['magiceden','solana','events']
1111
description: >
12-
Magic Eden transactions on Solana
12+
Magic Eden events on Solana
1313
columns:
1414
- &blockchain
1515
name: blockchain

spellbook/models/magiceden/solana/magiceden_solana_trades.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
)
44
}}
55

6-
SELECT * FROM {{ ref('magiceden_solana_transactions') }}
6+
SELECT * FROM {{ ref('magiceden_solana_events') }}
77
WHERE evt_type = 'Trade'

spellbook/models/nft/nft_transactions.sql renamed to spellbook/models/nft/nft_events.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{ config(
2-
alias ='transactions',
2+
alias ='events',
33
materialized ='incremental',
44
file_format ='delta',
55
incremental_strategy='merge',
@@ -9,9 +9,9 @@
99

1010

1111
SELECT * FROM (
12-
SELECT * FROM {{ ref('opensea_transactions') }}
12+
SELECT * FROM {{ ref('opensea_events') }}
1313
UNION
14-
SELECT * FROM {{ ref('magiceden_transactions') }})
14+
SELECT * FROM {{ ref('magiceden_events') }})
1515

1616
{% if is_incremental() %}
1717
-- this filter will only be applied on an incremental run

spellbook/models/nft/nft_schema.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
version: 2
22

33
models:
4-
- name: nft_transactions
4+
- name: nft_events
55
meta:
66
blockchain: ethereum, solana
77
sector: nft
88
contributors: soispoke
99
config:
10-
tags: ['nft', 'opensea', 'magiceden', 'ethereum', 'solana', 'transactions']
10+
tags: ['nft', 'opensea', 'magiceden', 'ethereum', 'solana', 'events']
1111
description: >
12-
NFT transactions
12+
NFT events
1313
columns:
1414
- &blockchain
1515
name: blockchain

spellbook/models/opensea/ethereum/opensea_ethereum_burns.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ tx_hash,
2929
tx_from,
3030
tx_to,
3131
unique_trade_id
32-
FROM ({{ ref('opensea_ethereum_transactions') }})
32+
FROM ({{ ref('opensea_ethereum_events') }})
3333
WHERE evt_type = 'Burn'

0 commit comments

Comments
 (0)