Skip to content

Commit

Permalink
fix: add WrappedTokenGateway lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
tomfutago committed Dec 22, 2024
1 parent 6a2d09f commit 98470f3
Show file tree
Hide file tree
Showing 12 changed files with 69 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,14 @@ src_LendingPool_evt_Withdraw as (
{% endif %}
),

src_WrappedTokenGatewayV2_call_withdrawETH as (
select *
from {{ source(project_decoded_as ~ '_' ~ blockchain, 'WrappedTokenGatewayV2_call_withdrawETH') }}
{% if is_incremental() %}
where {{ incremental_predicate('call_block_time') }}
{% endif %}
),

src_LendingPool_evt_LiquidationCall as (
select *
from {{ source(project_decoded_as ~ '_' ~ blockchain, 'LendingPool_evt_LiquidationCall') }}
Expand All @@ -167,18 +175,24 @@ base_supply as (
union all
select
'withdraw' as transaction_type,
reserve as token_address,
user as depositor,
cast(null as varbinary) as on_behalf_of,
to as withdrawn_to,
w.reserve as token_address,
w.user as depositor,
cast(wrap.to as varbinary) as on_behalf_of,
w.to as withdrawn_to,
cast(null as varbinary) as liquidator,
-1 * cast(amount as double) as amount,
contract_address,
evt_tx_hash,
evt_index,
evt_block_time,
evt_block_number
from src_LendingPool_evt_Withdraw
-1 * cast(w.amount as double) as amount,
w.contract_address,
w.evt_tx_hash,
w.evt_index,
w.evt_block_time,
w.evt_block_number
from src_LendingPool_evt_Withdraw w
left join src_WrappedTokenGatewayV2_call_withdrawETH wrap
on w.evt_block_number = wrap.call_block_number
and w.evt_tx_hash = wrap.call_tx_hash
and w.to = wrap.contract_address
and w.amount = wrap.amount
and wrap.call_success
union all
select
'deposit_liquidation' as transaction_type,
Expand Down Expand Up @@ -225,7 +239,8 @@ from base_supply
project,
version,
project_decoded_as = 'aave_v3',
decoded_contract_name = 'Pool'
decoded_contract_name = 'Pool',
decoded_wrapped_token_gateway_name = 'WrappedTokenGatewayV3'
)
%}

Expand All @@ -247,6 +262,14 @@ src_LendingPool_evt_Withdraw as (
{% endif %}
),

src_WrappedTokenGatewayV3_call_withdrawETH as (
select *
from {{ source(project_decoded_as ~ '_' ~ blockchain, decoded_wrapped_token_gateway_name ~ '_call_withdrawETH') }}
{% if is_incremental() %}
where {{ incremental_predicate('call_block_time') }}
{% endif %}
),

src_LendingPool_evt_Repay as (
select *
from {{ source(project_decoded_as ~ '_' ~ blockchain, decoded_contract_name ~ '_evt_Repay') }}
Expand Down Expand Up @@ -282,18 +305,24 @@ base_supply as (
union all
select
'withdraw' as transaction_type,
reserve as token_address,
user as depositor,
cast(null as varbinary) as on_behalf_of,
to as withdrawn_to,
w.reserve as token_address,
w.user as depositor,
cast(wrap.to as varbinary) as on_behalf_of,
w.to as withdrawn_to,
cast(null as varbinary) as liquidator,
-1 * cast(amount as double) as amount,
contract_address,
evt_tx_hash,
evt_index,
evt_block_time,
evt_block_number
from src_LendingPool_evt_Withdraw
-1 * cast(w.amount as double) as amount,
w.contract_address,
w.evt_tx_hash,
w.evt_index,
w.evt_block_time,
w.evt_block_number
from src_LendingPool_evt_Withdraw w
left join src_WrappedTokenGatewayV3_call_withdrawETH wrap
on w.evt_block_number = wrap.call_block_number
and w.evt_tx_hash = wrap.call_tx_hash
and w.to = wrap.contract_address
and w.amount = wrap.amount
and wrap.call_success
union all
select
'repay_with_atokens' as transaction_type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
blockchain = 'ethereum',
project = 'aave_lido',
version = '3',
decoded_contract_name = 'LidoPool'
decoded_contract_name = 'LidoPool',
decoded_wrapped_token_gateway_name = 'LidoWrappedTokenGatewayV3'
)
}}
1 change: 1 addition & 0 deletions sources/_sector/lending/supply/arbitrum/_sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ sources:
tables:
- name: L2Pool_evt_Supply
- name: L2Pool_evt_Withdraw
- name: WrappedTokenGatewayV3_call_withdrawETH

