Skip to content

Commit

Permalink
feat: add aave v3 to lending sector
Browse files Browse the repository at this point in the history
  • Loading branch information
tomfutago committed Dec 22, 2024
1 parent 6a2d09f commit 22c644f
Show file tree
Hide file tree
Showing 16 changed files with 228 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,39 @@ models:
- *project_contract_address
- *tx_hash
- *evt_index

- name: aave_v3_zksync_base_borrow
meta:
blockchain: zksync
sector: lending
project: aave
contributors: tomfutago
config:
tags: ['lending', 'borrow', 'aave', 'aave', 'zksync']
description: "Aave v3 borrow transactions on zkSync"
data_tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- transaction_type
- token_address
- tx_hash
- evt_index
- check_lending_base_borrow_seed:
seed_file: ref('aave_zksync_base_borrow_seed')
columns:
- *blockchain
- *project
- *version
- *transaction_type
- *token_address
- *borrower
- *on_behalf_of
- *repayer
- *liquidator
- *amount
- *block_month
- *block_time
- *block_number
- *project_contract_address
- *tx_hash
- *evt_index
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

{%
set models = [
ref('zerolend_zksync_base_borrow')
ref('zerolend_zksync_base_borrow'),
ref('aave_v3_zksync_base_borrow')
]
%}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{
config(
schema = 'aave_v3_zksync',
alias = 'base_borrow',
materialized = 'incremental',
file_format = 'delta',
incremental_strategy = 'merge',
unique_key = ['transaction_type', 'token_address', 'tx_hash', 'evt_index'],
incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')]
)
}}

{{
lending_aave_v3_compatible_borrow(
blockchain = 'zksync',
project = 'aave',
version = '3'
)
}}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ version: 2
models:
- name: lending_flashloans
meta:
blockchain: ethereum, celo, polygon, optimism, base, arbitrum, avalanche_c, fantom, gnosis, scroll, zksync
blockchain: ethereum, celo, polygon, optimism, base, arbitrum, avalanche_c, fantom, gnosis, zksync, zksync
sector: lending
project: aave
contributors: tomfutago, hildobby
config:
tags: ['lending', 'flashloans', 'aave', 'ethereum', 'celo', 'polygon', 'optimism', 'base', 'arbitrum', 'avalanche_c', 'fantom', 'gnosis', 'scroll', 'zksync']
tags: ['lending', 'flashloans', 'aave', 'ethereum', 'celo', 'polygon', 'optimism', 'base', 'arbitrum', 'avalanche_c', 'fantom', 'gnosis', 'zksync', 'zksync']
description: "All lending transactions involving flashloans transactions"
data_tests:
- dbt_utils.unique_combination_of_columns:
Expand Down Expand Up @@ -86,3 +86,34 @@ models:
description: "Event index"
data_tests:
- not_null

- name: aave_v3_zksync_base_flashloans
meta:
blockchain: zksync
sector: lending
project: aave
contributors: tomfutago
config:
tags: ['lending', 'flashloans', 'aave', 'zksync']
description: "Aave v3 flashloans transactions on zkSync"
data_tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- tx_hash
- evt_index
- check_lending_base_flashloans_seed:
seed_file: ref('aave_zksync_base_flashloans_seed')
columns:
- *blockchain
- *project
- *version
- *recipient
- *amount
- *fee
- *token_address
- *project_contract_address
- *block_month
- *block_time
- *block_number
- *tx_hash
- *evt_index
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

{%
set models = [
ref('zerolend_zksync_base_flashloans')
ref('zerolend_zksync_base_flashloans'),
ref('aave_v3_zksync_base_flashloans')
]
%}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{
config(
schema = 'aave_v3_zksync',
alias = 'base_flashloans',
materialized = 'incremental',
file_format = 'delta',
incremental_strategy = 'merge',
unique_key = ['tx_hash', 'evt_index'],
incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')]
)
}}

{{
lending_aave_v3_compatible_flashloans(
blockchain = 'zksync',
project = 'aave',
version = '3'
)
}}
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,39 @@ models:
- *project_contract_address
- *tx_hash
- *evt_index

