From 6d90c3f3be32050441211c185991ed56bff2b4f1 Mon Sep 17 00:00:00 2001 From: tomfutago Date: Sun, 4 Aug 2024 10:42:23 +0100 Subject: [PATCH 1/3] add aave lido to lending --- .../lending/borrow/ethereum/_schema.yml | 38 +++++++++++++++++++ .../ethereum/lending_ethereum_base_borrow.sql | 1 + .../aave_lido_v3_ethereum_base_borrow.sql | 20 ++++++++++ .../lending/flashloans/ethereum/_schema.yml | 33 ++++++++++++++++ .../lending_ethereum_base_flashloans.sql | 1 + .../aave_lido_v3_ethereum_base_flashloans.sql | 20 ++++++++++ .../lending/supply/ethereum/_schema.yml | 38 +++++++++++++++++++ .../ethereum/lending_ethereum_base_supply.sql | 1 + .../aave_lido_v3_ethereum_base_supply.sql | 20 ++++++++++ .../lending/borrow/ethereum/_sources.yml | 3 ++ .../lending/flashloans/ethereum/_sources.yml | 1 + .../lending/supply/ethereum/_sources.yml | 3 ++ 12 files changed, 179 insertions(+) create mode 100644 dbt_subprojects/hourly_spellbook/models/_sector/lending/borrow/ethereum/platforms/aave_lido_v3_ethereum_base_borrow.sql create mode 100644 dbt_subprojects/hourly_spellbook/models/_sector/lending/flashloans/ethereum/platforms/aave_lido_v3_ethereum_base_flashloans.sql create mode 100644 dbt_subprojects/hourly_spellbook/models/_sector/lending/supply/ethereum/platforms/aave_lido_v3_ethereum_base_supply.sql diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/lending/borrow/ethereum/_schema.yml b/dbt_subprojects/hourly_spellbook/models/_sector/lending/borrow/ethereum/_schema.yml index 3b95eb63415..1cc18741e53 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/lending/borrow/ethereum/_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_sector/lending/borrow/ethereum/_schema.yml @@ -201,6 +201,44 @@ models: - *tx_hash - *evt_index + - name: aave_lido_v3_ethereum_base_borrow + meta: + blockchain: ethereum + sector: lending + project: aave_lido + contributors: tomfutago + config: + tags: ['lending', 'borrow', 'aave', 'lido', 'v3', 'ethereum'] + description: "Aave v3 borrow transactions on Ethereum" + 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_lido_ethereum_base_borrow_seed') + filter: + version: 3 + 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 + - name: compound_v1_ethereum_base_borrow meta: blockchain: ethereum diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/lending/borrow/ethereum/lending_ethereum_base_borrow.sql b/dbt_subprojects/hourly_spellbook/models/_sector/lending/borrow/ethereum/lending_ethereum_base_borrow.sql index b6aec6c790f..4ae598e2a2c 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/lending/borrow/ethereum/lending_ethereum_base_borrow.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/lending/borrow/ethereum/lending_ethereum_base_borrow.sql @@ -11,6 +11,7 @@ ref('aave_v1_ethereum_base_borrow'), ref('aave_v2_ethereum_base_borrow'), ref('aave_v3_ethereum_base_borrow'), + ref('aave_lido_v3_ethereum_base_borrow'), ref('compound_v1_ethereum_base_borrow'), ref('compound_v2_ethereum_base_borrow'), ref('compound_v3_ethereum_base_borrow'), diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/lending/borrow/ethereum/platforms/aave_lido_v3_ethereum_base_borrow.sql b/dbt_subprojects/hourly_spellbook/models/_sector/lending/borrow/ethereum/platforms/aave_lido_v3_ethereum_base_borrow.sql new file mode 100644 index 00000000000..d70bc33a8ef --- /dev/null +++ b/dbt_subprojects/hourly_spellbook/models/_sector/lending/borrow/ethereum/platforms/aave_lido_v3_ethereum_base_borrow.sql @@ -0,0 +1,20 @@ +{{ + config( + schema = 'aave_lido_v3_ethereum', + 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 = 'ethereum', + project = 'aave_lido', + version = '3', + decoded_contract_name = 'LidoPool' + ) +}} diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/lending/flashloans/ethereum/_schema.yml b/dbt_subprojects/hourly_spellbook/models/_sector/lending/flashloans/ethereum/_schema.yml index 67c1924ca0c..6834502a7f4 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/lending/flashloans/ethereum/_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_sector/lending/flashloans/ethereum/_schema.yml @@ -172,6 +172,39 @@ models: - *tx_hash - *evt_index + - name: aave_lido_v3_ethereum_base_flashloans + meta: + blockchain: ethereum + sector: lending + project: aave_lido + contributors: tomfutago + config: + tags: ['lending', 'flashloans', 'aave', 'lido', 'ethereum'] + description: "Aave v3 flashloans transactions on Ethereum" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + - check_lending_base_flashloans_seed: + seed_file: ref('aave_lido_ethereum_base_flashloans_seed') + filter: + version: 3 + columns: + - *blockchain + - *project + - *version + - *recipient + - *amount + - *fee + - *token_address + - *project_contract_address + - *block_month + - *block_time + - *block_number + - *tx_hash + - *evt_index + - name: radiant_ethereum_base_flashloans meta: blockchain: ethereum diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/lending/flashloans/ethereum/lending_ethereum_base_flashloans.sql b/dbt_subprojects/hourly_spellbook/models/_sector/lending/flashloans/ethereum/lending_ethereum_base_flashloans.sql index dc79206488b..56f82efeaad 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/lending/flashloans/ethereum/lending_ethereum_base_flashloans.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/lending/flashloans/ethereum/lending_ethereum_base_flashloans.sql @@ -11,6 +11,7 @@ ref('aave_v1_ethereum_base_flashloans'), ref('aave_v2_ethereum_base_flashloans'), ref('aave_v3_ethereum_base_flashloans'), + ref('aave_lido_v3_ethereum_base_flashloans'), ref('radiant_ethereum_base_flashloans'), ref('uwulend_ethereum_base_flashloans'), ref('spark_ethereum_base_flashloans'), diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/lending/flashloans/ethereum/platforms/aave_lido_v3_ethereum_base_flashloans.sql b/dbt_subprojects/hourly_spellbook/models/_sector/lending/flashloans/ethereum/platforms/aave_lido_v3_ethereum_base_flashloans.sql new file mode 100644 index 00000000000..e101b5a57d2 --- /dev/null +++ b/dbt_subprojects/hourly_spellbook/models/_sector/lending/flashloans/ethereum/platforms/aave_lido_v3_ethereum_base_flashloans.sql @@ -0,0 +1,20 @@ +{{ + config( + schema = 'aave_lido_v3_ethereum', + 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 = 'ethereum', + project = 'aave_lido', + version = '3', + decoded_contract_name = 'LidoPool' + ) +}} diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/lending/supply/ethereum/_schema.yml b/dbt_subprojects/hourly_spellbook/models/_sector/lending/supply/ethereum/_schema.yml index 48aa4b7b3bf..91be773e8bc 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/lending/supply/ethereum/_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_sector/lending/supply/ethereum/_schema.yml @@ -201,6 +201,44 @@ models: - *tx_hash - *evt_index + - name: aave_lido_v3_ethereum_base_supply + meta: + blockchain: ethereum + sector: lending + project: aave_lido + contributors: tomfutago + config: + tags: ['lending', 'supply', 'aave', 'lido', 'ethereum'] + description: "Aave v3 supply transactions on Ethereum" + 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_lido_ethereum_base_supply_seed') + filter: + version: 3 + 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 + - name: compound_v2_ethereum_base_supply meta: blockchain: ethereum diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/lending/supply/ethereum/lending_ethereum_base_supply.sql b/dbt_subprojects/hourly_spellbook/models/_sector/lending/supply/ethereum/lending_ethereum_base_supply.sql index 068fec75880..fb90b03ccf6 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/lending/supply/ethereum/lending_ethereum_base_supply.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/lending/supply/ethereum/lending_ethereum_base_supply.sql @@ -11,6 +11,7 @@ ref('aave_v1_ethereum_base_supply'), ref('aave_v2_ethereum_base_supply'), ref('aave_v3_ethereum_base_supply'), + ref('aave_lido_v3_ethereum_base_supply'), ref('compound_v2_ethereum_base_supply'), ref('compound_v3_ethereum_base_supply'), ref('radiant_ethereum_base_supply'), diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/lending/supply/ethereum/platforms/aave_lido_v3_ethereum_base_supply.sql b/dbt_subprojects/hourly_spellbook/models/_sector/lending/supply/ethereum/platforms/aave_lido_v3_ethereum_base_supply.sql new file mode 100644 index 00000000000..2d19eebd8c1 --- /dev/null +++ b/dbt_subprojects/hourly_spellbook/models/_sector/lending/supply/ethereum/platforms/aave_lido_v3_ethereum_base_supply.sql @@ -0,0 +1,20 @@ +{{ + config( + schema = 'aave_lido_v3_ethereum', + 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 = 'ethereum', + project = 'aave_lido', + version = '3', + decoded_contract_name = 'LidoPool' + ) +}} diff --git a/sources/_sector/lending/borrow/ethereum/_sources.yml b/sources/_sector/lending/borrow/ethereum/_sources.yml index b4a2204eb00..43d886d8a84 100644 --- a/sources/_sector/lending/borrow/ethereum/_sources.yml +++ b/sources/_sector/lending/borrow/ethereum/_sources.yml @@ -18,6 +18,9 @@ sources: - name: Pool_evt_Borrow - name: Pool_evt_Repay - name: Pool_evt_LiquidationCall + - name: LidoPool_evt_Borrow + - name: LidoPool_evt_Repay + - name: LidoPool_evt_LiquidationCall - name: compound_v1_ethereum tables: diff --git a/sources/_sector/lending/flashloans/ethereum/_sources.yml b/sources/_sector/lending/flashloans/ethereum/_sources.yml index d21c7d1eaaf..0eddafb8db7 100644 --- a/sources/_sector/lending/flashloans/ethereum/_sources.yml +++ b/sources/_sector/lending/flashloans/ethereum/_sources.yml @@ -12,6 +12,7 @@ sources: - name: aave_v3_ethereum tables: - name: Pool_evt_FlashLoan + - name: LidoPool_evt_FlashLoan - name: radiant_capital_ethereum tables: diff --git a/sources/_sector/lending/supply/ethereum/_sources.yml b/sources/_sector/lending/supply/ethereum/_sources.yml index 0c8bc86aa22..b24a866deae 100644 --- a/sources/_sector/lending/supply/ethereum/_sources.yml +++ b/sources/_sector/lending/supply/ethereum/_sources.yml @@ -17,6 +17,9 @@ sources: - name: Pool_evt_Supply - name: Pool_evt_Withdraw - name: Pool_evt_ReserveDataUpdated + - name: LidoPool_evt_Supply + - name: LidoPool_evt_Withdraw + - name: LidoPool_evt_ReserveDataUpdated - name: compound_v2_ethereum tables: From 7bb1a8ce8e354d2e14fe2a52cd31bed439d43e6e Mon Sep 17 00:00:00 2001 From: tomfutago Date: Sun, 4 Aug 2024 10:48:38 +0100 Subject: [PATCH 2/3] prep aave_lido seeds --- .../seeds/_sector/lending/_schema.yml | 41 +++++++++++++++++++ .../aave_lido_ethereum_base_borrow_seed.csv | 1 + ...ave_lido_ethereum_base_flashloans_seed.csv | 1 + .../aave_lido_ethereum_base_supply_seed.csv | 1 + 4 files changed, 44 insertions(+) create mode 100644 dbt_subprojects/hourly_spellbook/seeds/_sector/lending/aave_lido_ethereum_base_borrow_seed.csv create mode 100644 dbt_subprojects/hourly_spellbook/seeds/_sector/lending/aave_lido_ethereum_base_flashloans_seed.csv create mode 100644 dbt_subprojects/hourly_spellbook/seeds/_sector/lending/aave_lido_ethereum_base_supply_seed.csv diff --git a/dbt_subprojects/hourly_spellbook/seeds/_sector/lending/_schema.yml b/dbt_subprojects/hourly_spellbook/seeds/_sector/lending/_schema.yml index 9df69a48fb6..51c103b4d09 100644 --- a/dbt_subprojects/hourly_spellbook/seeds/_sector/lending/_schema.yml +++ b/dbt_subprojects/hourly_spellbook/seeds/_sector/lending/_schema.yml @@ -56,6 +56,20 @@ seeds: token_address: varbinary borrower: varbinary amount: double + - name: aave_lido_ethereum_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_fantom_base_borrow_seed config: column_types: @@ -197,6 +211,20 @@ seeds: token_address: varbinary depositor: varbinary amount: double + - name: aave_lido_ethereum_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_fantom_base_supply_seed config: column_types: @@ -334,6 +362,19 @@ seeds: token_address: varbinary recipient: varbinary amount: double + - name: aave_lido_ethereum_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: aave_fantom_base_flashloans_seed config: column_types: diff --git a/dbt_subprojects/hourly_spellbook/seeds/_sector/lending/aave_lido_ethereum_base_borrow_seed.csv b/dbt_subprojects/hourly_spellbook/seeds/_sector/lending/aave_lido_ethereum_base_borrow_seed.csv new file mode 100644 index 00000000000..f40ede6c41e --- /dev/null +++ b/dbt_subprojects/hourly_spellbook/seeds/_sector/lending/aave_lido_ethereum_base_borrow_seed.csv @@ -0,0 +1 @@ +blockchain,project,version,block_number,block_time,tx_hash,evt_index,transaction_type,token_address,borrower,amount diff --git a/dbt_subprojects/hourly_spellbook/seeds/_sector/lending/aave_lido_ethereum_base_flashloans_seed.csv b/dbt_subprojects/hourly_spellbook/seeds/_sector/lending/aave_lido_ethereum_base_flashloans_seed.csv new file mode 100644 index 00000000000..7a805e33930 --- /dev/null +++ b/dbt_subprojects/hourly_spellbook/seeds/_sector/lending/aave_lido_ethereum_base_flashloans_seed.csv @@ -0,0 +1 @@ +blockchain,project,version,block_number,block_time,tx_hash,evt_index,token_address,recipient,amount diff --git a/dbt_subprojects/hourly_spellbook/seeds/_sector/lending/aave_lido_ethereum_base_supply_seed.csv b/dbt_subprojects/hourly_spellbook/seeds/_sector/lending/aave_lido_ethereum_base_supply_seed.csv new file mode 100644 index 00000000000..cbbc8fa554b --- /dev/null +++ b/dbt_subprojects/hourly_spellbook/seeds/_sector/lending/aave_lido_ethereum_base_supply_seed.csv @@ -0,0 +1 @@ +blockchain,project,version,block_number,block_time,tx_hash,evt_index,transaction_type,token_address,depositor,amount From 5a2f38ff7efb9a450f9033f983275eb53f449e88 Mon Sep 17 00:00:00 2001 From: tomfutago Date: Sun, 4 Aug 2024 11:06:41 +0100 Subject: [PATCH 3/3] update seeds --- .../_sector/lending/aave_lido_ethereum_base_borrow_seed.csv | 2 ++ .../lending/aave_lido_ethereum_base_flashloans_seed.csv | 3 +++ .../_sector/lending/aave_lido_ethereum_base_supply_seed.csv | 2 ++ 3 files changed, 7 insertions(+) diff --git a/dbt_subprojects/hourly_spellbook/seeds/_sector/lending/aave_lido_ethereum_base_borrow_seed.csv b/dbt_subprojects/hourly_spellbook/seeds/_sector/lending/aave_lido_ethereum_base_borrow_seed.csv index f40ede6c41e..fc67b4ca44b 100644 --- a/dbt_subprojects/hourly_spellbook/seeds/_sector/lending/aave_lido_ethereum_base_borrow_seed.csv +++ b/dbt_subprojects/hourly_spellbook/seeds/_sector/lending/aave_lido_ethereum_base_borrow_seed.csv @@ -1 +1,3 @@ blockchain,project,version,block_number,block_time,tx_hash,evt_index,transaction_type,token_address,borrower,amount +ethereum,aave_lido,3,20454208,2024-08-04 09:11:11.000 UTC,0x0bd845c9d078294327207457e91c6dc625c689c0044452953f7c630764c828d0,365,borrow,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0x702b6770a81f75964ca5d479f369efb31dfa7c32,2.8808742499190137e+19 +ethereum,aave_lido,3,20452066,2024-08-04 02:01:47.000 UTC,0x81d24a63c44b347b56947ba36da82862c526390acf4474bd4fcb7702868c4a37,172,repay,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0x3ee505ba316879d246a8fd2b3d7ee63b51b44fab,-2.0292e+20 diff --git a/dbt_subprojects/hourly_spellbook/seeds/_sector/lending/aave_lido_ethereum_base_flashloans_seed.csv b/dbt_subprojects/hourly_spellbook/seeds/_sector/lending/aave_lido_ethereum_base_flashloans_seed.csv index 7a805e33930..2b159c58fc6 100644 --- a/dbt_subprojects/hourly_spellbook/seeds/_sector/lending/aave_lido_ethereum_base_flashloans_seed.csv +++ b/dbt_subprojects/hourly_spellbook/seeds/_sector/lending/aave_lido_ethereum_base_flashloans_seed.csv @@ -1 +1,4 @@ blockchain,project,version,block_number,block_time,tx_hash,evt_index,token_address,recipient,amount +ethereum,aave_lido,3,20446968,2024-08-03 08:58:23.000 UTC,0x35bfa5ce81ad9a9bb6f9240b290d8d5027a8a627a6756acd2c43ebba14d86bfc,86,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0xe695175eaed06836f22d363fa4ddd82dc1d944c9,1.4888478115921598e+21 +ethereum,aave_lido,3,20444445,2024-08-03 00:30:11.000 UTC,0x14e516091c35101aa3db12f67100b118223e2c49052950c4ae0ccd8ba5bd63cd,465,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0x4afc4d809c7a7f0c2f647da3a89a54573d001703,1.3e+19 +ethereum,aave_lido,3,20443133,2024-08-02 20:05:35.000 UTC,0xf0eda867753757c6576b8a567b49cf7d21862de01c851cdc50765cadef019f3e,180,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0xcfd23170c2a4fdff9b03493056d71aa275468fe8,1.8075e+22 diff --git a/dbt_subprojects/hourly_spellbook/seeds/_sector/lending/aave_lido_ethereum_base_supply_seed.csv b/dbt_subprojects/hourly_spellbook/seeds/_sector/lending/aave_lido_ethereum_base_supply_seed.csv index cbbc8fa554b..520030237ca 100644 --- a/dbt_subprojects/hourly_spellbook/seeds/_sector/lending/aave_lido_ethereum_base_supply_seed.csv +++ b/dbt_subprojects/hourly_spellbook/seeds/_sector/lending/aave_lido_ethereum_base_supply_seed.csv @@ -1 +1,3 @@ blockchain,project,version,block_number,block_time,tx_hash,evt_index,transaction_type,token_address,depositor,amount +ethereum,aave_lido,3,20454405,2024-08-04 09:50:35.000 UTC,0x42345feb96d2e4e0230b2d272f31ed186c30e0adde9e1ca1aeed5a70da56d08b,362,deposit,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0x702b6770a81f75964ca5d479f369efb31dfa7c32,3.1706e+21 +ethereum,aave_lido,3,20454215,2024-08-04 09:12:35.000 UTC,0xe4924cb7355e0994d2b288acbbe08e4bdaaaad561de9060f64a08924c2493ad4,357,withdraw,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0x702b6770a81f75964ca5d479f369efb31dfa7c32,-7e+18