- name: compound_v3_arbitrum
tables:
Expand Down
2 changes: 2 additions & 0 deletions sources/_sector/lending/supply/avalanche_c/_sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ sources:
- name: LendingPool_evt_Deposit
- name: LendingPool_evt_Withdraw
- name: LendingPool_evt_RedeemUnderlying
- name: WrappedTokenGatewayV2_call_withdrawETH

- name: aave_v3_avalanche_c
tables:
- name: Pool_evt_Supply
- name: Pool_evt_Withdraw
- name: Pool_evt_RedeemUnderlying
- name: WrappedTokenGatewayV3_call_withdrawETH

- name: benqi_finance_avalanche_c
tables:
Expand Down
1 change: 1 addition & 0 deletions sources/_sector/lending/supply/base/_sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ sources:
- name: L2Pool_evt_Supply
- name: L2Pool_evt_Withdraw
- name: L2Pool_evt_RedeemUnderlying
- name: WrappedTokenGatewayV3_call_withdrawETH

- name: compound_v3_base
tables:
Expand Down
1 change: 1 addition & 0 deletions sources/_sector/lending/supply/bnb/_sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ sources:
tables:
- name: Pool_evt_Supply
- name: Pool_evt_Withdraw
- name: WrappedTokenGatewayV3_call_withdrawETH

- name: the_granary_bnb
tables:
Expand Down
4 changes: 4 additions & 0 deletions sources/_sector/lending/supply/ethereum/_sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,25 @@ sources:
tables:
- name: LendingPool_evt_Deposit
- name: LendingPool_evt_Withdraw
- name: WrappedTokenGatewayV2_call_withdrawETH

- name: aave_v3_ethereum
tables:
- name: Pool_evt_Supply
- name: Pool_evt_Withdraw
- name: Pool_evt_ReserveDataUpdated
- name: WrappedTokenGatewayV3_call_withdrawETH
- name: LidoPool_evt_Supply
- name: LidoPool_evt_Withdraw
- name: LidoPool_evt_ReserveDataUpdated
- name: LidoWrappedTokenGatewayV3_call_withdrawETH

- name: aave_v3_etherfi_ethereum
tables:
- name: PoolInstance_evt_Supply
- name: PoolInstance_evt_Withdraw
- name: PoolInstance_evt_ReserveDataUpdated
- name: WrappedTokenGatewayV3_call_withdrawETH

- name: compound_v2_ethereum
tables:
Expand Down
1 change: 1 addition & 0 deletions sources/_sector/lending/supply/fantom/_sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ sources:
- name: Pool_evt_Supply
- name: Pool_evt_Withdraw
- name: Pool_evt_RedeemUnderlying
- name: WrappedTokenGatewayV3_call_withdrawETH

- name: the_granary_fantom
tables:
Expand Down
1 change: 1 addition & 0 deletions sources/_sector/lending/supply/gnosis/_sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ sources:
tables:
- name: Pool_evt_Supply
- name: Pool_evt_Withdraw
- name: WrappedTokenGatewayV3_call_withdrawETH

- name: real_rmm_v1_gnosis
tables:
Expand Down
1 change: 1 addition & 0 deletions sources/_sector/lending/supply/optimism/_sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ sources:
- name: Pool_evt_Supply
- name: Pool_evt_Withdraw
- name: Pool_evt_RedeemUnderlying
- name: WrappedTokenGatewayV3_call_withdrawETH

- name: sonne_finance_optimism
tables:
Expand Down
2 changes: 2 additions & 0 deletions sources/_sector/lending/supply/polygon/_sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ sources:
- name: LendingPool_evt_Deposit
- name: LendingPool_evt_Withdraw
- name: LendingPool_evt_RedeemUnderlying
- name: WrappedTokenGatewayV2_call_withdrawETH

- name: aave_v3_polygon
tables:
- name: Pool_evt_Supply
- name: Pool_evt_Withdraw
- name: Pool_evt_RedeemUnderlying
- name: WrappedTokenGatewayV3_call_withdrawETH

- name: compound_v3_polygon
tables:
Expand Down
1 change: 1 addition & 0 deletions sources/_sector/lending/supply/scroll/_sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ sources:
tables:
- name: L2Pool_evt_Supply
- name: L2Pool_evt_Withdraw
- name: WrappedTokenGatewayV3_call_withdrawETH

- name: layer_bank_scroll
tables:
Expand Down

0 comments on commit 98470f3

Please sign in to comment.