Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Zora Network to the UserOps table #6339

Merged
merged 11 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
post_hook='{{ expose_spells(\'["ethereum","polygon","arbitrum","optimism","avalanche_c","gnosis","celo"]\',
"project",
"erc4337",
\'["0xbitfly"]\') }}'
\'["0xbitfly","intensodefi"]\') }}'
)
}}

Expand All @@ -18,6 +18,7 @@
, ref('account_abstraction_erc4337_base_account_deployed')
, ref('account_abstraction_erc4337_bnb_account_deployed')
, ref('account_abstraction_erc4337_celo_account_deployed')
, ref('account_abstraction_erc4337_zora_account_deployed')
] %}

SELECT *
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ version: 2
models:
- name: account_abstraction_erc4337_userops
meta:
blockchain: ethereum, polygon, arbitrum, optimism, avalanche_c, gnosis, celo
blockchain: ethereum, polygon, arbitrum, optimism, avalanche_c, gnosis, celo, zora
sector: erc4337
project: erc4337
contributors: 0xbitfly, hosuke
contributors: 0xbitfly, hosuke, intensodefi
config:
tags: ['ethereum', 'polygon', 'arbitrum', 'optimism', 'avalanche_c', 'gnosis', 'celo', 'erc4337', 'account', 'abstraction',]
tags: ['ethereum', 'polygon', 'arbitrum', 'optimism', 'avalanche_c', 'gnosis', 'celo','zora', 'erc4337', 'account', 'abstraction',]
description: >
erc4337 user operations across six blockchain.
columns:
Expand Down Expand Up @@ -69,12 +69,12 @@ models:

- name: account_abstraction_erc4337_account_deployed
meta:
blockchain: ethereum, polygon, arbitrum, optimism, avalanche_c, gnosis, celo
blockchain: ethereum, polygon, arbitrum, optimism, avalanche_c, gnosis, celo, zora
sector: erc4337
project: erc4337
contributors: 0xbitfly
contributors: 0xbitfly, intensodefi
config:
tags: ['ethereum', 'polygon', 'arbitrum', 'optimism', 'avalanche_c', 'gnosis', 'celo', 'erc4337', 'account', 'abstraction',]
tags: ['ethereum', 'polygon', 'arbitrum', 'optimism', 'avalanche_c', 'gnosis', 'celo','zora', 'erc4337', 'account', 'abstraction',]
description: >
erc4337 account deployed across six blockchain.
columns:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
post_hook='{{ expose_spells(\'["ethereum","polygon","arbitrum","optimism","avalanche_c","gnosis","celo"]\',
"project",
"erc4337",
\'["0xbitfly", "hosuke"]\') }}'
\'["0xbitfly", "hosuke","intensodefi"]\') }}'
)
}}

Expand All @@ -18,6 +18,7 @@
, ref('account_abstraction_erc4337_base_userops')
, ref('account_abstraction_erc4337_bnb_userops')
, ref('account_abstraction_erc4337_celo_userops')
, ref('account_abstraction_erc4337_zora_userops')
] %}

SELECT *
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{{ config(
alias = 'account_deployed',
schema = 'account_abstraction_erc4337_zora',
partition_by = ['block_month'],
materialized = 'incremental',
file_format = 'delta',
incremental_strategy = 'merge',
unique_key = ['userop_hash', 'tx_hash'],
post_hook='{{ expose_spells(\'["zora"]\',
"project",
"erc4337",
\'["0xbitfly", "peterrliem","intensodefi"]\') }}'
)}}


{% set erc4337_zora_models = [
ref('account_abstraction_erc4337_zora_v0_6_account_deployed')
, ref('account_abstraction_erc4337_zora_v0_7_account_deployed')
] %}

