Skip to content

Commit

Permalink
update RF4 trusted user model to include airdrop data (#1693)
Browse files Browse the repository at this point in the history
* feat: add op airdrop trusted user signal

* revise eigentrust global rank threshold
  • Loading branch information
ccerv1 authored Jun 23, 2024
1 parent 6a934f3 commit d9529e1
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
2 changes: 1 addition & 1 deletion warehouse/dbt/macros/models/combine_op_airdrops.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
-- Loop through each suffix and generate the full table reference
{% for suffix in suffixes %}
{% set table_name = 'op_airdrop' ~ suffix ~ '_addresses_detailed_list' %}
{% set query = "select address, op_amount_raw/1e18 as op_amount, cast('" ~ suffix ~ "' as int) as airdrop_round from " ~ source('static_data_sources', table_name) %}
{% set query = "select lower(cast(address as string)) as address, cast(op_amount_raw as numeric)/1e18 as op_amount, cast('" ~ suffix ~ "' as int) as airdrop_round from " ~ source('static_data_sources', table_name) %}
{% do queries.append(query) %}
{% endfor %}

Expand Down
31 changes: 29 additions & 2 deletions warehouse/dbt/models/marts/superchain/rf4_trusted_users.sql
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ eigentrust_top_users as (
snapshot_time = '2024-05-21'
and strategy_id = 1
order by eigentrust_rank desc
limit 50000
limit 42000
),

optimist_nft_holders as (
Expand All @@ -39,6 +39,22 @@ passport_scores as (
from {{ ref('stg_passport__scores') }}
),

airdrop_recipients as (
select
address,
1 as airdrop_recipient,
CAST(
COALESCE(count_drops > 1, false) as int64
) as airdrop_verification
from (
select
LOWER(address) as address,
COUNT(distinct airdrop_round) as count_drops
from {{ ref('stg_optimism_airdrop_addresses') }}
group by LOWER(address)
)
),

all_addresses as (
select distinct address
from (
Expand All @@ -47,6 +63,8 @@ all_addresses as (
select address from passport_scores
union all
select address from optimist_nft_holders
union all
select address from airdrop_recipients
)
),

Expand All @@ -64,7 +82,11 @@ trusted_user_model as (
COALESCE(passport_scores.passport_verification, 0)
as passport_verification,
COALESCE(optimist_nft_holders.optimist_nft_verification, 0)
as optimist_nft_verification
as optimist_nft_verification,
COALESCE(airdrop_recipients.airdrop_recipient, 0)
as airdrop_recipient,
COALESCE(airdrop_recipients.airdrop_verification, 0)
as airdrop_verification
from all_addresses
left join farcaster_users
on all_addresses.address = farcaster_users.address
Expand All @@ -74,6 +96,8 @@ trusted_user_model as (
on all_addresses.address = passport_scores.address
left join optimist_nft_holders
on all_addresses.address = optimist_nft_holders.address
left join airdrop_recipients
on all_addresses.address = airdrop_recipients.address
)

select
Expand All @@ -84,11 +108,14 @@ select
passport_user,
passport_verification,
optimist_nft_verification,
airdrop_recipient,
airdrop_verification,
(
farcaster_user
+ farcaster_prepermissionless
+ eigentrust_verification
+ passport_verification
+ optimist_nft_verification
+ airdrop_verification
) > 1 as is_trusted_user
from trusted_user_model

0 comments on commit d9529e1

Please sign in to comment.