mirror of
https://github.com/FlipsideCrypto/solana-models.git
synced 2026-02-06 13:56:50 +00:00
An 2289/hyperspace (#136)
* hyperspace nft sales model * coral cube * coral cube fix * hyperspace changes * test updates Co-authored-by: Desmond Hui <desmond@flipsidecrypto.com>
This commit is contained in:
parent
46634e7681
commit
3ce52fa753
3
data/testing__nft_sales_coral_cube.csv
Normal file
3
data/testing__nft_sales_coral_cube.csv
Normal file
@ -0,0 +1,3 @@
|
||||
tx_id,purchaser,seller,mint,sales_amount
|
||||
3z2bVCGpjTrF5HEeezN46jEmdN34ZAJ2crR5hxJA5AwGWJ6mNdtYuJxc3r24RVCNvKa2qqLQR843dHZAUPXCSb58,2DvdkRLsjx8sy6g5fbJvrcExndSXgxFx1VoWV8iTahQw,2DAF5XRgnt5EAC3t4vWbap6QWyjseAjVFqagRsNpFnr5,H5MhhjoqAtv6YAmyz8E91TbxopMJGYWB6o55rjTi1qVT,0.02303928
|
||||
52A5MK1MRryhY7PuX3Q9yWnXAd9WZvzUrUJgyRzKhbsG4UJ3PzBRuw2KiQM7AqwveXtf6jWadEMLfjuvSTzjjynf,2uRG2BSVDBdBP1PZA6Dhde5qqs6eJZfx2jbxA148yY9n,ESBjMYBxbsSidbQxKpY77W1V5Ewht4T1JNjqn9Qw9e7y,XMKDjR3wRYLWHWakMmpWmuWJwCRrvvSTtyUpASeYgcb,0.20203928
|
||||
|
3
data/testing__nft_sales_hyperspace.csv
Normal file
3
data/testing__nft_sales_hyperspace.csv
Normal file
@ -0,0 +1,3 @@
|
||||
tx_id,purchaser,seller,mint,sales_amount
|
||||
4dVZSdzGgRdJxM4j3JVwwo5t9sxZEB5SkcMU5tWe7dsnZKJvthwy2jHwxmhwApR2QFgD6h9DSc2nTt2JpziGDLKM,6JP6yRoBPYWzhUwvDAq4yND6Aq2kUhPvn5ciLxkUiRzz,EDx5p5oauVsC71FVdy9gqScmD5EbNUcfA744tzMweLs2,DnmmanrQ5WTzuWV9zZcrunNAwcToqKBE3arKwL4k5fhx,0.01
|
||||
3qRyNqFzkSKSf4cB43nfMS8VTSvMGe4zkG2jFF7Azhhxrw4HqimseHN7w6ox1G87yrr4ruaAjK6838eL7oAJiy7s,DBho2RcnzkxLyVTeAhWPbFjX7tQqoat29ipHG8hzUEGA,G5cCsPPf6mqFqzV4WKk8uEocMs73KZoUWkPKN5BcC6Qx,39EQ7EQPNadkqxT4WCUv7NEBjgTTREpeTuS7ijCHCGTQ,8.15
|
||||
|
@ -20,16 +20,27 @@ WITH sales_inner_instructions AS (
|
||||
) AS amount,
|
||||
instruction :accounts [0] :: STRING AS purchaser,
|
||||
instruction :accounts [1] :: STRING AS seller,
|
||||
instruction :accounts [2] :: STRING AS nft_account,
|
||||
CASE
|
||||
WHEN program_id = '6U2LkBQ6Bqd1VFt7H76343vpSwS5Tb1rNyXSNnjkf9VL' THEN instruction :accounts [3] :: STRING
|
||||
ELSE instruction :accounts [2] :: STRING
|
||||
END AS nft_account,
|
||||
_inserted_timestamp
|
||||
FROM
|
||||
{{ ref('silver__events') }} e
|
||||
LEFT OUTER JOIN TABLE(FLATTEN(inner_instruction :instructions)) i
|
||||
|
||||
WHERE
|
||||
program_id = 'hausS13jsjafwWwGqZTUQRmWyvyxn9EQpqMwV1PBBmk' -- Programid used by Coral Cube to execute sale, other non-opensea markets also use this
|
||||
AND instruction :data :: STRING LIKE '63LNsZWnP5%'
|
||||
AND instruction :accounts [10] :: STRING = '29xtkHHFLUHXiLoxTzbC7U8kekTwN3mVQSkfXnB1sQ6e'
|
||||
{{ ref('silver__events') }}
|
||||
e
|
||||
LEFT OUTER JOIN TABLE(FLATTEN(inner_instruction :instructions)) i
|
||||
WHERE
|
||||
instruction :data :: STRING LIKE '63LNsZWnP5%'
|
||||
AND (
|
||||
(
|
||||
program_id = 'hausS13jsjafwWwGqZTUQRmWyvyxn9EQpqMwV1PBBmk' -- Programid used BY Coral Cube V1 TO EXECUTE sale
|
||||
AND instruction :accounts [10] :: STRING = '29xtkHHFLUHXiLoxTzbC7U8kekTwN3mVQSkfXnB1sQ6e'
|
||||
)
|
||||
OR (
|
||||
program_id = '6U2LkBQ6Bqd1VFt7H76343vpSwS5Tb1rNyXSNnjkf9VL' -- Coral Cube V2
|
||||
AND instruction :accounts [10] :: STRING = 'Ex9xNf2ocrM9hmtKhkpQG4i4XeXWrhFxsusSc1wHz3X8'
|
||||
)
|
||||
)
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= (
|
||||
@ -38,11 +49,8 @@ AND _inserted_timestamp >= (
|
||||
FROM
|
||||
{{ this }}
|
||||
)
|
||||
|
||||
{% else %}
|
||||
AND
|
||||
block_timestamp :: DATE >= '2022-02-02' -- no Coral Cube sales before this date
|
||||
|
||||
AND block_timestamp :: DATE >= '2022-02-02' -- no Coral Cube sales before this DATE
|
||||
{% endif %}
|
||||
),
|
||||
post_token_balances AS (
|
||||
@ -63,7 +71,8 @@ WHERE
|
||||
{{ this }}
|
||||
)
|
||||
{% else %}
|
||||
WHERE block_timestamp :: DATE >= '2022-02-02' -- no Coral Cube sales before this date
|
||||
WHERE
|
||||
block_timestamp :: DATE >= '2022-02-02' -- no Coral Cube sales before this DATE
|
||||
{% endif %}
|
||||
),
|
||||
pre_final AS (
|
||||
@ -73,7 +82,10 @@ pre_final AS (
|
||||
s.tx_id,
|
||||
s.succeeded,
|
||||
s.program_id,
|
||||
p.mint,
|
||||
COALESCE(
|
||||
p.mint,
|
||||
s.nft_account
|
||||
) AS mint,
|
||||
s.purchaser,
|
||||
s.seller,
|
||||
SUM(
|
||||
@ -94,7 +106,10 @@ pre_final AS (
|
||||
s.tx_id,
|
||||
s.succeeded,
|
||||
s.program_id,
|
||||
p.mint,
|
||||
COALESCE(
|
||||
p.mint,
|
||||
s.nft_account
|
||||
),
|
||||
s.purchaser,
|
||||
s.seller,
|
||||
s._inserted_timestamp
|
||||
@ -104,4 +119,4 @@ SELECT
|
||||
FROM
|
||||
pre_final
|
||||
WHERE
|
||||
sales_amount > 0 -- ignore very small amount of txs are actual 0 sales or not sold in SOL (~100 out of >360k)
|
||||
sales_amount > 0 -- ignore very small amount OF txs are actual 0 sales
|
||||
|
||||
@ -6,6 +6,17 @@ models:
|
||||
combination_of_columns:
|
||||
- TX_ID
|
||||
- MINT
|
||||
- compare_model_subset:
|
||||
name: silver__nft_sales_coral_cube_business_logic_test
|
||||
compare_model: ref('testing__nft_sales_coral_cube')
|
||||
compare_columns:
|
||||
- tx_id
|
||||
- purchaser
|
||||
- seller
|
||||
- mint
|
||||
- round(sales_amount,8)
|
||||
model_condition: "where tx_id in ('3z2bVCGpjTrF5HEeezN46jEmdN34ZAJ2crR5hxJA5AwGWJ6mNdtYuJxc3r24RVCNvKa2qqLQR843dHZAUPXCSb58',
|
||||
'52A5MK1MRryhY7PuX3Q9yWnXAd9WZvzUrUJgyRzKhbsG4UJ3PzBRuw2KiQM7AqwveXtf6jWadEMLfjuvSTzjjynf')"
|
||||
columns:
|
||||
- name: BLOCK_TIMESTAMP
|
||||
description: "{{ doc('block_timestamp') }}"
|
||||
|
||||
@ -23,7 +23,8 @@ WITH base_table AS (
|
||||
e
|
||||
WHERE
|
||||
program_id = 'HYPERfwdTjyJ2SCaKHmpF2MtrXqWxrsotYDsTrshHWq8'
|
||||
AND INDEX = 3
|
||||
AND (instruction :accounts [10] :: STRING = '5pdaXth4ijgDCeYDKgSx3jAbN7m8h4gy1LRCErAAN1LM'
|
||||
OR instruction :accounts [11] :: STRING = '5pdaXth4ijgDCeYDKgSx3jAbN7m8h4gy1LRCErAAN1LM')
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= (
|
||||
|
||||
@ -6,6 +6,17 @@ models:
|
||||
combination_of_columns:
|
||||
- TX_ID
|
||||
- MINT
|
||||
- compare_model_subset:
|
||||
name: silver__nft_sales_hyperspace_business_logic_test
|
||||
compare_model: ref('testing__nft_sales_hyperspace')
|
||||
compare_columns:
|
||||
- tx_id
|
||||
- purchaser
|
||||
- seller
|
||||
- mint
|
||||
- round(sales_amount,8)
|
||||
model_condition: "where tx_id in ('4dVZSdzGgRdJxM4j3JVwwo5t9sxZEB5SkcMU5tWe7dsnZKJvthwy2jHwxmhwApR2QFgD6h9DSc2nTt2JpziGDLKM',
|
||||
'3qRyNqFzkSKSf4cB43nfMS8VTSvMGe4zkG2jFF7Azhhxrw4HqimseHN7w6ox1G87yrr4ruaAjK6838eL7oAJiy7s')"
|
||||
columns:
|
||||
- name: BLOCK_TIMESTAMP
|
||||
description: "{{ doc('block_timestamp') }}"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user