From da3de70c8c80eb3488a6adfac78feb3909bfbe54 Mon Sep 17 00:00:00 2001 From: timmay_castags Date: Wed, 6 Sep 2023 17:09:35 -0400 Subject: [PATCH 1/6] Add PNDC to Tokens and Price --- models/prices/ethereum/prices_ethereum_tokens.sql | 1 + models/prices/ethereum/prices_ethereum_tokens_legacy.sql | 1 + models/tokens/ethereum/tokens_ethereum_erc20.sql | 1 + models/tokens/ethereum/tokens_ethereum_erc20_legacy.sql | 1 + 4 files changed, 4 insertions(+) diff --git a/models/prices/ethereum/prices_ethereum_tokens.sql b/models/prices/ethereum/prices_ethereum_tokens.sql index 50f6cdf2b26..2b9fcacdff7 100644 --- a/models/prices/ethereum/prices_ethereum_tokens.sql +++ b/models/prices/ethereum/prices_ethereum_tokens.sql @@ -1614,6 +1614,7 @@ FROM ('xrio-realio-network-utility-token-exchangable', 'ethereum', 'XRIO', 0x0B4AC2BA3D4924C9A06D9C1d08D7867059A39cC1, 18), ('weth-weth', 'ethereum', 'bpETH', 0x0000000000a39bb272e79075ade125fd351887ac, 18), ('pepe-pepe1', 'ethereum', 'PEPE', 0x6982508145454Ce325dDbE47a25d4ec3d2311933, 18), + ('pndc-pndc', 'ethereum', 'PNDC', 0x423f4e6138E475D85CF7Ea071AC92097Ed631eea, 18), ('grain-granary','ethereum','GRAIN',0xf88baf18fab7e330fa0c4f83949e23f52fececce,18), ('verse-verse-token', 'ethereum', 'VERSE', 0x249ca82617ec3dfb2589c4c17ab7ec9765350a18, 18), ('mc-merit-circle', 'ethereum', 'MC', 0x949d48eca67b17269629c7194f4b727d4ef9e5d6, 18), diff --git a/models/prices/ethereum/prices_ethereum_tokens_legacy.sql b/models/prices/ethereum/prices_ethereum_tokens_legacy.sql index c0fc2bc6793..be4dd7334a3 100644 --- a/models/prices/ethereum/prices_ethereum_tokens_legacy.sql +++ b/models/prices/ethereum/prices_ethereum_tokens_legacy.sql @@ -1613,6 +1613,7 @@ FROM ('xrio-realio-network-utility-token-exchangable', 'ethereum', 'XRIO', '0x0B4AC2BA3D4924C9A06D9C1d08D7867059A39cC1', 18), ('weth-weth', 'ethereum', 'bpETH', '0x0000000000a39bb272e79075ade125fd351887ac', 18), ('pepe-pepe1', 'ethereum', 'PEPE', '0x6982508145454Ce325dDbE47a25d4ec3d2311933', 18), + ('pndc-pndc', 'ethereum', 'PNDC', '0x423f4e6138E475D85CF7Ea071AC92097Ed631eea', 18), ('grain-granary','ethereum','GRAIN','0xf88baf18fab7e330fa0c4f83949e23f52fececce', 18), ('verse-verse-token', 'ethereum', 'VERSE', '0x249ca82617ec3dfb2589c4c17ab7ec9765350a18', 18), ('mc-merit-circle', 'ethereum', 'MC', '0x949d48eca67b17269629c7194f4b727d4ef9e5d6', 18), diff --git a/models/tokens/ethereum/tokens_ethereum_erc20.sql b/models/tokens/ethereum/tokens_ethereum_erc20.sql index 5d1f1a59544..b83378b82bb 100644 --- a/models/tokens/ethereum/tokens_ethereum_erc20.sql +++ b/models/tokens/ethereum/tokens_ethereum_erc20.sql @@ -21074,6 +21074,7 @@ FROM (VALUES ,(0x5c6d51ecba4d8e4f20373e3ce96a62342b125d6d, 'ELFI', 18) ,(0x5f17b7dfa191c75911a01e03a40397eb4a766fc8, 'MTM', 18) ,(0x6982508145454ce325ddbe47a25d4ec3d2311933, 'PEPE', 18) + ,(0x423f4e6138E475D85CF7Ea071AC92097Ed631eea, 'PNDC', 18) ,(0x6d6b11219a15aefc32a430ac7ad6429ad36748c9, 'SHUGGI', 18) ,(0x7690202e2c2297bcd03664e31116d1dffe7e3b73, 'boxETH', 18) ,(0x96889af723ac5b082930c418a82a84bbbc8a495d, 'CXAI', 9) diff --git a/models/tokens/ethereum/tokens_ethereum_erc20_legacy.sql b/models/tokens/ethereum/tokens_ethereum_erc20_legacy.sql index 816d3226b3e..95adece7ccd 100644 --- a/models/tokens/ethereum/tokens_ethereum_erc20_legacy.sql +++ b/models/tokens/ethereum/tokens_ethereum_erc20_legacy.sql @@ -21074,6 +21074,7 @@ FROM (VALUES ,('0x5c6d51ecba4d8e4f20373e3ce96a62342b125d6d', 'ELFI', 18) ,('0x5f17b7dfa191c75911a01e03a40397eb4a766fc8', 'MTM', 18) ,('0x6982508145454ce325ddbe47a25d4ec3d2311933', 'PEPE', 18) + ,('0x423f4e6138E475D85CF7Ea071AC92097Ed631eea', 'PNDC', 18) ,('0x6d6b11219a15aefc32a430ac7ad6429ad36748c9', 'SHUGGI', 18) ,('0x7690202e2c2297bcd03664e31116d1dffe7e3b73', 'boxETH', 18) ,('0x96889af723ac5b082930c418a82a84bbbc8a495d', 'CXAI', 9) From 9a4a4c425cda251bff7a1d6b1b8e09d428dd99aa Mon Sep 17 00:00:00 2001 From: timmay_castags Date: Wed, 6 Sep 2023 20:24:16 -0400 Subject: [PATCH 2/6] Removed duplicate prices for PNDC --- models/prices/ethereum/prices_ethereum_tokens.sql | 1 - models/prices/ethereum/prices_ethereum_tokens_legacy.sql | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/models/prices/ethereum/prices_ethereum_tokens.sql b/models/prices/ethereum/prices_ethereum_tokens.sql index 2b9fcacdff7..50f6cdf2b26 100644 --- a/models/prices/ethereum/prices_ethereum_tokens.sql +++ b/models/prices/ethereum/prices_ethereum_tokens.sql @@ -1614,7 +1614,6 @@ FROM ('xrio-realio-network-utility-token-exchangable', 'ethereum', 'XRIO', 0x0B4AC2BA3D4924C9A06D9C1d08D7867059A39cC1, 18), ('weth-weth', 'ethereum', 'bpETH', 0x0000000000a39bb272e79075ade125fd351887ac, 18), ('pepe-pepe1', 'ethereum', 'PEPE', 0x6982508145454Ce325dDbE47a25d4ec3d2311933, 18), - ('pndc-pndc', 'ethereum', 'PNDC', 0x423f4e6138E475D85CF7Ea071AC92097Ed631eea, 18), ('grain-granary','ethereum','GRAIN',0xf88baf18fab7e330fa0c4f83949e23f52fececce,18), ('verse-verse-token', 'ethereum', 'VERSE', 0x249ca82617ec3dfb2589c4c17ab7ec9765350a18, 18), ('mc-merit-circle', 'ethereum', 'MC', 0x949d48eca67b17269629c7194f4b727d4ef9e5d6, 18), diff --git a/models/prices/ethereum/prices_ethereum_tokens_legacy.sql b/models/prices/ethereum/prices_ethereum_tokens_legacy.sql index be4dd7334a3..df80aaf308e 100644 --- a/models/prices/ethereum/prices_ethereum_tokens_legacy.sql +++ b/models/prices/ethereum/prices_ethereum_tokens_legacy.sql @@ -1613,7 +1613,7 @@ FROM ('xrio-realio-network-utility-token-exchangable', 'ethereum', 'XRIO', '0x0B4AC2BA3D4924C9A06D9C1d08D7867059A39cC1', 18), ('weth-weth', 'ethereum', 'bpETH', '0x0000000000a39bb272e79075ade125fd351887ac', 18), ('pepe-pepe1', 'ethereum', 'PEPE', '0x6982508145454Ce325dDbE47a25d4ec3d2311933', 18), - ('pndc-pndc', 'ethereum', 'PNDC', '0x423f4e6138E475D85CF7Ea071AC92097Ed631eea', 18), + ('pndc-pond-coin', 'ethereum', 'PNDC', '0x423f4e6138E475D85CF7Ea071AC92097Ed631eea', 18), ('grain-granary','ethereum','GRAIN','0xf88baf18fab7e330fa0c4f83949e23f52fececce', 18), ('verse-verse-token', 'ethereum', 'VERSE', '0x249ca82617ec3dfb2589c4c17ab7ec9765350a18', 18), ('mc-merit-circle', 'ethereum', 'MC', '0x949d48eca67b17269629c7194f4b727d4ef9e5d6', 18), From 4ad9bf0a4625688c8f97d5a27356f042b48767bc Mon Sep 17 00:00:00 2001 From: timmay_castags Date: Thu, 7 Sep 2023 12:30:36 -0400 Subject: [PATCH 3/6] removed legacy price update for PNDC --- models/prices/ethereum/prices_ethereum_tokens_legacy.sql | 1 - 1 file changed, 1 deletion(-) diff --git a/models/prices/ethereum/prices_ethereum_tokens_legacy.sql b/models/prices/ethereum/prices_ethereum_tokens_legacy.sql index df80aaf308e..c0fc2bc6793 100644 --- a/models/prices/ethereum/prices_ethereum_tokens_legacy.sql +++ b/models/prices/ethereum/prices_ethereum_tokens_legacy.sql @@ -1613,7 +1613,6 @@ FROM ('xrio-realio-network-utility-token-exchangable', 'ethereum', 'XRIO', '0x0B4AC2BA3D4924C9A06D9C1d08D7867059A39cC1', 18), ('weth-weth', 'ethereum', 'bpETH', '0x0000000000a39bb272e79075ade125fd351887ac', 18), ('pepe-pepe1', 'ethereum', 'PEPE', '0x6982508145454Ce325dDbE47a25d4ec3d2311933', 18), - ('pndc-pond-coin', 'ethereum', 'PNDC', '0x423f4e6138E475D85CF7Ea071AC92097Ed631eea', 18), ('grain-granary','ethereum','GRAIN','0xf88baf18fab7e330fa0c4f83949e23f52fececce', 18), ('verse-verse-token', 'ethereum', 'VERSE', '0x249ca82617ec3dfb2589c4c17ab7ec9765350a18', 18), ('mc-merit-circle', 'ethereum', 'MC', '0x949d48eca67b17269629c7194f4b727d4ef9e5d6', 18), From bfa8c1eaa734c9c159a0e60f6f8738661c900952 Mon Sep 17 00:00:00 2001 From: timmay_castags Date: Thu, 7 Sep 2023 12:30:44 -0400 Subject: [PATCH 4/6] Merge branch 'main' of https://github.com/timmaycastags/spellbook --- .../ethereum/airdrop_ethereum_claims.sql | 17 +++++++++++------ .../ampleforth_ethereum_airdrop_claims.sql | 12 ++++++------ .../apecoin_ethereum_airdrop_claims.sql | 12 ++++++------ .../bend_dao_ethereum_airdrop_claims.sql | 12 ++++++------ .../blur_ethereum_airdrop_1_claims.sql | 13 +++++++------ .../botto_ethereum_airdrop_claims.sql | 12 ++++++------ .../component_ethereum_airdrop_claims.sql | 12 ++++++------ .../dappradar_ethereum_airdrop_claims.sql | 12 ++++++------ .../ethereum/dydx_ethereum_airdrop_claims.sql | 19 ++++++++++--------- .../ethereum/ens_ethereum_airdrop_claims.sql | 19 +++++++------------ .../forefront_ethereum_airdrop_claims.sql | 12 ++++++------ .../forta_network_ethereum_airdrop_claims.sql | 14 +++++++------- .../galxe_ethereum_airdrop_claims.sql | 12 ++++++------ .../gas_dao_ethereum_airdrop_claims.sql | 13 +++++++------ .../genie_ethereum_airdrop_claims.sql | 13 +++++++------ .../gitcoin_ethereum_airdrop_claims.sql | 12 ++++++------ .../hop_protocol_ethereum_airdrop_claims.sql | 13 +++++++------ .../looksrare_ethereum_airdrop_claims.sql | 12 ++++++------ .../notional_ethereum_airdrop_claims.sql | 13 +++++++------ .../oneinch_ethereum_airdrop_claims.sql | 13 +++++++------ .../paladin_ethereum_airdrop_claims.sql | 12 ++++++------ .../pooltogether_ethereum_airdrop_claims.sql | 13 +++++++------ .../ribbon_ethereum_airdrop_claims.sql | 13 +++++++------ .../shapeshift_ethereum_airdrop_claims.sql | 12 ++++++------ .../snowswap_ethereum_airdrop_claims.sql | 12 ++++++------ .../sudoswap_ethereum_airdrop_claims.sql | 13 +++++++------ .../tokenfy_ethereum_airdrop_claims.sql | 12 ++++++------ .../uniswap_ethereum_airdrop_claims.sql | 13 +++++++------ .../ethereum/x2y2_ethereum_airdrop_claims.sql | 12 ++++++------ 29 files changed, 195 insertions(+), 184 deletions(-) diff --git a/models/airdrop/ethereum/airdrop_ethereum_claims.sql b/models/airdrop/ethereum/airdrop_ethereum_claims.sql index cae39ad3af9..072406f0e41 100644 --- a/models/airdrop/ethereum/airdrop_ethereum_claims.sql +++ b/models/airdrop/ethereum/airdrop_ethereum_claims.sql @@ -1,4 +1,5 @@ {{ config( + tags=['dunesql'], alias = alias('claims'), post_hook='{{ expose_spells(\'["ethereum"]\', "sector", @@ -26,27 +27,31 @@ , ref('looksrare_ethereum_airdrop_claims') , ref('oneinch_ethereum_airdrop_claims') , ref('paladin_ethereum_airdrop_claims') - , ref('paraswap_ethereum_airdrop_claims') , ref('ribbon_ethereum_airdrop_claims') - , ref('safe_ethereum_airdrop_claims') , ref('sudoswap_ethereum_airdrop_claims') , ref('tornado_cash_ethereum_airdrop_claims') , ref('uniswap_ethereum_airdrop_claims') , ref('x2y2_ethereum_airdrop_claims') , ref('pooltogether_ethereum_airdrop_claims') - , ref('gearbox_ethereum_airdrop_claims') , ref('notional_ethereum_airdrop_claims') , ref('snowswap_ethereum_airdrop_claims') , ref('botto_ethereum_airdrop_claims') - , ref('thales_ethereum_airdrop_claims') , ref('shapeshift_ethereum_airdrop_claims') - , ref('value_defi_ethereum_airdrop_claims') , ref('tokenfy_ethereum_airdrop_claims') , ref('component_ethereum_airdrop_claims') , ref('forefront_ethereum_airdrop_claims') - , ref('alchemydao_ethereum_airdrop_claims') ] %} + {# + -- these models rely on dex_prices to run, so can't migrate yet, will be added back after dex_prices migration + -- , ref('paraswap_ethereum_airdrop_claims') + -- , ref('safe_ethereum_airdrop_claims') + -- , ref('gearbox_ethereum_airdrop_claims') + -- , ref('thales_ethereum_airdrop_claims') + -- , ref('value_defi_ethereum_airdrop_claims') + -- , ref('alchemydao_ethereum_airdrop_claims') + #} + SELECT * FROM ( {% for airdrop_claims_model in airdrop_claims_models %} diff --git a/models/ampleforth/ethereum/ampleforth_ethereum_airdrop_claims.sql b/models/ampleforth/ethereum/ampleforth_ethereum_airdrop_claims.sql index 18ca79e6376..8068cddd277 100644 --- a/models/ampleforth/ethereum/ampleforth_ethereum_airdrop_claims.sql +++ b/models/ampleforth/ethereum/ampleforth_ethereum_airdrop_claims.sql @@ -1,10 +1,10 @@ {{ config( + tags=['dunesql', 'static'], schema = 'ampleforth_ethereum', alias = alias('airdrop_claims'), materialized = 'table', file_format = 'delta', - tags=['static'], unique_key = ['recipient', 'tx_hash', 'evt_index'], post_hook='{{ expose_spells(\'["ethereum"]\', "project", @@ -20,7 +20,7 @@ WITH early_price AS ( , MIN_BY(price, minute) AS price FROM {{ source('prices', 'usd') }} WHERE blockchain = 'ethereum' - AND contract_address='{{forth_token_address}}' + AND contract_address= {{forth_token_address}} ) SELECT 'ethereum' AS blockchain @@ -31,16 +31,16 @@ SELECT 'ethereum' AS blockchain , t.to AS recipient , t.contract_address , t.evt_tx_hash AS tx_hash -, CAST(t.value AS DECIMAL(38,0)) AS amount_raw +, t.value AS amount_raw , CAST(t.value/POWER(10, 18) AS double) AS amount_original , CASE WHEN t.evt_block_time >= (SELECT minute FROM early_price) THEN CAST(pu.price*t.value/POWER(10, 18) AS double) ELSE CAST((SELECT price FROM early_price)*t.value/POWER(10, 18) AS double) END AS amount_usd -, '{{forth_token_address}}' AS token_address +, {{forth_token_address}} AS token_address , 'FORTH' AS token_symbol , t.evt_index FROM {{ source('erc20_ethereum', 'evt_transfer') }} t LEFT JOIN {{ ref('prices_usd_forward_fill') }} pu ON pu.blockchain = 'ethereum' - AND pu.contract_address='{{forth_token_address}}' + AND pu.contract_address= {{forth_token_address}} AND pu.minute=date_trunc('minute', t.evt_block_time) -WHERE t.evt_block_time BETWEEN '2021-04-20' AND '2022-04-16' \ No newline at end of file +WHERE t.evt_block_time BETWEEN CAST('2021-04-20' as timestamp) AND CAST('2022-04-16' as timestamp) \ No newline at end of file diff --git a/models/apecoin/ethereum/apecoin_ethereum_airdrop_claims.sql b/models/apecoin/ethereum/apecoin_ethereum_airdrop_claims.sql index e9b768d83fb..b20df9b9c05 100644 --- a/models/apecoin/ethereum/apecoin_ethereum_airdrop_claims.sql +++ b/models/apecoin/ethereum/apecoin_ethereum_airdrop_claims.sql @@ -1,10 +1,10 @@ {{ config( + tags=['dunesql', 'static'], schema = 'apecoin_ethereum', alias = alias('airdrop_claims'), materialized = 'table', file_format = 'delta', - tags=['static'], unique_key = ['recipient', 'tx_hash', 'evt_index'], post_hook='{{ expose_spells(\'["ethereum"]\', "project", @@ -20,7 +20,7 @@ WITH early_price AS ( , MIN_BY(price, minute) AS price FROM {{ source('prices', 'usd') }} WHERE blockchain = 'ethereum' - AND contract_address='{{ape_token_address}}' + AND contract_address= {{ape_token_address}} ) SELECT 'ethereum' AS blockchain @@ -31,16 +31,16 @@ SELECT 'ethereum' AS blockchain , t.account AS recipient , t.contract_address , t.evt_tx_hash AS tx_hash -, CAST(t.amount AS DECIMAL(38,0)) AS amount_raw +, t.amount AS amount_raw , CAST(t.amount/POWER(10, 18) AS double) AS amount_original , CASE WHEN t.evt_block_time >= (SELECT minute FROM early_price) THEN CAST(pu.price*t.amount/POWER(10, 18) AS double) ELSE CAST((SELECT price FROM early_price)*t.amount/POWER(10, 18) AS double) END AS amount_usd -, '{{ape_token_address}}' AS token_address +, {{ape_token_address}} AS token_address , 'APE' AS token_symbol , t.evt_index FROM {{ source('apecoin_ethereum', 'AirdropGrapesToken_evt_AirDrop') }} t LEFT JOIN {{ ref('prices_usd_forward_fill') }} pu ON pu.blockchain = 'ethereum' - AND pu.contract_address='{{ape_token_address}}' + AND pu.contract_address= {{ape_token_address}} AND pu.minute=date_trunc('minute', t.evt_block_time) -WHERE t.evt_block_time BETWEEN '2022-03-17' AND '2022-06-16' \ No newline at end of file +WHERE t.evt_block_time BETWEEN CAST('2022-03-17' as TIMESTAMP) AND CAST('2022-06-16' as timestamp) \ No newline at end of file diff --git a/models/bend_dao/ethereum/bend_dao_ethereum_airdrop_claims.sql b/models/bend_dao/ethereum/bend_dao_ethereum_airdrop_claims.sql index ec3b50a03a1..ab38277be35 100644 --- a/models/bend_dao/ethereum/bend_dao_ethereum_airdrop_claims.sql +++ b/models/bend_dao/ethereum/bend_dao_ethereum_airdrop_claims.sql @@ -1,10 +1,10 @@ {{ config( + tags=['dunesql', 'static'], schema = 'bend_dao_ethereum', alias = alias('airdrop_claims'), materialized = 'table', file_format = 'delta', - tags=['static'], unique_key = ['recipient', 'tx_hash', 'evt_index'], post_hook='{{ expose_spells(\'["ethereum"]\', "project", @@ -20,7 +20,7 @@ WITH early_price AS ( , MIN_BY(price, minute) AS price FROM {{ source('prices', 'usd') }} WHERE blockchain = 'ethereum' - AND contract_address='{{bend_token_address}}' + AND contract_address= {{bend_token_address}} ) SELECT 'ethereum' AS blockchain @@ -31,16 +31,16 @@ SELECT 'ethereum' AS blockchain , t.account AS recipient , t.contract_address , t.evt_tx_hash AS tx_hash -, CAST(t.amount AS DECIMAL(38,0)) AS amount_raw +, t.amount AS amount_raw , CAST(t.amount/POWER(10, 18) AS double) AS amount_original , CASE WHEN t.evt_block_time >= (SELECT minute FROM early_price) THEN CAST(pu.price*t.amount/POWER(10, 18) AS double) ELSE CAST((SELECT price FROM early_price)*t.amount/POWER(10, 18) AS double) END AS amount_usd -, '{{bend_token_address}}' AS token_address +, {{bend_token_address}} AS token_address , 'BEND' AS token_symbol , t.evt_index FROM {{ source('benddao_ethereum', 'MerkleDistributor_evt_Claimed') }} t LEFT JOIN {{ ref('prices_usd_forward_fill') }} pu ON pu.blockchain = 'ethereum' - AND pu.contract_address='{{bend_token_address}}' + AND pu.contract_address= {{bend_token_address}} AND pu.minute=date_trunc('minute', t.evt_block_time) -WHERE t.evt_block_time BETWEEN '2022-03-21' AND '2022-06-19' \ No newline at end of file +WHERE t.evt_block_time BETWEEN CAST('2022-03-21' as timestamp) AND CAST('2022-06-19' as timestamp) \ No newline at end of file diff --git a/models/blur/ethereum/blur_ethereum_airdrop_1_claims.sql b/models/blur/ethereum/blur_ethereum_airdrop_1_claims.sql index 687ef8977ed..1688ca53519 100644 --- a/models/blur/ethereum/blur_ethereum_airdrop_1_claims.sql +++ b/models/blur/ethereum/blur_ethereum_airdrop_1_claims.sql @@ -1,5 +1,6 @@ {{ config( + tags=['dunesql'], schema = 'blur_ethereum', alias = alias('airdrop_1_claims'), materialized = 'incremental', @@ -20,7 +21,7 @@ WITH early_price AS ( , MIN_BY(price, minute) AS price FROM {{ source('prices', 'usd') }} WHERE blockchain = 'ethereum' - AND contract_address='{{blur_token_address}}' + AND contract_address= {{blur_token_address}} ) SELECT 'ethereum' AS blockchain @@ -31,21 +32,21 @@ SELECT 'ethereum' AS blockchain , t.account AS recipient , t.contract_address , t.evt_tx_hash AS tx_hash -, CAST(t.amount AS DECIMAL(38,0)) AS amount_raw +, t.amount AS amount_raw , CAST(t.amount/POWER(10, 18) AS double) AS amount_original , CASE WHEN t.evt_block_time >= (SELECT minute FROM early_price) THEN CAST(pu.price*t.amount/POWER(10, 18) AS double) ELSE CAST((SELECT price FROM early_price)*t.amount/POWER(10, 18) AS double) END AS amount_usd -, '{{blur_token_address}}' AS token_address +, {{blur_token_address}} AS token_address , 'BLUR' AS token_symbol , t.evt_index FROM {{ source('blur_ethereum', 'BlurAirdrop_evt_Claimed') }} t LEFT JOIN {{ ref('prices_usd_forward_fill') }} pu ON pu.blockchain = 'ethereum' - AND pu.contract_address='{{blur_token_address}}' + AND pu.contract_address= {{blur_token_address}} AND pu.minute=date_trunc('minute', t.evt_block_time) {% if is_incremental() %} - AND pu.minute >= date_trunc("day", now() - interval '1 week') + AND pu.minute >= date_trunc('day', now() - interval '7' Day) {% endif %} {% if is_incremental() %} -WHERE t.evt_block_time >= date_trunc("day", now() - interval '1 week') +WHERE t.evt_block_time >= date_trunc('day', now() - interval '7' Day) {% endif %} \ No newline at end of file diff --git a/models/botto/ethereum/botto_ethereum_airdrop_claims.sql b/models/botto/ethereum/botto_ethereum_airdrop_claims.sql index 6b615177e36..8c3ac418101 100644 --- a/models/botto/ethereum/botto_ethereum_airdrop_claims.sql +++ b/models/botto/ethereum/botto_ethereum_airdrop_claims.sql @@ -1,10 +1,10 @@ {{ config( + tags=['dunesql', 'static'], schema = 'botto_ethereum', alias = alias('airdrop_claims'), materialized = 'table', file_format = 'delta', - tags=['static'], unique_key = ['recipient', 'tx_hash', 'evt_index'], post_hook='{{ expose_spells(\'["ethereum"]\', "project", @@ -20,7 +20,7 @@ WITH early_price AS ( , MIN_BY(price, minute) AS price FROM {{ source('prices', 'usd') }} WHERE blockchain = 'ethereum' - AND contract_address='{{botto_token_address}}' + AND contract_address= {{botto_token_address}} ) SELECT 'ethereum' AS blockchain @@ -31,16 +31,16 @@ SELECT 'ethereum' AS blockchain , t.to AS recipient , t.contract_address , t.evt_tx_hash AS tx_hash -, CAST(t.amount AS DECIMAL(38,0)) AS amount_raw +, t.amount AS amount_raw , CAST(t.amount/POWER(10, 18) AS double) AS amount_original , CASE WHEN t.evt_block_time >= (SELECT minute FROM early_price) THEN CAST(pu.price*t.amount/POWER(10, 18) AS double) ELSE CAST((SELECT price FROM early_price)*t.amount/POWER(10, 18) AS double) END AS amount_usd -, '{{botto_token_address}}' AS token_address +, {{botto_token_address}} AS token_address , 'BOTTO' AS token_symbol , t.evt_index FROM {{ source('botto_ethereum', 'BottoAirdrop_evt_AirdropTransfer') }} t LEFT JOIN {{ ref('prices_usd_forward_fill') }} pu ON pu.blockchain = 'ethereum' - AND pu.contract_address='{{botto_token_address}}' + AND pu.contract_address= {{botto_token_address}} AND pu.minute=date_trunc('minute', t.evt_block_time) -WHERE t.evt_block_time BETWEEN '2021-10-07' AND '2022-01-09' \ No newline at end of file +WHERE t.evt_block_time BETWEEN timestamp '2021-10-07' AND timestamp '2022-01-09' \ No newline at end of file diff --git a/models/component/ethereum/component_ethereum_airdrop_claims.sql b/models/component/ethereum/component_ethereum_airdrop_claims.sql index aaa2a151e4f..f9b5c8fceac 100644 --- a/models/component/ethereum/component_ethereum_airdrop_claims.sql +++ b/models/component/ethereum/component_ethereum_airdrop_claims.sql @@ -1,10 +1,10 @@ {{ config( + tags=['dunesql', 'static'], schema = 'component_ethereum', alias = alias('airdrop_claims'), materialized = 'table', file_format = 'delta', - tags=['static'], unique_key = ['recipient', 'tx_hash', 'evt_index'], post_hook='{{ expose_spells(\'["ethereum"]\', "project", @@ -20,7 +20,7 @@ WITH early_price AS ( , MIN_BY(price, minute) AS price FROM {{ source('prices', 'usd') }} WHERE blockchain = 'ethereum' - AND contract_address='{{cmp_token_address}}' + AND contract_address= {{cmp_token_address}} ) SELECT 'ethereum' AS blockchain @@ -31,16 +31,16 @@ SELECT 'ethereum' AS blockchain , t.account AS recipient , t.contract_address , t.evt_tx_hash AS tx_hash -, CAST(t.amount AS DECIMAL(38,0)) AS amount_raw +, t.amount AS amount_raw , CAST(t.amount/POWER(10, 18) AS double) AS amount_original , CASE WHEN t.evt_block_time >= (SELECT minute FROM early_price) THEN CAST(pu.price*t.amount/POWER(10, 18) AS double) ELSE CAST((SELECT price FROM early_price)*t.amount/POWER(10, 18) AS double) END AS amount_usd -, '{{cmp_token_address}}' AS token_address +, {{cmp_token_address}} AS token_address , 'CMP' AS token_symbol , t.evt_index FROM {{ source('component_ethereum', 'MerkleDistributor_evt_Claimed') }} t LEFT JOIN {{ ref('prices_usd_forward_fill') }} pu ON pu.blockchain = 'ethereum' - AND pu.contract_address='{{cmp_token_address}}' + AND pu.contract_address= {{cmp_token_address}} AND pu.minute=date_trunc('minute', t.evt_block_time) -WHERE t.evt_block_time BETWEEN '2021-04-27' AND '2021-07-29' \ No newline at end of file +WHERE t.evt_block_time BETWEEN timestamp '2021-04-27' AND timestamp '2021-07-29' \ No newline at end of file diff --git a/models/dappradar/ethereum/dappradar_ethereum_airdrop_claims.sql b/models/dappradar/ethereum/dappradar_ethereum_airdrop_claims.sql index 721955777f8..1ff57052cde 100644 --- a/models/dappradar/ethereum/dappradar_ethereum_airdrop_claims.sql +++ b/models/dappradar/ethereum/dappradar_ethereum_airdrop_claims.sql @@ -1,10 +1,10 @@ {{ config( + tags=['dunesql', 'static'], schema = 'dappradar_ethereum', alias = alias('airdrop_claims'), materialized = 'table', file_format = 'delta', - tags=['static'], unique_key = ['recipient', 'tx_hash', 'evt_index'], post_hook='{{ expose_spells(\'["ethereum"]\', "project", @@ -20,7 +20,7 @@ WITH early_price AS ( , MIN_BY(price, minute) AS price FROM {{ source('prices', 'usd') }} WHERE blockchain = 'ethereum' - AND contract_address='{{radar_token_address}}' + AND contract_address= {{radar_token_address}} ) @@ -32,16 +32,16 @@ SELECT 'ethereum' AS blockchain , t.recipient , t.contract_address , t.evt_tx_hash AS tx_hash -, CAST(t.amount AS DECIMAL(38,0)) AS amount_raw +, t.amount AS amount_raw , CAST(t.amount/POWER(10, 18) AS double) AS amount_original , CASE WHEN t.evt_block_time >= (SELECT minute FROM early_price) THEN CAST(pu.price*t.amount/POWER(10, 18) AS double) ELSE CAST((SELECT price FROM early_price)*t.amount/POWER(10, 18) AS double) END AS amount_usd -, '{{radar_token_address}}' AS token_address +, {{radar_token_address}} AS token_address , 'RADAR' AS token_symbol , t.evt_index FROM {{ source('dappradar_ethereum', 'Airdrop_evt_TokenClaimed') }} t LEFT JOIN {{ ref('prices_usd_forward_fill') }} pu ON pu.blockchain = 'ethereum' - AND pu.contract_address='{{radar_token_address}}' + AND pu.contract_address= {{radar_token_address}} AND pu.minute=date_trunc('minute', t.evt_block_time) -WHERE t.evt_block_time BETWEEN '2021-12-14' AND '2022-03-20' \ No newline at end of file +WHERE t.evt_block_time BETWEEN timestamp '2021-12-14' AND timestamp '2022-03-20' \ No newline at end of file diff --git a/models/dydx/ethereum/dydx_ethereum_airdrop_claims.sql b/models/dydx/ethereum/dydx_ethereum_airdrop_claims.sql index 31fe49f7a90..2eda15a39b4 100644 --- a/models/dydx/ethereum/dydx_ethereum_airdrop_claims.sql +++ b/models/dydx/ethereum/dydx_ethereum_airdrop_claims.sql @@ -1,5 +1,6 @@ {{ config( + tags=['dunesql'], schema = 'dydx_ethereum', alias = alias('airdrop_claims'), materialized = 'incremental', @@ -20,7 +21,7 @@ WITH early_price AS ( , MIN_BY(price, minute) AS price FROM {{ source('prices', 'usd') }} WHERE blockchain = 'ethereum' - AND contract_address='{{dydx_token_address}}' + AND contract_address= {{dydx_token_address}} ) SELECT 'ethereum' AS blockchain @@ -31,24 +32,24 @@ SELECT 'ethereum' AS blockchain , t.to AS recipient , t.contract_address , t.evt_tx_hash AS tx_hash -, CAST(t.value AS DECIMAL(38,0)) AS amount_raw +, t.value AS amount_raw , CAST(t.value/POWER(10, 18) AS double) AS amount_original , CASE WHEN t.evt_block_time >= (SELECT minute FROM early_price) THEN CAST(pu.price*t.value/POWER(10, 18) AS double) ELSE CAST((SELECT price FROM early_price)*t.value/POWER(10, 18) AS double) END AS amount_usd -, '{{dydx_token_address}}' AS token_address +, {{dydx_token_address}} AS token_address , 'DYDX' AS token_symbol , t.evt_index FROM {{ source('erc20_ethereum', 'evt_transfer') }} t LEFT JOIN {{ ref('prices_usd_forward_fill') }} pu ON pu.blockchain = 'ethereum' - AND pu.contract_address='{{dydx_token_address}}' + AND pu.contract_address= {{dydx_token_address}} AND pu.minute=date_trunc('minute', t.evt_block_time) {% if is_incremental() %} - AND pu.minute >= date_trunc("day", now() - interval '1 week') + AND pu.minute >= date_trunc('day', now() - interval '7' Day) {% endif %} -WHERE t.contract_address = '{{dydx_token_address}}' -AND t.from = '0x639192d54431f8c816368d3fb4107bc168d0e871' -AND t.evt_block_time > '2021-09-08' +WHERE t.contract_address = {{dydx_token_address}} +AND t."from" = 0x639192d54431f8c816368d3fb4107bc168d0e871 +AND t.evt_block_time > timestamp '2021-09-08' {% if is_incremental() %} -AND t.evt_block_time >= date_trunc("day", now() - interval '1 week') +AND t.evt_block_time >= date_trunc('day', now() - interval '7' Day) {% endif %} \ No newline at end of file diff --git a/models/ens/ethereum/ens_ethereum_airdrop_claims.sql b/models/ens/ethereum/ens_ethereum_airdrop_claims.sql index e0b169dda2e..9c6f7ca9d50 100644 --- a/models/ens/ethereum/ens_ethereum_airdrop_claims.sql +++ b/models/ens/ethereum/ens_ethereum_airdrop_claims.sql @@ -1,10 +1,10 @@ {{ config( + tags=['dunesql', 'static'], schema = 'ens_ethereum', alias = alias('airdrop_claims'), - materialized = 'incremental', + materialized = 'table', file_format = 'delta', - incremental_strategy = 'merge', unique_key = ['recipient', 'tx_hash', 'evt_index'], post_hook='{{ expose_spells(\'["ethereum"]\', "project", @@ -20,7 +20,7 @@ WITH early_price AS ( , MIN_BY(price, minute) AS price FROM {{ source('prices', 'usd') }} WHERE blockchain = 'ethereum' - AND contract_address='{{ens_token_address}}' + AND contract_address= {{ens_token_address}} ) SELECT 'ethereum' AS blockchain @@ -31,21 +31,16 @@ SELECT 'ethereum' AS blockchain , t.claimant AS recipient , t.contract_address , t.evt_tx_hash AS tx_hash -, CAST(t.amount AS DECIMAL(38,0)) AS amount_raw +, t.amount AS amount_raw , CAST(t.amount/POWER(10, 18) AS double) AS amount_original , CASE WHEN t.evt_block_time >= (SELECT minute FROM early_price) THEN CAST(pu.price*t.amount/POWER(10, 18) AS double) ELSE CAST((SELECT price FROM early_price)*t.amount/POWER(10, 18) AS double) END AS amount_usd -, '{{ens_token_address}}' AS token_address +, {{ens_token_address}} AS token_address , 'ENS' AS token_symbol , t.evt_index FROM {{ source('ethereumnameservice_ethereum', 'ENSToken_evt_Claim') }} t LEFT JOIN {{ ref('prices_usd_forward_fill') }} pu ON pu.blockchain = 'ethereum' - AND pu.contract_address='{{ens_token_address}}' + AND pu.contract_address= {{ens_token_address}} AND pu.minute=date_trunc('minute', t.evt_block_time) - {% if is_incremental() %} - AND pu.minute >= date_trunc("day", now() - interval '1 week') - {% endif %} -{% if is_incremental() %} -WHERE t.evt_block_time >= date_trunc("day", now() - interval '1 week') -{% endif %} \ No newline at end of file +WHERE t.evt_block_time BETWEEN timestamp '2021-11-09' AND timestamp '2022-11-25' diff --git a/models/forefront/ethereum/forefront_ethereum_airdrop_claims.sql b/models/forefront/ethereum/forefront_ethereum_airdrop_claims.sql index 55ecb3cac6e..1dd86a0beda 100644 --- a/models/forefront/ethereum/forefront_ethereum_airdrop_claims.sql +++ b/models/forefront/ethereum/forefront_ethereum_airdrop_claims.sql @@ -1,10 +1,10 @@ {{ config( + tags=['dunesql', 'static'], schema = 'forefront_ethereum', alias = alias('airdrop_claims'), materialized = 'table', file_format = 'delta', - tags=['static'], unique_key = ['recipient', 'tx_hash', 'evt_index'], post_hook='{{ expose_spells(\'["ethereum"]\', "project", @@ -20,7 +20,7 @@ WITH early_price AS ( , MIN_BY(price, minute) AS price FROM {{ source('prices', 'usd') }} WHERE blockchain = 'ethereum' - AND contract_address='{{ff_token_address}}' + AND contract_address= {{ff_token_address}} ) SELECT 'ethereum' AS blockchain @@ -31,16 +31,16 @@ SELECT 'ethereum' AS blockchain , t.account AS recipient , t.contract_address , t.evt_tx_hash AS tx_hash -, CAST(t.amount AS DECIMAL(38,0)) AS amount_raw +, t.amount AS amount_raw , CAST(t.amount/POWER(10, 18) AS double) AS amount_original , CASE WHEN t.evt_block_time >= (SELECT minute FROM early_price) THEN CAST(pu.price*t.amount/POWER(10, 18) AS double) ELSE CAST((SELECT price FROM early_price)*t.amount/POWER(10, 18) AS double) END AS amount_usd -, '{{ff_token_address}}' AS token_address +, {{ff_token_address}} AS token_address , 'FF' AS token_symbol , evt_index FROM {{ source('forefront_ethereum', 'ForefrontMerkle_evt_Claimed') }} t LEFT JOIN {{ ref('prices_usd_forward_fill') }} pu ON pu.blockchain = 'ethereum' - AND pu.contract_address='{{ff_token_address}}' + AND pu.contract_address= {{ff_token_address}} AND pu.minute=date_trunc('minute', t.evt_block_time) -WHERE t.evt_block_time BETWEEN '2021-03-31' AND '2021-04-16' \ No newline at end of file +WHERE t.evt_block_time BETWEEN timestamp '2021-03-31' AND timestamp '2021-04-16' \ No newline at end of file diff --git a/models/forta_network/ethereum/forta_network_ethereum_airdrop_claims.sql b/models/forta_network/ethereum/forta_network_ethereum_airdrop_claims.sql index 97085380828..b7ae885d251 100644 --- a/models/forta_network/ethereum/forta_network_ethereum_airdrop_claims.sql +++ b/models/forta_network/ethereum/forta_network_ethereum_airdrop_claims.sql @@ -1,10 +1,10 @@ {{ config( + tags=['dunesql', 'static'], schema = 'forta_network_ethereum', alias = alias('airdrop_claims'), materialized = 'table', file_format = 'delta', - tags=['static'], unique_key = ['recipient', 'tx_hash', 'evt_index'], post_hook='{{ expose_spells(\'["ethereum"]\', "project", @@ -13,14 +13,14 @@ ) }} -{% set fort_token_address = '0x41545f8b9472d758bb669ed8eaeeecd7a9c4ec29' %} +{% set forta_token_address = '0x41545f8b9472d758bb669ed8eaeeecd7a9c4ec29' %} WITH early_price AS ( SELECT MIN(minute) AS minute , MIN_BY(price, minute) AS price FROM {{ source('prices', 'usd') }} WHERE blockchain = 'ethereum' - AND contract_address='{{forta_token_address}}' + AND contract_address= {{forta_token_address}} ) SELECT 'ethereum' AS blockchain @@ -31,16 +31,16 @@ SELECT 'ethereum' AS blockchain , t.recipient , t.contract_address , t.evt_tx_hash AS tx_hash -, CAST(t.amount AS DECIMAL(38,0)) AS amount_raw +, t.amount AS amount_raw , CAST(t.amount/POWER(10, 18) AS double) AS amount_original , CASE WHEN t.evt_block_time >= (SELECT minute FROM early_price) THEN CAST(pu.price*t.amount/POWER(10, 18) AS double) ELSE CAST((SELECT price FROM early_price)*t.amount/POWER(10, 18) AS double) END AS amount_usd -, '{{forta_token_address}}' AS token_address +, {{forta_token_address}} AS token_address , 'FORT' AS token_symbol , t.evt_index FROM {{ source('forta_network_ethereum', 'Airdrop_evt_TokensReleased') }} t LEFT JOIN {{ ref('prices_usd_forward_fill') }} pu ON pu.blockchain = 'ethereum' - AND pu.contract_address='{{forta_token_address}}' + AND pu.contract_address= {{forta_token_address}} AND pu.minute=date_trunc('minute', t.evt_block_time) -WHERE t.evt_block_time BETWEEN '2022-06-14' AND '2022-09-16' \ No newline at end of file +WHERE t.evt_block_time BETWEEN timestamp '2022-06-14' AND timestamp '2022-09-16' \ No newline at end of file diff --git a/models/galxe/ethereum/galxe_ethereum_airdrop_claims.sql b/models/galxe/ethereum/galxe_ethereum_airdrop_claims.sql index cc71206c2f6..1b4393c49dc 100644 --- a/models/galxe/ethereum/galxe_ethereum_airdrop_claims.sql +++ b/models/galxe/ethereum/galxe_ethereum_airdrop_claims.sql @@ -1,10 +1,10 @@ {{ config( + tags=['dunesql', 'static'], schema = 'galxe_ethereum', alias = alias('airdrop_claims'), materialized = 'table', file_format = 'delta', - tags=['static'], unique_key = ['recipient', 'tx_hash', 'evt_index'], post_hook='{{ expose_spells(\'["ethereum"]\', "project", @@ -20,7 +20,7 @@ WITH early_price AS ( , MIN_BY(price, minute) AS price FROM {{ source('prices', 'usd') }} WHERE blockchain = 'ethereum' - AND contract_address='{{gal_token_address}}' + AND contract_address= {{gal_token_address}} ) SELECT 'ethereum' AS blockchain @@ -31,16 +31,16 @@ SELECT 'ethereum' AS blockchain , t.account AS recipient , t.contract_address , t.evt_tx_hash AS tx_hash -, CAST(t.amount AS DECIMAL(38,0)) AS amount_raw +, t.amount AS amount_raw , CAST(t.amount/POWER(10, 18) AS double) AS amount_original , CASE WHEN t.evt_block_time >= (SELECT minute FROM early_price) THEN CAST(pu.price*t.amount/POWER(10, 18) AS double) ELSE CAST((SELECT price FROM early_price)*t.amount/POWER(10, 18) AS double) END AS amount_usd -, '{{gal_token_address}}' AS token_address +, {{gal_token_address}} AS token_address , 'GAL' AS token_symbol , t.evt_index FROM {{ source('galaxy_ethereum', 'MerkleDistributor_Airdrop_evt_Claimed') }} t LEFT JOIN {{ ref('prices_usd_forward_fill') }} pu ON pu.blockchain = 'ethereum' - AND pu.contract_address='{{gal_token_address}}' + AND pu.contract_address= {{gal_token_address}} AND pu.minute=date_trunc('minute', t.evt_block_time) -WHERE t.evt_block_time BETWEEN '2022-05-05' AND '2022-06-05' \ No newline at end of file +WHERE t.evt_block_time BETWEEN timestamp '2022-05-05' AND timestamp '2022-06-05' \ No newline at end of file diff --git a/models/gas_dao/ethereum/gas_dao_ethereum_airdrop_claims.sql b/models/gas_dao/ethereum/gas_dao_ethereum_airdrop_claims.sql index 3a232a72fae..01fe4ef6d60 100644 --- a/models/gas_dao/ethereum/gas_dao_ethereum_airdrop_claims.sql +++ b/models/gas_dao/ethereum/gas_dao_ethereum_airdrop_claims.sql @@ -1,5 +1,6 @@ {{ config( + tags=['dunesql'], schema = 'gas_dao_ethereum', alias = alias('airdrop_claims'), materialized = 'incremental', @@ -20,7 +21,7 @@ WITH early_price AS ( , MIN_BY(price, minute) AS price FROM {{ source('prices', 'usd') }} WHERE blockchain = 'ethereum' - AND contract_address='{{gas_token_address}}' + AND contract_address= {{gas_token_address}} ) SELECT 'ethereum' AS blockchain @@ -31,21 +32,21 @@ SELECT 'ethereum' AS blockchain , t.claimant AS recipient , t.contract_address , t.evt_tx_hash AS tx_hash -, CAST(t.amount AS DECIMAL(38,0)) AS amount_raw +, t.amount AS amount_raw , CAST(t.amount/POWER(10, 18) AS double) AS amount_original , CASE WHEN t.evt_block_time >= (SELECT minute FROM early_price) THEN CAST(pu.price*t.amount/POWER(10, 18) AS double) ELSE CAST((SELECT price FROM early_price)*t.amount/POWER(10, 18) AS double) END AS amount_usd -, '{{gas_token_address}}' AS token_address +, {{gas_token_address}} AS token_address , 'GAS' AS token_symbol , t.evt_index FROM {{ source('gas_dao_ethereum', 'GASToken_evt_Claim') }} t LEFT JOIN {{ ref('prices_usd_forward_fill') }} pu ON pu.blockchain = 'ethereum' - AND pu.contract_address='{{gas_token_address}}' + AND pu.contract_address= {{gas_token_address}} AND pu.minute=date_trunc('minute', t.evt_block_time) {% if is_incremental() %} - AND pu.minute >= date_trunc("day", now() - interval '1 week') + AND pu.minute >= date_trunc('day', now() - interval '7' Day) {% endif %} {% if is_incremental() %} -WHERE t.evt_block_time >= date_trunc("day", now() - interval '1 week') +WHERE t.evt_block_time >= date_trunc('day', now() - interval '7' Day) {% endif %} \ No newline at end of file diff --git a/models/genie/ethereum/genie_ethereum_airdrop_claims.sql b/models/genie/ethereum/genie_ethereum_airdrop_claims.sql index 3523f85aea4..ce59b5e7566 100644 --- a/models/genie/ethereum/genie_ethereum_airdrop_claims.sql +++ b/models/genie/ethereum/genie_ethereum_airdrop_claims.sql @@ -1,5 +1,6 @@ {{ config( + tags=['dunesql'], schema = 'genie_ethereum', alias = alias('airdrop_claims'), materialized = 'incremental', @@ -23,20 +24,20 @@ SELECT 'ethereum' AS blockchain , t.account AS recipient , t.contract_address , t.evt_tx_hash AS tx_hash -, CAST(t.amount AS DECIMAL(38,0)) AS amount_raw +, t.amount AS amount_raw , CAST(t.amount/POWER(10, 18) AS double) AS amount_original , CAST(pu.price*t.amount/POWER(10, 18) AS double) AS amount_usd -, '{{usdc_token_address}}' AS token_address +, {{usdc_token_address}} AS token_address , 'USDC' AS token_symbol , t.evt_index FROM {{ source('uniswap_ethereum', 'MerkleDistributorWithDeadline_evt_Claimed') }} t LEFT JOIN {{ ref('prices_usd_forward_fill') }} pu ON pu.blockchain = 'ethereum' - AND pu.contract_address='{{usdc_token_address}}' + AND pu.contract_address= {{usdc_token_address}} AND pu.minute=date_trunc('minute', t.evt_block_time) {% if is_incremental() %} - AND pu.minute >= date_trunc("day", now() - interval '1 week') + AND pu.minute >= date_trunc('day', now() - interval '7' Day) {% endif %} -WHERE t.evt_block_time >= '2022-11-23' +WHERE t.evt_block_time >= timestamp '2022-11-23' {% if is_incremental() %} -AND t.evt_block_time >= date_trunc("day", now() - interval '1 week') +AND t.evt_block_time >= date_trunc('day', now() - interval '7' Day) {% endif %} \ No newline at end of file diff --git a/models/gitcoin/ethereum/gitcoin_ethereum_airdrop_claims.sql b/models/gitcoin/ethereum/gitcoin_ethereum_airdrop_claims.sql index 0c31ce6cffe..acb2d632807 100644 --- a/models/gitcoin/ethereum/gitcoin_ethereum_airdrop_claims.sql +++ b/models/gitcoin/ethereum/gitcoin_ethereum_airdrop_claims.sql @@ -1,10 +1,10 @@ {{ config( + tags=['dunesql', 'static'], schema = 'gitcoin_ethereum', alias = alias('airdrop_claims'), materialized = 'table', file_format = 'delta', - tags=['static'], unique_key = ['recipient', 'tx_hash', 'evt_index'], post_hook='{{ expose_spells(\'["ethereum"]\', "project", @@ -20,7 +20,7 @@ WITH early_price AS ( , MIN_BY(price, minute) AS price FROM {{ source('prices', 'usd') }} WHERE blockchain = 'ethereum' - AND contract_address='{{gtc_token_address}}' + AND contract_address= {{gtc_token_address}} ) SELECT 'ethereum' AS blockchain @@ -31,16 +31,16 @@ SELECT 'ethereum' AS blockchain , t.account AS recipient , t.contract_address , t.evt_tx_hash AS tx_hash -, CAST(t.amount AS DECIMAL(38,0)) AS amount_raw +, t.amount AS amount_raw , CAST(t.amount/POWER(10, 18) AS double) AS amount_original , CASE WHEN t.evt_block_time >= (SELECT minute FROM early_price) THEN CAST(pu.price*t.amount/POWER(10, 18) AS double) ELSE CAST((SELECT price FROM early_price)*t.amount/POWER(10, 18) AS double) END AS amount_usd -, '{{gtc_token_address}}' AS token_address +, {{gtc_token_address}} AS token_address , 'GTC' AS token_symbol , t.evt_index FROM {{ source('gitcoin_ethereum', 'TokenDistributor_evt_Claimed') }} t LEFT JOIN {{ ref('prices_usd_forward_fill') }} pu ON pu.blockchain = 'ethereum' - AND pu.contract_address='{{gtc_token_address}}' + AND pu.contract_address= {{gtc_token_address}} AND pu.minute=date_trunc('minute', t.evt_block_time) -WHERE t.evt_block_time BETWEEN '2021-05-24' AND '2021-06-24' \ No newline at end of file +WHERE t.evt_block_time BETWEEN timestamp '2021-05-24' AND timestamp '2021-06-24' \ No newline at end of file diff --git a/models/hop_protocol/ethereum/hop_protocol_ethereum_airdrop_claims.sql b/models/hop_protocol/ethereum/hop_protocol_ethereum_airdrop_claims.sql index 028cf7b242f..e913cab5a55 100644 --- a/models/hop_protocol/ethereum/hop_protocol_ethereum_airdrop_claims.sql +++ b/models/hop_protocol/ethereum/hop_protocol_ethereum_airdrop_claims.sql @@ -1,5 +1,6 @@ {{ config( + tags=['dunesql'], schema = 'hop_protocol_ethereum', alias = alias('airdrop_claims'), materialized = 'incremental', @@ -20,7 +21,7 @@ WITH early_price AS ( , MIN_BY(price, minute) AS price FROM {{ source('prices', 'usd') }} WHERE blockchain = 'ethereum' - AND contract_address='{{hop_token_address}}' + AND contract_address= {{hop_token_address}} ) SELECT 'ethereum' AS blockchain @@ -31,21 +32,21 @@ SELECT 'ethereum' AS blockchain , t.claimant AS recipient , t.contract_address , t.evt_tx_hash AS tx_hash -, CAST(t.amount AS DECIMAL(38,0)) AS amount_raw +, t.amount AS amount_raw , CAST(t.amount/POWER(10, 18) AS double) AS amount_original , CASE WHEN t.evt_block_time >= (SELECT minute FROM early_price) THEN CAST(pu.price*t.amount/POWER(10, 18) AS double) ELSE CAST((SELECT price FROM early_price)*t.amount/POWER(10, 18) AS double) END AS amount_usd -, '{{hop_token_address}}' AS token_address +, {{hop_token_address}} AS token_address , 'HOP' AS token_symbol , t.evt_index FROM {{ source('hop_protocol_ethereum', 'HOPToken_evt_Claim') }} t LEFT JOIN {{ ref('prices_usd_forward_fill') }} pu ON pu.blockchain = 'ethereum' - AND pu.contract_address='{{hop_token_address}}' + AND pu.contract_address= {{hop_token_address}} AND pu.minute=date_trunc('minute', t.evt_block_time) {% if is_incremental() %} - AND pu.minute >= date_trunc("day", now() - interval '1 week') + AND pu.minute >= date_trunc('day', now() - interval '7' Day) {% endif %} {% if is_incremental() %} -WHERE t.evt_block_time >= date_trunc("day", now() - interval '1 week') +WHERE t.evt_block_time >= date_trunc('day', now() - interval '7' Day) {% endif %} \ No newline at end of file diff --git a/models/looksrare/ethereum/looksrare_ethereum_airdrop_claims.sql b/models/looksrare/ethereum/looksrare_ethereum_airdrop_claims.sql index 4cdbe0ddf78..917be207779 100644 --- a/models/looksrare/ethereum/looksrare_ethereum_airdrop_claims.sql +++ b/models/looksrare/ethereum/looksrare_ethereum_airdrop_claims.sql @@ -1,10 +1,10 @@ {{ config( + tags=['dunesql', 'static'], schema = 'looksrare_ethereum', alias = alias('airdrop_claims'), materialized = 'table', file_format = 'delta', - tags=['static'], unique_key = ['recipient', 'tx_hash', 'evt_index'], post_hook='{{ expose_spells(\'["ethereum"]\', "project", @@ -20,7 +20,7 @@ WITH early_price AS ( , MIN_BY(price, minute) AS price FROM {{ source('prices', 'usd') }} WHERE blockchain = 'ethereum' - AND contract_address='{{looks_token_address}}' + AND contract_address= {{looks_token_address}} ) SELECT 'ethereum' AS blockchain @@ -31,16 +31,16 @@ SELECT 'ethereum' AS blockchain , t.user AS recipient , t.contract_address , t.evt_tx_hash AS tx_hash -, CAST(t.amount AS DECIMAL(38,0)) AS amount_raw +, t.amount AS amount_raw , CAST(t.amount/POWER(10, 18) AS double) AS amount_original , CASE WHEN t.evt_block_time >= (SELECT minute FROM early_price) THEN CAST(pu.price*t.amount/POWER(10, 18) AS double) ELSE CAST((SELECT price FROM early_price)*t.amount/POWER(10, 18) AS double) END AS amount_usd -, '{{looks_token_address}}' AS token_address +, {{looks_token_address}} AS token_address , 'LOOKS' AS token_symbol , t.evt_index FROM {{ source('looksrare_ethereum', 'LooksRareAirdrop_evt_AirdropRewardsClaim') }} t LEFT JOIN {{ ref('prices_usd_forward_fill') }} pu ON pu.blockchain = 'ethereum' - AND pu.contract_address='{{looks_token_address}}' + AND pu.contract_address= {{looks_token_address}} AND pu.minute=date_trunc('minute', t.evt_block_time) -WHERE t.evt_block_time BETWEEN '2022-01-10' AND '2022-03-19' \ No newline at end of file +WHERE t.evt_block_time BETWEEN timestamp '2022-01-10' AND timestamp '2022-03-19' \ No newline at end of file diff --git a/models/notional/ethereum/notional_ethereum_airdrop_claims.sql b/models/notional/ethereum/notional_ethereum_airdrop_claims.sql index aeddc3d0469..74633b708e0 100644 --- a/models/notional/ethereum/notional_ethereum_airdrop_claims.sql +++ b/models/notional/ethereum/notional_ethereum_airdrop_claims.sql @@ -1,5 +1,6 @@ {{ config( + tags=['dunesql'], schema = 'notional_ethereum', alias = alias('airdrop_claims'), materialized = 'incremental', @@ -20,7 +21,7 @@ WITH early_price AS ( , MIN_BY(price, minute) AS price FROM {{ source('prices', 'usd') }} WHERE blockchain = 'ethereum' - AND contract_address='{{note_token_address}}' + AND contract_address= {{note_token_address}} ) SELECT 'ethereum' AS blockchain @@ -31,21 +32,21 @@ SELECT 'ethereum' AS blockchain , t.account AS recipient , t.contract_address , t.evt_tx_hash AS tx_hash -, CAST(t.amount AS DECIMAL(38,0)) AS amount_raw +, t.amount AS amount_raw , CAST(t.amount/POWER(10, 18) AS double) AS amount_original , CASE WHEN t.evt_block_time >= (SELECT minute FROM early_price) THEN CAST(pu.price*t.amount/POWER(10, 18) AS double) ELSE CAST((SELECT price FROM early_price)*t.amount/POWER(10, 18) AS double) END AS amount_usd -, '{{note_token_address}}' AS token_address +, {{note_token_address}} AS token_address , 'NOTE' AS token_symbol , t.evt_index FROM {{ source('notional_ethereum', 'MerkleDistributor_evt_Claimed') }} t LEFT JOIN {{ ref('prices_usd_forward_fill') }} pu ON pu.blockchain = 'ethereum' - AND pu.contract_address='{{note_token_address}}' + AND pu.contract_address= {{note_token_address}} AND pu.minute=date_trunc('minute', t.evt_block_time) {% if is_incremental() %} - AND pu.minute >= date_trunc("day", now() - interval '1 week') + AND pu.minute >= date_trunc('day', now() - interval '7' Day) {% endif %} {% if is_incremental() %} -WHERE t.evt_block_time >= date_trunc("day", now() - interval '1 week') +WHERE t.evt_block_time >= date_trunc('day', now() - interval '7' Day) {% endif %} \ No newline at end of file diff --git a/models/oneinch/ethereum/oneinch_ethereum_airdrop_claims.sql b/models/oneinch/ethereum/oneinch_ethereum_airdrop_claims.sql index e04a8ade063..b3a824da2ff 100644 --- a/models/oneinch/ethereum/oneinch_ethereum_airdrop_claims.sql +++ b/models/oneinch/ethereum/oneinch_ethereum_airdrop_claims.sql @@ -1,5 +1,6 @@ {{ config( + tags=['dunesql'], schema = 'oneinch_ethereum', alias = alias('airdrop_claims'), materialized = 'incremental', @@ -20,7 +21,7 @@ WITH early_price AS ( , MIN_BY(price, minute) AS price FROM {{ source('prices', 'usd') }} WHERE blockchain = 'ethereum' - AND contract_address='{{oinch_token_address}}' + AND contract_address= {{oinch_token_address}} ) SELECT 'ethereum' AS blockchain @@ -31,21 +32,21 @@ SELECT 'ethereum' AS blockchain , t.account AS recipient , t.contract_address , t.evt_tx_hash AS tx_hash -, CAST(t.amount AS DECIMAL(38,0)) AS amount_raw +, t.amount AS amount_raw , CAST(t.amount/POWER(10, 18) AS double) AS amount_original , CASE WHEN t.evt_block_time >= (SELECT minute FROM early_price) THEN CAST(pu.price*t.amount/POWER(10, 18) AS double) ELSE CAST((SELECT price FROM early_price)*t.amount/POWER(10, 18) AS double) END AS amount_usd -, '{{oinch_token_address}}' AS token_address +, {{oinch_token_address}} AS token_address , '1INCH' AS token_symbol , t.evt_index FROM {{ source('oneinch_ethereum', 'MerkleDistributor_evt_Claimed') }} t LEFT JOIN {{ ref('prices_usd_forward_fill') }} pu ON pu.blockchain = 'ethereum' - AND pu.contract_address='{{oinch_token_address}}' + AND pu.contract_address= {{oinch_token_address}} AND pu.minute=date_trunc('minute', t.evt_block_time) {% if is_incremental() %} - AND pu.minute >= date_trunc("day", now() - interval '1 week') + AND pu.minute >= date_trunc('day', now() - interval '7' Day) {% endif %} {% if is_incremental() %} -WHERE t.evt_block_time >= date_trunc("day", now() - interval '1 week') +WHERE t.evt_block_time >= date_trunc('day', now() - interval '7' Day) {% endif %} \ No newline at end of file diff --git a/models/paladin/ethereum/paladin_ethereum_airdrop_claims.sql b/models/paladin/ethereum/paladin_ethereum_airdrop_claims.sql index 37e3d75f294..4b03bc109d9 100644 --- a/models/paladin/ethereum/paladin_ethereum_airdrop_claims.sql +++ b/models/paladin/ethereum/paladin_ethereum_airdrop_claims.sql @@ -1,10 +1,10 @@ {{ config( + tags=['dunesql', 'static'], schema = 'paladin_ethereum', alias = alias('airdrop_claims'), materialized = 'table', file_format = 'delta', - tags=['static'], unique_key = ['recipient', 'tx_hash', 'evt_index'], post_hook='{{ expose_spells(\'["ethereum"]\', "project", @@ -20,7 +20,7 @@ WITH early_price AS ( , MIN_BY(price, minute) AS price FROM {{ source('prices', 'usd') }} WHERE blockchain = 'ethereum' - AND contract_address='{{pal_token_address}}' + AND contract_address= {{pal_token_address}} ) SELECT 'ethereum' AS blockchain @@ -31,16 +31,16 @@ SELECT 'ethereum' AS blockchain , t.account AS recipient , t.contract_address , t.evt_tx_hash AS tx_hash -, CAST(t.amount AS DECIMAL(38,0)) AS amount_raw +, t.amount AS amount_raw , CAST(t.amount/POWER(10, 18) AS double) AS amount_original , CASE WHEN t.evt_block_time >= (SELECT minute FROM early_price) THEN CAST(pu.price*t.amount/POWER(10, 18) AS double) ELSE CAST((SELECT price FROM early_price)*t.amount/POWER(10, 18) AS double) END AS amount_usd -, '{{pal_token_address}}' AS token_address +, {{pal_token_address}} AS token_address , 'PAL' AS token_symbol , t.evt_index FROM {{ source('paladin_ethereum', 'MerkleDistributor_evt_Claimed') }} t LEFT JOIN {{ ref('prices_usd_forward_fill') }} pu ON pu.blockchain = 'ethereum' - AND pu.contract_address='{{pal_token_address}}' + AND pu.contract_address= {{pal_token_address}} AND pu.minute=date_trunc('minute', t.evt_block_time) -WHERE t.evt_block_time BETWEEN '2021-11-03' AND '2022-02-02' \ No newline at end of file +WHERE t.evt_block_time BETWEEN timestamp '2021-11-03' AND timestamp '2022-02-02' \ No newline at end of file diff --git a/models/pooltogether/ethereum/pooltogether_ethereum_airdrop_claims.sql b/models/pooltogether/ethereum/pooltogether_ethereum_airdrop_claims.sql index 5cf93c26c4e..784edc44f4f 100644 --- a/models/pooltogether/ethereum/pooltogether_ethereum_airdrop_claims.sql +++ b/models/pooltogether/ethereum/pooltogether_ethereum_airdrop_claims.sql @@ -1,5 +1,6 @@ {{ config( + tags=['dunesql'], schema = 'pooltogether_ethereum', alias = alias('airdrop_claims'), materialized = 'incremental', @@ -20,7 +21,7 @@ WITH early_price AS ( , MIN_BY(price, minute) AS price FROM {{ source('prices', 'usd') }} WHERE blockchain = 'ethereum' - AND contract_address='{{pool_token_address}}' + AND contract_address= {{pool_token_address}} ) SELECT 'ethereum' AS blockchain @@ -31,21 +32,21 @@ SELECT 'ethereum' AS blockchain , t.account AS recipient , t.contract_address , t.evt_tx_hash AS tx_hash -, CAST(t.amount AS DECIMAL(38,0)) AS amount_raw +, t.amount AS amount_raw , CAST(t.amount/POWER(10, 18) AS double) AS amount_original , CASE WHEN t.evt_block_time >= (SELECT minute FROM early_price) THEN CAST(pu.price*t.amount/POWER(10, 18) AS double) ELSE CAST((SELECT price FROM early_price)*t.amount/POWER(10, 18) AS double) END AS amount_usd -, '{{pool_token_address}}' AS token_address +, {{pool_token_address}} AS token_address , 'POOL' AS token_symbol , t.evt_index FROM {{ source('pooltogether_ethereum', 'MerkleDistributor_evt_Claimed') }} t LEFT JOIN {{ ref('prices_usd_forward_fill') }} pu ON pu.blockchain = 'ethereum' - AND pu.contract_address='{{pool_token_address}}' + AND pu.contract_address= {{pool_token_address}} AND pu.minute=date_trunc('minute', t.evt_block_time) {% if is_incremental() %} - AND pu.minute >= date_trunc("day", now() - interval '1 week') + AND pu.minute >= date_trunc('day', now() - interval '7' Day) {% endif %} {% if is_incremental() %} -WHERE t.evt_block_time >= date_trunc("day", now() - interval '1 week') +WHERE t.evt_block_time >= date_trunc('day', now() - interval '7' Day) {% endif %} \ No newline at end of file diff --git a/models/ribbon/ethereum/ribbon_ethereum_airdrop_claims.sql b/models/ribbon/ethereum/ribbon_ethereum_airdrop_claims.sql index 8e5b7427ad7..57f4e5e4c32 100644 --- a/models/ribbon/ethereum/ribbon_ethereum_airdrop_claims.sql +++ b/models/ribbon/ethereum/ribbon_ethereum_airdrop_claims.sql @@ -1,5 +1,6 @@ {{ config( + tags=['dunesql'], schema = 'ribbon_ethereum', alias = alias('airdrop_claims'), materialized = 'incremental', @@ -20,7 +21,7 @@ WITH early_price AS ( , MIN_BY(price, minute) AS price FROM {{ source('prices', 'usd') }} WHERE blockchain = 'ethereum' - AND contract_address='{{rbn_token_address}}' + AND contract_address= {{rbn_token_address}} ) SELECT 'ethereum' AS blockchain @@ -31,21 +32,21 @@ SELECT 'ethereum' AS blockchain , t.account AS recipient , t.contract_address , t.evt_tx_hash AS tx_hash -, CAST(t.amount AS DECIMAL(38,0)) AS amount_raw +, t.amount AS amount_raw , CAST(t.amount/POWER(10, 18) AS double) AS amount_original , CASE WHEN t.evt_block_time >= (SELECT minute FROM early_price) THEN CAST(pu.price*t.amount/POWER(10, 18) AS double) ELSE CAST((SELECT price FROM early_price)*t.amount/POWER(10, 18) AS double) END AS amount_usd -, '{{rbn_token_address}}' AS token_address +, {{rbn_token_address}} AS token_address , 'RBN' AS token_symbol , t.evt_index FROM {{ source('ribbon_ethereum', 'MerkleDistributor_evt_Claimed') }} t LEFT JOIN {{ ref('prices_usd_forward_fill') }} pu ON pu.blockchain = 'ethereum' - AND pu.contract_address='{{rbn_token_address}}' + AND pu.contract_address= {{rbn_token_address}} AND pu.minute=date_trunc('minute', t.evt_block_time) {% if is_incremental() %} - AND pu.minute >= date_trunc("day", now() - interval '1 week') + AND pu.minute >= date_trunc('day', now() - interval '7' Day) {% endif %} {% if is_incremental() %} -WHERE t.evt_block_time >= date_trunc("day", now() - interval '1 week') +WHERE t.evt_block_time >= date_trunc('day', now() - interval '7' Day) {% endif %} \ No newline at end of file diff --git a/models/shapeshift/ethereum/shapeshift_ethereum_airdrop_claims.sql b/models/shapeshift/ethereum/shapeshift_ethereum_airdrop_claims.sql index 076a28530e8..a0bf8434d53 100644 --- a/models/shapeshift/ethereum/shapeshift_ethereum_airdrop_claims.sql +++ b/models/shapeshift/ethereum/shapeshift_ethereum_airdrop_claims.sql @@ -1,10 +1,10 @@ {{ config( + tags=['dunesql', 'static'], schema = 'shapeshiftethereum', alias = alias('airdrop_claims'), materialized = 'table', file_format = 'delta', - tags=['static'], unique_key = ['recipient', 'tx_hash', 'evt_index'], post_hook='{{ expose_spells(\'["ethereum"]\', "project", @@ -20,7 +20,7 @@ WITH early_price AS ( , MIN_BY(price, minute) AS price FROM {{ source('prices', 'usd') }} WHERE blockchain = 'ethereum' - AND contract_address='{{fox_token_address}}' + AND contract_address= {{fox_token_address}} ) SELECT 'ethereum' AS blockchain @@ -31,16 +31,16 @@ SELECT 'ethereum' AS blockchain , t.account AS recipient , t.contract_address , t.evt_tx_hash AS tx_hash -, CAST(t.amount AS DECIMAL(38,0)) AS amount_raw +, t.amount AS amount_raw , CAST(t.amount/POWER(10, 18) AS double) AS amount_original , CASE WHEN t.evt_block_time >= (SELECT minute FROM early_price) THEN CAST(pu.price*t.amount/POWER(10, 18) AS double) ELSE CAST((SELECT price FROM early_price)*t.amount/POWER(10, 18) AS double) END AS amount_usd -, '{{fox_token_address}}' AS token_address +, {{fox_token_address}} AS token_address , 'FOX' AS token_symbol , t.evt_index FROM {{ source('shapeshift_ethereum', 'TokenDistributor_evt_Claimed') }} t LEFT JOIN {{ ref('prices_usd_forward_fill') }} pu ON pu.blockchain = 'ethereum' - AND pu.contract_address='{{fox_token_address}}' + AND pu.contract_address= {{fox_token_address}} AND pu.minute=date_trunc('minute', t.evt_block_time) -WHERE t.evt_block_time BETWEEN '2021-07-08' AND '2021-10-22' \ No newline at end of file +WHERE t.evt_block_time BETWEEN timestamp '2021-07-08' AND timestamp '2021-10-22' \ No newline at end of file diff --git a/models/snowswap/ethereum/snowswap_ethereum_airdrop_claims.sql b/models/snowswap/ethereum/snowswap_ethereum_airdrop_claims.sql index 83620e679e6..f53070bd432 100644 --- a/models/snowswap/ethereum/snowswap_ethereum_airdrop_claims.sql +++ b/models/snowswap/ethereum/snowswap_ethereum_airdrop_claims.sql @@ -1,10 +1,10 @@ {{ config( + tags=['dunesql', 'static'], schema = 'snowswap_ethereum', alias = alias('airdrop_claims'), materialized = 'table', file_format = 'delta', - tags=['static'], unique_key = ['recipient', 'tx_hash', 'evt_index'], post_hook='{{ expose_spells(\'["ethereum"]\', "project", @@ -20,7 +20,7 @@ WITH early_price AS ( , MIN_BY(price, minute) AS price FROM {{ source('prices', 'usd') }} WHERE blockchain = 'ethereum' - AND contract_address='{{snow_token_address}}' + AND contract_address= {{snow_token_address}} ) SELECT 'ethereum' AS blockchain @@ -31,16 +31,16 @@ SELECT 'ethereum' AS blockchain , t.account AS recipient , t.contract_address , t.evt_tx_hash AS tx_hash -, CAST(t.amount AS DECIMAL(38,0)) AS amount_raw +, t.amount AS amount_raw , CAST(t.amount/POWER(10, 18) AS double) AS amount_original , CASE WHEN t.evt_block_time >= (SELECT minute FROM early_price) THEN CAST(pu.price*t.amount/POWER(10, 18) AS double) ELSE CAST((SELECT price FROM early_price)*t.amount/POWER(10, 18) AS double) END AS amount_usd -, '{{snow_token_address}}' AS token_address +, {{snow_token_address}} AS token_address , 'SNOW' AS token_symbol , t.evt_index FROM {{ source('snowswap_ethereum', 'MerkleDistributor_evt_Claimed') }} t LEFT JOIN {{ ref('prices_usd_forward_fill') }} pu ON pu.blockchain = 'ethereum' - AND pu.contract_address='{{snow_token_address}}' + AND pu.contract_address= {{snow_token_address}} AND pu.minute=date_trunc('minute', t.evt_block_time) -WHERE t.evt_block_time BETWEEN '2020-10-14' AND '2020-10-31' \ No newline at end of file +WHERE t.evt_block_time BETWEEN timestamp '2020-10-14' AND timestamp '2020-10-31' \ No newline at end of file diff --git a/models/sudoswap/ethereum/sudoswap_ethereum_airdrop_claims.sql b/models/sudoswap/ethereum/sudoswap_ethereum_airdrop_claims.sql index a7aef4ba690..5e4e1df1526 100644 --- a/models/sudoswap/ethereum/sudoswap_ethereum_airdrop_claims.sql +++ b/models/sudoswap/ethereum/sudoswap_ethereum_airdrop_claims.sql @@ -1,5 +1,6 @@ {{ config( + tags=['dunesql'], schema = 'sudoswap_ethereum', alias = alias('airdrop_claims'), materialized = 'incremental', @@ -20,7 +21,7 @@ WITH early_price AS ( , MIN_BY(price, minute) AS price FROM {{ source('prices', 'usd') }} WHERE blockchain = 'ethereum' - AND contract_address='{{sudo_token_address}}' + AND contract_address= {{sudo_token_address}} ) SELECT 'ethereum' AS blockchain @@ -31,21 +32,21 @@ SELECT 'ethereum' AS blockchain , t.account AS recipient , t.contract_address , t.evt_tx_hash AS tx_hash -, CAST(t.amount AS DECIMAL(38,0)) AS amount_raw +, t.amount AS amount_raw , CAST(t.amount/POWER(10, 18) AS double) AS amount_original , CASE WHEN t.evt_block_time >= (SELECT minute FROM early_price) THEN CAST(pu.price*t.amount/POWER(10, 18) AS double) ELSE CAST((SELECT price FROM early_price)*t.amount/POWER(10, 18) AS double) END AS amount_usd -, '{{sudo_token_address}}' AS token_address +, {{sudo_token_address}} AS token_address , 'SUDO' AS token_symbol , t.evt_index FROM {{ source('sudoswap_ethereum', 'Astrodrop_evt_Claimed') }} t LEFT JOIN {{ ref('prices_usd_forward_fill') }} pu ON pu.blockchain = 'ethereum' - AND pu.contract_address='{{sudo_token_address}}' + AND pu.contract_address= {{sudo_token_address}} AND pu.minute=date_trunc('minute', t.evt_block_time) {% if is_incremental() %} - AND pu.minute >= date_trunc("day", now() - interval '1 week') + AND pu.minute >= date_trunc('day', now() - interval '7' Day) {% endif %} {% if is_incremental() %} -WHERE t.evt_block_time >= date_trunc("day", now() - interval '1 week') +WHERE t.evt_block_time >= date_trunc('day', now() - interval '7' Day) {% endif %} \ No newline at end of file diff --git a/models/tokenfy/ethereum/tokenfy_ethereum_airdrop_claims.sql b/models/tokenfy/ethereum/tokenfy_ethereum_airdrop_claims.sql index c538374a44e..a02994069fe 100644 --- a/models/tokenfy/ethereum/tokenfy_ethereum_airdrop_claims.sql +++ b/models/tokenfy/ethereum/tokenfy_ethereum_airdrop_claims.sql @@ -1,10 +1,10 @@ {{ config( + tags=['dunesql', 'static'], schema = 'tokenfy_ethereum', alias = alias('airdrop_claims'), materialized = 'table', file_format = 'delta', - tags=['static'], unique_key = ['recipient', 'tx_hash', 'evt_index'], post_hook='{{ expose_spells(\'["ethereum"]\', "project", @@ -20,7 +20,7 @@ WITH early_price AS ( , MIN_BY(price, minute) AS price FROM {{ source('prices', 'usd') }} WHERE blockchain = 'ethereum' - AND contract_address='{{tknfy_token_address}}' + AND contract_address= {{tknfy_token_address}} ) SELECT 'ethereum' AS blockchain @@ -31,18 +31,18 @@ SELECT 'ethereum' AS blockchain , t.to AS recipient , t.contract_address , t.evt_tx_hash AS tx_hash -, CAST(t.value AS DECIMAL(38,0)) AS amount_raw +, t.value AS amount_raw , CAST(t.value/POWER(10, 18) AS double) AS amount_original , CASE WHEN t.evt_block_time >= (SELECT minute FROM early_price) THEN CAST(pu.price*t.value/POWER(10, 18) AS double) ELSE CAST((SELECT price FROM early_price)*t.value/POWER(10, 18) AS double) END AS amount_usd -, '{{tknfy_token_address}}' AS token_address +, {{tknfy_token_address}} AS token_address , 'TKNFY' AS token_symbol , t.evt_index FROM {{ source('erc20_ethereum', 'evt_transfer') }} t INNER JOIN {{source( 'tokenfy_ethereum', 'Tokenfy_call_claim' ) }} c ON c.call_block_number=t.evt_block_number AND c.call_tx_hash=t.evt_tx_hash LEFT JOIN {{ ref('prices_usd_forward_fill') }} pu ON pu.blockchain = 'ethereum' - AND pu.contract_address='{{tknfy_token_address}}' + AND pu.contract_address= {{tknfy_token_address}} AND pu.minute=date_trunc('minute', t.evt_block_time) -WHERE t.evt_block_time BETWEEN '2022-01-21' AND '2022-02-05' \ No newline at end of file +WHERE t.evt_block_time BETWEEN timestamp '2022-01-21' AND timestamp '2022-02-05' \ No newline at end of file diff --git a/models/uniswap/ethereum/uniswap_ethereum_airdrop_claims.sql b/models/uniswap/ethereum/uniswap_ethereum_airdrop_claims.sql index a05179fd8de..54a01ba4445 100644 --- a/models/uniswap/ethereum/uniswap_ethereum_airdrop_claims.sql +++ b/models/uniswap/ethereum/uniswap_ethereum_airdrop_claims.sql @@ -1,5 +1,6 @@ {{ config( + tags=['dunesql'], schema = 'euniswap_ethereum', alias = alias('airdrop_claims'), materialized = 'incremental', @@ -20,7 +21,7 @@ WITH early_price AS ( , MIN_BY(price, minute) AS price FROM {{ source('prices', 'usd') }} WHERE blockchain = 'ethereum' - AND contract_address='{{uni_token_address}}' + AND contract_address= {{uni_token_address}} ) SELECT 'ethereum' AS blockchain @@ -31,21 +32,21 @@ SELECT 'ethereum' AS blockchain , t.account AS recipient , t.contract_address , t.evt_tx_hash AS tx_hash -, CAST(t.amount AS DECIMAL(38,0)) AS amount_raw +, t.amount AS amount_raw , CAST(t.amount/POWER(10, 18) AS double) AS amount_original , CASE WHEN t.evt_block_time >= (SELECT minute FROM early_price) THEN CAST(pu.price*t.amount/POWER(10, 18) AS double) ELSE CAST((SELECT price FROM early_price)*t.amount/POWER(10, 18) AS double) END AS amount_usd -, '{{uni_token_address}}' AS token_address +, {{uni_token_address}} AS token_address , 'UNI' AS token_symbol , t.evt_index FROM {{ source('uniswap_ethereum', 'MerkleDistributor_evt_Claimed') }} t LEFT JOIN {{ ref('prices_usd_forward_fill') }} pu ON pu.blockchain = 'ethereum' - AND pu.contract_address='{{uni_token_address}}' + AND pu.contract_address= {{uni_token_address}} AND pu.minute=date_trunc('minute', t.evt_block_time) {% if is_incremental() %} - AND pu.minute >= date_trunc("day", now() - interval '1 week') + AND pu.minute >= date_trunc('day', now() - interval '7' Day) {% endif %} {% if is_incremental() %} -WHERE t.evt_block_time >= date_trunc("day", now() - interval '1 week') +WHERE t.evt_block_time >= date_trunc('day', now() - interval '7' Day) {% endif %} \ No newline at end of file diff --git a/models/x2y2/ethereum/x2y2_ethereum_airdrop_claims.sql b/models/x2y2/ethereum/x2y2_ethereum_airdrop_claims.sql index ef73693b4fd..f896c64a6be 100644 --- a/models/x2y2/ethereum/x2y2_ethereum_airdrop_claims.sql +++ b/models/x2y2/ethereum/x2y2_ethereum_airdrop_claims.sql @@ -1,10 +1,10 @@ {{ config( + tags=['dunesql', 'static'], schema = 'x2y2_ethereum', alias = alias('airdrop_claims'), materialized = 'table', file_format = 'delta', - tags=['static'], unique_key = ['recipient', 'tx_hash', 'evt_index'], post_hook='{{ expose_spells(\'["ethereum"]\', "project", @@ -20,7 +20,7 @@ WITH early_price AS ( , MIN_BY(price, minute) AS price FROM {{ source('prices', 'usd') }} WHERE blockchain = 'ethereum' - AND contract_address='{{xtyt_token_address}}' + AND contract_address= {{xtyt_token_address}} ) SELECT 'ethereum' AS blockchain @@ -31,16 +31,16 @@ SELECT 'ethereum' AS blockchain , t.to AS recipient , t.contract_address , t.evt_tx_hash AS tx_hash -, CAST(t.value AS DECIMAL(38,0)) AS amount_raw +, t.value AS amount_raw , CAST(t.value/POWER(10, 18) AS double) AS amount_original , CASE WHEN t.evt_block_time >= (SELECT minute FROM early_price) THEN CAST(pu.price*t.value/POWER(10, 18) AS double) ELSE CAST((SELECT price FROM early_price)*t.value/POWER(10, 18) AS double) END AS amount_usd -, '{{xtyt_token_address}}' AS token_address +, {{xtyt_token_address}} AS token_address , 'X2Y2' AS token_symbol , t.evt_index FROM {{ source('erc20_ethereum', 'evt_transfer') }} t LEFT JOIN {{ ref('prices_usd_forward_fill') }} pu ON pu.blockchain = 'ethereum' - AND pu.contract_address='{{xtyt_token_address}}' + AND pu.contract_address= {{xtyt_token_address}} AND pu.minute=date_trunc('minute', t.evt_block_time) -WHERE t.evt_block_time BETWEEN '2022-02-15' AND '2022-03-31' \ No newline at end of file +WHERE t.evt_block_time BETWEEN timestamp '2022-02-15' AND timestamp '2022-03-31' \ No newline at end of file From 3856a12b3e73726778bf4adca6229c60b28a2cba Mon Sep 17 00:00:00 2001 From: timmay_castags Date: Thu, 28 Nov 2024 15:16:54 -0500 Subject: [PATCH 5/6] Add Clark to Tokens and Prices for Base chain --- .../tokens/models/prices/base/prices_base_tokens.sql | 3 ++- .../tokens/models/tokens/base/tokens_base_erc20.sql | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dbt_subprojects/tokens/models/prices/base/prices_base_tokens.sql b/dbt_subprojects/tokens/models/prices/base/prices_base_tokens.sql index 7891a6ece06..ae73fbb8141 100644 --- a/dbt_subprojects/tokens/models/prices/base/prices_base_tokens.sql +++ b/dbt_subprojects/tokens/models/prices/base/prices_base_tokens.sql @@ -190,6 +190,7 @@ FROM ('alf-alf', 'base', 'ALF',0x26f1bb40ea88b46ceb21557dc0ffac7b7c0ad40f, 18), ('tad1-tadpole', 'base', 'TAD',0x55027a5b06f4340cc4c82dcc74c90ca93dcb173e, 18), ('blue-blue-guy', 'base', 'BLUE',0x891502ba08132653151f822a3a430198f1844115, 18), - ('alb-alienbase', 'base', 'ALB',0x1dd2d631c92b1acdfcdd51a0f7145a50130050c4, 18) + ('alb-alienbase', 'base', 'ALB',0x1dd2d631c92b1acdfcdd51a0f7145a50130050c4, 18), + ('clark-coinbase-mascot','base','CLARK',0x5f7373Fa845692b1dD7bfaE576D6c743482bf26a, 18) ) as temp (token_id, blockchain, symbol, contract_address, decimals) diff --git a/dbt_subprojects/tokens/models/tokens/base/tokens_base_erc20.sql b/dbt_subprojects/tokens/models/tokens/base/tokens_base_erc20.sql index 027885e76fa..3362d13c44a 100644 --- a/dbt_subprojects/tokens/models/tokens/base/tokens_base_erc20.sql +++ b/dbt_subprojects/tokens/models/tokens/base/tokens_base_erc20.sql @@ -405,5 +405,6 @@ FROM (VALUES , (0x574178357661527601482b79af6bb1ff7cc1306a, '1984', 18) , (0x63e14921ba4546cb15087d574346574eee055812, 'PVP', 18) , (0xd68470491eb513365322810e55e0eba80785dfdd, '243M theft', 18) - , (0xb0505e5a99abd03d94a1169e638b78edfed26ea4, 'uSUI', 18) + , (0xb0505e5a99abd03d94a1169e638b78edfed26ea4, 'uSUI', 18) + , (0x5f7373Fa845692b1dD7bfaE576D6c743482bf26a, 'CLARK', 18) ) AS temp_table (contract_address, symbol, decimals) From 852ce22a52d613492c88e180d5a31c5ee71c5627 Mon Sep 17 00:00:00 2001 From: timmay_castags Date: Thu, 28 Nov 2024 15:19:55 -0500 Subject: [PATCH 6/6] Merged Morpho and Clark --- dbt_subprojects/tokens/models/tokens/base/tokens_base_erc20.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/dbt_subprojects/tokens/models/tokens/base/tokens_base_erc20.sql b/dbt_subprojects/tokens/models/tokens/base/tokens_base_erc20.sql index 95d8dab348c..dba5bebbb47 100644 --- a/dbt_subprojects/tokens/models/tokens/base/tokens_base_erc20.sql +++ b/dbt_subprojects/tokens/models/tokens/base/tokens_base_erc20.sql @@ -406,5 +406,6 @@ FROM (VALUES , (0x63e14921ba4546cb15087d574346574eee055812, 'PVP', 18) , (0xd68470491eb513365322810e55e0eba80785dfdd, '243M theft', 18) , (0xb0505e5a99abd03d94a1169e638b78edfed26ea4, 'uSUI', 18) + , (0x5f7373Fa845692b1dD7bfaE576D6c743482bf26a, 'CLARK', 18) , (0xBAa5CC21fd487B8Fcc2F632f3F4E8D37262a0842, 'MORPHO', 18) ) AS temp_table (contract_address, symbol, decimals)