Skip to content

Commit

Permalink
add: deployer_v1 to API (#1525)
Browse files Browse the repository at this point in the history
* add optimist sbt and refactor trust model

* refactor: grab fid : address mappings direct from farcaster

* add: whether address is passport user or not

* fix: modify non-farcaster verifications

* fix: simplify user checks

* feat: deployers_v1

* contracts model that includes deployments from factories

* add: artifact source field

* fix: union statement
  • Loading branch information
ccerv1 authored May 25, 2024
1 parent 632af36 commit bcb797e
Show file tree
Hide file tree
Showing 4 changed files with 134 additions and 0 deletions.
22 changes: 22 additions & 0 deletions apps/hasura/metadata/databases/cloudsql/tables/contracts_v1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
table:
name: contracts_v1
schema: public
select_permissions:
- role: anonymous
permission:
columns: "*"
filter: {}
allow_aggregations: false
comment: ""
- role: user
permission:
columns: "*"
filter: {}
allow_aggregations: false
comment: ""
- role: developer
permission:
columns: "*"
filter: {}
allow_aggregations: true
comment: ""
1 change: 1 addition & 0 deletions apps/hasura/metadata/databases/cloudsql/tables/tables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
- "!include artifacts_v1.yaml"
- "!include code_metrics_by_project_v1.yaml"
- "!include collections_v1.yaml"
- "!include contracts_v1.yaml"
- "!include event_indexing_status_by_project_v1.yaml"
- "!include event_types_v1.yaml"
- "!include events_daily_to_artifact.yaml"
Expand Down
94 changes: 94 additions & 0 deletions warehouse/dbt/models/intermediate/directory/int_contracts.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
with deployers as (
select
*,
'OPTIMISM' as artifact_source
from {{ ref('stg_optimism__deployers') }}
union all
select
*,
'BASE' as artifact_source
from {{ ref('stg_base__deployers') }}
union all
select
*,
'FRAX' as artifact_source
from {{ ref('stg_frax__deployers') }}
union all
select
*,
'MODE' as artifact_source
from {{ ref('stg_mode__deployers') }}
union all
select
*,
'ZORA' as artifact_source
from {{ ref('stg_zora__deployers') }}
),

factories as (
select
*,
'OPTIMISM' as artifact_source
from {{ ref('stg_optimism__factories') }}
union all
select
*,
'BASE' as artifact_source
from {{ ref('stg_base__factories') }}
union all
select
*,
'FRAX' as artifact_source
from {{ ref('stg_frax__factories') }}
union all
select
*,
'MODE' as artifact_source
from {{ ref('stg_mode__factories') }}
union all
select
*,
'ZORA' as artifact_source
from {{ ref('stg_zora__factories') }}
),

contract_deployments as (
select
artifact_source,
transaction_hash,
block_timestamp,
deployer_address as root_deployer_address,
deployer_address as created_by_address,
contract_address,
deployer_address as originating_eoa_address,
'EOA' as creator_type,
case
when contract_address in (
select distinct factory_address
from factories
) then 'FACTORY'
else 'CONTRACT'
end as contract_type
from deployers
),

factory_deployments as (
select
factories.artifact_source,
factories.transaction_hash,
factories.block_timestamp,
deployers.deployer_address as root_deployer_address,
factories.factory_address as created_by_address,
factories.contract_address,
'FACTORY' as creator_type,
'CONTRACT' as contract_type,
COALESCE(factories.originating_address, deployers.deployer_address)
as originating_eoa_address
from factories
inner join deployers
on factories.factory_address = deployers.contract_address
)

select * from contract_deployments
union all
select * from factory_deployments
17 changes: 17 additions & 0 deletions warehouse/dbt/models/marts/directory/contracts_v1.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{
config(meta = {
'sync_to_db': True
})
}}

select
artifact_source,
transaction_hash,
block_timestamp,
root_deployer_address,
created_by_address,
contract_address,
originating_eoa_address,
creator_type,
contract_type
from {{ ref('int_contracts') }}

0 comments on commit bcb797e

Please sign in to comment.