SELECT
blockchain
, version
, block_time
, block_month
, userop_hash
, entrypoint_contract
, tx_hash
, sender
, paymaster
, factory
FROM (
{% for erc4337_model in erc4337_zora_models %}
SELECT
blockchain
, version
, block_time
, block_month
, userop_hash
, entrypoint_contract
, tx_hash
, sender
, paymaster
, factory
FROM {{ erc4337_model }}

{% if is_incremental() %}
WHERE {{ incremental_predicate('block_time') }}
{% endif %}

{% if not loop.last %}
UNION ALL
{% endif %}
{% endfor %}
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
version: 2

models:

- name: account_abstraction_erc4337_zora_v0_6_userops_basics
meta:
blockchain: zora
sector: erc4337
project: erc4337
contributors: intensodefi
config:
tags: ["zora", "erc4337", "account", "abstraction", "entrypoint"]
description: "erc4337 v0.6 user operations on zora"
columns:
- &blockchain
name: blockchain
description: "blockchain which EntryPoint was deployed"
- &version
name: version
description: "version of the EntryPoint contract"
- &block_month
name: block_month
description: "UTC event block date of each User Operation"
- &block_time
name: block_time
description: "UTC event block time of each User Operation"
- &entrypoint_contract
name: entrypoint_contract
description: "the contract address of the EntryPoint"
- &tx_hash
name: tx_hash
description: "Unique transaction hash value tied to each transaction on the User Operation"
- &sender
name: sender
description: "the sender(AA wallet address) that submmited the user operation"
- &userop_hash
name: userop_hash
description: "Unique user operation hash"
- &success
name: success
description: "weather the user operation is successfully execuated"
- &paymaster
name: paymaster
description: "the address that pay for the user operation gas fees on behalf of the user"
- &op_fee
name: op_fee
description: "The gas paid by sender or paymaster It depends on the chain gas setting"
- &beneficiary
name: beneficiary
description: "the address where the bundler setting for the user operation pay for thier gas fee"

- name: account_abstraction_erc4337_zora_userops
meta:
blockchain: zora
sector: erc4337
project: erc4337
contributors: intensodefi
config:
tags: ["zora", "erc4337", "account", "abstraction", "entrypoint"]
description: "erc4337 user operation on zora"
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- userop_hash
- tx_hash
- check_seed:
seed_file: ref('account_abstraction_erc4337_userops_seed')
filter:
blockchain: zora
version: v0.6
match_columns:
- userop_hash
- tx_hash
check_columns:
- paymaster
- bundler
columns:
- *blockchain
- *version
- *block_month
- *block_time
- *entrypoint_contract
- *tx_hash
- *sender
- *userop_hash
- *success
- *paymaster
- *op_fee
- &op_fee_usd
name: op_fee_usd
description: "The user operation gas (in usd) paid by sender or paymaster. "
- &bundler
name: bundler
description: "address that bundle UserOps and submit those UserOps to the final on-chain by send a EOA transaction. It is the transaction from address"
- &tx_to
name: tx_to
description: "address where the bundler send the transaction"
- &gas_symbol
name: gas_symbol
description: "the gas symbol paied for the transaction"
- &tx_fee
name: tx_fee
description: "the bundler paied gas value for the transaction"
- &tx_fee_usd
name: tx_fee_usd
description: "the bundler paied gas (in usd) value for the transaction"
- *beneficiary


- name: account_abstraction_erc4337_zora_v0_6_account_deployed
meta:
blockchain: zora
sector: erc4337
project: erc4337
contributors: intensodefi
config:
tags: ["zora", "erc4337", "account", "abstraction", "entrypoint"]
description: "erc4337 v0.6 account deployed on zora"
columns:
- *blockchain
- *version
- *block_time
- *block_month
- *userop_hash
- *entrypoint_contract
- *tx_hash
- *sender
- *paymaster
- &factory
name: factory
description: "who can create a new AA Wallet. It's smart contract address"

- name: account_abstraction_erc4337_zora_account_deployed
meta:
blockchain: zora
sector: erc4337
project: erc4337
contributors: intensodefi
config:
tags: ["zora", "erc4337", "account", "abstraction", "entrypoint"]
description: "erc4337 account deployed on zora"
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- userop_hash
- tx_hash
- check_seed:
seed_file: ref('account_abstraction_erc4337_account_deployed_seed')
filter:
blockchain: zora
version: v0.6
match_columns:
- userop_hash
- tx_hash
check_columns:
- paymaster
- factory
columns:
- *blockchain
- *version
- *block_time
- *block_month
- *userop_hash
- *entrypoint_contract
- *tx_hash
- *sender
- *paymaster
- *factory
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{{ config(
alias = 'userops',
schema = 'account_abstraction_erc4337_zora',
partition_by = ['block_month'],
materialized = 'incremental',
file_format = 'delta',
incremental_strategy = 'merge',
unique_key = ['userop_hash', 'tx_hash'],
post_hook='{{ expose_spells(\'["zora"]\',
"project",
"erc4337",
\'["0xbitfly", "hosuke", "peterrliem","intensodefi"]\') }}'
)}}

-- min deployed_date on chain
{% set chain = 'zora' %}
{% set gas_symbol = 'ETH' %}
{% set wrapped_gas_address = '0x4200000000000000000000000000000000000006' %}
{% set deployed_date = '2023-06-20' %}

{% set erc4337_models = [
ref('account_abstraction_erc4337_zora_v0_6_userops_basics')
, ref('account_abstraction_erc4337_zora_v0_7_userops_basics')
] %}

with userop as(
SELECT *
FROM (
{% for erc4337_model in erc4337_models %}
SELECT
blockchain
, version
, block_month
, block_time
, entrypoint_contract
, tx_hash
, sender
, userop_hash
, success
, paymaster
, op_fee
, beneficiary
FROM {{ erc4337_model }}
{% if is_incremental() %}
WHERE {{ incremental_predicate('block_time') }}
{% endif %}
{% if not loop.last %}
UNION ALL
{% endif %}
{% endfor %}
)
)
, txs as (
select
hash as tx_hash
, tx."from" as tx_from
, tx.to as tx_to
, '{{gas_symbol}}' as gas_symbol
, ((cast(gas_used as double) * gas_price)+l1_fee) / 1e18 as tx_fee
from {{ source('zora', 'transactions') }} tx
where hash in (
select tx_hash from userop
)
and block_time > date '{{deployed_date}}'
{% if is_incremental() %}
and {{ incremental_predicate('block_time') }}
{% endif %}
)
, price as (
select symbol, decimals, minute, price
from {{source('prices','usd')}}
where minute > date '{{deployed_date}}'
and contract_address={{wrapped_gas_address}}
and blockchain='zora'
{% if is_incremental() %}
and minute >= date_trunc('day', now() - interval '7' day)
{% endif %}
)
select
userop.blockchain
, userop.version
, userop.block_month
, userop.block_time
, userop.entrypoint_contract
, userop.tx_hash
, userop.sender
, userop.userop_hash
, userop.success
, userop.paymaster
, userop.op_fee as op_fee
, userop.op_fee * price.price as op_fee_usd
, txs.tx_from as bundler
, txs.tx_to
, txs.gas_symbol
, txs.tx_fee
, txs.tx_fee * price.price as tx_fee_usd
, userop.beneficiary
from userop
left join txs on userop.tx_hash = txs.tx_hash
left join price on date_trunc('minute', userop.block_time) = price.minute
Loading
Loading