- name: aave_v3_zksync_base_supply
meta:
blockchain: zksync
sector: lending
project: aave
contributors: tomfutago
config:
tags: ['lending', 'supply', 'aave', 'zksync']
description: "Aave v3 supply transactions on zkSync"
data_tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- transaction_type
- token_address
- tx_hash
- evt_index
- check_lending_base_supply_seed:
seed_file: ref('aave_zksync_base_supply_seed')
columns:
- *blockchain
- *project
- *version
- *transaction_type
- *token_address
- *depositor
- *on_behalf_of
- *withdrawn_to
- *liquidator
- *amount
- *block_month
- *block_time
- *block_number
- *project_contract_address
- *tx_hash
- *evt_index
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

{%
set models = [
ref('zerolend_zksync_base_supply')
ref('zerolend_zksync_base_supply'),
ref('aave_v3_zksync_base_supply')
]
%}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{
config(
schema = 'aave_v3_zksync',
alias = 'base_supply',
materialized = 'incremental',
file_format = 'delta',
incremental_strategy = 'merge',
unique_key = ['transaction_type', 'token_address', 'tx_hash', 'evt_index'],
incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')]
)
}}

{{
lending_aave_v3_compatible_supply(
blockchain = 'zksync',
project = 'aave',
version = '3'
)
}}
41 changes: 41 additions & 0 deletions dbt_subprojects/hourly_spellbook/seeds/_sector/lending/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,20 @@ seeds:
token_address: varbinary
borrower: varbinary
amount: double
- name: aave_zksync_base_borrow_seed
config:
column_types:
blockchain: varchar
project: varchar
version: varchar
block_number: bigint
block_time: timestamp
tx_hash: varbinary
evt_index: bigint
transaction_type: varchar
token_address: varbinary
borrower: varbinary
amount: double

- name: aave_arbitrum_base_supply_seed
config:
Expand Down Expand Up @@ -337,6 +351,20 @@ seeds:
token_address: varbinary
depositor: varbinary
amount: double
- name: aave_zksync_base_supply_seed
config:
column_types:
blockchain: varchar
project: varchar
version: varchar
block_number: bigint
block_time: timestamp
tx_hash: varbinary
evt_index: bigint
transaction_type: varchar
token_address: varbinary
depositor: varbinary
amount: double

- name: aave_arbitrum_base_flashloans_seed
config:
Expand Down Expand Up @@ -494,6 +522,19 @@ seeds:
token_address: varbinary
recipient: varbinary
amount: double
- name: aave_zksync_base_flashloans_seed
config:
column_types:
blockchain: varchar
project: varchar
version: varchar
block_number: bigint
block_time: timestamp
tx_hash: varbinary
evt_index: bigint
token_address: varbinary
recipient: varbinary
amount: double

- name: moola_celo_base_borrow_seed
config:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blockchain,project,version,block_number,block_time,tx_hash,evt_index,transaction_type,token_address,borrower,amount
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blockchain,project,version,block_number,block_time,tx_hash,evt_index,token_address,recipient,amount
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blockchain,project,version,block_number,block_time,tx_hash,evt_index,transaction_type,token_address,depositor,amount
6 changes: 6 additions & 0 deletions sources/_sector/lending/borrow/zksync/_sources.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
version: 2

sources:
- name: aave_v3_zksync
tables:
- name: Pool_evt_Borrow
- name: Pool_evt_Repay
- name: Pool_evt_LiquidationCall

- name: zerolend_zksync
tables:
- name: Pool_evt_Borrow
Expand Down
4 changes: 4 additions & 0 deletions sources/_sector/lending/flashloans/zksync/_sources.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
version: 2

sources:
- name: aave_v3_zksync
tables:
- name: Pool_evt_FlashLoan

- name: zerolend_zksync
tables:
- name: Pool_evt_FlashLoan
6 changes: 6 additions & 0 deletions sources/_sector/lending/supply/zksync/_sources.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
version: 2

sources:
- name: aave_v3_zksync
tables:
- name: Pool_evt_Supply
- name: Pool_evt_Withdraw
- name: WrappedTokenGatewayV3_call_withdrawETH

- name: zerolend_zksync
tables:
- name: Pool_evt_Supply
Expand Down

0 comments on commit 22c644f

Please sign in to comment.