From 812e5b9447f61e09a94eb1965cae8707c1190a27 Mon Sep 17 00:00:00 2001 From: soispoke <66172107+soispoke@users.noreply.github.com> Date: Wed, 8 Jun 2022 10:42:00 +0200 Subject: [PATCH] Add collections to erc721 balances (#1140) * Add collections to erc721 balances * Update balances_ethereum_erc721_hour.sql * Update balances_ethereum_erc721_latest.sql --- .../balances/ethereum/erc721/balances_ethereum_erc721_day.sql | 4 +++- .../ethereum/erc721/balances_ethereum_erc721_hour.sql | 4 +++- .../ethereum/erc721/balances_ethereum_erc721_latest.sql | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/spellbook/models/balances/ethereum/erc721/balances_ethereum_erc721_day.sql b/spellbook/models/balances/ethereum/erc721/balances_ethereum_erc721_day.sql index d5a588f8d2e..d76e611ecb9 100644 --- a/spellbook/models/balances/ethereum/erc721/balances_ethereum_erc721_day.sql +++ b/spellbook/models/balances/ethereum/erc721/balances_ethereum_erc721_day.sql @@ -27,6 +27,8 @@ SELECT d.day, b.wallet_address, b.token_address, - b.tokenId + b.tokenId, + nft_tokens.name as collection FROM daily_balances b INNER JOIN days d ON b.day <= d.day AND d.day < b.next_day +LEFT JOIN {{ ref('tokens_ethereum_nft') }} nft_tokens ON nft_tokens.contract_address = b.token_address diff --git a/spellbook/models/balances/ethereum/erc721/balances_ethereum_erc721_hour.sql b/spellbook/models/balances/ethereum/erc721/balances_ethereum_erc721_hour.sql index f051dec505b..e7d4b88f2f6 100644 --- a/spellbook/models/balances/ethereum/erc721/balances_ethereum_erc721_hour.sql +++ b/spellbook/models/balances/ethereum/erc721/balances_ethereum_erc721_hour.sql @@ -27,6 +27,8 @@ SELECT d.hour, b.wallet_address, b.token_address, - b.tokenId + b.tokenId, + nft_tokens.name as collection FROM daily_balances b INNER JOIN hours d ON b.hour <= d.hour AND d.hour < b.next_hour +LEFT JOIN {{ ref('tokens_ethereum_nft') }} nft_tokens ON nft_tokens.contract_address = b.token_address diff --git a/spellbook/models/balances/ethereum/erc721/balances_ethereum_erc721_latest.sql b/spellbook/models/balances/ethereum/erc721/balances_ethereum_erc721_latest.sql index 124ade32396..493f0d04767 100644 --- a/spellbook/models/balances/ethereum/erc721/balances_ethereum_erc721_latest.sql +++ b/spellbook/models/balances/ethereum/erc721/balances_ethereum_erc721_latest.sql @@ -6,5 +6,7 @@ SELECT wallet_address, token_address, tokenId, + nft_tokens.name as collection, updated_at -FROM {{ ref('transfers_ethereum_erc721_rolling_hour') }} \ No newline at end of file +FROM {{ ref('transfers_ethereum_erc721_rolling_hour') }} +LEFT JOIN {{ ref('tokens_ethereum_nft') }} nft_tokens ON nft_tokens.contract_address = token_address