farcaster (#68)

This commit is contained in:
Austin 2024-06-05 22:19:02 -04:00 committed by GitHub
parent bb12267c27
commit fa1509a2a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
20 changed files with 490 additions and 1 deletions

View File

@ -86,6 +86,17 @@ Note: These tables ceased updating on Feburary 4th, 2024.
- [layerzero__fact_transactions_snapshot](https://flipsidecrypto.github.io/external-models/#!/model/model.external_models.layerzero__fact_transactions_snapshot)
**Farcaster (Neynar)**
- [dim_fids](https://flipsidecrypto.github.io/external-models/#!/model/model.external_models.farcaster__dim_fids)
- [dim_fnames](https://flipsidecrypto.github.io/external-models/#!/model/model.external_models.farcaster__dim_fnames)
- [fact_casts](https://flipsidecrypto.github.io/external-models/#!/model/model.external_models.farcaster__fact_casts)
- [fact_links](https://flipsidecrypto.github.io/external-models/#!/model/model.external_models.farcaster__fact_links)
- [fact_reactions](https://flipsidecrypto.github.io/external-models/#!/model/model.external_models.farcaster__fact_reactions)
- [fact_signers](https://flipsidecrypto.github.io/external-models/#!/model/model.external_models.farcaster__fact_signers)
- [fact_storage](https://flipsidecrypto.github.io/external-models/#!/model/model.external_models.farcaster__fact_storage)
- [fact_user_data](https://flipsidecrypto.github.io/external-models/#!/model/model.external_models.farcaster__fact_user_data)
- [fact_verifications](https://flipsidecrypto.github.io/external-models/#!/model/model.external_models.farcaster__fact_verifications)
## **Helpful User-Defined Functions (UDFs)**
UDFs are custom functions built by the Flipside team that can be used in your queries to make your life easier.

View File

@ -0,0 +1,18 @@
{{ config(
materialized = 'view',
persist_docs ={ "relation": true,
"columns": true },
tags = ['farcaster'],
meta ={ 'database_tags':{ 'table':{ 'PROTOCOL': 'FARCASTER' }} }
) }}
SELECT
custody_address,
fid,
created_at,
updated_at
FROM
{{ source(
'external_bronze',
'farcaster_fids'
) }}

View File

@ -0,0 +1,19 @@
version: 2
models:
- name: farcaster__dim_fids
description: Stores all registered FIDs on the Farcaster network. For more info see [Neynar](https://docs.neynar.com/docs/how-to-query-neynar-sql-playground-for-farcaster-data) or [schema](https://github.com/farcasterxyz/hub-monorepo/tree/51c57245df8ec1c68d616dd3ab8ae5b80edf68fd/apps/replicator)
columns:
- name: FID
description: FID of the user (primary key)
- name: CREATED_AT
description: When the row was first created in this DB (not the same as registration date!)
- name: UPDATED_AT
description: When the row was last updated.
tests:
- not_null
- dbt_expectations.expect_row_values_to_have_recent_data:
datepart: day
interval: 2
- name: CUSTODY_ADDRESS
description: Address that owns the FID.

View File

@ -0,0 +1,21 @@
{{ config(
materialized = 'view',
persist_docs ={ "relation": true,
"columns": true },
tags = ['farcaster'],
meta ={ 'database_tags':{ 'table':{ 'PROTOCOL': 'FARCASTER' }} }
) }}
SELECT
fid,
fname,
custody_address,
expires_at,
created_at,
updated_at,
deleted_at
FROM
{{ source(
'external_bronze',
'farcaster_fnames'
) }}

View File

@ -0,0 +1,24 @@
version: 2
models:
- name: farcaster__dim_fnames
description: Stores all usernames that are currently registered. Note that in the case a username is deregistered, the row is soft-deleted via the `deleted_at` column until a new username is registered for the given FID. For more info see [Neynar](https://docs.neynar.com/docs/how-to-query-neynar-sql-playground-for-farcaster-data) or [schema](https://github.com/farcasterxyz/hub-monorepo/tree/51c57245df8ec1c68d616dd3ab8ae5b80edf68fd/apps/replicator)
columns:
- name: FID
description: FID the username belongs to.
- name: FNAME
description: Username, e.g. dwr if an fname, or dwr.eth if an ENS name.
- name: CREATED_AT
description: When the row was first created in this DB (not the same as when the key was created on the network!)
- name: UPDATED_AT
description: When the row was last updated.
tests:
- not_null
- dbt_expectations.expect_row_values_to_have_recent_data:
datepart: day
interval: 2
- name: DELETED_AT
description: When the proof was revoked or the fname was otherwise deregistered from this user.
- name: CUSTODY_ADDRESS
description: Address that owns the FID.
- name: EXPIRES_AT

View File

@ -0,0 +1,30 @@
{{ config(
materialized = 'view',
persist_docs ={ "relation": true,
"columns": true },
tags = ['farcaster'],
meta ={ 'database_tags':{ 'table':{ 'PROTOCOL': 'FARCASTER' }} }
) }}
SELECT
TIMESTAMP,
fid,
HASH,
parent_hash,
parent_fid,
parent_url,
text,
embeds,
mentions,
mentions_positions,
root_parent_hash,
root_parent_url,
id,
created_at,
updated_at,
deleted_at
FROM
{{ source(
'external_bronze',
'farcaster_casts'
) }}

View File

@ -0,0 +1,43 @@
version: 2
models:
- name: farcaster__fact_casts
description: Represents a cast authored by a user. For more info see [Neynar](https://docs.neynar.com/docs/how-to-query-neynar-sql-playground-for-farcaster-data) or [schema](https://github.com/farcasterxyz/hub-monorepo/tree/51c57245df8ec1c68d616dd3ab8ae5b80edf68fd/apps/replicator)
columns:
- name: TIMESTAMP
description: Message timestamp in UTC.
- name: FID
description: FID of the user that signed the message.
- name: HASH
description: Message hash.
- name: PARENT_HASH
description: If this cast was a reply, the hash of the parent cast. null otherwise.
- name: PARENT_FID
description: If this cast was a reply, the FID of the author of the parent cast. null otherwise.
- name: PARENT_URL
description: If this cast was a reply to a URL (e.g. an NFT, a web URL, etc.), the URL. null otherwise.
- name: TEXT
description: The raw text of the cast with mentions removed.
- name: EMBEDS
description: Array of URLs or cast IDs that were embedded with this cast.
- name: MENTIONS
description: Array of FIDs mentioned in the cast.
- name: MENTIONS_POSITIONS
description: UTF8 byte offsets of the mentioned FIDs in the cast.
- name: ROOT_PARENT_HASH
description: If this cast was a reply, the hash of the original cast in the reply chain. null otherwise.
- name: ROOT_PARENT_URL
description: If this cast was a reply, then the URL that the original cast in the reply chain was replying to.
- name: ID
description: Generic identifier specific to this DB (a.k.a. surrogate key)
- name: CREATED_AT
description: When the row was first created in this DB (not the same as the message timestamp!)
- name: UPDATED_AT
description: When the row was last updated.
tests:
- not_null
- dbt_expectations.expect_row_values_to_have_recent_data:
datepart: day
interval: 2
- name: DELETED_AT
description: When the cast was considered deleted/revoked/pruned by the hub (e.g. in response to a CastRemove message, etc.)

View File

@ -0,0 +1,24 @@
{{ config(
materialized = 'view',
persist_docs ={ "relation": true,
"columns": true },
tags = ['farcaster'],
meta ={ 'database_tags':{ 'table':{ 'PROTOCOL': 'FARCASTER' }} }
) }}
SELECT
id,
fid,
target_fid,
HASH,
TIMESTAMP,
TYPE,
display_timestamp,
created_at,
updated_at,
deleted_at
FROM
{{ source(
'external_bronze',
'farcaster_links'
) }}

View File

@ -0,0 +1,31 @@
version: 2
models:
- name: farcaster__fact_links
description: Represents a link between two FIDs (e.g. a follow, subscription, etc.). For more info see [Neynar](https://docs.neynar.com/docs/how-to-query-neynar-sql-playground-for-farcaster-data) or [schema](https://github.com/farcasterxyz/hub-monorepo/tree/51c57245df8ec1c68d616dd3ab8ae5b80edf68fd/apps/replicator)
columns:
- name: ID
description: Generic identifier specific to this DB (a.k.a. surrogate key)
- name: FID
description: Farcaster ID (the user ID).
- name: TARGET_FID
description: Farcaster ID of the target user.
- name: HASH
description: Message hash.
- name: TIMESTAMP
description: Message timestamp in UTC.
- name: TYPE
description: Type of connection between users, e.g. follow.
- name: DISPLAY_TIMESTAMP
description: When the row was last updated.
- name: CREATED_AT
description: When the row was first created in this DB (not when the link itself was created on the network!)
- name: UPDATED_AT
description: When the row was last updated
tests:
- not_null
- dbt_expectations.expect_row_values_to_have_recent_data:
datepart: day
interval: 2
- name: DELETED_AT
description: When the link was considered deleted by the hub (e.g. in response to a LinkRemoveMessage message, etc.)

View File

@ -0,0 +1,25 @@
{{ config(
materialized = 'view',
persist_docs ={ "relation": true,
"columns": true },
tags = ['farcaster'],
meta ={ 'database_tags':{ 'table':{ 'PROTOCOL': 'FARCASTER' }} }
) }}
SELECT
id,
fid,
target_fid,
target_url,
reaction_type,
HASH,
target_hash,
TIMESTAMP,
created_at,
updated_at,
deleted_at
FROM
{{ source(
'external_bronze',
'farcaster_reactions'
) }}

View File

@ -0,0 +1,33 @@
version: 2
models:
- name: farcaster__fact_reactions
description: Represents a user reacting (liking or recasting) content. For more info see [Neynar](https://docs.neynar.com/docs/how-to-query-neynar-sql-playground-for-farcaster-data) or [schema](https://github.com/farcasterxyz/hub-monorepo/tree/51c57245df8ec1c68d616dd3ab8ae5b80edf68fd/apps/replicator)
columns:
- name: ID
description: Generic identifier specific to this DB (a.k.a. surrogate key)
- name: FID
description: FID of the user that signed the message.
- name: TARGET_FID
description: If target was a cast, the FID of the author of the cast. null otherwise.
- name: TARGET_URL
description: If target was a URL (e.g. NFT, a web URL, etc.), the URL. null otherwise.
- name: REACTION_TYPE
description: Type of reaction.
- name: HASH
description: Message hash.
- name: TARGET_HASH
description: If target was a cast, the hash of the cast. null otherwise.
- name: TIMESTAMP
description: Message timestamp in UTC.
- name: CREATED_AT
description: When the row was first created in this DB (not the same as the message timestamp!)
- name: UPDATED_AT
description: When the row was last updated.
tests:
- not_null
- dbt_expectations.expect_row_values_to_have_recent_data:
datepart: day
interval: 2
- name: DELETED_AT
description: When the reaction was considered deleted by the hub (e.g. in response to a ReactionRemove message, etc.)

View File

@ -0,0 +1,23 @@
{{ config(
materialized = 'view',
persist_docs ={ "relation": true,
"columns": true },
tags = ['farcaster'],
meta ={ 'database_tags':{ 'table':{ 'PROTOCOL': 'FARCASTER' }} }
) }}
SELECT
id,
fid,
app_fid,
NAME,
signer,
TIMESTAMP,
created_at,
updated_at,
deleted_at
FROM
{{ source(
'external_bronze',
'farcaster_signers'
) }}

View File

@ -0,0 +1,26 @@
version: 2
models:
- name: farcaster__fact_signers
description: Stores all registered signers. For more info see [Neynar](https://docs.neynar.com/docs/how-to-query-neynar-sql-playground-for-farcaster-data) or [schema](https://github.com/farcasterxyz/hub-monorepo/tree/51c57245df8ec1c68d616dd3ab8ae5b80edf68fd/apps/replicator)
columns:
- name: ID
description: Generic identifier specific to this DB (a.k.a. surrogate key)
- name: FID
description: FID of the user that authorized this signer.
- name: APP_FID
description: FID of the user/app that requested this signer.
- name: NAME
- name: SIGNER
- name: TIMESTAMP
- name: CREATED_AT
description: When the row was first created in this DB (not the same as when the key was created on the network!)
- name: UPDATED_AT
description: When the row was last updated.
tests:
- not_null
- dbt_expectations.expect_row_values_to_have_recent_data:
datepart: day
interval: 2
- name: DELETED_AT
description: Timestamp of the block where this signer was removed.

View File

@ -0,0 +1,22 @@
{{ config(
materialized = 'view',
persist_docs ={ "relation": true,
"columns": true },
tags = ['farcaster'],
meta ={ 'database_tags':{ 'table':{ 'PROTOCOL': 'FARCASTER' }} }
) }}
SELECT
id,
fid,
units,
expiry,
TIMESTAMP,
created_at,
updated_at,
deleted_at
FROM
{{ source(
'external_bronze',
'farcaster_storage'
) }}

View File

@ -0,0 +1,26 @@
version: 2
models:
- name: farcaster__fact_storage
description: Stores how many units of storage each FID has purchased, and when it expires. For more info see [Neynar](https://docs.neynar.com/docs/how-to-query-neynar-sql-playground-for-farcaster-data) or [schema](https://github.com/farcasterxyz/hub-monorepo/tree/51c57245df8ec1c68d616dd3ab8ae5b80edf68fd/apps/replicator)
columns:
- name: ID
description: Generic identifier specific to this DB (a.k.a. surrogate key)
- name: FID
description: FID that owns the storage.
- name: UNITS
description: Number of storage units allocated.
- name: EXPIRY
description: When this storage allocation will expire.
- name: TIMESTAMP
description: Message timestamp in UTC.
- name: CREATED_AT
description: When the row was first created in this DB
- name: UPDATED_AT
description: When the row was last updated.
tests:
- not_null
- dbt_expectations.expect_row_values_to_have_recent_data:
datepart: day
interval: 2
- name: DELETED_AT

View File

@ -0,0 +1,23 @@
{{ config(
materialized = 'view',
persist_docs ={ "relation": true,
"columns": true },
tags = ['farcaster'],
meta ={ 'database_tags':{ 'table':{ 'PROTOCOL': 'FARCASTER' }} }
) }}
SELECT
id,
fid,
TYPE,
VALUE,
HASH,
TIMESTAMP,
created_at,
updated_at,
deleted_at
FROM
{{ source(
'external_bronze',
'farcaster_user_data'
) }}

View File

@ -0,0 +1,29 @@
version: 2
models:
- name: farcaster__fact_user_data
description: Represents data associated with a user (e.g. profile photo, bio, username, etc.) For more info see [Neynar](https://docs.neynar.com/docs/how-to-query-neynar-sql-playground-for-farcaster-data) or [schema](https://github.com/farcasterxyz/hub-monorepo/tree/51c57245df8ec1c68d616dd3ab8ae5b80edf68fd/apps/replicator)
columns:
- name: ID
description: Generic identifier specific to this DB (a.k.a. surrogate key)
- name: FID
description: FID of the user that signed the message.
- name: TYPE
description: The type of user data (PFP, bio, username, etc.)
- name: VALUE
description: The string value of the field.
- name: HASH
description: Message hash.
- name: TIMESTAMP
description: Message timestamp in UTC.
- name: CREATED_AT
description: When the row was first created in this DB (not the same as the message timestamp!)
- name: UPDATED_AT
description: When the row was last updated.
tests:
- not_null
- dbt_expectations.expect_row_values_to_have_recent_data:
datepart: day
interval: 2
- name: DELETED_AT
description: When the data was considered deleted by the hub

View File

@ -0,0 +1,22 @@
{{ config(
materialized = 'view',
persist_docs ={ "relation": true,
"columns": true },
tags = ['farcaster'],
meta ={ 'database_tags':{ 'table':{ 'PROTOCOL': 'FARCASTER' }} }
) }}
SELECT
id,
fid,
claim,
HASH,
TIMESTAMP,
created_at,
updated_at,
deleted_at
FROM
{{ source(
'external_bronze',
'farcaster_verifications'
) }}

View File

@ -0,0 +1,26 @@
version: 2
models:
- name: farcaster__fact_verifications
description: Represents a user verifying something on the network. Currently, the only verification is proving ownership of an Ethereum wallet address. For more info see [Neynar](https://docs.neynar.com/docs/how-to-query-neynar-sql-playground-for-farcaster-data) or [schema](https://github.com/farcasterxyz/hub-monorepo/tree/51c57245df8ec1c68d616dd3ab8ae5b80edf68fd/apps/replicator)
columns:
- name: ID
description: Generic identifier specific to this DB (a.k.a. surrogate key)
- name: FID
description: FID of the user that signed the message.
- name: CLAIM
- name: HASH
description: Message hash.
- name: TIMESTAMP
description: Message timestamp in UTC.
- name: CREATED_AT
description: When the row was first created in this DB (not the same as the message timestamp!)
- name: UPDATED_AT
description: When the row was last updated.
tests:
- not_null
- dbt_expectations.expect_row_values_to_have_recent_data:
datepart: day
interval: 2
- name: DELETED_AT
description: When the verification was considered deleted by the hub (e.g. in response to a VerificationRemove message, etc.)

View File

@ -70,4 +70,17 @@ sources:
database: external
schema: layerzero
tables:
- name: transactions
- name: transactions
- name: external_bronze
database: external
schema: bronze
tables:
- name: farcaster_casts
- name: farcaster_fids
- name: farcaster_fnames
- name: farcaster_links
- name: farcaster_signers
- name: farcaster_storage
- name: farcaster_reactions
- name: farcaster_user_data
- name: farcaster_verifications