-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adds open rank trusted users metric (#1626)
* feat: adds open rank trusted users metric * v2 of openrank * update schema
- Loading branch information
Showing
3 changed files
with
86 additions
and
9 deletions.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
warehouse/dbt/models/marts/superchain/metrics/rf4_openrank_trusted_users.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{% set badgeholder_addresses = [ | ||
'0x60ca282757ba67f3adbf21f3ba2ebe4ab3eb01fc', '0x9934465ee73beaf148b1b3ff232c8cd86c4c2c63', '0x534631bcf33bdb069fb20a93d2fdb9e4d4dd42cf', '0x5872ce037211233b9f6f5095c25988021f270c21', '0x75cac0ceb8a39ddb4942a83ad2aafaf0c2a3e13f', '0x9c949881084dcbd97237f786710ab8e52a457136', '0x73186b2a81952c2340c4eb2e74e89869e1183df0', '0x288c53a1ba857ead34ad0e79f644087f8174185a', '0x894aa5f1e45454677a8560dde3b45cb5c427ef92', '0x648aa14e4424e0825a5ce739c8c68610e143fb79', '0x34aa3f359a9d614239015126635ce7732c18fdf3', '0x14276eb29e90541831cb94c80331484ae6d2a1d8', '0xc5cd017ce8efd2fefedf114350657394531477ae', '0x7fc80fad32ec41fd5cfcc14eee9c31953b6b4a8b', '0x488b2608a66e5d32e5a91eba21a198bd3fd8bcd9', '0x0331969e189d63fbc31d771bb04ab44227d748d8', '0x17640d0d8c93bf710b6ee4208997bb727b5b7bc2', '0x5a5d9ab7b1bd978f80909503ebb828879daca9c3', '0xe4c3768f48d4e676ae48c189db726edf8c1d401e', '0xdc0a92c350a52b6583e235a57901b8731af8b249', '0x51448923d8a215a5a8cd872a51f22c2f5c43b444', '0xef32eb37f3e8b4bdddf99879b23015f309ed7304', '0x3b60e31cfc48a9074cd5bebb26c9eaa77650a43f', '0xac3a69dd4a8fecc18b172bfa9643d6b0863819c8', '0x57893e666bd15e886d74751b0879361a3383b57a', '0x4fd6b3204a6ab48978018b25821682f090840333', '0xa2bbe92f4e320185dd42261897464f60c9a05a35', '0x634c474a393e4498bc2f0c1dee16a50e9e0ebe2b', '0x308fedfb88f6e85f27b85c8011ccb9b5e15bcbf7', '0xeee718c1e522ecb4b609265db7a83ab48ea0b06f', '0x5507dbd48a5a5bace8a6030e878cc4e0af147c33', '0x64fed9e56b548343e7bb47c49ecd7ffa9f1a34fe', '0x69e271483c38ed4902a55c3ea8aab9e7cc8617e5', '0x146cfed833cc926b16b0da9257e8a281c2add9f3', '0x885c327cad2aebb969dfaab4c928b73ca17e3887', '0x8eb9e5e5375b72ee7c5cb786ce8564d854c26a86', '0x7a48a728d9fd2d5a55c545c4378e5ba909349e90', '0x12681667bb220521c222f50ece5eb752046bc144', '0xda60aceb12a1a61d09b008ae4a60c760db32220f', '0xdca1bb1fc782ea3fa76ea4ada42af10c85766b6a', '0xde2b6860cb3212a6a1f8f8628abfe076723a4b39', '0xe4239eb12c1c6e5a84727db0a7b0507311eb5389', '0x66946def4ba6153c500d743b7a5febfc1654d6bd', '0xdcf7be2ff93e1a7671724598b1526f3a33b1ec25', '0x7ae8b0d6353f0931eb9fac0a3562fa9e4c6ff933', '0x839395e20bbb182fa440d08f850e6c7a8f6f0780', '0x06f455e2c297a4ae015191fa7a4a11c77c5b1b7c', '0x8f07bc36ff569312fdc41f3867d80bbd2fe94b76', '0xd35e119782059a27fead4edda8b555f393650bc8', '0x6dc43be93a8b5fd37dc16f24872babc6da5e5e3e', '0xdb150346155675dd0c93efd960d5985244a34820', '0x6adea326faea1b688af33df59e18f7a819bcaa4f', '0x61b647d3b5a04eec7e78b1d9cfbf9dea593c7865', '0xe422d6c46a69e989ba6468ccd0435cb0c5c243e3', '0x3db5b38ef4b433d9c6a664bd35551be73313189a', '0xb0623c91c65621df716ab8afe5f66656b21a9108', '0x94db037207f6fb697dbd33524aadffd108819dc8', '0x53c61cfb8128ad59244e8c1d26109252ace23d14', '0x75536cf4f01c2bfa528f5c74ddc1232db3af3ee5', '0x66da63b03feca7dd44a5bb023bb3645d3252fa32', '0xa2bf1b0a7e079767b4701b5a1d9d5700eb42d1d1', '0x9194efdf03174a804f3552f4f7b7a4bb74badb7f', '0x00de4b13153673bcae2616b67bf822500d325fc3', '0x28f569cc6c29d804a1720edc16bf1ebab2ea35b4', '0xa142ab9eab9264807a41f0e5cbdab877d204e233', '0xc2e2b715d9e302947ec7e312fd2384b5a1296099', '0x5d36a202687fd6bd0f670545334bf0b4827cc1e2', '0x2b888954421b424c5d3d9ce9bb67c9bd47537d12', '0x1c9a6c17ba87451520cc4aa4ca63db07dc180242', '0x5e349eca2dc61abcd9dd99ce94d04136151a09ee', '0xbc39fb41fe0229352774930c5aa3bf1635c2665f', '0xdd7a79b1b6e8dd444f99d68a7d493a85556944a2', '0x801707059a55d748b23b02043c71b7a3d976f071', '0xe53e89d978ff1da716f80baa6e6d8b3fa23f2284', '0x396a34c10b11e33a4bf6f3e6a419a23c54ad34fb', '0x7f22646e85da79953ac09e9b45ee1b3be3a42abc', '0xf68d2bfcecd7895bba05a7451dd09a1749026454', '0x585639fbf797c1258eba8875c080eb63c833d252', '0x1e6d9f536a5d1cc04fc13b3133efdb90c8ee5ea1', '0xabf28f8d9adfb2255f4a059e37d3bce9104969db', '0x434f5325ddcdbbfcce64be2617c72c4aa33ec3e7', '0xdcf09a83e9cc4611b2215bfb7116bfaf5e906d3d', '0x6eda5acaff7f5964e1ecc3fd61c62570c186ca0c', '0x98ab20307fdaba1ce8b16d69d22461c6dbe85459', '0x7899d9b1181cbb427b0b1be0684c096c260f7474', '0x8c50651d964b1a573ba0cf51980ca51d9e42623c', '0x826976d7c600d45fb8287ca1d7c76fc8eb732030', '0x53e0b897eae600b2f6855fce4a42482e9229d2c2', '0x66810420d110919a0e8b550fde3fe24d50ef0e26', '0x5554672e67ba866b9861701d0e0494ab324ad19a', '0x576f1e53afe5e99b2257258c7e3248d3a1822548', '0xf4b0556b9b6f53e00a1fdd2b0478ce841991d8fa', '0x1de2a056508e0d0dd88a88f1f5cdf9cfa510795c', '0x07bf3cda34aa78d92949bbdce31520714ab5b228', '0xa3eac0016f6581ac34768c0d4b99ddcd88071c3c', '0x925afeb19355e289ed1346ede709633ca8788b25', '0xdadd7c883288cfe2e257b0a361865e5e9349808b', '0x429f9ada43e9f345cbb85ec88681bb70df808892', '0x665d84fffddd72d24df555e6b065b833478dffca', '0x69dc230b06a15796e3f42baf706e0e55d4d5eaa1', '0x5555763613a12d8f3e73be831dff8598089d3dca', '0x842bb1bb84cc8a3d6277b0ff9729d22d55e9c50b', '0xbf430a49c4d85aeed3908619d5387a1fbf8e74a9', '0x48a63097e1ac123b1f5a8bbffafa4afa8192fab0', '0xa50d0e425461ccab26ef30104cdd879b90db3843', '0x1f5d295778796a8b9f29600a585ab73d452acb1c', '0x512fce9b07ce64590849115ee6b32fd40ec0f5f3', '0xaeb99a255c3a243ab3e4f654041e9bf5340cf313', '0x15c6ac4cf1b5e49c44332fb0a1043ccab19db80a', '0x399e0ae23663f27181ebb4e66ec504b3aab25541', '0xebb03f5a580ff088bd4269f88a0cfe5eaf00d2b0', '0x490c91f38ec57e3ab00811e0c51a62bfed7e81f4', '0xcf79c7eaec5bdc1a9e32d099c5d6bdf67e4cf6e8', '0x45a10f35befa4ab841c77860204b133118b7ccae', '0x00409fc839a2ec2e6d12305423d37cd011279c09', '0xf503017d7baf7fbc0fff7492b751025c6a78179b', '0x29c4dbc1a81d06c9aa2faed93bb8b4a78f3eabdb', '0x006a8a496889e9983a5256f34b608ee9569ba319', '0x55aed0ce035883626e536254dda2f23a5b5d977f', '0x616cad18642f45d3fa5fcaad0a2d81764a9cba84', '0x07fda67513ec0897866098a11dc3858089d4a505', '0x91031dcfdea024b4d51e775486111d2b2a715871', '0xd8da6bf26964af9d7eed9e03e53415d37aa96045', '0x0f2ce18919b4eb9838760cfdda65e4c8766e9c19', '0xb8c6da1c1e8a4473f290941278e66bfdbe4fd6c8', '0xd31b671f1a398b519222fdaba5ab5464b9f2a3fa', '0xbc3ed6b537f2980e66f396fe14210a56ba3f72c4', '0xdb5781a835b60110298ff7205d8ef9678ff1f800', '0x378c23b326504df4d29c81ba6757f53b2c59f315', '0x23936429fc179da0e1300644fb3b489c736d562f', '0x1d3bf13f8f7a83390d03db5e23a950778e1d1309', '0x92bf20563e747b2f8711549be17a9d7b876c4053' | ||
] %} | ||
|
||
with badgeholders as ( | ||
select | ||
address, | ||
fid | ||
from {{ ref('stg_farcaster__addresses') }} | ||
where address in ( | ||
{% for address in badgeholder_addresses %} | ||
{% if not loop.last %}'{{ address }}', | ||
{% else %} | ||
'{{ address }}' | ||
{% endif %} | ||
{% endfor %} | ||
) | ||
), | ||
|
||
local_trust_fids as ( | ||
select cast(peer_farcaster_id as string) as fid | ||
from {{ ref('stg_karma3__localtrust') }} | ||
where | ||
cast(farcaster_id as string) in (select fid from badgeholders) | ||
and eigentrust_rank < 100 | ||
and strategy_id = 1 | ||
), | ||
|
||
web_of_trust as ( | ||
select fid from local_trust_fids | ||
union all | ||
select fid from badgeholders | ||
), | ||
|
||
trusted_addresses as ( | ||
select | ||
address, | ||
fid | ||
from {{ ref('stg_farcaster__addresses') }} | ||
where fid in ( | ||
select fid | ||
from web_of_trust | ||
) | ||
) | ||
|
||
select | ||
events.project_id, | ||
'openrank_trusted_users_count' as metric, | ||
count(distinct trusted_addresses.fid) as amount | ||
from {{ ref('rf4_events_daily_to_project') }} as events | ||
left join trusted_addresses | ||
on events.from_artifact_name = trusted_addresses.address | ||
where | ||
events.event_type = 'CONTRACT_INVOCATION_SUCCESS_DAILY_COUNT' | ||
and events.bucket_day >= '2023-10-01' | ||
and trusted_addresses.fid is not null | ||
group by | ||
events.project_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.